babylon.d.txt 713 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613
  1. declare var engine: BABYLON.Engine;
  2. declare var canvas: HtmlCanvasElement;
  3. declare module BABYLON {
  4. class InstancingAttributeInfo {
  5. /**
  6. * Index/offset of the attribute in the vertex shader
  7. */
  8. index: number;
  9. /**
  10. * size of the attribute, 1, 2, 3 or 4
  11. */
  12. attributeSize: number;
  13. /**
  14. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  15. * default is FLOAT
  16. */
  17. attribyteType: number;
  18. /**
  19. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  20. */
  21. normalized: boolean;
  22. /**
  23. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  24. */
  25. offset: number;
  26. /**
  27. * Name of the GLSL attribute, for debugging purpose only
  28. */
  29. attributeName: string;
  30. }
  31. class EngineCapabilities {
  32. maxTexturesImageUnits: number;
  33. maxTextureSize: number;
  34. maxCubemapTextureSize: number;
  35. maxRenderTextureSize: number;
  36. maxVertexAttribs: number;
  37. standardDerivatives: boolean;
  38. s3tc: WEBGL_compressed_texture_s3tc;
  39. textureFloat: boolean;
  40. textureAnisotropicFilterExtension: EXT_texture_filter_anisotropic;
  41. maxAnisotropy: number;
  42. instancedArrays: ANGLE_instanced_arrays;
  43. uintIndices: boolean;
  44. highPrecisionShaderSupported: boolean;
  45. fragmentDepthSupported: boolean;
  46. textureFloatLinearFiltering: boolean;
  47. textureFloatRender: boolean;
  48. textureHalfFloat: boolean;
  49. textureHalfFloatLinearFiltering: boolean;
  50. textureHalfFloatRender: boolean;
  51. textureLOD: boolean;
  52. drawBuffersExtension: any;
  53. }
  54. interface EngineOptions extends WebGLContextAttributes {
  55. limitDeviceRatio?: number;
  56. autoEnableWebVR?: boolean;
  57. }
  58. /**
  59. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  60. */
  61. class Engine {
  62. static NEVER: number;
  63. static ALWAYS: number;
  64. static LESS: number;
  65. static EQUAL: number;
  66. static LEQUAL: number;
  67. static GREATER: number;
  68. static GEQUAL: number;
  69. static NOTEQUAL: number;
  70. static KEEP: number;
  71. static REPLACE: number;
  72. static INCR: number;
  73. static DECR: number;
  74. static INVERT: number;
  75. static INCR_WRAP: number;
  76. static DECR_WRAP: number;
  77. static ALPHA_DISABLE: number;
  78. static ALPHA_ONEONE: number;
  79. static ALPHA_ADD: number;
  80. static ALPHA_COMBINE: number;
  81. static ALPHA_SUBTRACT: number;
  82. static ALPHA_MULTIPLY: number;
  83. static ALPHA_MAXIMIZED: number;
  84. static DELAYLOADSTATE_NONE: number;
  85. static DELAYLOADSTATE_LOADED: number;
  86. static DELAYLOADSTATE_LOADING: number;
  87. static DELAYLOADSTATE_NOTLOADED: number;
  88. static TEXTUREFORMAT_ALPHA: number;
  89. static TEXTUREFORMAT_LUMINANCE: number;
  90. static TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  91. static TEXTUREFORMAT_RGB: number;
  92. static TEXTUREFORMAT_RGBA: number;
  93. static TEXTURETYPE_UNSIGNED_INT: number;
  94. static TEXTURETYPE_FLOAT: number;
  95. static TEXTURETYPE_HALF_FLOAT: number;
  96. static Version: string;
  97. static CollisionsEpsilon: number;
  98. static CodeRepository: string;
  99. static ShadersRepository: string;
  100. isFullscreen: boolean;
  101. isPointerLock: boolean;
  102. cullBackFaces: boolean;
  103. renderEvenInBackground: boolean;
  104. enableOfflineSupport: boolean;
  105. scenes: Scene[];
  106. vrDisplaysPromise: any;
  107. static audioEngine: AudioEngine;
  108. private fpsRange;
  109. private previousFramesDuration;
  110. private fps;
  111. private deltaTime;
  112. /**
  113. * @constructor
  114. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  115. * @param {boolean} [antialias] - enable antialias
  116. * @param options - further options to be sent to the getContext function
  117. */
  118. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  119. webGLVersion: string;
  120. /**
  121. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  122. */
  123. isStencilEnable: boolean;
  124. resetTextureCache(): void;
  125. getGlInfo(): {
  126. vendor: string;
  127. renderer: string;
  128. version: string;
  129. };
  130. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  131. getRenderWidth(useScreen?: boolean): number;
  132. getRenderHeight(useScreen?: boolean): number;
  133. getRenderingCanvas(): HTMLCanvasElement;
  134. getRenderingCanvasClientRect(): ClientRect;
  135. setHardwareScalingLevel(level: number): void;
  136. getHardwareScalingLevel(): number;
  137. getLoadedTexturesCache(): WebGLTexture[];
  138. getCaps(): EngineCapabilities;
  139. drawCalls: number;
  140. drawCallsPerfCounter: PerfCounter;
  141. getDepthFunction(): number;
  142. setDepthFunction(depthFunc: number): void;
  143. setDepthFunctionToGreater(): void;
  144. setDepthFunctionToGreaterOrEqual(): void;
  145. setDepthFunctionToLess(): void;
  146. setDepthFunctionToLessOrEqual(): void;
  147. getStencilBuffer(): boolean;
  148. setStencilBuffer(enable: boolean): void;
  149. getStencilMask(): number;
  150. setStencilMask(mask: number): void;
  151. getStencilFunction(): number;
  152. getStencilFunctionReference(): number;
  153. getStencilFunctionMask(): number;
  154. setStencilFunction(stencilFunc: number): void;
  155. setStencilFunctionReference(reference: number): void;
  156. setStencilFunctionMask(mask: number): void;
  157. getStencilOperationFail(): number;
  158. getStencilOperationDepthFail(): number;
  159. getStencilOperationPass(): number;
  160. setStencilOperationFail(operation: number): void;
  161. setStencilOperationDepthFail(operation: number): void;
  162. setStencilOperationPass(operation: number): void;
  163. /**
  164. * stop executing a render loop function and remove it from the execution array
  165. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  166. */
  167. stopRenderLoop(renderFunction?: () => void): void;
  168. /**
  169. * Register and execute a render loop. The engine can have more than one render function.
  170. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  171. * @example
  172. * engine.runRenderLoop(function () {
  173. * scene.render()
  174. * })
  175. */
  176. runRenderLoop(renderFunction: () => void): void;
  177. /**
  178. * Toggle full screen mode.
  179. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  180. * @param {any} options - an options object to be sent to the requestFullscreen function
  181. */
  182. switchFullscreen(requestPointerLock: boolean): void;
  183. clear(color: any, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  184. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  185. /**
  186. * Set the WebGL's viewport
  187. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  188. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  189. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  190. */
  191. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  192. /**
  193. * Directly set the WebGL Viewport
  194. * The x, y, width & height are directly passed to the WebGL call
  195. * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state.
  196. */
  197. setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
  198. beginFrame(): void;
  199. endFrame(): void;
  200. /**
  201. * resize the view according to the canvas' size.
  202. * @example
  203. * window.addEventListener("resize", function () {
  204. * engine.resize();
  205. * });
  206. */
  207. resize(): void;
  208. /**
  209. * force a specific size of the canvas
  210. * @param {number} width - the new canvas' width
  211. * @param {number} height - the new canvas' height
  212. */
  213. setSize(width: number, height: number): void;
  214. initWebVR(): void;
  215. enableVR(vrDevice: any): void;
  216. disableVR(): void;
  217. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  218. private bindUnboundFramebuffer(framebuffer);
  219. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
  220. generateMipMapsForCubemap(texture: WebGLTexture): void;
  221. flushFramebuffer(): void;
  222. restoreDefaultFramebuffer(): void;
  223. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  224. createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  225. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
  226. createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer;
  227. bindArrayBuffer(buffer: WebGLBuffer): void;
  228. private bindIndexBuffer(buffer);
  229. private bindBuffer(buffer, target);
  230. updateArrayBuffer(data: Float32Array): void;
  231. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  232. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  233. bindBuffers(vertexBuffers: {
  234. [key: string]: VertexBuffer;
  235. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  236. unbindInstanceAttributes(): void;
  237. createInstancesBuffer(capacity: number): WebGLBuffer;
  238. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  239. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  240. applyStates(): void;
  241. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  242. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  243. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): 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, indexParameters?: any): 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, context?: WebGLRenderingContext): WebGLProgram;
  247. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  248. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  249. enableEffect(effect: Effect): void;
  250. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  251. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  252. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  253. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  254. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  255. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  256. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  257. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  258. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  259. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  260. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  261. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  262. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  263. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  264. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  265. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  266. setFloat(uniform: WebGLUniformLocation, value: number): void;
  267. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  268. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  269. setBool(uniform: WebGLUniformLocation, bool: number): void;
  270. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  271. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  272. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  273. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  274. setDepthBuffer(enable: boolean): void;
  275. getDepthWrite(): boolean;
  276. setDepthWrite(enable: boolean): void;
  277. setColorWrite(enable: boolean): void;
  278. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  279. getAlphaMode(): number;
  280. setAlphaTesting(enable: boolean): void;
  281. getAlphaTesting(): boolean;
  282. wipeCaches(): void;
  283. setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  284. createTexture(urlOrList: string | Array<string>, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
  285. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  286. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  287. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  288. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  289. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean): void;
  290. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  291. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  292. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  293. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void): WebGLTexture;
  294. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  295. createRawCubeTexture(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][])): WebGLTexture;
  296. private setProgram(program);
  297. bindSamplers(effect: Effect): void;
  298. private activateTexture(texture);
  299. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  300. unbindAllTextures(): void;
  301. setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
  302. setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
  303. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  304. /**
  305. * Add an externaly attached data from its key.
  306. * This method call will fail and return false, if such key already exists.
  307. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  308. * @param key the unique key that identifies the data
  309. * @param data the data object to associate to the key for this Engine instance
  310. * @return true if no such key were already present and the data was added successfully, false otherwise
  311. */
  312. addExternalData<T>(key: string, data: T): boolean;
  313. /**
  314. * Get an externaly attached data from its key
  315. * @param key the unique key that identifies the data
  316. * @return the associated data, if present (can be null), or undefined if not present
  317. */
  318. getExternalData<T>(key: string): T;
  319. /**
  320. * Get an externaly attached data from its key, create it using a factory if it's not already present
  321. * @param key the unique key that identifies the data
  322. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  323. * @return the associated data, can be null if the factory returned null.
  324. */
  325. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  326. /**
  327. * Remove an externaly attached data from the Engine instance
  328. * @param key the unique key that identifies the data
  329. * @return true if the data was successfully removed, false if it doesn't exist
  330. */
  331. removeExternalData(key: any): boolean;
  332. releaseInternalTexture(texture: WebGLTexture): void;
  333. unbindAllAttributes(): void;
  334. dispose(): void;
  335. displayLoadingUI(): void;
  336. hideLoadingUI(): void;
  337. loadingScreen: ILoadingScreen;
  338. loadingUIText: string;
  339. loadingUIBackgroundColor: string;
  340. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  341. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  342. getVertexShaderSource(program: WebGLProgram): string;
  343. getFragmentShaderSource(program: WebGLProgram): string;
  344. getFps(): number;
  345. getDeltaTime(): number;
  346. static isSupported(): boolean;
  347. }
  348. }
  349. interface Window {
  350. mozIndexedDB(func: any): any;
  351. webkitIndexedDB(func: any): any;
  352. msIndexedDB: IDBFactory;
  353. IDBTransaction(func: any): any;
  354. webkitIDBTransaction(func: any): any;
  355. msIDBTransaction(func: any): any;
  356. IDBKeyRange(func: any): any;
  357. webkitIDBKeyRange(func: any): any;
  358. msIDBKeyRange(func: any): any;
  359. webkitURL: HTMLURL;
  360. webkitRequestAnimationFrame(func: any): any;
  361. mozRequestAnimationFrame(func: any): any;
  362. oRequestAnimationFrame(func: any): any;
  363. WebGLRenderingContext: WebGLRenderingContext;
  364. MSGesture: MSGesture;
  365. CANNON: any;
  366. SIMD: any;
  367. AudioContext: AudioContext;
  368. webkitAudioContext: AudioContext;
  369. PointerEvent: any;
  370. Math: Math;
  371. Uint8Array: Uint8ArrayConstructor;
  372. Float32Array: Float32ArrayConstructor;
  373. }
  374. interface AudioContext extends EventTarget {
  375. decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: any): void;
  376. }
  377. interface HTMLURL {
  378. createObjectURL(param1: any, param2?: any): any;
  379. }
  380. interface Document {
  381. exitFullscreen(): void;
  382. webkitCancelFullScreen(): void;
  383. mozCancelFullScreen(): void;
  384. msCancelFullScreen(): void;
  385. mozFullScreen: boolean;
  386. msIsFullScreen: boolean;
  387. fullscreen: boolean;
  388. mozPointerLockElement: HTMLElement;
  389. msPointerLockElement: HTMLElement;
  390. webkitPointerLockElement: HTMLElement;
  391. }
  392. interface HTMLCanvasElement {
  393. requestPointerLock(): void;
  394. msRequestPointerLock?(): void;
  395. mozRequestPointerLock?(): void;
  396. webkitRequestPointerLock?(): void;
  397. }
  398. interface CanvasRenderingContext2D {
  399. imageSmoothingEnabled: boolean;
  400. mozImageSmoothingEnabled: boolean;
  401. oImageSmoothingEnabled: boolean;
  402. webkitImageSmoothingEnabled: boolean;
  403. }
  404. interface WebGLTexture {
  405. isReady: boolean;
  406. isCube: boolean;
  407. url: string;
  408. noMipmap: boolean;
  409. samplingMode: number;
  410. references: number;
  411. generateMipMaps: boolean;
  412. type: number;
  413. onLoadedCallbacks: Array<Function>;
  414. }
  415. interface WebGLBuffer {
  416. references: number;
  417. capacity: number;
  418. is32Bits: boolean;
  419. }
  420. interface MouseEvent {
  421. mozMovementX: number;
  422. mozMovementY: number;
  423. webkitMovementX: number;
  424. webkitMovementY: number;
  425. msMovementX: number;
  426. msMovementY: number;
  427. }
  428. interface MSStyleCSSProperties {
  429. webkitTransform: string;
  430. webkitTransition: string;
  431. }
  432. interface Navigator {
  433. getVRDisplays: () => any;
  434. mozGetVRDevices: (any: any) => any;
  435. isCocoonJS: boolean;
  436. }
  437. interface Screen {
  438. orientation: string;
  439. mozOrientation: string;
  440. }
  441. interface HTMLMediaElement {
  442. crossOrigin: string;
  443. }
  444. interface Math {
  445. fround(x: number): number;
  446. imul(a: number, b: number): number;
  447. }
  448. interface SIMDglobal {
  449. SIMD: SIMD;
  450. Math: Math;
  451. Uint8Array: Uint8ArrayConstructor;
  452. Float32Array: Float32ArrayConstructor;
  453. }
  454. interface SIMD {
  455. Float32x4: SIMD.Float32x4Constructor;
  456. Int32x4: SIMD.Int32x4Constructor;
  457. Int16x8: SIMD.Int16x8Constructor;
  458. Int8x16: SIMD.Int8x16Constructor;
  459. Uint32x4: SIMD.Uint32x4Constructor;
  460. Uint16x8: SIMD.Uint16x8Constructor;
  461. Uint8x16: SIMD.Uint8x16Constructor;
  462. Bool32x4: SIMD.Bool32x4Constructor;
  463. Bool16x8: SIMD.Bool16x8Constructor;
  464. Bool8x16: SIMD.Bool8x16Constructor;
  465. }
  466. declare namespace SIMD {
  467. interface Float32x4 {
  468. constructor: Float32x4Constructor;
  469. valueOf(): Float32x4;
  470. toLocaleString(): string;
  471. toString(): string;
  472. }
  473. interface Float32x4Constructor {
  474. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  475. prototype: Float32x4;
  476. extractLane(simd: SIMD.Float32x4, lane: number): number;
  477. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  478. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  479. check(a: SIMD.Float32x4): SIMD.Float32x4;
  480. splat(n: number): SIMD.Float32x4;
  481. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  482. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  483. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  484. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  485. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  486. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  487. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  488. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  489. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  490. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  491. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  492. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  493. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  494. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  495. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  496. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  497. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  498. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  499. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  500. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  501. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  502. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  503. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  504. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  505. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  506. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  507. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  508. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  509. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  510. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  511. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  512. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  513. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  514. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  515. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  516. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  517. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  518. }
  519. interface Int32x4 {
  520. constructor: Int32x4Constructor;
  521. valueOf(): Int32x4;
  522. toLocaleString(): string;
  523. toString(): string;
  524. }
  525. interface Int32x4Constructor {
  526. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  527. prototype: Int32x4;
  528. extractLane(simd: SIMD.Int32x4, lane: number): number;
  529. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  530. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  531. check(a: SIMD.Int32x4): SIMD.Int32x4;
  532. splat(n: number): SIMD.Int32x4;
  533. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  534. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  535. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  536. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  537. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  538. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  539. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  540. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  541. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  542. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  543. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  544. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  545. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  546. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  547. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  548. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  549. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  550. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  551. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  552. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  553. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  554. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  555. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  556. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  557. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  558. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  559. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  560. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  561. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  562. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  563. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  564. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  565. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  566. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  567. }
  568. interface Int16x8 {
  569. constructor: Int16x8Constructor;
  570. valueOf(): Int16x8;
  571. toLocaleString(): string;
  572. toString(): string;
  573. }
  574. interface Int16x8Constructor {
  575. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  576. prototype: Int16x8;
  577. extractLane(simd: SIMD.Int16x8, lane: number): number;
  578. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  579. shuffle(a: SIMD.Int16x8, b: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  580. check(a: SIMD.Int16x8): SIMD.Int16x8;
  581. splat(n: number): SIMD.Int16x8;
  582. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  583. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  584. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  585. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  586. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  587. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  588. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  589. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  590. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  591. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  592. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  593. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  594. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  595. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  596. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  597. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  598. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  599. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  600. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  601. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  602. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  603. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  604. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  605. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  606. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  607. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  608. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  609. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  610. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  611. }
  612. interface Int8x16 {
  613. constructor: Int8x16Constructor;
  614. valueOf(): Int8x16;
  615. toLocaleString(): string;
  616. toString(): string;
  617. }
  618. interface Int8x16Constructor {
  619. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Int8x16;
  620. prototype: Int8x16;
  621. extractLane(simd: SIMD.Int8x16, lane: number): number;
  622. swizzle(a: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  623. shuffle(a: SIMD.Int8x16, b: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  624. check(a: SIMD.Int8x16): SIMD.Int8x16;
  625. splat(n: number): SIMD.Int8x16;
  626. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  627. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  628. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  629. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  630. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  631. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  632. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  633. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  634. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  635. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  636. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  637. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  638. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  639. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  640. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  641. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  642. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  643. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  644. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  645. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  646. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  647. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  648. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  649. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  650. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  651. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  652. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  653. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  654. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  655. }
  656. interface Uint32x4 {
  657. constructor: Uint32x4Constructor;
  658. valueOf(): Uint32x4;
  659. toLocaleString(): string;
  660. toString(): string;
  661. }
  662. interface Uint32x4Constructor {
  663. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  664. prototype: Uint32x4;
  665. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  666. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  667. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  668. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  669. splat(n: number): SIMD.Uint32x4;
  670. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  671. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  672. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  673. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  674. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  675. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  676. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  677. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  678. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  679. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  680. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  681. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  682. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  683. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  684. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  685. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  686. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  687. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  688. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  689. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  690. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  691. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  692. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  693. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  694. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  695. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  696. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  697. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  698. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  699. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  700. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  701. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  702. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  703. }
  704. interface Uint16x8 {
  705. constructor: Uint16x8Constructor;
  706. valueOf(): Uint16x8;
  707. toLocaleString(): string;
  708. toString(): string;
  709. }
  710. interface Uint16x8Constructor {
  711. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  712. prototype: Uint16x8;
  713. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  714. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  715. shuffle(a: SIMD.Uint16x8, b: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  716. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  717. splat(n: number): SIMD.Uint16x8;
  718. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  719. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  720. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  721. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  722. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  723. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  724. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  725. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  726. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  727. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  728. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  729. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  730. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  731. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  732. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  733. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  734. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  735. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  736. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  737. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  738. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  739. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  740. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  741. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  742. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  743. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  744. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  745. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  746. }
  747. interface Uint8x16 {
  748. constructor: Uint8x16Constructor;
  749. valueOf(): Uint8x16;
  750. toLocaleString(): string;
  751. toString(): string;
  752. }
  753. interface Uint8x16Constructor {
  754. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Uint8x16;
  755. prototype: Uint8x16;
  756. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  757. swizzle(a: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  758. shuffle(a: SIMD.Uint8x16, b: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  759. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  760. splat(n: number): SIMD.Uint8x16;
  761. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  762. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  763. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  764. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  765. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  766. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  767. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  768. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  769. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  770. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  771. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  772. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  773. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  774. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  775. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  776. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  777. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  778. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  779. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  780. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  781. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  782. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  783. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  784. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  785. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  786. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  787. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  788. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  789. }
  790. interface Bool32x4 {
  791. constructor: Bool32x4Constructor;
  792. valueOf(): Bool32x4;
  793. toLocaleString(): string;
  794. toString(): string;
  795. }
  796. interface Bool32x4Constructor {
  797. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  798. prototype: Bool32x4;
  799. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  800. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  801. splat(n: boolean): SIMD.Bool32x4;
  802. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  803. allTrue(a: SIMD.Bool32x4): boolean;
  804. anyTrue(a: SIMD.Bool32x4): boolean;
  805. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  806. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  807. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  808. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  809. }
  810. interface Bool16x8 {
  811. constructor: Bool16x8Constructor;
  812. valueOf(): Bool16x8;
  813. toLocaleString(): string;
  814. toString(): string;
  815. }
  816. interface Bool16x8Constructor {
  817. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  818. prototype: Bool16x8;
  819. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  820. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  821. splat(n: boolean): SIMD.Bool16x8;
  822. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  823. allTrue(a: SIMD.Bool16x8): boolean;
  824. anyTrue(a: SIMD.Bool16x8): boolean;
  825. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  826. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  827. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  828. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  829. }
  830. interface Bool8x16 {
  831. constructor: Bool8x16Constructor;
  832. valueOf(): Bool8x16;
  833. toLocaleString(): string;
  834. toString(): string;
  835. }
  836. interface Bool8x16Constructor {
  837. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean, s8?: boolean, s9?: boolean, s10?: boolean, s11?: boolean, s12?: boolean, s13?: boolean, s14?: boolean, s15?: boolean): Bool8x16;
  838. prototype: Bool8x16;
  839. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  840. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  841. splat(n: boolean): SIMD.Bool8x16;
  842. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  843. allTrue(a: SIMD.Bool8x16): boolean;
  844. anyTrue(a: SIMD.Bool8x16): boolean;
  845. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  846. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  847. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  848. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  849. }
  850. }
  851. declare module BABYLON {
  852. /**
  853. * Node is the basic class for all scene objects (Mesh, Light Camera).
  854. */
  855. class Node {
  856. name: string;
  857. id: string;
  858. uniqueId: number;
  859. state: string;
  860. metadata: any;
  861. doNotSerialize: boolean;
  862. animations: Animation[];
  863. onReady: (node: Node) => void;
  864. parent: Node;
  865. /**
  866. * An event triggered when the mesh is disposed.
  867. * @type {BABYLON.Observable}
  868. */
  869. onDisposeObservable: Observable<Node>;
  870. onDispose: () => void;
  871. /**
  872. * @constructor
  873. * @param {string} name - the name and id to be given to this node
  874. * @param {BABYLON.Scene} the scene this node will be added to
  875. */
  876. constructor(name: string, scene: Scene);
  877. getScene(): Scene;
  878. getEngine(): Engine;
  879. getWorldMatrix(): Matrix;
  880. updateCache(force?: boolean): void;
  881. isSynchronizedWithParent(): boolean;
  882. isSynchronized(updateCache?: boolean): boolean;
  883. hasNewParent(update?: boolean): boolean;
  884. /**
  885. * Is this node ready to be used/rendered
  886. * @return {boolean} is it ready
  887. */
  888. isReady(): boolean;
  889. /**
  890. * Is this node enabled.
  891. * If the node has a parent and is enabled, the parent will be inspected as well.
  892. * @return {boolean} whether this node (and its parent) is enabled.
  893. * @see setEnabled
  894. */
  895. isEnabled(): boolean;
  896. /**
  897. * Set the enabled state of this node.
  898. * @param {boolean} value - the new enabled state
  899. * @see isEnabled
  900. */
  901. setEnabled(value: boolean): void;
  902. /**
  903. * Is this node a descendant of the given node.
  904. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  905. * @param {BABYLON.Node} ancestor - The parent node to inspect
  906. * @see parent
  907. */
  908. isDescendantOf(ancestor: Node): boolean;
  909. /**
  910. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  911. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  912. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  913. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  914. */
  915. /**
  916. * Will return all nodes that have this node as ascendant.
  917. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  918. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  919. * @return {BABYLON.Node[]} all children nodes of all types.
  920. */
  921. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  922. /**
  923. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  924. * @Deprecated, legacy support.
  925. * use getDecendants instead.
  926. */
  927. getChildren(predicate?: (node: Node) => boolean): Node[];
  928. /**
  929. * Get all child-meshes of this node.
  930. */
  931. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  932. getAnimationByName(name: string): Animation;
  933. createAnimationRange(name: string, from: number, to: number): void;
  934. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  935. getAnimationRange(name: string): AnimationRange;
  936. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  937. serializeAnimationRanges(): any;
  938. dispose(): void;
  939. getDirection(localAxis: BABYLON.Vector3): BABYLON.Vector3;
  940. getDirectionToRef(localAxis: BABYLON.Vector3, result: BABYLON.Vector3): void;
  941. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  942. }
  943. }
  944. declare module BABYLON {
  945. interface IDisposable {
  946. dispose(): void;
  947. }
  948. class PointerEventTypes {
  949. static POINTERDOWN: number;
  950. static POINTERUP: number;
  951. static POINTERMOVE: number;
  952. static POINTERWHEEL: number;
  953. static POINTERPICK: number;
  954. }
  955. class PointerInfoBase {
  956. type: number;
  957. event: PointerEvent | MouseWheelEvent;
  958. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  959. }
  960. /**
  961. * This class is used to store pointer related info for the onPrePointerObservable event.
  962. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  963. */
  964. class PointerInfoPre extends PointerInfoBase {
  965. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
  966. localPosition: Vector2;
  967. skipOnPointerObservable: boolean;
  968. }
  969. /**
  970. * This type contains all the data related to a pointer event in Babylon.js.
  971. * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
  972. */
  973. class PointerInfo extends PointerInfoBase {
  974. pickInfo: PickingInfo;
  975. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  976. }
  977. /**
  978. * This class is used by the onRenderingGroupObservable
  979. */
  980. class RenderingGroupInfo {
  981. /**
  982. * The Scene that being rendered
  983. */
  984. scene: Scene;
  985. /**
  986. * The camera currently used for the rendering pass
  987. */
  988. camera: Camera;
  989. /**
  990. * The ID of the renderingGroup being processed
  991. */
  992. renderingGroupId: number;
  993. /**
  994. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  995. */
  996. renderStage: number;
  997. /**
  998. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  999. * This stage will be fired no matter what
  1000. */
  1001. static STAGE_PRECLEAR: number;
  1002. /**
  1003. * Called before opaque object are rendered.
  1004. * This stage will be fired only if there's 3D Opaque content to render
  1005. */
  1006. static STAGE_PREOPAQUE: number;
  1007. /**
  1008. * Called after the opaque objects are rendered and before the transparent ones
  1009. * This stage will be fired only if there's 3D transparent content to render
  1010. */
  1011. static STAGE_PRETRANSPARENT: number;
  1012. /**
  1013. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  1014. * This stage will be fired no matter what
  1015. */
  1016. static STAGE_POSTTRANSPARENT: number;
  1017. }
  1018. /**
  1019. * Represents a scene to be rendered by the engine.
  1020. * @see http://doc.babylonjs.com/page.php?p=21911
  1021. */
  1022. class Scene implements IAnimatable {
  1023. static MinDeltaTime: number;
  1024. static MaxDeltaTime: number;
  1025. static FOGMODE_NONE: number;
  1026. static FOGMODE_EXP: number;
  1027. static FOGMODE_EXP2: number;
  1028. static FOGMODE_LINEAR: number;
  1029. autoClear: boolean;
  1030. clearColor: any;
  1031. ambientColor: Color3;
  1032. forceWireframe: boolean;
  1033. forcePointsCloud: boolean;
  1034. forceShowBoundingBoxes: boolean;
  1035. clipPlane: Plane;
  1036. animationsEnabled: boolean;
  1037. constantlyUpdateMeshUnderPointer: boolean;
  1038. useRightHandedSystem: boolean;
  1039. hoverCursor: string;
  1040. metadata: any;
  1041. /**
  1042. * An event triggered when the scene is disposed.
  1043. * @type {BABYLON.Observable}
  1044. */
  1045. onDisposeObservable: Observable<Scene>;
  1046. onDispose: () => void;
  1047. /**
  1048. * An event triggered before rendering the scene
  1049. * @type {BABYLON.Observable}
  1050. */
  1051. onBeforeRenderObservable: Observable<Scene>;
  1052. beforeRender: () => void;
  1053. /**
  1054. * An event triggered after rendering the scene
  1055. * @type {BABYLON.Observable}
  1056. */
  1057. onAfterRenderObservable: Observable<Scene>;
  1058. afterRender: () => void;
  1059. /**
  1060. * An event triggered when the scene is ready
  1061. * @type {BABYLON.Observable}
  1062. */
  1063. onReadyObservable: Observable<Scene>;
  1064. /**
  1065. * An event triggered before rendering a camera
  1066. * @type {BABYLON.Observable}
  1067. */
  1068. onBeforeCameraRenderObservable: Observable<Camera>;
  1069. beforeCameraRender: () => void;
  1070. /**
  1071. * An event triggered after rendering a camera
  1072. * @type {BABYLON.Observable}
  1073. */
  1074. onAfterCameraRenderObservable: Observable<Camera>;
  1075. afterCameraRender: () => void;
  1076. /**
  1077. * An event triggered when a camera is created
  1078. * @type {BABYLON.Observable}
  1079. */
  1080. onNewCameraAddedObservable: Observable<Camera>;
  1081. /**
  1082. * An event triggered when a camera is removed
  1083. * @type {BABYLON.Observable}
  1084. */
  1085. onCameraRemovedObservable: Observable<Camera>;
  1086. /**
  1087. * An event triggered when a light is created
  1088. * @type {BABYLON.Observable}
  1089. */
  1090. onNewLightAddedObservable: Observable<Light>;
  1091. /**
  1092. * An event triggered when a light is removed
  1093. * @type {BABYLON.Observable}
  1094. */
  1095. onLightRemovedObservable: Observable<Light>;
  1096. /**
  1097. * An event triggered when a geometry is created
  1098. * @type {BABYLON.Observable}
  1099. */
  1100. onNewGeometryAddedObservable: Observable<Geometry>;
  1101. /**
  1102. * An event triggered when a geometry is removed
  1103. * @type {BABYLON.Observable}
  1104. */
  1105. onGeometryRemovedObservable: Observable<Geometry>;
  1106. /**
  1107. * An event triggered when a mesh is created
  1108. * @type {BABYLON.Observable}
  1109. */
  1110. onNewMeshAddedObservable: Observable<AbstractMesh>;
  1111. /**
  1112. * An event triggered when a mesh is removed
  1113. * @type {BABYLON.Observable}
  1114. */
  1115. onMeshRemovedObservable: Observable<AbstractMesh>;
  1116. /**
  1117. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  1118. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  1119. * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)
  1120. */
  1121. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  1122. animations: Animation[];
  1123. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  1124. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  1125. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  1126. /**
  1127. * @deprecated Use onPointerObservable instead
  1128. */
  1129. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1130. /**
  1131. * @deprecated Use onPointerObservable instead
  1132. */
  1133. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1134. /**
  1135. * @deprecated Use onPointerObservable instead
  1136. */
  1137. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1138. /**
  1139. * @deprecated Use onPointerObservable instead
  1140. */
  1141. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1142. /**
  1143. * This observable event is triggered when any mouse event registered during Scene.attach() is called BEFORE the 3D engine to process anything (mesh/sprite picking for instance).
  1144. * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
  1145. */
  1146. onPrePointerObservable: Observable<PointerInfoPre>;
  1147. /**
  1148. * Observable event triggered each time an input event is received from the rendering canvas
  1149. */
  1150. onPointerObservable: Observable<PointerInfo>;
  1151. unTranslatedPointer: Vector2;
  1152. cameraToUseForPointers: Camera;
  1153. /**
  1154. * is fog enabled on this scene.
  1155. * @type {boolean}
  1156. */
  1157. fogEnabled: boolean;
  1158. fogMode: number;
  1159. fogColor: Color3;
  1160. fogDensity: number;
  1161. fogStart: number;
  1162. fogEnd: number;
  1163. /**
  1164. * is shadow enabled on this scene.
  1165. * @type {boolean}
  1166. */
  1167. shadowsEnabled: boolean;
  1168. /**
  1169. * is light enabled on this scene.
  1170. * @type {boolean}
  1171. */
  1172. lightsEnabled: boolean;
  1173. /**
  1174. * All of the lights added to this scene.
  1175. * @see BABYLON.Light
  1176. * @type {BABYLON.Light[]}
  1177. */
  1178. lights: Light[];
  1179. /**
  1180. * All of the cameras added to this scene.
  1181. * @see BABYLON.Camera
  1182. * @type {BABYLON.Camera[]}
  1183. */
  1184. cameras: Camera[];
  1185. activeCameras: Camera[];
  1186. activeCamera: Camera;
  1187. /**
  1188. * All of the (abstract) meshes added to this scene.
  1189. * @see BABYLON.AbstractMesh
  1190. * @type {BABYLON.AbstractMesh[]}
  1191. */
  1192. meshes: AbstractMesh[];
  1193. materials: Material[];
  1194. multiMaterials: MultiMaterial[];
  1195. defaultMaterial: StandardMaterial;
  1196. texturesEnabled: boolean;
  1197. textures: BaseTexture[];
  1198. particlesEnabled: boolean;
  1199. particleSystems: ParticleSystem[];
  1200. spritesEnabled: boolean;
  1201. spriteManagers: SpriteManager[];
  1202. layers: Layer[];
  1203. highlightLayers: HighlightLayer[];
  1204. skeletonsEnabled: boolean;
  1205. skeletons: Skeleton[];
  1206. lensFlaresEnabled: boolean;
  1207. lensFlareSystems: LensFlareSystem[];
  1208. collisionsEnabled: boolean;
  1209. collisionCoordinator: ICollisionCoordinator;
  1210. gravity: Vector3;
  1211. postProcessesEnabled: boolean;
  1212. postProcessManager: PostProcessManager;
  1213. postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1214. renderTargetsEnabled: boolean;
  1215. dumpNextRenderTargets: boolean;
  1216. customRenderTargets: RenderTargetTexture[];
  1217. useDelayedTextureLoading: boolean;
  1218. importedMeshesFiles: String[];
  1219. probesEnabled: boolean;
  1220. reflectionProbes: ReflectionProbe[];
  1221. database: any;
  1222. /**
  1223. * This scene's action manager
  1224. * @type {BABYLON.ActionManager}
  1225. */
  1226. actionManager: ActionManager;
  1227. proceduralTexturesEnabled: boolean;
  1228. mainSoundTrack: SoundTrack;
  1229. soundTracks: SoundTrack[];
  1230. simplificationQueue: SimplificationQueue;
  1231. /**
  1232. * @constructor
  1233. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1234. */
  1235. constructor(engine: Engine);
  1236. debugLayer: DebugLayer;
  1237. workerCollisions: boolean;
  1238. SelectionOctree: Octree<AbstractMesh>;
  1239. /**
  1240. * The mesh that is currently under the pointer.
  1241. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1242. */
  1243. meshUnderPointer: AbstractMesh;
  1244. /**
  1245. * Current on-screen X position of the pointer
  1246. * @return {number} X position of the pointer
  1247. */
  1248. pointerX: number;
  1249. /**
  1250. * Current on-screen Y position of the pointer
  1251. * @return {number} Y position of the pointer
  1252. */
  1253. pointerY: number;
  1254. getCachedMaterial(): Material;
  1255. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1256. getOutlineRenderer(): OutlineRenderer;
  1257. getEngine(): Engine;
  1258. getTotalVertices(): number;
  1259. totalVerticesPerfCounter: PerfCounter;
  1260. getActiveIndices(): number;
  1261. totalActiveIndicesPerfCounter: PerfCounter;
  1262. getActiveParticles(): number;
  1263. activeParticlesPerfCounter: PerfCounter;
  1264. getActiveBones(): number;
  1265. activeBonesPerfCounter: PerfCounter;
  1266. getLastFrameDuration(): number;
  1267. lastFramePerfCounter: PerfCounter;
  1268. getEvaluateActiveMeshesDuration(): number;
  1269. evaluateActiveMeshesDurationPerfCounter: PerfCounter;
  1270. getActiveMeshes(): SmartArray<Mesh>;
  1271. getRenderTargetsDuration(): number;
  1272. getRenderDuration(): number;
  1273. renderDurationPerfCounter: PerfCounter;
  1274. getParticlesDuration(): number;
  1275. particlesDurationPerfCounter: PerfCounter;
  1276. getSpritesDuration(): number;
  1277. spriteDuractionPerfCounter: PerfCounter;
  1278. getAnimationRatio(): number;
  1279. getRenderId(): number;
  1280. incrementRenderId(): void;
  1281. /**
  1282. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1283. * @param attachUp defines if you want to attach events to pointerup
  1284. * @param attachDown defines if you want to attach events to pointerdown
  1285. * @param attachMove defines if you want to attach events to pointermove
  1286. */
  1287. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1288. detachControl(): void;
  1289. isReady(): boolean;
  1290. resetCachedMaterial(): void;
  1291. registerBeforeRender(func: () => void): void;
  1292. unregisterBeforeRender(func: () => void): void;
  1293. registerAfterRender(func: () => void): void;
  1294. unregisterAfterRender(func: () => void): void;
  1295. getWaitingItemsCount(): number;
  1296. /**
  1297. * Registers a function to be executed when the scene is ready.
  1298. * @param {Function} func - the function to be executed.
  1299. */
  1300. executeWhenReady(func: () => void): void;
  1301. /**
  1302. * Will start the animation sequence of a given target
  1303. * @param target - the target
  1304. * @param {number} from - from which frame should animation start
  1305. * @param {number} to - till which frame should animation run.
  1306. * @param {boolean} [loop] - should the animation loop
  1307. * @param {number} [speedRatio] - the speed in which to run the animation
  1308. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1309. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1310. * @return {BABYLON.Animatable} the animatable object created for this animation
  1311. * @see BABYLON.Animatable
  1312. * @see http://doc.babylonjs.com/page.php?p=22081
  1313. */
  1314. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1315. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1316. getAnimatableByTarget(target: any): Animatable;
  1317. Animatables: Animatable[];
  1318. /**
  1319. * Will stop the animation of the given target
  1320. * @param target - the target
  1321. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1322. * @see beginAnimation
  1323. */
  1324. stopAnimation(target: any, animationName?: string): void;
  1325. getViewMatrix(): Matrix;
  1326. getProjectionMatrix(): Matrix;
  1327. getTransformMatrix(): Matrix;
  1328. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1329. addMesh(newMesh: AbstractMesh): void;
  1330. removeMesh(toRemove: AbstractMesh): number;
  1331. removeSkeleton(toRemove: Skeleton): number;
  1332. removeLight(toRemove: Light): number;
  1333. removeCamera(toRemove: Camera): number;
  1334. addLight(newLight: Light): void;
  1335. addCamera(newCamera: Camera): void;
  1336. /**
  1337. * Switch active camera
  1338. * @param {Camera} newCamera - new active camera
  1339. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1340. */
  1341. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1342. /**
  1343. * sets the active camera of the scene using its ID
  1344. * @param {string} id - the camera's ID
  1345. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1346. * @see activeCamera
  1347. */
  1348. setActiveCameraByID(id: string): Camera;
  1349. /**
  1350. * sets the active camera of the scene using its name
  1351. * @param {string} name - the camera's name
  1352. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1353. * @see activeCamera
  1354. */
  1355. setActiveCameraByName(name: string): Camera;
  1356. /**
  1357. * get a material using its id
  1358. * @param {string} the material's ID
  1359. * @return {BABYLON.Material|null} the material or null if none found.
  1360. */
  1361. getMaterialByID(id: string): Material;
  1362. /**
  1363. * get a material using its name
  1364. * @param {string} the material's name
  1365. * @return {BABYLON.Material|null} the material or null if none found.
  1366. */
  1367. getMaterialByName(name: string): Material;
  1368. getLensFlareSystemByName(name: string): LensFlareSystem;
  1369. getLensFlareSystemByID(id: string): LensFlareSystem;
  1370. getCameraByID(id: string): Camera;
  1371. getCameraByUniqueID(uniqueId: number): Camera;
  1372. /**
  1373. * get a camera using its name
  1374. * @param {string} the camera's name
  1375. * @return {BABYLON.Camera|null} the camera or null if none found.
  1376. */
  1377. getCameraByName(name: string): Camera;
  1378. /**
  1379. * get a bone using its id
  1380. * @param {string} the bone's id
  1381. * @return {BABYLON.Bone|null} the bone or null if not found
  1382. */
  1383. getBoneByID(id: string): Bone;
  1384. /**
  1385. * get a bone using its id
  1386. * @param {string} the bone's name
  1387. * @return {BABYLON.Bone|null} the bone or null if not found
  1388. */
  1389. getBoneByName(name: string): Bone;
  1390. /**
  1391. * get a light node using its name
  1392. * @param {string} the light's name
  1393. * @return {BABYLON.Light|null} the light or null if none found.
  1394. */
  1395. getLightByName(name: string): Light;
  1396. /**
  1397. * get a light node using its ID
  1398. * @param {string} the light's id
  1399. * @return {BABYLON.Light|null} the light or null if none found.
  1400. */
  1401. getLightByID(id: string): Light;
  1402. /**
  1403. * get a light node using its scene-generated unique ID
  1404. * @param {number} the light's unique id
  1405. * @return {BABYLON.Light|null} the light or null if none found.
  1406. */
  1407. getLightByUniqueID(uniqueId: number): Light;
  1408. /**
  1409. * get a particle system by id
  1410. * @param id {number} the particle system id
  1411. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  1412. */
  1413. getParticleSystemByID(id: string): ParticleSystem;
  1414. /**
  1415. * get a geometry using its ID
  1416. * @param {string} the geometry's id
  1417. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1418. */
  1419. getGeometryByID(id: string): Geometry;
  1420. /**
  1421. * add a new geometry to this scene.
  1422. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1423. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1424. * @return {boolean} was the geometry added or not
  1425. */
  1426. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1427. /**
  1428. * Removes an existing geometry
  1429. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1430. * @return {boolean} was the geometry removed or not
  1431. */
  1432. removeGeometry(geometry: Geometry): boolean;
  1433. getGeometries(): Geometry[];
  1434. /**
  1435. * Get the first added mesh found of a given ID
  1436. * @param {string} id - the id to search for
  1437. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1438. */
  1439. getMeshByID(id: string): AbstractMesh;
  1440. getMeshesByID(id: string): Array<AbstractMesh>;
  1441. /**
  1442. * Get a mesh with its auto-generated unique id
  1443. * @param {number} uniqueId - the unique id to search for
  1444. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1445. */
  1446. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  1447. /**
  1448. * Get a the last added mesh found of a given ID
  1449. * @param {string} id - the id to search for
  1450. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1451. */
  1452. getLastMeshByID(id: string): AbstractMesh;
  1453. /**
  1454. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1455. * @param {string} id - the id to search for
  1456. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1457. */
  1458. getLastEntryByID(id: string): Node;
  1459. getNodeByID(id: string): Node;
  1460. getNodeByName(name: string): Node;
  1461. getMeshByName(name: string): AbstractMesh;
  1462. getSoundByName(name: string): Sound;
  1463. getLastSkeletonByID(id: string): Skeleton;
  1464. getSkeletonById(id: string): Skeleton;
  1465. getSkeletonByName(name: string): Skeleton;
  1466. isActiveMesh(mesh: Mesh): boolean;
  1467. /**
  1468. * Return a unique id as a string which can serve as an identifier for the scene
  1469. */
  1470. uid: string;
  1471. /**
  1472. * Add an externaly attached data from its key.
  1473. * This method call will fail and return false, if such key already exists.
  1474. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1475. * @param key the unique key that identifies the data
  1476. * @param data the data object to associate to the key for this Engine instance
  1477. * @return true if no such key were already present and the data was added successfully, false otherwise
  1478. */
  1479. addExternalData<T>(key: string, data: T): boolean;
  1480. /**
  1481. * Get an externaly attached data from its key
  1482. * @param key the unique key that identifies the data
  1483. * @return the associated data, if present (can be null), or undefined if not present
  1484. */
  1485. getExternalData<T>(key: string): T;
  1486. /**
  1487. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1488. * @param key the unique key that identifies the data
  1489. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1490. * @return the associated data, can be null if the factory returned null.
  1491. */
  1492. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1493. /**
  1494. * Remove an externaly attached data from the Engine instance
  1495. * @param key the unique key that identifies the data
  1496. * @return true if the data was successfully removed, false if it doesn't exist
  1497. */
  1498. removeExternalData(key: any): boolean;
  1499. updateTransformMatrix(force?: boolean): void;
  1500. render(): void;
  1501. audioEnabled: boolean;
  1502. headphone: boolean;
  1503. enableDepthRenderer(): DepthRenderer;
  1504. disableDepthRenderer(): void;
  1505. freezeMaterials(): void;
  1506. unfreezeMaterials(): void;
  1507. dispose(): void;
  1508. disposeSounds(): void;
  1509. getWorldExtends(): {
  1510. min: Vector3;
  1511. max: Vector3;
  1512. };
  1513. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1514. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1515. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1516. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1517. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1518. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1519. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): PickingInfo[];
  1520. multiPickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean): PickingInfo[];
  1521. setPointerOverMesh(mesh: AbstractMesh): void;
  1522. getPointerOverMesh(): AbstractMesh;
  1523. setPointerOverSprite(sprite: Sprite): void;
  1524. getPointerOverSprite(): Sprite;
  1525. getPhysicsEngine(): PhysicsEngine;
  1526. /**
  1527. * Enables physics to the current scene
  1528. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1529. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1530. * @return {boolean} was the physics engine initialized
  1531. */
  1532. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1533. disablePhysicsEngine(): void;
  1534. isPhysicsEnabled(): boolean;
  1535. /**
  1536. *
  1537. * Sets the gravity of the physics engine (and NOT of the scene)
  1538. * @param {BABYLON.Vector3} [gravity] - the new gravity to be used
  1539. */
  1540. setGravity(gravity: Vector3): void;
  1541. /**
  1542. * Legacy support, using the new API
  1543. * @Deprecated
  1544. */
  1545. createCompoundImpostor(parts: any, options: PhysicsImpostorParameters): any;
  1546. deleteCompoundImpostor(compound: any): void;
  1547. createDefaultCameraOrLight(): void;
  1548. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1549. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1550. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1551. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1552. /**
  1553. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1554. * This allowed control for front to back rendering or reversly depending of the special needs.
  1555. *
  1556. * @param renderingGroupId The rendering group id corresponding to its index
  1557. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1558. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1559. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1560. */
  1561. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  1562. /**
  1563. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1564. *
  1565. * @param renderingGroupId The rendering group id corresponding to its index
  1566. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1567. */
  1568. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  1569. }
  1570. }
  1571. declare module BABYLON {
  1572. class Action {
  1573. triggerOptions: any;
  1574. trigger: number;
  1575. constructor(triggerOptions: any, condition?: Condition);
  1576. getTriggerParameter(): any;
  1577. execute(evt: ActionEvent): void;
  1578. skipToNextActiveAction(): void;
  1579. then(action: Action): Action;
  1580. serialize(parent: any): any;
  1581. name: string;
  1582. targetType: string;
  1583. value: string;
  1584. };
  1585. }
  1586. }
  1587. declare module BABYLON {
  1588. /**
  1589. * ActionEvent is the event beint sent when an action is triggered.
  1590. */
  1591. class ActionEvent {
  1592. source: any;
  1593. pointerX: number;
  1594. pointerY: number;
  1595. meshUnderPointer: AbstractMesh;
  1596. sourceEvent: any;
  1597. additionalData: any;
  1598. /**
  1599. * @constructor
  1600. * @param source The mesh or sprite that triggered the action.
  1601. * @param pointerX The X mouse cursor position at the time of the event
  1602. * @param pointerY The Y mouse cursor position at the time of the event
  1603. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1604. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1605. */
  1606. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  1607. /**
  1608. * Helper function to auto-create an ActionEvent from a source mesh.
  1609. * @param source The source mesh that triggered the event
  1610. * @param evt {Event} The original (browser) event
  1611. */
  1612. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1613. /**
  1614. * Helper function to auto-create an ActionEvent from a source mesh.
  1615. * @param source The source sprite that triggered the event
  1616. * @param scene Scene associated with the sprite
  1617. * @param evt {Event} The original (browser) event
  1618. */
  1619. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1620. /**
  1621. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1622. * @param scene the scene where the event occurred
  1623. * @param evt {Event} The original (browser) event
  1624. */
  1625. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1626. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  1627. }
  1628. /**
  1629. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1630. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1631. */
  1632. class ActionManager {
  1633. static NothingTrigger: number;
  1634. static OnPickTrigger: number;
  1635. static OnLeftPickTrigger: number;
  1636. static OnRightPickTrigger: number;
  1637. static OnCenterPickTrigger: number;
  1638. static OnPickDownTrigger: number;
  1639. static OnPickUpTrigger: number;
  1640. static OnPickOutTrigger: number;
  1641. static OnLongPressTrigger: number;
  1642. static OnPointerOverTrigger: number;
  1643. static OnPointerOutTrigger: number;
  1644. static OnEveryFrameTrigger: number;
  1645. static OnIntersectionEnterTrigger: number;
  1646. static OnIntersectionExitTrigger: number;
  1647. static OnKeyDownTrigger: number;
  1648. static OnKeyUpTrigger: number;
  1649. static DragMovementThreshold: number;
  1650. static LongPressDelay: number;
  1651. actions: Action[];
  1652. hoverCursor: string;
  1653. constructor(scene: Scene);
  1654. dispose(): void;
  1655. getScene(): Scene;
  1656. /**
  1657. * Does this action manager handles actions of any of the given triggers
  1658. * @param {number[]} triggers - the triggers to be tested
  1659. * @return {boolean} whether one (or more) of the triggers is handeled
  1660. */
  1661. hasSpecificTriggers(triggers: number[]): boolean;
  1662. /**
  1663. * Does this action manager handles actions of a given trigger
  1664. * @param {number} trigger - the trigger to be tested
  1665. * @return {boolean} whether the trigger is handeled
  1666. */
  1667. hasSpecificTrigger(trigger: number): boolean;
  1668. /**
  1669. * Does this action manager has pointer triggers
  1670. * @return {boolean} whether or not it has pointer triggers
  1671. */
  1672. hasPointerTriggers: boolean;
  1673. /**
  1674. * Does this action manager has pick triggers
  1675. * @return {boolean} whether or not it has pick triggers
  1676. */
  1677. hasPickTriggers: boolean;
  1678. /**
  1679. * Registers an action to this action manager
  1680. * @param {BABYLON.Action} action - the action to be registered
  1681. * @return {BABYLON.Action} the action amended (prepared) after registration
  1682. */
  1683. registerAction(action: Action): Action;
  1684. /**
  1685. * Process a specific trigger
  1686. * @param {number} trigger - the trigger to process
  1687. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1688. */
  1689. processTrigger(trigger: number, evt: ActionEvent): void;
  1690. serialize(name: string): any;
  1691. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  1692. static GetTriggerName(trigger: number): string;
  1693. }
  1694. }
  1695. declare module BABYLON {
  1696. class Condition {
  1697. constructor(actionManager: ActionManager);
  1698. isValid(): boolean;
  1699. serialize(): any;
  1700. }
  1701. class ValueCondition extends Condition {
  1702. propertyPath: string;
  1703. value: any;
  1704. operator: number;
  1705. static IsEqual: number;
  1706. static IsDifferent: number;
  1707. static IsGreater: number;
  1708. static IsLesser: number;
  1709. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1710. isValid(): boolean;
  1711. serialize(): any;
  1712. static GetOperatorName(operator: number): string;
  1713. }
  1714. class PredicateCondition extends Condition {
  1715. predicate: () => boolean;
  1716. constructor(actionManager: ActionManager, predicate: () => boolean);
  1717. isValid(): boolean;
  1718. }
  1719. class StateCondition extends Condition {
  1720. value: string;
  1721. constructor(actionManager: ActionManager, target: any, value: string);
  1722. isValid(): boolean;
  1723. serialize(): any;
  1724. }
  1725. }
  1726. declare module BABYLON {
  1727. class SwitchBooleanAction extends Action {
  1728. propertyPath: string;
  1729. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  1730. execute(): void;
  1731. serialize(parent: any): any;
  1732. }
  1733. class SetStateAction extends Action {
  1734. value: string;
  1735. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  1736. execute(): void;
  1737. serialize(parent: any): any;
  1738. }
  1739. class SetValueAction extends Action {
  1740. propertyPath: string;
  1741. value: any;
  1742. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1743. execute(): void;
  1744. serialize(parent: any): any;
  1745. }
  1746. class IncrementValueAction extends Action {
  1747. propertyPath: string;
  1748. value: any;
  1749. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1750. execute(): void;
  1751. serialize(parent: any): any;
  1752. }
  1753. class PlayAnimationAction extends Action {
  1754. from: number;
  1755. to: number;
  1756. loop: boolean;
  1757. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  1758. execute(): void;
  1759. serialize(parent: any): any;
  1760. }
  1761. class StopAnimationAction extends Action {
  1762. constructor(triggerOptions: any, target: any, condition?: Condition);
  1763. execute(): void;
  1764. serialize(parent: any): any;
  1765. }
  1766. class DoNothingAction extends Action {
  1767. constructor(triggerOptions?: any, condition?: Condition);
  1768. execute(): void;
  1769. serialize(parent: any): any;
  1770. }
  1771. class CombineAction extends Action {
  1772. children: Action[];
  1773. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  1774. execute(evt: ActionEvent): void;
  1775. serialize(parent: any): any;
  1776. }
  1777. class ExecuteCodeAction extends Action {
  1778. func: (evt: ActionEvent) => void;
  1779. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  1780. execute(evt: ActionEvent): void;
  1781. }
  1782. class SetParentAction extends Action {
  1783. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  1784. execute(): void;
  1785. serialize(parent: any): any;
  1786. }
  1787. class PlaySoundAction extends Action {
  1788. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1789. execute(): void;
  1790. serialize(parent: any): any;
  1791. }
  1792. class StopSoundAction extends Action {
  1793. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1794. execute(): void;
  1795. serialize(parent: any): any;
  1796. }
  1797. }
  1798. declare module BABYLON {
  1799. class InterpolateValueAction extends Action {
  1800. propertyPath: string;
  1801. value: any;
  1802. duration: number;
  1803. stopOtherAnimations: boolean;
  1804. onInterpolationDone: () => void;
  1805. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  1806. execute(): void;
  1807. serialize(parent: any): any;
  1808. }
  1809. }
  1810. declare module BABYLON {
  1811. class Animatable {
  1812. target: any;
  1813. fromFrame: number;
  1814. toFrame: number;
  1815. loopAnimation: boolean;
  1816. speedRatio: number;
  1817. onAnimationEnd: any;
  1818. animationStarted: boolean;
  1819. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  1820. getAnimations(): Animation[];
  1821. appendAnimations(target: any, animations: Animation[]): void;
  1822. getAnimationByTargetProperty(property: string): Animation;
  1823. reset(): void;
  1824. enableBlending(blendingSpeed: number): void;
  1825. disableBlending(): void;
  1826. goToFrame(frame: number): void;
  1827. pause(): void;
  1828. restart(): void;
  1829. stop(animationName?: string): void;
  1830. }
  1831. }
  1832. declare module BABYLON {
  1833. class AnimationRange {
  1834. name: string;
  1835. from: number;
  1836. to: number;
  1837. constructor(name: string, from: number, to: number);
  1838. clone(): AnimationRange;
  1839. }
  1840. /**
  1841. * Composed of a frame, and an action function
  1842. */
  1843. class AnimationEvent {
  1844. frame: number;
  1845. action: () => void;
  1846. onlyOnce: boolean;
  1847. isDone: boolean;
  1848. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  1849. }
  1850. class PathCursor {
  1851. private path;
  1852. value: number;
  1853. animations: Animation[];
  1854. constructor(path: Path2);
  1855. getPoint(): Vector3;
  1856. moveAhead(step?: number): PathCursor;
  1857. moveBack(step?: number): PathCursor;
  1858. move(step: number): PathCursor;
  1859. private ensureLimits();
  1860. private markAsDirty(propertyName);
  1861. private raiseOnChange();
  1862. onchange(f: (cursor: PathCursor) => void): PathCursor;
  1863. }
  1864. class Animation {
  1865. name: string;
  1866. targetProperty: string;
  1867. framePerSecond: number;
  1868. dataType: number;
  1869. loopMode: number;
  1870. enableBlending: boolean;
  1871. targetPropertyPath: string[];
  1872. currentFrame: number;
  1873. allowMatricesInterpolation: boolean;
  1874. blendingSpeed: number;
  1875. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  1876. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  1877. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  1878. /**
  1879. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  1880. */
  1881. toString(fullDetails?: boolean): string;
  1882. /**
  1883. * Add an event to this animation.
  1884. */
  1885. addEvent(event: AnimationEvent): void;
  1886. /**
  1887. * Remove all events found at the given frame
  1888. * @param frame
  1889. */
  1890. removeEvents(frame: number): void;
  1891. createRange(name: string, from: number, to: number): void;
  1892. deleteRange(name: string, deleteFrames?: boolean): void;
  1893. getRange(name: string): AnimationRange;
  1894. reset(): void;
  1895. isStopped(): boolean;
  1896. getKeys(): Array<{
  1897. frame: number;
  1898. value: any;
  1899. }>;
  1900. getHighestFrame(): number;
  1901. getEasingFunction(): IEasingFunction;
  1902. setEasingFunction(easingFunction: EasingFunction): void;
  1903. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  1904. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  1905. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  1906. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  1907. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  1908. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  1909. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1910. clone(): Animation;
  1911. setKeys(values: Array<{
  1912. frame: number;
  1913. value: any;
  1914. }>): void;
  1915. setValue(currentValue: any, blend?: boolean): void;
  1916. goToFrame(frame: number): void;
  1917. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  1918. serialize(): any;
  1919. static ANIMATIONTYPE_FLOAT: number;
  1920. static ANIMATIONTYPE_VECTOR3: number;
  1921. static ANIMATIONTYPE_VECTOR2: number;
  1922. static ANIMATIONTYPE_SIZE: number;
  1923. static ANIMATIONTYPE_QUATERNION: number;
  1924. static ANIMATIONTYPE_MATRIX: number;
  1925. static ANIMATIONTYPE_COLOR3: number;
  1926. static ANIMATIONLOOPMODE_RELATIVE: number;
  1927. static ANIMATIONLOOPMODE_CYCLE: number;
  1928. static ANIMATIONLOOPMODE_CONSTANT: number;
  1929. static Parse(parsedAnimation: any): Animation;
  1930. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  1931. }
  1932. }
  1933. declare module BABYLON {
  1934. interface IEasingFunction {
  1935. ease(gradient: number): number;
  1936. }
  1937. class EasingFunction implements IEasingFunction {
  1938. static EASINGMODE_EASEIN: number;
  1939. static EASINGMODE_EASEOUT: number;
  1940. static EASINGMODE_EASEINOUT: number;
  1941. setEasingMode(easingMode: number): void;
  1942. getEasingMode(): number;
  1943. easeInCore(gradient: number): number;
  1944. ease(gradient: number): number;
  1945. }
  1946. class CircleEase extends EasingFunction implements IEasingFunction {
  1947. easeInCore(gradient: number): number;
  1948. }
  1949. class BackEase extends EasingFunction implements IEasingFunction {
  1950. amplitude: number;
  1951. constructor(amplitude?: number);
  1952. easeInCore(gradient: number): number;
  1953. }
  1954. class BounceEase extends EasingFunction implements IEasingFunction {
  1955. bounces: number;
  1956. bounciness: number;
  1957. constructor(bounces?: number, bounciness?: number);
  1958. easeInCore(gradient: number): number;
  1959. }
  1960. class CubicEase extends EasingFunction implements IEasingFunction {
  1961. easeInCore(gradient: number): number;
  1962. }
  1963. class ElasticEase extends EasingFunction implements IEasingFunction {
  1964. oscillations: number;
  1965. springiness: number;
  1966. constructor(oscillations?: number, springiness?: number);
  1967. easeInCore(gradient: number): number;
  1968. }
  1969. class ExponentialEase extends EasingFunction implements IEasingFunction {
  1970. exponent: number;
  1971. constructor(exponent?: number);
  1972. easeInCore(gradient: number): number;
  1973. }
  1974. class PowerEase extends EasingFunction implements IEasingFunction {
  1975. power: number;
  1976. constructor(power?: number);
  1977. easeInCore(gradient: number): number;
  1978. }
  1979. class QuadraticEase extends EasingFunction implements IEasingFunction {
  1980. easeInCore(gradient: number): number;
  1981. }
  1982. class QuarticEase extends EasingFunction implements IEasingFunction {
  1983. easeInCore(gradient: number): number;
  1984. }
  1985. class QuinticEase extends EasingFunction implements IEasingFunction {
  1986. easeInCore(gradient: number): number;
  1987. }
  1988. class SineEase extends EasingFunction implements IEasingFunction {
  1989. easeInCore(gradient: number): number;
  1990. }
  1991. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  1992. x1: number;
  1993. y1: number;
  1994. x2: number;
  1995. y2: number;
  1996. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  1997. easeInCore(gradient: number): number;
  1998. }
  1999. }
  2000. declare module BABYLON {
  2001. class Analyser {
  2002. SMOOTHING: number;
  2003. FFT_SIZE: number;
  2004. BARGRAPHAMPLITUDE: number;
  2005. DEBUGCANVASPOS: {
  2006. x: number;
  2007. y: number;
  2008. };
  2009. DEBUGCANVASSIZE: {
  2010. width: number;
  2011. height: number;
  2012. };
  2013. constructor(scene: Scene);
  2014. getFrequencyBinCount(): number;
  2015. getByteFrequencyData(): Uint8Array;
  2016. getByteTimeDomainData(): Uint8Array;
  2017. getFloatFrequencyData(): Uint8Array;
  2018. drawDebugCanvas(): void;
  2019. stopDebugCanvas(): void;
  2020. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  2021. dispose(): void;
  2022. }
  2023. }
  2024. declare module BABYLON {
  2025. class AudioEngine {
  2026. canUseWebAudio: boolean;
  2027. masterGain: GainNode;
  2028. WarnedWebAudioUnsupported: boolean;
  2029. unlocked: boolean;
  2030. onAudioUnlocked: () => any;
  2031. isMP3supported: boolean;
  2032. isOGGsupported: boolean;
  2033. audioContext: AudioContext;
  2034. constructor();
  2035. dispose(): void;
  2036. getGlobalVolume(): number;
  2037. setGlobalVolume(newVolume: number): void;
  2038. connectToAnalyser(analyser: Analyser): void;
  2039. }
  2040. }
  2041. declare module BABYLON {
  2042. class Sound {
  2043. name: string;
  2044. autoplay: boolean;
  2045. loop: boolean;
  2046. useCustomAttenuation: boolean;
  2047. soundTrackId: number;
  2048. spatialSound: boolean;
  2049. refDistance: number;
  2050. rolloffFactor: number;
  2051. maxDistance: number;
  2052. distanceModel: string;
  2053. onended: () => any;
  2054. isPlaying: boolean;
  2055. isPaused: boolean;
  2056. /**
  2057. * Create a sound and attach it to a scene
  2058. * @param name Name of your sound
  2059. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  2060. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  2061. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  2062. */
  2063. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  2064. dispose(): void;
  2065. setAudioBuffer(audioBuffer: AudioBuffer): void;
  2066. updateOptions(options: any): void;
  2067. switchPanningModelToHRTF(): void;
  2068. switchPanningModelToEqualPower(): void;
  2069. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  2070. /**
  2071. * Transform this sound into a directional source
  2072. * @param coneInnerAngle Size of the inner cone in degree
  2073. * @param coneOuterAngle Size of the outer cone in degree
  2074. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  2075. */
  2076. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  2077. setPosition(newPosition: Vector3): void;
  2078. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  2079. updateDistanceFromListener(): void;
  2080. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  2081. /**
  2082. * Play the sound
  2083. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  2084. * @param offset (optional) Start the sound setting it at a specific time
  2085. */
  2086. play(time?: number, offset?: number): void;
  2087. /**
  2088. * Stop the sound
  2089. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  2090. */
  2091. stop(time?: number): void;
  2092. pause(): void;
  2093. setVolume(newVolume: number, time?: number): void;
  2094. setPlaybackRate(newPlaybackRate: number): void;
  2095. getVolume(): number;
  2096. attachToMesh(meshToConnectTo: AbstractMesh): void;
  2097. detachFromMesh(): void;
  2098. clone(): Sound;
  2099. getAudioBuffer(): AudioBuffer;
  2100. serialize(): any;
  2101. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  2102. }
  2103. }
  2104. declare module BABYLON {
  2105. class SoundTrack {
  2106. id: number;
  2107. soundCollection: Array<Sound>;
  2108. constructor(scene: Scene, options?: any);
  2109. dispose(): void;
  2110. AddSound(sound: Sound): void;
  2111. RemoveSound(sound: Sound): void;
  2112. setVolume(newVolume: number): void;
  2113. switchPanningModelToHRTF(): void;
  2114. switchPanningModelToEqualPower(): void;
  2115. connectToAnalyser(analyser: Analyser): void;
  2116. }
  2117. }
  2118. declare module BABYLON {
  2119. class Bone extends Node {
  2120. name: string;
  2121. children: Bone[];
  2122. animations: Animation[];
  2123. length: number;
  2124. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
  2125. getParent(): Bone;
  2126. getLocalMatrix(): Matrix;
  2127. getBaseMatrix(): Matrix;
  2128. getRestPose(): Matrix;
  2129. returnToRest(): void;
  2130. getWorldMatrix(): Matrix;
  2131. getInvertedAbsoluteTransform(): Matrix;
  2132. getAbsoluteTransform(): Matrix;
  2133. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  2134. markAsDirty(): void;
  2135. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
  2136. translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2137. setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2138. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  2139. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2140. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2141. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  2142. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  2143. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  2144. setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2145. setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
  2146. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  2147. getScale(): Vector3;
  2148. getScaleToRef(result: Vector3): void;
  2149. getPosition(space?: Space, mesh?: AbstractMesh): Vector3;
  2150. getPositionToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2151. getAbsolutePosition(mesh?: AbstractMesh): Vector3;
  2152. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  2153. computeAbsoluteTransforms(): void;
  2154. getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
  2155. getDirectionToRef(localAxis: Vector3, result: Vector3, mesh?: AbstractMesh): void;
  2156. getRotation(space?: Space, mesh?: AbstractMesh): Vector3;
  2157. getRotationToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2158. getRotationQuaternion(space?: Space, mesh?: AbstractMesh): Quaternion;
  2159. getRotationQuaternionToRef(space: Space, mesh: AbstractMesh, result: Quaternion): void;
  2160. }
  2161. }
  2162. declare module BABYLON {
  2163. class BoneIKController {
  2164. target: AbstractMesh;
  2165. poleTarget: AbstractMesh;
  2166. poleAngle: number;
  2167. mesh: AbstractMesh;
  2168. maxAngle: number;
  2169. constructor(mesh: AbstractMesh, bone: Bone, target: AbstractMesh, poleTarget: AbstractMesh, poleAngle?: number);
  2170. update(): void;
  2171. }
  2172. }
  2173. declare module BABYLON {
  2174. class BoneLookController {
  2175. target: Vector3;
  2176. mesh: AbstractMesh;
  2177. bone: Bone;
  2178. upAxis: Vector3;
  2179. adjustYaw: number;
  2180. adjustPitch: number;
  2181. adjustRoll: number;
  2182. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, adjustYaw?: number, adjustPitch?: number, adjustRoll?: number);
  2183. update(): void;
  2184. }
  2185. }
  2186. declare module BABYLON {
  2187. class Skeleton {
  2188. name: string;
  2189. id: string;
  2190. bones: Bone[];
  2191. dimensionsAtRest: Vector3;
  2192. needInitialSkinMatrix: boolean;
  2193. constructor(name: string, id: string, scene: Scene);
  2194. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  2195. getScene(): Scene;
  2196. /**
  2197. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2198. */
  2199. toString(fullDetails?: boolean): string;
  2200. /**
  2201. * Get bone's index searching by name
  2202. * @param {string} name is bone's name to search for
  2203. * @return {number} Indice of the bone. Returns -1 if not found
  2204. */
  2205. getBoneIndexByName(name: string): number;
  2206. createAnimationRange(name: string, from: number, to: number): void;
  2207. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  2208. getAnimationRange(name: string): AnimationRange;
  2209. /**
  2210. * Returns as an Array, all AnimationRanges defined on this skeleton
  2211. */
  2212. getAnimationRanges(): AnimationRange[];
  2213. /**
  2214. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  2215. */
  2216. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  2217. returnToRest(): void;
  2218. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  2219. prepare(): void;
  2220. getAnimatables(): IAnimatable[];
  2221. clone(name: string, id: string): Skeleton;
  2222. enableBlending(blendingSpeed?: number): void;
  2223. dispose(): void;
  2224. serialize(): any;
  2225. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  2226. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  2227. getPoseMatrix(): Matrix;
  2228. }
  2229. }
  2230. declare module BABYLON {
  2231. class Collider {
  2232. radius: Vector3;
  2233. retry: number;
  2234. velocity: Vector3;
  2235. basePoint: Vector3;
  2236. epsilon: number;
  2237. collisionFound: boolean;
  2238. velocityWorldLength: number;
  2239. basePointWorld: Vector3;
  2240. velocityWorld: Vector3;
  2241. normalizedVelocity: Vector3;
  2242. initialVelocity: Vector3;
  2243. initialPosition: Vector3;
  2244. nearestDistance: number;
  2245. intersectionPoint: Vector3;
  2246. collidedMesh: AbstractMesh;
  2247. }
  2248. }
  2249. declare module BABYLON {
  2250. var CollisionWorker: string;
  2251. interface ICollisionCoordinator {
  2252. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2253. init(scene: Scene): void;
  2254. destroy(): void;
  2255. onMeshAdded(mesh: AbstractMesh): any;
  2256. onMeshUpdated(mesh: AbstractMesh): any;
  2257. onMeshRemoved(mesh: AbstractMesh): any;
  2258. onGeometryAdded(geometry: Geometry): any;
  2259. onGeometryUpdated(geometry: Geometry): any;
  2260. onGeometryDeleted(geometry: Geometry): any;
  2261. }
  2262. interface SerializedMesh {
  2263. id: string;
  2264. name: string;
  2265. uniqueId: number;
  2266. geometryId: string;
  2267. sphereCenter: Array<number>;
  2268. sphereRadius: number;
  2269. boxMinimum: Array<number>;
  2270. boxMaximum: Array<number>;
  2271. worldMatrixFromCache: any;
  2272. subMeshes: Array<SerializedSubMesh>;
  2273. checkCollisions: boolean;
  2274. }
  2275. interface SerializedSubMesh {
  2276. position: number;
  2277. verticesStart: number;
  2278. verticesCount: number;
  2279. indexStart: number;
  2280. indexCount: number;
  2281. hasMaterial: boolean;
  2282. sphereCenter: Array<number>;
  2283. sphereRadius: number;
  2284. boxMinimum: Array<number>;
  2285. boxMaximum: Array<number>;
  2286. }
  2287. interface SerializedGeometry {
  2288. id: string;
  2289. positions: Float32Array;
  2290. indices: Int32Array;
  2291. normals: Float32Array;
  2292. }
  2293. interface BabylonMessage {
  2294. taskType: WorkerTaskType;
  2295. payload: InitPayload | CollidePayload | UpdatePayload;
  2296. }
  2297. interface SerializedColliderToWorker {
  2298. position: Array<number>;
  2299. velocity: Array<number>;
  2300. radius: Array<number>;
  2301. }
  2302. enum WorkerTaskType {
  2303. INIT = 0,
  2304. UPDATE = 1,
  2305. COLLIDE = 2,
  2306. }
  2307. interface WorkerReply {
  2308. error: WorkerReplyType;
  2309. taskType: WorkerTaskType;
  2310. payload?: any;
  2311. }
  2312. interface CollisionReplyPayload {
  2313. newPosition: Array<number>;
  2314. collisionId: number;
  2315. collidedMeshUniqueId: number;
  2316. }
  2317. interface InitPayload {
  2318. }
  2319. interface CollidePayload {
  2320. collisionId: number;
  2321. collider: SerializedColliderToWorker;
  2322. maximumRetry: number;
  2323. excludedMeshUniqueId?: number;
  2324. }
  2325. interface UpdatePayload {
  2326. updatedMeshes: {
  2327. [n: number]: SerializedMesh;
  2328. };
  2329. updatedGeometries: {
  2330. [s: string]: SerializedGeometry;
  2331. };
  2332. removedMeshes: Array<number>;
  2333. removedGeometries: Array<string>;
  2334. }
  2335. enum WorkerReplyType {
  2336. SUCCESS = 0,
  2337. UNKNOWN_ERROR = 1,
  2338. }
  2339. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  2340. constructor();
  2341. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  2342. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  2343. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2344. init(scene: Scene): void;
  2345. destroy(): void;
  2346. onMeshAdded(mesh: AbstractMesh): void;
  2347. onMeshUpdated: (mesh: AbstractMesh) => void;
  2348. onMeshRemoved(mesh: AbstractMesh): void;
  2349. onGeometryAdded(geometry: Geometry): void;
  2350. onGeometryUpdated: (geometry: Geometry) => void;
  2351. onGeometryDeleted(geometry: Geometry): void;
  2352. }
  2353. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  2354. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2355. init(scene: Scene): void;
  2356. destroy(): void;
  2357. onMeshAdded(mesh: AbstractMesh): void;
  2358. onMeshUpdated(mesh: AbstractMesh): void;
  2359. onMeshRemoved(mesh: AbstractMesh): void;
  2360. onGeometryAdded(geometry: Geometry): void;
  2361. onGeometryUpdated(geometry: Geometry): void;
  2362. onGeometryDeleted(geometry: Geometry): void;
  2363. }
  2364. }
  2365. declare module BABYLON {
  2366. var WorkerIncluded: boolean;
  2367. class CollisionCache {
  2368. getMeshes(): {
  2369. [n: number]: SerializedMesh;
  2370. };
  2371. getGeometries(): {
  2372. [s: number]: SerializedGeometry;
  2373. };
  2374. getMesh(id: any): SerializedMesh;
  2375. addMesh(mesh: SerializedMesh): void;
  2376. removeMesh(uniqueId: number): void;
  2377. getGeometry(id: string): SerializedGeometry;
  2378. addGeometry(geometry: SerializedGeometry): void;
  2379. removeGeometry(id: string): void;
  2380. }
  2381. class CollideWorker {
  2382. collider: Collider;
  2383. private finalPosition;
  2384. private collisionsScalingMatrix;
  2385. private collisionTranformationMatrix;
  2386. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  2387. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  2388. private checkCollision(mesh);
  2389. private processCollisionsForSubMeshes(transformMatrix, mesh);
  2390. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  2391. private checkSubmeshCollision(subMesh);
  2392. }
  2393. interface ICollisionDetector {
  2394. onInit(payload: InitPayload): void;
  2395. onUpdate(payload: UpdatePayload): void;
  2396. onCollision(payload: CollidePayload): void;
  2397. }
  2398. class CollisionDetectorTransferable implements ICollisionDetector {
  2399. onInit(payload: InitPayload): void;
  2400. onUpdate(payload: UpdatePayload): void;
  2401. onCollision(payload: CollidePayload): void;
  2402. }
  2403. }
  2404. declare module BABYLON {
  2405. class IntersectionInfo {
  2406. bu: number;
  2407. bv: number;
  2408. distance: number;
  2409. faceId: number;
  2410. subMeshId: number;
  2411. constructor(bu: number, bv: number, distance: number);
  2412. }
  2413. class PickingInfo {
  2414. hit: boolean;
  2415. distance: number;
  2416. pickedPoint: Vector3;
  2417. pickedMesh: AbstractMesh;
  2418. bu: number;
  2419. bv: number;
  2420. faceId: number;
  2421. subMeshId: number;
  2422. pickedSprite: Sprite;
  2423. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  2424. getTextureCoordinates(): Vector2;
  2425. }
  2426. }
  2427. declare module BABYLON {
  2428. class ArcRotateCamera extends TargetCamera {
  2429. alpha: number;
  2430. beta: number;
  2431. radius: number;
  2432. target: Vector3;
  2433. inertialAlphaOffset: number;
  2434. inertialBetaOffset: number;
  2435. inertialRadiusOffset: number;
  2436. lowerAlphaLimit: any;
  2437. upperAlphaLimit: any;
  2438. lowerBetaLimit: number;
  2439. upperBetaLimit: number;
  2440. lowerRadiusLimit: any;
  2441. upperRadiusLimit: any;
  2442. inertialPanningX: number;
  2443. inertialPanningY: number;
  2444. angularSensibilityX: number;
  2445. angularSensibilityY: number;
  2446. pinchPrecision: number;
  2447. panningSensibility: number;
  2448. keysUp: number[];
  2449. keysDown: number[];
  2450. keysLeft: number[];
  2451. keysRight: number[];
  2452. wheelPrecision: number;
  2453. zoomOnFactor: number;
  2454. targetScreenOffset: Vector2;
  2455. allowUpsideDown: boolean;
  2456. inputs: ArcRotateCameraInputsManager;
  2457. panningAxis: Vector3;
  2458. onCollide: (collidedMesh: AbstractMesh) => void;
  2459. checkCollisions: boolean;
  2460. collisionRadius: Vector3;
  2461. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  2462. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  2463. detachControl(element: HTMLElement): void;
  2464. rebuildAnglesAndRadius(): void;
  2465. setPosition(position: Vector3): void;
  2466. setTarget(target: Vector3, toBoundingCenter?: boolean): void;
  2467. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  2468. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  2469. /**
  2470. * @override
  2471. * Override Camera.createRigCamera
  2472. */
  2473. createRigCamera(name: string, cameraIndex: number): Camera;
  2474. /**
  2475. * @override
  2476. * Override Camera._updateRigCameras
  2477. */
  2478. dispose(): void;
  2479. getTypeName(): string;
  2480. }
  2481. }
  2482. declare module BABYLON {
  2483. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  2484. constructor(camera: ArcRotateCamera);
  2485. addMouseWheel(): ArcRotateCameraInputsManager;
  2486. addPointers(): ArcRotateCameraInputsManager;
  2487. addKeyboard(): ArcRotateCameraInputsManager;
  2488. addGamepad(): ArcRotateCameraInputsManager;
  2489. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  2490. }
  2491. }
  2492. declare module BABYLON {
  2493. class Camera extends Node {
  2494. inputs: CameraInputsManager<Camera>;
  2495. static PERSPECTIVE_CAMERA: number;
  2496. static ORTHOGRAPHIC_CAMERA: number;
  2497. static FOVMODE_VERTICAL_FIXED: number;
  2498. static FOVMODE_HORIZONTAL_FIXED: number;
  2499. static RIG_MODE_NONE: number;
  2500. static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  2501. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  2502. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  2503. static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  2504. static RIG_MODE_VR: number;
  2505. static RIG_MODE_WEBVR: number;
  2506. static ForceAttachControlToAlwaysPreventDefault: boolean;
  2507. position: Vector3;
  2508. upVector: Vector3;
  2509. orthoLeft: any;
  2510. orthoRight: any;
  2511. orthoBottom: any;
  2512. orthoTop: any;
  2513. fov: number;
  2514. minZ: number;
  2515. maxZ: number;
  2516. inertia: number;
  2517. mode: number;
  2518. isIntermediate: boolean;
  2519. viewport: Viewport;
  2520. layerMask: number;
  2521. fovMode: number;
  2522. cameraRigMode: number;
  2523. interaxialDistance: number;
  2524. isStereoscopicSideBySide: boolean;
  2525. constructor(name: string, position: Vector3, scene: Scene);
  2526. /**
  2527. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2528. */
  2529. toString(fullDetails?: boolean): string;
  2530. globalPosition: Vector3;
  2531. getActiveMeshes(): SmartArray<Mesh>;
  2532. isActiveMesh(mesh: Mesh): boolean;
  2533. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2534. detachControl(element: HTMLElement): void;
  2535. update(): void;
  2536. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  2537. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  2538. getWorldMatrix(): Matrix;
  2539. getViewMatrix(force?: boolean): Matrix;
  2540. freezeProjectionMatrix(projection?: Matrix): void;
  2541. unfreezeProjectionMatrix(): void;
  2542. getProjectionMatrix(force?: boolean): Matrix;
  2543. getTranformationMatrix(): Matrix;
  2544. private updateFrustumPlanes();
  2545. isInFrustum(target: ICullable): boolean;
  2546. isCompletelyInFrustum(target: ICullable): boolean;
  2547. dispose(): void;
  2548. setCameraRigMode(mode: number, rigParams: any): void;
  2549. setCameraRigParameter(name: string, value: any): void;
  2550. /**
  2551. * needs to be overridden by children so sub has required properties to be copied
  2552. */
  2553. createRigCamera(name: string, cameraIndex: number): Camera;
  2554. /**
  2555. * May need to be overridden by children
  2556. */
  2557. serialize(): any;
  2558. getTypeName(): string;
  2559. clone(name: string): Camera;
  2560. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  2561. static Parse(parsedCamera: any, scene: Scene): Camera;
  2562. }
  2563. }
  2564. declare module BABYLON {
  2565. var CameraInputTypes: {};
  2566. interface ICameraInput<TCamera extends BABYLON.Camera> {
  2567. camera: TCamera;
  2568. getTypeName(): string;
  2569. getSimpleName(): string;
  2570. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  2571. detachControl: (element: HTMLElement) => void;
  2572. checkInputs?: () => void;
  2573. }
  2574. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  2575. [name: string]: ICameraInput<TCamera>;
  2576. [idx: number]: ICameraInput<TCamera>;
  2577. }
  2578. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  2579. attached: CameraInputsMap<TCamera>;
  2580. attachedElement: HTMLElement;
  2581. noPreventDefault: boolean;
  2582. camera: TCamera;
  2583. checkInputs: () => void;
  2584. constructor(camera: TCamera);
  2585. add(input: ICameraInput<TCamera>): void;
  2586. remove(inputToRemove: ICameraInput<TCamera>): void;
  2587. removeByType(inputType: string): void;
  2588. attachInput(input: ICameraInput<TCamera>): void;
  2589. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  2590. detachElement(element: HTMLElement): void;
  2591. rebuildInputCheck(): void;
  2592. clear(): void;
  2593. serialize(serializedCamera: any): void;
  2594. parse(parsedCamera: any): void;
  2595. }
  2596. }
  2597. declare module BABYLON {
  2598. class DeviceOrientationCamera extends FreeCamera {
  2599. constructor(name: string, position: Vector3, scene: Scene);
  2600. getTypeName(): string;
  2601. resetToCurrentRotation(axis?: Axis): void;
  2602. }
  2603. }
  2604. declare module BABYLON {
  2605. class FollowCamera extends TargetCamera {
  2606. radius: number;
  2607. rotationOffset: number;
  2608. heightOffset: number;
  2609. cameraAcceleration: number;
  2610. maxCameraSpeed: number;
  2611. target: AbstractMesh;
  2612. constructor(name: string, position: Vector3, scene: Scene, target?: AbstractMesh);
  2613. private getRadians(degrees);
  2614. private follow(cameraTarget);
  2615. getTypeName(): string;
  2616. }
  2617. class ArcFollowCamera extends TargetCamera {
  2618. alpha: number;
  2619. beta: number;
  2620. radius: number;
  2621. target: AbstractMesh;
  2622. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  2623. private follow();
  2624. getTypeName(): string;
  2625. }
  2626. }
  2627. declare module BABYLON {
  2628. class FreeCamera extends TargetCamera {
  2629. ellipsoid: Vector3;
  2630. checkCollisions: boolean;
  2631. applyGravity: boolean;
  2632. inputs: FreeCameraInputsManager;
  2633. angularSensibility: number;
  2634. keysUp: number[];
  2635. keysDown: number[];
  2636. keysLeft: number[];
  2637. keysRight: number[];
  2638. onCollide: (collidedMesh: AbstractMesh) => void;
  2639. constructor(name: string, position: Vector3, scene: Scene);
  2640. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2641. detachControl(element: HTMLElement): void;
  2642. dispose(): void;
  2643. getTypeName(): string;
  2644. }
  2645. }
  2646. declare module BABYLON {
  2647. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  2648. constructor(camera: FreeCamera);
  2649. addKeyboard(): FreeCameraInputsManager;
  2650. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  2651. addGamepad(): FreeCameraInputsManager;
  2652. addDeviceOrientation(): FreeCameraInputsManager;
  2653. addTouch(): FreeCameraInputsManager;
  2654. addVirtualJoystick(): FreeCameraInputsManager;
  2655. }
  2656. }
  2657. declare module BABYLON {
  2658. class GamepadCamera extends UniversalCamera {
  2659. gamepadAngularSensibility: number;
  2660. gamepadMoveSensibility: number;
  2661. constructor(name: string, position: Vector3, scene: Scene);
  2662. getTypeName(): string;
  2663. }
  2664. }
  2665. declare module BABYLON {
  2666. class AnaglyphFreeCamera extends FreeCamera {
  2667. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2668. getTypeName(): string;
  2669. }
  2670. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  2671. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  2672. getTypeName(): string;
  2673. }
  2674. class AnaglyphGamepadCamera extends GamepadCamera {
  2675. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2676. getTypeName(): string;
  2677. }
  2678. class AnaglyphUniversalCamera extends UniversalCamera {
  2679. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2680. getTypeName(): string;
  2681. }
  2682. class StereoscopicFreeCamera extends FreeCamera {
  2683. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2684. getTypeName(): string;
  2685. }
  2686. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  2687. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2688. getTypeName(): string;
  2689. }
  2690. class StereoscopicGamepadCamera extends GamepadCamera {
  2691. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2692. getTypeName(): string;
  2693. }
  2694. class StereoscopicUniversalCamera extends UniversalCamera {
  2695. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2696. getTypeName(): string;
  2697. }
  2698. }
  2699. declare module BABYLON {
  2700. class TargetCamera extends Camera {
  2701. cameraDirection: Vector3;
  2702. cameraRotation: Vector2;
  2703. rotation: Vector3;
  2704. rotationQuaternion: Quaternion;
  2705. speed: number;
  2706. noRotationConstraint: boolean;
  2707. lockedTarget: any;
  2708. constructor(name: string, position: Vector3, scene: Scene);
  2709. getFrontPosition(distance: number): Vector3;
  2710. setTarget(target: Vector3): void;
  2711. getTarget(): Vector3;
  2712. /**
  2713. * @override
  2714. * Override Camera.createRigCamera
  2715. */
  2716. createRigCamera(name: string, cameraIndex: number): Camera;
  2717. /**
  2718. * @override
  2719. * Override Camera._updateRigCameras
  2720. */
  2721. getTypeName(): string;
  2722. }
  2723. }
  2724. declare module BABYLON {
  2725. class TouchCamera extends FreeCamera {
  2726. touchAngularSensibility: number;
  2727. touchMoveSensibility: number;
  2728. constructor(name: string, position: Vector3, scene: Scene);
  2729. getTypeName(): string;
  2730. }
  2731. }
  2732. declare module BABYLON {
  2733. class UniversalCamera extends TouchCamera {
  2734. gamepadAngularSensibility: number;
  2735. gamepadMoveSensibility: number;
  2736. constructor(name: string, position: Vector3, scene: Scene);
  2737. getTypeName(): string;
  2738. }
  2739. }
  2740. declare module BABYLON {
  2741. class VirtualJoysticksCamera extends FreeCamera {
  2742. constructor(name: string, position: Vector3, scene: Scene);
  2743. }
  2744. }
  2745. declare module BABYLON {
  2746. class DebugLayer {
  2747. shouldDisplayLabel: (node: Node) => boolean;
  2748. shouldDisplayAxis: (mesh: Mesh) => boolean;
  2749. axisRatio: number;
  2750. accentColor: string;
  2751. customStatsFunction: () => string;
  2752. constructor(scene: Scene);
  2753. isVisible(): boolean;
  2754. hide(): void;
  2755. show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void;
  2756. }
  2757. }
  2758. declare module BABYLON.Debug {
  2759. /**
  2760. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  2761. */
  2762. class SkeletonViewer {
  2763. skeleton: Skeleton;
  2764. mesh: AbstractMesh;
  2765. autoUpdateBonesMatrices: boolean;
  2766. renderingGroupId: number;
  2767. color: Color3;
  2768. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  2769. isEnabled: boolean;
  2770. update(): void;
  2771. dispose(): void;
  2772. }
  2773. }
  2774. declare module BABYLON {
  2775. /**
  2776. * Highlight layer options. This helps customizing the behaviour
  2777. * of the highlight layer.
  2778. */
  2779. interface IHighlightLayerOptions {
  2780. /**
  2781. * Multiplication factor apply to the canvas size to compute the render target size
  2782. * used to generated the glowing objects (the smaller the faster).
  2783. */
  2784. mainTextureRatio?: number;
  2785. /**
  2786. * Enforces a fixed size texture to ensure resize independant blur.
  2787. */
  2788. mainTextureFixedSize?: number;
  2789. /**
  2790. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  2791. * of the picture to blur (the smaller the faster).
  2792. */
  2793. blurTextureSizeRatio?: number;
  2794. /**
  2795. * How big in texel of the blur texture is the vertical blur.
  2796. */
  2797. blurVerticalSize?: number;
  2798. /**
  2799. * How big in texel of the blur texture is the horizontal blur.
  2800. */
  2801. blurHorizontalSize?: number;
  2802. /**
  2803. * Alpha blending mode used to apply the blur. Default is combine.
  2804. */
  2805. alphaBlendingMode?: number;
  2806. /**
  2807. * The camera attached to the layer.
  2808. */
  2809. camera?: Camera;
  2810. }
  2811. /**
  2812. * The highlight layer Helps adding a glow effect around a mesh.
  2813. *
  2814. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  2815. * glowy meshes to your scene.
  2816. *
  2817. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  2818. */
  2819. class HighlightLayer {
  2820. /**
  2821. * The neutral color used during the preparation of the glow effect.
  2822. * This is black by default as the blend operation is a blend operation.
  2823. */
  2824. static neutralColor: Color4;
  2825. /**
  2826. * Stencil value used for glowing meshes.
  2827. */
  2828. static glowingMeshStencilReference: number;
  2829. /**
  2830. * Stencil value used for the other meshes in the scene.
  2831. */
  2832. static normalMeshStencilReference: number;
  2833. /**
  2834. * Specifies whether or not the inner glow is ACTIVE in the layer.
  2835. */
  2836. innerGlow: boolean;
  2837. /**
  2838. * Specifies whether or not the outer glow is ACTIVE in the layer.
  2839. */
  2840. outerGlow: boolean;
  2841. /**
  2842. * Specifies wether the highlight layer is enabled or not.
  2843. */
  2844. isEnabled: boolean;
  2845. /**
  2846. * Gets the horizontal size of the blur.
  2847. */
  2848. /**
  2849. * Specifies the horizontal size of the blur.
  2850. */
  2851. blurHorizontalSize: number;
  2852. /**
  2853. * Gets the vertical size of the blur.
  2854. */
  2855. /**
  2856. * Specifies the vertical size of the blur.
  2857. */
  2858. blurVerticalSize: number;
  2859. /**
  2860. * Gets the camera attached to the layer.
  2861. */
  2862. camera: Camera;
  2863. /**
  2864. * An event triggered when the highlight layer has been disposed.
  2865. * @type {BABYLON.Observable}
  2866. */
  2867. onDisposeObservable: Observable<HighlightLayer>;
  2868. /**
  2869. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  2870. * @type {BABYLON.Observable}
  2871. */
  2872. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  2873. /**
  2874. * An event triggered when the highlight layer is being blurred.
  2875. * @type {BABYLON.Observable}
  2876. */
  2877. onBeforeBlurObservable: Observable<HighlightLayer>;
  2878. /**
  2879. * An event triggered when the highlight layer has been blurred.
  2880. * @type {BABYLON.Observable}
  2881. */
  2882. onAfterBlurObservable: Observable<HighlightLayer>;
  2883. /**
  2884. * An event triggered when the glowing blurred texture is being merged in the scene.
  2885. * @type {BABYLON.Observable}
  2886. */
  2887. onBeforeComposeObservable: Observable<HighlightLayer>;
  2888. /**
  2889. * An event triggered when the glowing blurred texture has been merged in the scene.
  2890. * @type {BABYLON.Observable}
  2891. */
  2892. onAfterComposeObservable: Observable<HighlightLayer>;
  2893. /**
  2894. * An event triggered when the highlight layer changes its size.
  2895. * @type {BABYLON.Observable}
  2896. */
  2897. onSizeChangedObservable: Observable<HighlightLayer>;
  2898. /**
  2899. * Instantiates a new highlight Layer and references it to the scene..
  2900. * @param name The name of the layer
  2901. * @param scene The scene to use the layer in
  2902. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  2903. */
  2904. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  2905. /**
  2906. * Creates the render target textures and post processes used in the highlight layer.
  2907. */
  2908. private createTextureAndPostProcesses();
  2909. /**
  2910. * Checks for the readiness of the element composing the layer.
  2911. * @param subMesh the mesh to check for
  2912. * @param useInstances specify wether or not to use instances to render the mesh
  2913. * @param emissiveTexture the associated emissive texture used to generate the glow
  2914. * @return true if ready otherwise, false
  2915. */
  2916. private isReady(subMesh, useInstances, emissiveTexture);
  2917. /**
  2918. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  2919. */
  2920. render(): void;
  2921. /**
  2922. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  2923. * @param mesh The mesh to exclude from the highlight layer
  2924. */
  2925. addExcludedMesh(mesh: Mesh): void;
  2926. /**
  2927. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  2928. * @param mesh The mesh to highlight
  2929. */
  2930. removeExcludedMesh(mesh: Mesh): void;
  2931. /**
  2932. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  2933. * @param mesh The mesh to highlight
  2934. * @param color The color of the highlight
  2935. * @param glowEmissiveOnly Extract the glow from the emissive texture
  2936. */
  2937. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  2938. /**
  2939. * Remove a mesh from the highlight layer in order to make it stop glowing.
  2940. * @param mesh The mesh to highlight
  2941. */
  2942. removeMesh(mesh: Mesh): void;
  2943. /**
  2944. * Returns true if the layer contains information to display, otherwise false.
  2945. */
  2946. shouldRender(): boolean;
  2947. /**
  2948. * Sets the main texture desired size which is the closest power of two
  2949. * of the engine canvas size.
  2950. */
  2951. private setMainTextureSize();
  2952. /**
  2953. * Force the stencil to the normal expected value for none glowing parts
  2954. */
  2955. private defaultStencilReference(mesh);
  2956. /**
  2957. * Dispose only the render target textures and post process.
  2958. */
  2959. private disposeTextureAndPostProcesses();
  2960. /**
  2961. * Dispose the highlight layer and free resources.
  2962. */
  2963. dispose(): void;
  2964. }
  2965. }
  2966. declare module BABYLON {
  2967. class Layer {
  2968. name: string;
  2969. texture: Texture;
  2970. isBackground: boolean;
  2971. color: Color4;
  2972. scale: Vector2;
  2973. offset: Vector2;
  2974. alphaBlendingMode: number;
  2975. alphaTest: boolean;
  2976. /**
  2977. * An event triggered when the layer is disposed.
  2978. * @type {BABYLON.Observable}
  2979. */
  2980. onDisposeObservable: Observable<Layer>;
  2981. onDispose: () => void;
  2982. /**
  2983. * An event triggered before rendering the scene
  2984. * @type {BABYLON.Observable}
  2985. */
  2986. onBeforeRenderObservable: Observable<Layer>;
  2987. onBeforeRender: () => void;
  2988. /**
  2989. * An event triggered after rendering the scene
  2990. * @type {BABYLON.Observable}
  2991. */
  2992. onAfterRenderObservable: Observable<Layer>;
  2993. onAfterRender: () => void;
  2994. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  2995. render(): void;
  2996. dispose(): void;
  2997. }
  2998. }
  2999. declare module BABYLON {
  3000. class BoundingBox implements ICullable {
  3001. minimum: Vector3;
  3002. maximum: Vector3;
  3003. vectors: Vector3[];
  3004. center: Vector3;
  3005. extendSize: Vector3;
  3006. directions: Vector3[];
  3007. vectorsWorld: Vector3[];
  3008. minimumWorld: Vector3;
  3009. maximumWorld: Vector3;
  3010. constructor(minimum: Vector3, maximum: Vector3);
  3011. getWorldMatrix(): Matrix;
  3012. setWorldMatrix(matrix: Matrix): BoundingBox;
  3013. isInFrustum(frustumPlanes: Plane[]): boolean;
  3014. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3015. intersectsPoint(point: Vector3): boolean;
  3016. intersectsSphere(sphere: BoundingSphere): boolean;
  3017. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  3018. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  3019. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  3020. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3021. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3022. }
  3023. }
  3024. declare module BABYLON {
  3025. interface ICullable {
  3026. isInFrustum(frustumPlanes: Plane[]): boolean;
  3027. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3028. }
  3029. class BoundingInfo implements ICullable {
  3030. minimum: Vector3;
  3031. maximum: Vector3;
  3032. boundingBox: BoundingBox;
  3033. boundingSphere: BoundingSphere;
  3034. constructor(minimum: Vector3, maximum: Vector3);
  3035. isLocked: boolean;
  3036. update(world: Matrix): void;
  3037. isInFrustum(frustumPlanes: Plane[]): boolean;
  3038. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3039. intersectsPoint(point: Vector3): boolean;
  3040. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  3041. }
  3042. }
  3043. declare module BABYLON {
  3044. class BoundingSphere {
  3045. minimum: Vector3;
  3046. maximum: Vector3;
  3047. center: Vector3;
  3048. radius: number;
  3049. centerWorld: Vector3;
  3050. radiusWorld: number;
  3051. constructor(minimum: Vector3, maximum: Vector3);
  3052. isInFrustum(frustumPlanes: Plane[]): boolean;
  3053. intersectsPoint(point: Vector3): boolean;
  3054. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  3055. }
  3056. }
  3057. declare module BABYLON {
  3058. class Ray {
  3059. origin: Vector3;
  3060. direction: Vector3;
  3061. length: number;
  3062. constructor(origin: Vector3, direction: Vector3, length?: number);
  3063. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  3064. intersectsBox(box: BoundingBox): boolean;
  3065. intersectsSphere(sphere: BoundingSphere): boolean;
  3066. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  3067. intersectsPlane(plane: Plane): number;
  3068. private static smallnum;
  3069. private static rayl;
  3070. /**
  3071. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  3072. * @param sega the first point of the segment to test the intersection against
  3073. * @param segb the second point of the segment to test the intersection against
  3074. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  3075. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  3076. */
  3077. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  3078. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3079. /**
  3080. * 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
  3081. * transformed to the given world matrix.
  3082. * @param origin The origin point
  3083. * @param end The end point
  3084. * @param world a matrix to transform the ray to. Default is the identity matrix.
  3085. */
  3086. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  3087. static Transform(ray: Ray, matrix: Matrix): Ray;
  3088. }
  3089. }
  3090. declare module BABYLON {
  3091. class LensFlare {
  3092. size: number;
  3093. position: number;
  3094. color: Color3;
  3095. texture: Texture;
  3096. alphaMode: number;
  3097. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  3098. dispose: () => void;
  3099. }
  3100. }
  3101. declare module BABYLON {
  3102. class LensFlareSystem {
  3103. name: string;
  3104. lensFlares: LensFlare[];
  3105. borderLimit: number;
  3106. viewportBorder: number;
  3107. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  3108. layerMask: number;
  3109. id: string;
  3110. constructor(name: string, emitter: any, scene: Scene);
  3111. isEnabled: boolean;
  3112. getScene(): Scene;
  3113. getEmitter(): any;
  3114. setEmitter(newEmitter: any): void;
  3115. getEmitterPosition(): Vector3;
  3116. computeEffectivePosition(globalViewport: Viewport): boolean;
  3117. render(): boolean;
  3118. dispose(): void;
  3119. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  3120. serialize(): any;
  3121. }
  3122. }
  3123. declare module BABYLON {
  3124. class DirectionalLight extends Light implements IShadowLight {
  3125. position: Vector3;
  3126. direction: Vector3;
  3127. transformedPosition: Vector3;
  3128. shadowOrthoScale: number;
  3129. autoUpdateExtends: boolean;
  3130. constructor(name: string, direction: Vector3, scene: Scene);
  3131. getAbsolutePosition(): Vector3;
  3132. setDirectionToTarget(target: Vector3): Vector3;
  3133. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3134. supportsVSM(): boolean;
  3135. needRefreshPerFrame(): boolean;
  3136. needCube(): boolean;
  3137. getShadowDirection(faceIndex?: number): Vector3;
  3138. computeTransformedPosition(): boolean;
  3139. transferToEffect(effect: Effect, directionUniformName: string): void;
  3140. getTypeID(): number;
  3141. }
  3142. }
  3143. declare module BABYLON {
  3144. class HemisphericLight extends Light {
  3145. groundColor: Color3;
  3146. direction: Vector3;
  3147. constructor(name: string, direction: Vector3, scene: Scene);
  3148. setDirectionToTarget(target: Vector3): Vector3;
  3149. getShadowGenerator(): ShadowGenerator;
  3150. transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  3151. getTypeID(): number;
  3152. }
  3153. }
  3154. declare module BABYLON {
  3155. interface IShadowLight {
  3156. id: string;
  3157. position: Vector3;
  3158. transformedPosition: Vector3;
  3159. name: string;
  3160. computeTransformedPosition(): boolean;
  3161. getScene(): Scene;
  3162. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3163. supportsVSM(): boolean;
  3164. needRefreshPerFrame(): boolean;
  3165. needCube(): boolean;
  3166. getShadowDirection(faceIndex?: number): Vector3;
  3167. }
  3168. class Light extends Node {
  3169. /**
  3170. * If every light affecting the material is in this lightmapMode,
  3171. * material.lightmapTexture adds or multiplies
  3172. * (depends on material.useLightmapAsShadowmap)
  3173. * after every other light calculations.
  3174. */
  3175. static LIGHTMAP_DEFAULT: number;
  3176. /**
  3177. * material.lightmapTexture as only diffuse lighting from this light
  3178. * adds pnly specular lighting from this light
  3179. * adds dynamic shadows
  3180. */
  3181. static LIGHTMAP_SPECULAR: number;
  3182. /**
  3183. * material.lightmapTexture as only lighting
  3184. * no light calculation from this light
  3185. * only adds dynamic shadows from this light
  3186. */
  3187. static LIGHTMAP_SHADOWSONLY: number;
  3188. diffuse: Color3;
  3189. specular: Color3;
  3190. intensity: number;
  3191. range: number;
  3192. includeOnlyWithLayerMask: number;
  3193. includedOnlyMeshes: AbstractMesh[];
  3194. excludedMeshes: AbstractMesh[];
  3195. excludeWithLayerMask: number;
  3196. lightmapMode: number;
  3197. radius: number;
  3198. constructor(name: string, scene: Scene);
  3199. /**
  3200. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3201. */
  3202. toString(fullDetails?: boolean): string;
  3203. getShadowGenerator(): IShadowGenerator;
  3204. getAbsolutePosition(): Vector3;
  3205. transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  3206. canAffectMesh(mesh: AbstractMesh): boolean;
  3207. getWorldMatrix(): Matrix;
  3208. dispose(): void;
  3209. getTypeID(): number;
  3210. clone(name: string): Light;
  3211. serialize(): any;
  3212. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  3213. static Parse(parsedLight: any, scene: Scene): Light;
  3214. }
  3215. }
  3216. declare module BABYLON {
  3217. class PointLight extends Light implements IShadowLight {
  3218. transformedPosition: Vector3;
  3219. position: Vector3;
  3220. constructor(name: string, position: Vector3, scene: Scene);
  3221. getAbsolutePosition(): Vector3;
  3222. computeTransformedPosition(): boolean;
  3223. transferToEffect(effect: Effect, positionUniformName: string): void;
  3224. needCube(): boolean;
  3225. supportsVSM(): boolean;
  3226. needRefreshPerFrame(): boolean;
  3227. getShadowDirection(faceIndex?: number): Vector3;
  3228. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3229. getTypeID(): number;
  3230. }
  3231. }
  3232. declare module BABYLON {
  3233. class SpotLight extends Light implements IShadowLight {
  3234. position: Vector3;
  3235. direction: Vector3;
  3236. angle: number;
  3237. exponent: number;
  3238. transformedPosition: Vector3;
  3239. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  3240. getAbsolutePosition(): Vector3;
  3241. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3242. needCube(): boolean;
  3243. supportsVSM(): boolean;
  3244. needRefreshPerFrame(): boolean;
  3245. getShadowDirection(faceIndex?: number): Vector3;
  3246. setDirectionToTarget(target: Vector3): Vector3;
  3247. computeTransformedPosition(): boolean;
  3248. transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  3249. getTypeID(): number;
  3250. getRotation(): Vector3;
  3251. }
  3252. }
  3253. declare module BABYLON {
  3254. interface ISceneLoaderPluginExtensions {
  3255. [extension: string]: {
  3256. isBinary: boolean;
  3257. };
  3258. }
  3259. interface ISceneLoaderPlugin {
  3260. extensions: string | ISceneLoaderPluginExtensions;
  3261. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  3262. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  3263. }
  3264. interface ISceneLoaderPluginAsync {
  3265. extensions: string | ISceneLoaderPluginExtensions;
  3266. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror?: () => void) => void;
  3267. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => boolean;
  3268. }
  3269. class SceneLoader {
  3270. static NO_LOGGING: number;
  3271. static MINIMAL_LOGGING: number;
  3272. static SUMMARY_LOGGING: number;
  3273. static DETAILED_LOGGING: number;
  3274. static ForceFullSceneLoadingForIncremental: boolean;
  3275. static ShowLoadingScreen: boolean;
  3276. static loggingLevel: number;
  3277. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  3278. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  3279. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void;
  3280. /**
  3281. * Load a scene
  3282. * @param rootUrl a string that defines the root url for scene and resources
  3283. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  3284. * @param engine is the instance of BABYLON.Engine to use to create the scene
  3285. */
  3286. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  3287. /**
  3288. * Append a scene
  3289. * @param rootUrl a string that defines the root url for scene and resources
  3290. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  3291. * @param scene is the instance of BABYLON.Scene to append to
  3292. */
  3293. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  3294. }
  3295. }
  3296. declare module BABYLON {
  3297. /**
  3298. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  3299. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  3300. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  3301. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  3302. */
  3303. class ColorCurves {
  3304. /**
  3305. * Gets the global Hue value.
  3306. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3307. */
  3308. /**
  3309. * Sets the global Hue value.
  3310. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3311. */
  3312. GlobalHue: number;
  3313. /**
  3314. * Gets the global Density value.
  3315. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3316. * Values less than zero provide a filter of opposite hue.
  3317. */
  3318. /**
  3319. * Sets the global Density value.
  3320. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3321. * Values less than zero provide a filter of opposite hue.
  3322. */
  3323. GlobalDensity: number;
  3324. /**
  3325. * Gets the global Saturation value.
  3326. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3327. */
  3328. /**
  3329. * Sets the global Saturation value.
  3330. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3331. */
  3332. GlobalSaturation: number;
  3333. /**
  3334. * Gets the highlights Hue value.
  3335. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3336. */
  3337. /**
  3338. * Sets the highlights Hue value.
  3339. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3340. */
  3341. HighlightsHue: number;
  3342. /**
  3343. * Gets the highlights Density value.
  3344. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3345. * Values less than zero provide a filter of opposite hue.
  3346. */
  3347. /**
  3348. * Sets the highlights Density value.
  3349. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3350. * Values less than zero provide a filter of opposite hue.
  3351. */
  3352. HighlightsDensity: number;
  3353. /**
  3354. * Gets the highlights Saturation value.
  3355. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3356. */
  3357. /**
  3358. * Sets the highlights Saturation value.
  3359. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3360. */
  3361. HighlightsSaturation: number;
  3362. /**
  3363. * Gets the highlights Exposure value.
  3364. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3365. */
  3366. /**
  3367. * Sets the highlights Exposure value.
  3368. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3369. */
  3370. HighlightsExposure: number;
  3371. /**
  3372. * Gets the midtones Hue value.
  3373. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3374. */
  3375. /**
  3376. * Sets the midtones Hue value.
  3377. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3378. */
  3379. MidtonesHue: number;
  3380. /**
  3381. * Gets the midtones Density value.
  3382. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3383. * Values less than zero provide a filter of opposite hue.
  3384. */
  3385. /**
  3386. * Sets the midtones Density value.
  3387. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3388. * Values less than zero provide a filter of opposite hue.
  3389. */
  3390. MidtonesDensity: number;
  3391. /**
  3392. * Gets the midtones Saturation value.
  3393. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3394. */
  3395. /**
  3396. * Sets the midtones Saturation value.
  3397. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3398. */
  3399. MidtonesSaturation: number;
  3400. /**
  3401. * Gets the midtones Exposure value.
  3402. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3403. */
  3404. /**
  3405. * Sets the midtones Exposure value.
  3406. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3407. */
  3408. MidtonesExposure: number;
  3409. /**
  3410. * Gets the shadows Hue value.
  3411. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3412. */
  3413. /**
  3414. * Sets the shadows Hue value.
  3415. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3416. */
  3417. ShadowsHue: number;
  3418. /**
  3419. * Gets the shadows Density value.
  3420. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3421. * Values less than zero provide a filter of opposite hue.
  3422. */
  3423. /**
  3424. * Sets the shadows Density value.
  3425. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3426. * Values less than zero provide a filter of opposite hue.
  3427. */
  3428. ShadowsDensity: number;
  3429. /**
  3430. * Gets the shadows Saturation value.
  3431. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3432. */
  3433. /**
  3434. * Sets the shadows Saturation value.
  3435. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3436. */
  3437. ShadowsSaturation: number;
  3438. /**
  3439. * Gets the shadows Exposure value.
  3440. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3441. */
  3442. /**
  3443. * Sets the shadows Exposure value.
  3444. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3445. */
  3446. ShadowsExposure: number;
  3447. /**
  3448. * Binds the color curves to the shader.
  3449. * @param colorCurves The color curve to bind
  3450. * @param effect The effect to bind to
  3451. */
  3452. static Bind(colorCurves: ColorCurves, effect: Effect): void;
  3453. /**
  3454. * Prepare the list of uniforms associated with the ColorCurves effects.
  3455. * @param uniformsList The list of uniforms used in the effect
  3456. */
  3457. static PrepareUniforms(uniformsList: string[]): void;
  3458. /**
  3459. * Returns color grading data based on a hue, density, saturation and exposure value.
  3460. * @param filterHue The hue of the color filter.
  3461. * @param filterDensity The density of the color filter.
  3462. * @param saturation The saturation.
  3463. * @param exposure The exposure.
  3464. * @param result The result data container.
  3465. */
  3466. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  3467. /**
  3468. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  3469. * @param value The input slider value in range [-100,100].
  3470. * @returns Adjusted value.
  3471. */
  3472. private static applyColorGradingSliderNonlinear(value);
  3473. /**
  3474. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  3475. * @param hue The hue (H) input.
  3476. * @param saturation The saturation (S) input.
  3477. * @param brightness The brightness (B) input.
  3478. * @result An RGBA color represented as Vector4.
  3479. */
  3480. private static fromHSBToRef(hue, saturation, brightness, result);
  3481. /**
  3482. * Returns a value clamped between min and max
  3483. * @param value The value to clamp
  3484. * @param min The minimum of value
  3485. * @param max The maximum of value
  3486. * @returns The clamped value.
  3487. */
  3488. private static clamp(value, min, max);
  3489. /**
  3490. * Clones the current color curve instance.
  3491. * @return The cloned curves
  3492. */
  3493. clone(): ColorCurves;
  3494. /**
  3495. * Serializes the current color curve instance to a json representation.
  3496. * @return a JSON representation
  3497. */
  3498. serialize(): any;
  3499. /**
  3500. * Parses the color curve from a json representation.
  3501. * @param source the JSON source to parse
  3502. * @return The parsed curves
  3503. */
  3504. static Parse(source: any): ColorCurves;
  3505. }
  3506. }
  3507. declare module BABYLON {
  3508. class EffectFallbacks {
  3509. addFallback(rank: number, define: string): void;
  3510. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  3511. isMoreFallbacks: boolean;
  3512. reduce(currentDefines: string): string;
  3513. }
  3514. class Effect {
  3515. name: any;
  3516. defines: string;
  3517. onCompiled: (effect: Effect) => void;
  3518. onError: (effect: Effect, errors: string) => void;
  3519. onBind: (effect: Effect) => void;
  3520. 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, indexParameters?: any);
  3521. isReady(): boolean;
  3522. getProgram(): WebGLProgram;
  3523. getAttributesNames(): string[];
  3524. getAttributeLocation(index: number): number;
  3525. getAttributeLocationByName(name: string): number;
  3526. getAttributesCount(): number;
  3527. getUniformIndex(uniformName: string): number;
  3528. getUniform(uniformName: string): WebGLUniformLocation;
  3529. getSamplers(): string[];
  3530. getCompilationError(): string;
  3531. getVertexShaderSource(): string;
  3532. getFragmentShaderSource(): string;
  3533. isSupported: boolean;
  3534. setTexture(channel: string, texture: BaseTexture): void;
  3535. setTextureArray(channel: string, textures: BaseTexture[]): void;
  3536. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  3537. setIntArray(uniformName: string, array: Int32Array): Effect;
  3538. setIntArray2(uniformName: string, array: Int32Array): Effect;
  3539. setIntArray3(uniformName: string, array: Int32Array): Effect;
  3540. setIntArray4(uniformName: string, array: Int32Array): Effect;
  3541. setFloatArray(uniformName: string, array: Float32Array): Effect;
  3542. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  3543. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  3544. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  3545. setArray(uniformName: string, array: number[]): Effect;
  3546. setArray2(uniformName: string, array: number[]): Effect;
  3547. setArray3(uniformName: string, array: number[]): Effect;
  3548. setArray4(uniformName: string, array: number[]): Effect;
  3549. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  3550. setMatrix(uniformName: string, matrix: Matrix): Effect;
  3551. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  3552. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  3553. setFloat(uniformName: string, value: number): Effect;
  3554. setBool(uniformName: string, bool: boolean): Effect;
  3555. setVector2(uniformName: string, vector2: Vector2): Effect;
  3556. setFloat2(uniformName: string, x: number, y: number): Effect;
  3557. setVector3(uniformName: string, vector3: Vector3): Effect;
  3558. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  3559. setVector4(uniformName: string, vector4: Vector4): Effect;
  3560. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  3561. setColor3(uniformName: string, color3: Color3): Effect;
  3562. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  3563. static ShadersStore: {};
  3564. static IncludesShadersStore: {};
  3565. }
  3566. }
  3567. declare module BABYLON {
  3568. class FresnelParameters {
  3569. isEnabled: boolean;
  3570. leftColor: Color3;
  3571. rightColor: Color3;
  3572. bias: number;
  3573. power: number;
  3574. clone(): FresnelParameters;
  3575. serialize(): any;
  3576. static Parse(parsedFresnelParameters: any): FresnelParameters;
  3577. }
  3578. }
  3579. declare module BABYLON {
  3580. class MaterialDefines {
  3581. rebuild(): void;
  3582. isEqual(other: MaterialDefines): boolean;
  3583. cloneTo(other: MaterialDefines): void;
  3584. reset(): void;
  3585. toString(): string;
  3586. }
  3587. class Material {
  3588. name: string;
  3589. static TriangleFillMode: number;
  3590. static WireFrameFillMode: number;
  3591. static PointFillMode: number;
  3592. static ClockWiseSideOrientation: number;
  3593. static CounterClockWiseSideOrientation: number;
  3594. id: string;
  3595. checkReadyOnEveryCall: boolean;
  3596. checkReadyOnlyOnce: boolean;
  3597. state: string;
  3598. alpha: number;
  3599. backFaceCulling: boolean;
  3600. sideOrientation: number;
  3601. onCompiled: (effect: Effect) => void;
  3602. onError: (effect: Effect, errors: string) => void;
  3603. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  3604. /**
  3605. * An event triggered when the material is disposed.
  3606. * @type {BABYLON.Observable}
  3607. */
  3608. onDisposeObservable: Observable<Material>;
  3609. onDispose: () => void;
  3610. /**
  3611. * An event triggered when the material is bound.
  3612. * @type {BABYLON.Observable}
  3613. */
  3614. onBindObservable: Observable<AbstractMesh>;
  3615. onBind: (Mesh: AbstractMesh) => void;
  3616. /**
  3617. * An event triggered when the material is unbound.
  3618. * @type {BABYLON.Observable}
  3619. */
  3620. onUnBindObservable: Observable<Material>;
  3621. alphaMode: number;
  3622. disableDepthWrite: boolean;
  3623. fogEnabled: boolean;
  3624. pointSize: number;
  3625. zOffset: number;
  3626. wireframe: boolean;
  3627. pointsCloud: boolean;
  3628. fillMode: number;
  3629. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  3630. /**
  3631. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3632. * subclasses should override adding information pertainent to themselves
  3633. */
  3634. toString(fullDetails?: boolean): string;
  3635. isFrozen: boolean;
  3636. freeze(): void;
  3637. unfreeze(): void;
  3638. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3639. getEffect(): Effect;
  3640. getScene(): Scene;
  3641. needAlphaBlending(): boolean;
  3642. needAlphaTesting(): boolean;
  3643. getAlphaTestTexture(): BaseTexture;
  3644. markDirty(): void;
  3645. bind(world: Matrix, mesh?: Mesh): void;
  3646. bindOnlyWorldMatrix(world: Matrix): void;
  3647. unbind(): void;
  3648. clone(name: string): Material;
  3649. getBindedMeshes(): AbstractMesh[];
  3650. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3651. serialize(): any;
  3652. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  3653. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  3654. }
  3655. }
  3656. declare module BABYLON {
  3657. class MaterialHelper {
  3658. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, maxSimultaneousLights?: number): boolean;
  3659. static PrepareUniformsAndSamplersList(uniformsList: string[], samplersList: string[], defines: MaterialDefines, maxSimultaneousLights?: number): void;
  3660. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  3661. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  3662. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  3663. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: number, effect: Effect, depthValuesAlreadySet: boolean): boolean;
  3664. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  3665. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  3666. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  3667. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  3668. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  3669. static BindClipPlane(effect: Effect, scene: Scene): void;
  3670. }
  3671. }
  3672. declare module BABYLON {
  3673. class MultiMaterial extends Material {
  3674. subMaterials: Material[];
  3675. constructor(name: string, scene: Scene);
  3676. getSubMaterial(index: any): Material;
  3677. isReady(mesh?: AbstractMesh): boolean;
  3678. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  3679. serialize(): any;
  3680. }
  3681. }
  3682. declare module BABYLON {
  3683. /**
  3684. * The Physically based material of BJS.
  3685. *
  3686. * This offers the main features of a standard PBR material.
  3687. * For more information, please refer to the documentation :
  3688. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  3689. */
  3690. class PBRMaterial extends BABYLON.Material {
  3691. /**
  3692. * Intensity of the direct lights e.g. the four lights available in your scene.
  3693. * This impacts both the direct diffuse and specular highlights.
  3694. */
  3695. directIntensity: number;
  3696. /**
  3697. * Intensity of the emissive part of the material.
  3698. * This helps controlling the emissive effect without modifying the emissive color.
  3699. */
  3700. emissiveIntensity: number;
  3701. /**
  3702. * Intensity of the environment e.g. how much the environment will light the object
  3703. * either through harmonics for rough material or through the refelction for shiny ones.
  3704. */
  3705. environmentIntensity: number;
  3706. /**
  3707. * This is a special control allowing the reduction of the specular highlights coming from the
  3708. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  3709. */
  3710. specularIntensity: number;
  3711. /**
  3712. * Debug Control allowing disabling the bump map on this material.
  3713. */
  3714. disableBumpMap: boolean;
  3715. /**
  3716. * Debug Control helping enforcing or dropping the darkness of shadows.
  3717. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  3718. */
  3719. overloadedShadowIntensity: number;
  3720. /**
  3721. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  3722. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  3723. */
  3724. overloadedShadeIntensity: number;
  3725. /**
  3726. * The camera exposure used on this material.
  3727. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  3728. * This corresponds to a photographic exposure.
  3729. */
  3730. cameraExposure: number;
  3731. /**
  3732. * The camera contrast used on this material.
  3733. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  3734. */
  3735. cameraContrast: number;
  3736. /**
  3737. * Color Grading 2D Lookup Texture.
  3738. * This allows special effects like sepia, black and white to sixties rendering style.
  3739. */
  3740. cameraColorGradingTexture: BaseTexture;
  3741. /**
  3742. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  3743. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  3744. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  3745. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  3746. */
  3747. cameraColorCurves: ColorCurves;
  3748. /**
  3749. * Debug Control allowing to overload the ambient color.
  3750. * This as to be use with the overloadedAmbientIntensity parameter.
  3751. */
  3752. overloadedAmbient: Color3;
  3753. /**
  3754. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  3755. */
  3756. overloadedAmbientIntensity: number;
  3757. /**
  3758. * Debug Control allowing to overload the albedo color.
  3759. * This as to be use with the overloadedAlbedoIntensity parameter.
  3760. */
  3761. overloadedAlbedo: Color3;
  3762. /**
  3763. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  3764. */
  3765. overloadedAlbedoIntensity: number;
  3766. /**
  3767. * Debug Control allowing to overload the reflectivity color.
  3768. * This as to be use with the overloadedReflectivityIntensity parameter.
  3769. */
  3770. overloadedReflectivity: Color3;
  3771. /**
  3772. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  3773. */
  3774. overloadedReflectivityIntensity: number;
  3775. /**
  3776. * Debug Control allowing to overload the emissive color.
  3777. * This as to be use with the overloadedEmissiveIntensity parameter.
  3778. */
  3779. overloadedEmissive: Color3;
  3780. /**
  3781. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  3782. */
  3783. overloadedEmissiveIntensity: number;
  3784. /**
  3785. * Debug Control allowing to overload the reflection color.
  3786. * This as to be use with the overloadedReflectionIntensity parameter.
  3787. */
  3788. overloadedReflection: Color3;
  3789. /**
  3790. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  3791. */
  3792. overloadedReflectionIntensity: number;
  3793. /**
  3794. * Debug Control allowing to overload the microsurface.
  3795. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  3796. */
  3797. overloadedMicroSurface: number;
  3798. /**
  3799. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  3800. */
  3801. overloadedMicroSurfaceIntensity: number;
  3802. /**
  3803. * AKA Diffuse Texture in standard nomenclature.
  3804. */
  3805. albedoTexture: BaseTexture;
  3806. /**
  3807. * AKA Occlusion Texture in other nomenclature.
  3808. */
  3809. ambientTexture: BaseTexture;
  3810. /**
  3811. * AKA Occlusion Texture Intensity in other nomenclature.
  3812. */
  3813. ambientTextureStrength: number;
  3814. opacityTexture: BaseTexture;
  3815. reflectionTexture: BaseTexture;
  3816. emissiveTexture: BaseTexture;
  3817. /**
  3818. * AKA Specular texture in other nomenclature.
  3819. */
  3820. reflectivityTexture: BaseTexture;
  3821. bumpTexture: BaseTexture;
  3822. lightmapTexture: BaseTexture;
  3823. refractionTexture: BaseTexture;
  3824. ambientColor: Color3;
  3825. /**
  3826. * AKA Diffuse Color in other nomenclature.
  3827. */
  3828. albedoColor: Color3;
  3829. /**
  3830. * AKA Specular Color in other nomenclature.
  3831. */
  3832. reflectivityColor: Color3;
  3833. reflectionColor: Color3;
  3834. emissiveColor: Color3;
  3835. /**
  3836. * AKA Glossiness in other nomenclature.
  3837. */
  3838. microSurface: number;
  3839. /**
  3840. * source material index of refraction (IOR)' / 'destination material IOR.
  3841. */
  3842. indexOfRefraction: number;
  3843. /**
  3844. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  3845. */
  3846. invertRefractionY: boolean;
  3847. opacityFresnelParameters: FresnelParameters;
  3848. emissiveFresnelParameters: FresnelParameters;
  3849. /**
  3850. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  3851. * Materials half opaque for instance using refraction could benefit from this control.
  3852. */
  3853. linkRefractionWithTransparency: boolean;
  3854. /**
  3855. * The emissive and albedo are linked to never be more than one (Energy conservation).
  3856. */
  3857. linkEmissiveWithAlbedo: boolean;
  3858. useLightmapAsShadowmap: boolean;
  3859. /**
  3860. * In this mode, the emissive informtaion will always be added to the lighting once.
  3861. * A light for instance can be thought as emissive.
  3862. */
  3863. useEmissiveAsIllumination: boolean;
  3864. /**
  3865. * Secifies that the alpha is coming form the albedo channel alpha channel.
  3866. */
  3867. useAlphaFromAlbedoTexture: boolean;
  3868. /**
  3869. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  3870. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  3871. */
  3872. useSpecularOverAlpha: boolean;
  3873. /**
  3874. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  3875. */
  3876. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  3877. /**
  3878. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  3879. * The material will try to infer what glossiness each pixel should be.
  3880. */
  3881. useAutoMicroSurfaceFromReflectivityMap: boolean;
  3882. /**
  3883. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  3884. * the creation of the material.
  3885. */
  3886. useScalarInLinearSpace: boolean;
  3887. /**
  3888. * BJS is using an harcoded light falloff based on a manually sets up range.
  3889. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  3890. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  3891. */
  3892. usePhysicalLightFalloff: boolean;
  3893. /**
  3894. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  3895. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  3896. */
  3897. useRadianceOverAlpha: boolean;
  3898. /**
  3899. * Allows using the bump map in parallax mode.
  3900. */
  3901. useParallax: boolean;
  3902. /**
  3903. * Allows using the bump map in parallax occlusion mode.
  3904. */
  3905. useParallaxOcclusion: boolean;
  3906. /**
  3907. * Controls the scale bias of the parallax mode.
  3908. */
  3909. parallaxScaleBias: number;
  3910. /**
  3911. * If sets to true, disables all the lights affecting the material.
  3912. */
  3913. disableLighting: boolean;
  3914. /**
  3915. * Number of Simultaneous lights allowed on the material.
  3916. */
  3917. maxSimultaneousLights: number;
  3918. /**
  3919. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  3920. */
  3921. invertNormalMapX: boolean;
  3922. /**
  3923. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  3924. */
  3925. invertNormalMapY: boolean;
  3926. /**
  3927. * Instantiates a new PBRMaterial instance.
  3928. *
  3929. * @param name The material name
  3930. * @param scene The scene the material will be use in.
  3931. */
  3932. constructor(name: string, scene: Scene);
  3933. useLogarithmicDepth: boolean;
  3934. needAlphaBlending(): boolean;
  3935. needAlphaTesting(): boolean;
  3936. getAlphaTestTexture(): BaseTexture;
  3937. private convertColorToLinearSpaceToRef(color, ref);
  3938. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  3939. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  3940. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3941. unbind(): void;
  3942. bindOnlyWorldMatrix(world: Matrix): void;
  3943. bind(world: Matrix, mesh?: Mesh): void;
  3944. getAnimatables(): IAnimatable[];
  3945. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3946. clone(name: string): PBRMaterial;
  3947. serialize(): any;
  3948. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  3949. }
  3950. }
  3951. declare module BABYLON {
  3952. class ShaderMaterial extends Material {
  3953. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  3954. needAlphaBlending(): boolean;
  3955. needAlphaTesting(): boolean;
  3956. setTexture(name: string, texture: Texture): ShaderMaterial;
  3957. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  3958. setFloat(name: string, value: number): ShaderMaterial;
  3959. setFloats(name: string, value: number[]): ShaderMaterial;
  3960. setColor3(name: string, value: Color3): ShaderMaterial;
  3961. setColor4(name: string, value: Color4): ShaderMaterial;
  3962. setVector2(name: string, value: Vector2): ShaderMaterial;
  3963. setVector3(name: string, value: Vector3): ShaderMaterial;
  3964. setVector4(name: string, value: Vector4): ShaderMaterial;
  3965. setMatrix(name: string, value: Matrix): ShaderMaterial;
  3966. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  3967. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  3968. setArray3(name: string, value: number[]): ShaderMaterial;
  3969. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3970. bindOnlyWorldMatrix(world: Matrix): void;
  3971. bind(world: Matrix, mesh?: Mesh): void;
  3972. clone(name: string): ShaderMaterial;
  3973. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3974. serialize(): any;
  3975. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  3976. }
  3977. }
  3978. declare module BABYLON {
  3979. class StandardMaterial extends Material {
  3980. diffuseTexture: BaseTexture;
  3981. ambientTexture: BaseTexture;
  3982. opacityTexture: BaseTexture;
  3983. reflectionTexture: BaseTexture;
  3984. emissiveTexture: BaseTexture;
  3985. specularTexture: BaseTexture;
  3986. bumpTexture: BaseTexture;
  3987. lightmapTexture: BaseTexture;
  3988. refractionTexture: BaseTexture;
  3989. ambientColor: Color3;
  3990. diffuseColor: Color3;
  3991. specularColor: Color3;
  3992. emissiveColor: Color3;
  3993. specularPower: number;
  3994. useAlphaFromDiffuseTexture: boolean;
  3995. useEmissiveAsIllumination: boolean;
  3996. linkEmissiveWithDiffuse: boolean;
  3997. useReflectionFresnelFromSpecular: boolean;
  3998. useSpecularOverAlpha: boolean;
  3999. useReflectionOverAlpha: boolean;
  4000. disableLighting: boolean;
  4001. useParallax: boolean;
  4002. useParallaxOcclusion: boolean;
  4003. parallaxScaleBias: number;
  4004. roughness: number;
  4005. indexOfRefraction: number;
  4006. invertRefractionY: boolean;
  4007. useLightmapAsShadowmap: boolean;
  4008. diffuseFresnelParameters: FresnelParameters;
  4009. opacityFresnelParameters: FresnelParameters;
  4010. reflectionFresnelParameters: FresnelParameters;
  4011. refractionFresnelParameters: FresnelParameters;
  4012. emissiveFresnelParameters: FresnelParameters;
  4013. useGlossinessFromSpecularMapAlpha: boolean;
  4014. maxSimultaneousLights: number;
  4015. /**
  4016. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4017. */
  4018. invertNormalMapX: boolean;
  4019. /**
  4020. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4021. */
  4022. invertNormalMapY: boolean;
  4023. /**
  4024. * Color Grading 2D Lookup Texture.
  4025. * This allows special effects like sepia, black and white to sixties rendering style.
  4026. */
  4027. cameraColorGradingTexture: BaseTexture;
  4028. /**
  4029. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4030. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4031. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  4032. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4033. */
  4034. cameraColorCurves: ColorCurves;
  4035. constructor(name: string, scene: Scene);
  4036. useLogarithmicDepth: boolean;
  4037. needAlphaBlending(): boolean;
  4038. needAlphaTesting(): boolean;
  4039. getAlphaTestTexture(): BaseTexture;
  4040. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4041. unbind(): void;
  4042. bindOnlyWorldMatrix(world: Matrix): void;
  4043. bind(world: Matrix, mesh?: Mesh): void;
  4044. getAnimatables(): IAnimatable[];
  4045. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4046. clone(name: string): StandardMaterial;
  4047. serialize(): any;
  4048. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  4049. static DiffuseTextureEnabled: boolean;
  4050. static AmbientTextureEnabled: boolean;
  4051. static OpacityTextureEnabled: boolean;
  4052. static ReflectionTextureEnabled: boolean;
  4053. static EmissiveTextureEnabled: boolean;
  4054. static SpecularTextureEnabled: boolean;
  4055. static BumpTextureEnabled: boolean;
  4056. static FresnelEnabled: boolean;
  4057. static LightmapTextureEnabled: boolean;
  4058. static RefractionTextureEnabled: boolean;
  4059. static ColorGradingTextureEnabled: boolean;
  4060. }
  4061. }
  4062. declare module BABYLON {
  4063. class SIMDHelper {
  4064. static IsEnabled: boolean;
  4065. static DisableSIMD(): void;
  4066. static EnableSIMD(): void;
  4067. }
  4068. }
  4069. declare module BABYLON {
  4070. const ToGammaSpace: number;
  4071. const ToLinearSpace: number;
  4072. const Epsilon: number;
  4073. class MathTools {
  4074. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  4075. static ToHex(i: number): string;
  4076. static Sign(value: number): number;
  4077. static Clamp(value: number, min?: number, max?: number): number;
  4078. }
  4079. class Color3 {
  4080. r: number;
  4081. g: number;
  4082. b: number;
  4083. constructor(r?: number, g?: number, b?: number);
  4084. toString(): string;
  4085. getClassName(): string;
  4086. getHashCode(): number;
  4087. toArray(array: number[], index?: number): Color3;
  4088. toColor4(alpha?: number): Color4;
  4089. asArray(): number[];
  4090. toLuminance(): number;
  4091. multiply(otherColor: Color3): Color3;
  4092. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  4093. equals(otherColor: Color3): boolean;
  4094. equalsFloats(r: number, g: number, b: number): boolean;
  4095. scale(scale: number): Color3;
  4096. scaleToRef(scale: number, result: Color3): Color3;
  4097. add(otherColor: Color3): Color3;
  4098. addToRef(otherColor: Color3, result: Color3): Color3;
  4099. subtract(otherColor: Color3): Color3;
  4100. subtractToRef(otherColor: Color3, result: Color3): Color3;
  4101. clone(): Color3;
  4102. copyFrom(source: Color3): Color3;
  4103. copyFromFloats(r: number, g: number, b: number): Color3;
  4104. toHexString(): string;
  4105. toLinearSpace(): Color3;
  4106. toLinearSpaceToRef(convertedColor: Color3): Color3;
  4107. toGammaSpace(): Color3;
  4108. toGammaSpaceToRef(convertedColor: Color3): Color3;
  4109. static FromHexString(hex: string): Color3;
  4110. static FromArray(array: number[], offset?: number): Color3;
  4111. static FromInts(r: number, g: number, b: number): Color3;
  4112. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  4113. static Red(): Color3;
  4114. static Green(): Color3;
  4115. static Blue(): Color3;
  4116. static Black(): Color3;
  4117. static White(): Color3;
  4118. static Purple(): Color3;
  4119. static Magenta(): Color3;
  4120. static Yellow(): Color3;
  4121. static Gray(): Color3;
  4122. }
  4123. class Color4 {
  4124. r: number;
  4125. g: number;
  4126. b: number;
  4127. a: number;
  4128. constructor(r: number, g: number, b: number, a: number);
  4129. addInPlace(right: any): Color4;
  4130. asArray(): number[];
  4131. toArray(array: number[], index?: number): Color4;
  4132. add(right: Color4): Color4;
  4133. subtract(right: Color4): Color4;
  4134. subtractToRef(right: Color4, result: Color4): Color4;
  4135. scale(scale: number): Color4;
  4136. scaleToRef(scale: number, result: Color4): Color4;
  4137. /**
  4138. * Multipy an RGBA Color4 value by another and return a new Color4 object
  4139. * @param color The Color4 (RGBA) value to multiply by
  4140. * @returns A new Color4.
  4141. */
  4142. multiply(color: Color4): Color4;
  4143. /**
  4144. * Multipy an RGBA Color4 value by another and push the result in a reference value
  4145. * @param color The Color4 (RGBA) value to multiply by
  4146. * @param result The Color4 (RGBA) to fill the result in
  4147. * @returns the result Color4.
  4148. */
  4149. multiplyToRef(color: Color4, result: Color4): Color4;
  4150. toString(): string;
  4151. getClassName(): string;
  4152. getHashCode(): number;
  4153. clone(): Color4;
  4154. copyFrom(source: Color4): Color4;
  4155. toHexString(): string;
  4156. static FromHexString(hex: string): Color4;
  4157. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  4158. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  4159. static FromArray(array: number[], offset?: number): Color4;
  4160. static FromInts(r: number, g: number, b: number, a: number): Color4;
  4161. static CheckColors4(colors: number[], count: number): number[];
  4162. }
  4163. class Vector2 {
  4164. x: number;
  4165. y: number;
  4166. constructor(x: number, y: number);
  4167. toString(): string;
  4168. getClassName(): string;
  4169. getHashCode(): number;
  4170. toArray(array: number[] | Float32Array, index?: number): Vector2;
  4171. asArray(): number[];
  4172. copyFrom(source: Vector2): Vector2;
  4173. copyFromFloats(x: number, y: number): Vector2;
  4174. add(otherVector: Vector2): Vector2;
  4175. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  4176. addInPlace(otherVector: Vector2): Vector2;
  4177. addVector3(otherVector: Vector3): Vector2;
  4178. subtract(otherVector: Vector2): Vector2;
  4179. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  4180. subtractInPlace(otherVector: Vector2): Vector2;
  4181. multiplyInPlace(otherVector: Vector2): Vector2;
  4182. multiply(otherVector: Vector2): Vector2;
  4183. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  4184. multiplyByFloats(x: number, y: number): Vector2;
  4185. divide(otherVector: Vector2): Vector2;
  4186. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  4187. negate(): Vector2;
  4188. scaleInPlace(scale: number): Vector2;
  4189. scale(scale: number): Vector2;
  4190. equals(otherVector: Vector2): boolean;
  4191. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  4192. length(): number;
  4193. lengthSquared(): number;
  4194. normalize(): Vector2;
  4195. clone(): Vector2;
  4196. static Zero(): Vector2;
  4197. static FromArray(array: number[] | Float32Array, offset?: number): Vector2;
  4198. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void;
  4199. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  4200. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  4201. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  4202. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  4203. static Dot(left: Vector2, right: Vector2): number;
  4204. static Normalize(vector: Vector2): Vector2;
  4205. static Minimize(left: Vector2, right: Vector2): Vector2;
  4206. static Maximize(left: Vector2, right: Vector2): Vector2;
  4207. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  4208. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  4209. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  4210. static Distance(value1: Vector2, value2: Vector2): number;
  4211. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  4212. static Center(value1: Vector2, value2: Vector2): Vector2;
  4213. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  4214. }
  4215. class Vector3 {
  4216. x: number;
  4217. y: number;
  4218. z: number;
  4219. constructor(x: number, y: number, z: number);
  4220. toString(): string;
  4221. getClassName(): string;
  4222. getHashCode(): number;
  4223. asArray(): number[];
  4224. toArray(array: number[] | Float32Array, index?: number): Vector3;
  4225. toQuaternion(): Quaternion;
  4226. addInPlace(otherVector: Vector3): Vector3;
  4227. add(otherVector: Vector3): Vector3;
  4228. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  4229. subtractInPlace(otherVector: Vector3): Vector3;
  4230. subtract(otherVector: Vector3): Vector3;
  4231. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  4232. subtractFromFloats(x: number, y: number, z: number): Vector3;
  4233. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  4234. negate(): Vector3;
  4235. scaleInPlace(scale: number): Vector3;
  4236. scale(scale: number): Vector3;
  4237. scaleToRef(scale: number, result: Vector3): void;
  4238. equals(otherVector: Vector3): boolean;
  4239. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  4240. equalsToFloats(x: number, y: number, z: number): boolean;
  4241. multiplyInPlace(otherVector: Vector3): Vector3;
  4242. multiply(otherVector: Vector3): Vector3;
  4243. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  4244. multiplyByFloats(x: number, y: number, z: number): Vector3;
  4245. divide(otherVector: Vector3): Vector3;
  4246. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  4247. MinimizeInPlace(other: Vector3): Vector3;
  4248. MaximizeInPlace(other: Vector3): Vector3;
  4249. length(): number;
  4250. lengthSquared(): number;
  4251. normalize(): Vector3;
  4252. clone(): Vector3;
  4253. copyFrom(source: Vector3): Vector3;
  4254. copyFromFloats(x: number, y: number, z: number): Vector3;
  4255. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  4256. static FromArray(array: number[] | Float32Array, offset?: number): Vector3;
  4257. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  4258. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void;
  4259. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  4260. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  4261. static Zero(): Vector3;
  4262. static Up(): Vector3;
  4263. static Forward(): Vector3;
  4264. static Right(): Vector3;
  4265. static Left(): Vector3;
  4266. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  4267. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  4268. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  4269. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  4270. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  4271. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  4272. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  4273. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  4274. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  4275. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  4276. static Dot(left: Vector3, right: Vector3): number;
  4277. static Cross(left: Vector3, right: Vector3): Vector3;
  4278. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  4279. static Normalize(vector: Vector3): Vector3;
  4280. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  4281. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  4282. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  4283. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  4284. static Minimize(left: Vector3, right: Vector3): Vector3;
  4285. static Maximize(left: Vector3, right: Vector3): Vector3;
  4286. static Distance(value1: Vector3, value2: Vector3): number;
  4287. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  4288. static Center(value1: Vector3, value2: Vector3): Vector3;
  4289. /**
  4290. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  4291. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  4292. * to something in order to rotate it from its local system to the given target system.
  4293. */
  4294. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  4295. /**
  4296. * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
  4297. */
  4298. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  4299. }
  4300. class Vector4 {
  4301. x: number;
  4302. y: number;
  4303. z: number;
  4304. w: number;
  4305. constructor(x: number, y: number, z: number, w: number);
  4306. toString(): string;
  4307. getClassName(): string;
  4308. getHashCode(): number;
  4309. asArray(): number[];
  4310. toArray(array: number[], index?: number): Vector4;
  4311. addInPlace(otherVector: Vector4): Vector4;
  4312. add(otherVector: Vector4): Vector4;
  4313. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  4314. subtractInPlace(otherVector: Vector4): Vector4;
  4315. subtract(otherVector: Vector4): Vector4;
  4316. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  4317. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  4318. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  4319. negate(): Vector4;
  4320. scaleInPlace(scale: number): Vector4;
  4321. scale(scale: number): Vector4;
  4322. scaleToRef(scale: number, result: Vector4): void;
  4323. equals(otherVector: Vector4): boolean;
  4324. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  4325. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  4326. multiplyInPlace(otherVector: Vector4): Vector4;
  4327. multiply(otherVector: Vector4): Vector4;
  4328. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  4329. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  4330. divide(otherVector: Vector4): Vector4;
  4331. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  4332. MinimizeInPlace(other: Vector4): Vector4;
  4333. MaximizeInPlace(other: Vector4): Vector4;
  4334. length(): number;
  4335. lengthSquared(): number;
  4336. normalize(): Vector4;
  4337. toVector3(): Vector3;
  4338. clone(): Vector4;
  4339. copyFrom(source: Vector4): Vector4;
  4340. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  4341. static FromArray(array: number[], offset?: number): Vector4;
  4342. static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
  4343. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  4344. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  4345. static Zero(): Vector4;
  4346. static Normalize(vector: Vector4): Vector4;
  4347. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  4348. static Minimize(left: Vector4, right: Vector4): Vector4;
  4349. static Maximize(left: Vector4, right: Vector4): Vector4;
  4350. static Distance(value1: Vector4, value2: Vector4): number;
  4351. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  4352. static Center(value1: Vector4, value2: Vector4): Vector4;
  4353. }
  4354. interface ISize {
  4355. width: number;
  4356. height: number;
  4357. }
  4358. class Size implements ISize {
  4359. width: number;
  4360. height: number;
  4361. constructor(width: number, height: number);
  4362. toString(): string;
  4363. getClassName(): string;
  4364. getHashCode(): number;
  4365. copyFrom(src: Size): void;
  4366. copyFromFloats(width: number, height: number): void;
  4367. multiplyByFloats(w: number, h: number): Size;
  4368. clone(): Size;
  4369. equals(other: Size): boolean;
  4370. surface: number;
  4371. static Zero(): Size;
  4372. add(otherSize: Size): Size;
  4373. substract(otherSize: Size): Size;
  4374. static Lerp(start: Size, end: Size, amount: number): Size;
  4375. }
  4376. class Quaternion {
  4377. x: number;
  4378. y: number;
  4379. z: number;
  4380. w: number;
  4381. constructor(x?: number, y?: number, z?: number, w?: number);
  4382. toString(): string;
  4383. getClassName(): string;
  4384. getHashCode(): number;
  4385. asArray(): number[];
  4386. equals(otherQuaternion: Quaternion): boolean;
  4387. clone(): Quaternion;
  4388. copyFrom(other: Quaternion): Quaternion;
  4389. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  4390. add(other: Quaternion): Quaternion;
  4391. subtract(other: Quaternion): Quaternion;
  4392. scale(value: number): Quaternion;
  4393. multiply(q1: Quaternion): Quaternion;
  4394. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  4395. multiplyInPlace(q1: Quaternion): Quaternion;
  4396. conjugateToRef(ref: Quaternion): Quaternion;
  4397. conjugateInPlace(): Quaternion;
  4398. conjugate(): Quaternion;
  4399. length(): number;
  4400. normalize(): Quaternion;
  4401. toEulerAngles(order?: string): Vector3;
  4402. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  4403. toRotationMatrix(result: Matrix): Quaternion;
  4404. fromRotationMatrix(matrix: Matrix): Quaternion;
  4405. static FromRotationMatrix(matrix: Matrix): Quaternion;
  4406. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  4407. static Inverse(q: Quaternion): Quaternion;
  4408. static Identity(): Quaternion;
  4409. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  4410. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  4411. static FromArray(array: number[], offset?: number): Quaternion;
  4412. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  4413. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  4414. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  4415. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  4416. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  4417. }
  4418. class Matrix {
  4419. m: Float32Array;
  4420. isIdentity(): boolean;
  4421. determinant(): number;
  4422. toArray(): Float32Array;
  4423. asArray(): Float32Array;
  4424. invert(): Matrix;
  4425. reset(): Matrix;
  4426. add(other: Matrix): Matrix;
  4427. addToRef(other: Matrix, result: Matrix): Matrix;
  4428. addToSelf(other: Matrix): Matrix;
  4429. invertToRef(other: Matrix): Matrix;
  4430. setTranslation(vector3: Vector3): Matrix;
  4431. getTranslation(): Vector3;
  4432. multiply(other: Matrix): Matrix;
  4433. copyFrom(other: Matrix): Matrix;
  4434. copyToArray(array: Float32Array, offset?: number): Matrix;
  4435. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  4436. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  4437. equals(value: Matrix): boolean;
  4438. clone(): Matrix;
  4439. getClassName(): string;
  4440. getHashCode(): number;
  4441. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  4442. static FromArray(array: number[], offset?: number): Matrix;
  4443. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  4444. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  4445. 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;
  4446. getRow(index: number): Vector4;
  4447. setRow(index: number, row: Vector4): Matrix;
  4448. 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;
  4449. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  4450. static Identity(): Matrix;
  4451. static IdentityToRef(result: Matrix): void;
  4452. static Zero(): Matrix;
  4453. static RotationX(angle: number): Matrix;
  4454. static Invert(source: Matrix): Matrix;
  4455. static RotationXToRef(angle: number, result: Matrix): void;
  4456. static RotationY(angle: number): Matrix;
  4457. static RotationYToRef(angle: number, result: Matrix): void;
  4458. static RotationZ(angle: number): Matrix;
  4459. static RotationZToRef(angle: number, result: Matrix): void;
  4460. static RotationAxis(axis: Vector3, angle: number): Matrix;
  4461. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  4462. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  4463. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  4464. static Scaling(x: number, y: number, z: number): Matrix;
  4465. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  4466. static Translation(x: number, y: number, z: number): Matrix;
  4467. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  4468. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  4469. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  4470. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  4471. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  4472. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  4473. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  4474. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  4475. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  4476. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  4477. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  4478. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  4479. static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  4480. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  4481. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  4482. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  4483. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  4484. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  4485. static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  4486. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  4487. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  4488. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  4489. static Transpose(matrix: Matrix): Matrix;
  4490. static Reflection(plane: Plane): Matrix;
  4491. static ReflectionToRef(plane: Plane, result: Matrix): void;
  4492. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, mat: Matrix): void;
  4493. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  4494. }
  4495. class Plane {
  4496. normal: Vector3;
  4497. d: number;
  4498. constructor(a: number, b: number, c: number, d: number);
  4499. asArray(): number[];
  4500. clone(): Plane;
  4501. getClassName(): string;
  4502. getHashCode(): number;
  4503. normalize(): Plane;
  4504. transform(transformation: Matrix): Plane;
  4505. dotCoordinate(point: any): number;
  4506. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  4507. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  4508. signedDistanceTo(point: Vector3): number;
  4509. static FromArray(array: number[]): Plane;
  4510. static FromPoints(point1: any, point2: any, point3: any): Plane;
  4511. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  4512. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  4513. }
  4514. class Viewport {
  4515. x: number;
  4516. y: number;
  4517. width: number;
  4518. height: number;
  4519. constructor(x: number, y: number, width: number, height: number);
  4520. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  4521. }
  4522. class Frustum {
  4523. static GetPlanes(transform: Matrix): Plane[];
  4524. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  4525. }
  4526. enum Space {
  4527. LOCAL = 0,
  4528. WORLD = 1,
  4529. }
  4530. class Axis {
  4531. static X: Vector3;
  4532. static Y: Vector3;
  4533. static Z: Vector3;
  4534. }
  4535. class BezierCurve {
  4536. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  4537. }
  4538. enum Orientation {
  4539. CW = 0,
  4540. CCW = 1,
  4541. }
  4542. class Angle {
  4543. constructor(radians: number);
  4544. degrees: () => number;
  4545. radians: () => number;
  4546. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  4547. static FromRadians(radians: number): Angle;
  4548. static FromDegrees(degrees: number): Angle;
  4549. }
  4550. class Arc2 {
  4551. startPoint: Vector2;
  4552. midPoint: Vector2;
  4553. endPoint: Vector2;
  4554. centerPoint: Vector2;
  4555. radius: number;
  4556. angle: Angle;
  4557. startAngle: Angle;
  4558. orientation: Orientation;
  4559. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  4560. }
  4561. class Path2 {
  4562. closed: boolean;
  4563. constructor(x: number, y: number);
  4564. addLineTo(x: number, y: number): Path2;
  4565. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  4566. close(): Path2;
  4567. length(): number;
  4568. getPoints(): Vector2[];
  4569. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  4570. static StartingAt(x: number, y: number): Path2;
  4571. }
  4572. class Path3D {
  4573. path: Vector3[];
  4574. /**
  4575. * new Path3D(path, normal, raw)
  4576. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  4577. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  4578. * path : an array of Vector3, the curve axis of the Path3D
  4579. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  4580. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  4581. */
  4582. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  4583. /**
  4584. * Returns the Path3D array of successive Vector3 designing its curve.
  4585. */
  4586. getCurve(): Vector3[];
  4587. /**
  4588. * Returns an array populated with tangent vectors on each Path3D curve point.
  4589. */
  4590. getTangents(): Vector3[];
  4591. /**
  4592. * Returns an array populated with normal vectors on each Path3D curve point.
  4593. */
  4594. getNormals(): Vector3[];
  4595. /**
  4596. * Returns an array populated with binormal vectors on each Path3D curve point.
  4597. */
  4598. getBinormals(): Vector3[];
  4599. /**
  4600. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  4601. */
  4602. getDistances(): number[];
  4603. /**
  4604. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  4605. * Returns the same object updated.
  4606. */
  4607. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  4608. }
  4609. class Curve3 {
  4610. /**
  4611. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  4612. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  4613. * @param v1 (Vector3) the control point
  4614. * @param v2 (Vector3) the end point of the Quadratic Bezier
  4615. * @param nbPoints (integer) the wanted number of points in the curve
  4616. */
  4617. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  4618. /**
  4619. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  4620. * @param v0 (Vector3) the origin point of the Cubic Bezier
  4621. * @param v1 (Vector3) the first control point
  4622. * @param v2 (Vector3) the second control point
  4623. * @param v3 (Vector3) the end point of the Cubic Bezier
  4624. * @param nbPoints (integer) the wanted number of points in the curve
  4625. */
  4626. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  4627. /**
  4628. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  4629. * @param p1 (Vector3) the origin point of the Hermite Spline
  4630. * @param t1 (Vector3) the tangent vector at the origin point
  4631. * @param p2 (Vector3) the end point of the Hermite Spline
  4632. * @param t2 (Vector3) the tangent vector at the end point
  4633. * @param nbPoints (integer) the wanted number of points in the curve
  4634. */
  4635. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  4636. /**
  4637. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  4638. * A Curve3 is designed from a series of successive Vector3.
  4639. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  4640. */
  4641. constructor(points: Vector3[]);
  4642. /**
  4643. * Returns the Curve3 stored array of successive Vector3
  4644. */
  4645. getPoints(): Vector3[];
  4646. /**
  4647. * Returns the computed length (float) of the curve.
  4648. */
  4649. length(): number;
  4650. /**
  4651. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  4652. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  4653. * curveA and curveB keep unchanged.
  4654. */
  4655. continue(curve: Curve3): Curve3;
  4656. }
  4657. class SphericalHarmonics {
  4658. L00: Vector3;
  4659. L1_1: Vector3;
  4660. L10: Vector3;
  4661. L11: Vector3;
  4662. L2_2: Vector3;
  4663. L2_1: Vector3;
  4664. L20: Vector3;
  4665. L21: Vector3;
  4666. L22: Vector3;
  4667. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  4668. scale(scale: number): void;
  4669. }
  4670. class SphericalPolynomial {
  4671. x: Vector3;
  4672. y: Vector3;
  4673. z: Vector3;
  4674. xx: Vector3;
  4675. yy: Vector3;
  4676. zz: Vector3;
  4677. xy: Vector3;
  4678. yz: Vector3;
  4679. zx: Vector3;
  4680. addAmbient(color: Color3): void;
  4681. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  4682. }
  4683. class PositionNormalVertex {
  4684. position: Vector3;
  4685. normal: Vector3;
  4686. constructor(position?: Vector3, normal?: Vector3);
  4687. clone(): PositionNormalVertex;
  4688. }
  4689. class PositionNormalTextureVertex {
  4690. position: Vector3;
  4691. normal: Vector3;
  4692. uv: Vector2;
  4693. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  4694. clone(): PositionNormalTextureVertex;
  4695. }
  4696. class Tmp {
  4697. static Color3: Color3[];
  4698. static Vector2: Vector2[];
  4699. static Vector3: Vector3[];
  4700. static Vector4: Vector4[];
  4701. static Quaternion: Quaternion[];
  4702. static Matrix: Matrix[];
  4703. }
  4704. }
  4705. declare module BABYLON {
  4706. class Particle {
  4707. position: Vector3;
  4708. direction: Vector3;
  4709. color: Color4;
  4710. colorStep: Color4;
  4711. lifeTime: number;
  4712. age: number;
  4713. size: number;
  4714. angle: number;
  4715. angularSpeed: number;
  4716. copyTo(other: Particle): void;
  4717. }
  4718. }
  4719. declare module BABYLON {
  4720. class ParticleSystem implements IDisposable, IAnimatable {
  4721. name: string;
  4722. static BLENDMODE_ONEONE: number;
  4723. static BLENDMODE_STANDARD: number;
  4724. animations: Animation[];
  4725. id: string;
  4726. renderingGroupId: number;
  4727. emitter: any;
  4728. emitRate: number;
  4729. manualEmitCount: number;
  4730. updateSpeed: number;
  4731. targetStopDuration: number;
  4732. disposeOnStop: boolean;
  4733. minEmitPower: number;
  4734. maxEmitPower: number;
  4735. minLifeTime: number;
  4736. maxLifeTime: number;
  4737. minSize: number;
  4738. maxSize: number;
  4739. minAngularSpeed: number;
  4740. maxAngularSpeed: number;
  4741. particleTexture: Texture;
  4742. layerMask: number;
  4743. /**
  4744. * An event triggered when the system is disposed.
  4745. * @type {BABYLON.Observable}
  4746. */
  4747. onDisposeObservable: Observable<ParticleSystem>;
  4748. onDispose: () => void;
  4749. updateFunction: (particles: Particle[]) => void;
  4750. blendMode: number;
  4751. forceDepthWrite: boolean;
  4752. gravity: Vector3;
  4753. direction1: Vector3;
  4754. direction2: Vector3;
  4755. minEmitBox: Vector3;
  4756. maxEmitBox: Vector3;
  4757. color1: Color4;
  4758. color2: Color4;
  4759. colorDead: Color4;
  4760. textureMask: Color4;
  4761. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  4762. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  4763. private particles;
  4764. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  4765. recycleParticle(particle: Particle): void;
  4766. getCapacity(): number;
  4767. isAlive(): boolean;
  4768. isStarted(): boolean;
  4769. start(): void;
  4770. stop(): void;
  4771. animate(): void;
  4772. render(): number;
  4773. dispose(): void;
  4774. clone(name: string, newEmitter: any): ParticleSystem;
  4775. serialize(): any;
  4776. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  4777. }
  4778. }
  4779. declare module BABYLON {
  4780. class SolidParticle {
  4781. idx: number;
  4782. color: Color4;
  4783. position: Vector3;
  4784. rotation: Vector3;
  4785. rotationQuaternion: Quaternion;
  4786. scaling: Vector3;
  4787. uvs: Vector4;
  4788. velocity: Vector3;
  4789. alive: boolean;
  4790. isVisible: boolean;
  4791. shapeId: number;
  4792. idxInShape: number;
  4793. /**
  4794. * Creates a Solid Particle object.
  4795. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  4796. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  4797. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  4798. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  4799. * `shapeId` (integer) is the model shape identifier in the SPS.
  4800. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  4801. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  4802. */
  4803. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
  4804. /**
  4805. * legacy support, changed scale to scaling
  4806. */
  4807. scale: Vector3;
  4808. /**
  4809. * legacy support, changed quaternion to rotationQuaternion
  4810. */
  4811. quaternion: Quaternion;
  4812. /**
  4813. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  4814. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  4815. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  4816. */
  4817. intersectsMesh(target: Mesh | SolidParticle): boolean;
  4818. }
  4819. class ModelShape {
  4820. shapeID: number;
  4821. /**
  4822. * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.
  4823. * SPS internal tool, don't use it manually.
  4824. */
  4825. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  4826. }
  4827. }
  4828. declare module BABYLON {
  4829. /**
  4830. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  4831. */
  4832. class SolidParticleSystem implements IDisposable {
  4833. /**
  4834. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  4835. * Example : var p = SPS.particles[i];
  4836. */
  4837. particles: SolidParticle[];
  4838. /**
  4839. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  4840. */
  4841. nbParticles: number;
  4842. /**
  4843. * If the particles must ever face the camera (default false). Useful for planar particles.
  4844. */
  4845. billboard: boolean;
  4846. /**
  4847. * Recompute normals when adding a shape
  4848. */
  4849. recomputeNormals: boolean;
  4850. /**
  4851. * This a counter ofr your own usage. It's not set by any SPS functions.
  4852. */
  4853. counter: number;
  4854. /**
  4855. * The SPS name. This name is also given to the underlying mesh.
  4856. */
  4857. name: string;
  4858. /**
  4859. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  4860. */
  4861. mesh: Mesh;
  4862. /**
  4863. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  4864. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  4865. */
  4866. vars: any;
  4867. /**
  4868. * This array is populated when the SPS is set as 'pickable'.
  4869. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  4870. * Each element of this array is an object `{idx: int, faceId: int}`.
  4871. * `idx` is the picked particle index in the `SPS.particles` array
  4872. * `faceId` is the picked face index counted within this particle.
  4873. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  4874. */
  4875. pickedParticles: {
  4876. idx: number;
  4877. faceId: number;
  4878. }[];
  4879. /**
  4880. * Creates a SPS (Solid Particle System) object.
  4881. * `name` (String) is the SPS name, this will be the underlying mesh name.
  4882. * `scene` (Scene) is the scene in which the SPS is added.
  4883. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  4884. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  4885. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  4886. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  4887. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  4888. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  4889. */
  4890. constructor(name: string, scene: Scene, options?: {
  4891. updatable?: boolean;
  4892. isPickable?: boolean;
  4893. particleIntersection?: boolean;
  4894. boundingSphereOnly?: boolean;
  4895. bSphereRadiusFactor?: number;
  4896. });
  4897. /**
  4898. * Builds the SPS underlying mesh. Returns a standard Mesh.
  4899. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  4900. */
  4901. buildMesh(): Mesh;
  4902. /**
  4903. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  4904. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  4905. * Thus the particles generated from `digest()` have their property `position` set yet.
  4906. * `mesh` ( Mesh ) is the mesh to be digested
  4907. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  4908. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  4909. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  4910. */
  4911. digest(mesh: Mesh, options?: {
  4912. facetNb?: number;
  4913. number?: number;
  4914. delta?: number;
  4915. }): SolidParticleSystem;
  4916. /**
  4917. * Adds some particles to the SPS from the model shape. Returns the shape id.
  4918. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  4919. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  4920. * `nb` (positive integer) the number of particles to be created from this model
  4921. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  4922. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  4923. */
  4924. addShape(mesh: Mesh, nb: number, options?: {
  4925. positionFunction?: any;
  4926. vertexFunction?: any;
  4927. }): number;
  4928. /**
  4929. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  4930. */
  4931. rebuildMesh(): void;
  4932. /**
  4933. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  4934. * This method calls `updateParticle()` for each particle of the SPS.
  4935. * For an animated SPS, it is usually called within the render loop.
  4936. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  4937. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  4938. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  4939. */
  4940. setParticles(start?: number, end?: number, update?: boolean): void;
  4941. /**
  4942. * Disposes the SPS
  4943. */
  4944. dispose(): void;
  4945. /**
  4946. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  4947. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  4948. */
  4949. refreshVisibleSize(): void;
  4950. /**
  4951. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  4952. * @param size the size (float) of the visibility box
  4953. * note : this doesn't lock the SPS mesh bounding box.
  4954. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  4955. */
  4956. setVisibilityBox(size: number): void;
  4957. /**
  4958. * Sets the SPS as always visible or not
  4959. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  4960. */
  4961. isAlwaysVisible: boolean;
  4962. /**
  4963. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  4964. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  4965. */
  4966. isVisibilityBoxLocked: boolean;
  4967. /**
  4968. * Tells to `setParticles()` to compute the particle rotations or not.
  4969. * Default value : true. The SPS is faster when it's set to false.
  4970. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  4971. */
  4972. computeParticleRotation: boolean;
  4973. /**
  4974. * Tells to `setParticles()` to compute the particle colors or not.
  4975. * Default value : true. The SPS is faster when it's set to false.
  4976. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  4977. */
  4978. computeParticleColor: boolean;
  4979. /**
  4980. * Tells to `setParticles()` to compute the particle textures or not.
  4981. * Default value : true. The SPS is faster when it's set to false.
  4982. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  4983. */
  4984. computeParticleTexture: boolean;
  4985. /**
  4986. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  4987. * Default value : false. The SPS is faster when it's set to false.
  4988. * Note : the particle custom vertex positions aren't stored values.
  4989. */
  4990. computeParticleVertex: boolean;
  4991. /**
  4992. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  4993. */
  4994. computeBoundingBox: boolean;
  4995. /**
  4996. * This function does nothing. It may be overwritten to set all the particle first values.
  4997. * The SPS doesn't call this function, you may have to call it by your own.
  4998. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  4999. */
  5000. initParticles(): void;
  5001. /**
  5002. * This function does nothing. It may be overwritten to recycle a particle.
  5003. * The SPS doesn't call this function, you may have to call it by your own.
  5004. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  5005. */
  5006. recycleParticle(particle: SolidParticle): SolidParticle;
  5007. /**
  5008. * Updates a particle : this function should be overwritten by the user.
  5009. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  5010. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  5011. * ex : just set a particle position or velocity and recycle conditions
  5012. */
  5013. updateParticle(particle: SolidParticle): SolidParticle;
  5014. /**
  5015. * Updates a vertex of a particle : it can be overwritten by the user.
  5016. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  5017. * @param particle the current particle
  5018. * @param vertex the current index of the current particle
  5019. * @param pt the index of the current vertex in the particle shape
  5020. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  5021. * ex : just set a vertex particle position
  5022. */
  5023. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  5024. /**
  5025. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  5026. * This does nothing and may be overwritten by the user.
  5027. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  5028. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  5029. * @param update the boolean update value actually passed to setParticles()
  5030. */
  5031. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  5032. /**
  5033. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  5034. * This will be passed three parameters.
  5035. * This does nothing and may be overwritten by the user.
  5036. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  5037. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  5038. * @param update the boolean update value actually passed to setParticles()
  5039. */
  5040. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  5041. }
  5042. }
  5043. declare module BABYLON {
  5044. class AbstractMesh extends Node implements IDisposable, ICullable {
  5045. static BILLBOARDMODE_NONE: number;
  5046. static BILLBOARDMODE_X: number;
  5047. static BILLBOARDMODE_Y: number;
  5048. static BILLBOARDMODE_Z: number;
  5049. static BILLBOARDMODE_ALL: number;
  5050. /**
  5051. * An event triggered when this mesh collides with another one
  5052. * @type {BABYLON.Observable}
  5053. */
  5054. onCollideObservable: Observable<AbstractMesh>;
  5055. onCollide: () => void;
  5056. /**
  5057. * An event triggered when the collision's position changes
  5058. * @type {BABYLON.Observable}
  5059. */
  5060. onCollisionPositionChangeObservable: Observable<Vector3>;
  5061. onCollisionPositionChange: () => void;
  5062. /**
  5063. * An event triggered after the world matrix is updated
  5064. * @type {BABYLON.Observable}
  5065. */
  5066. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  5067. definedFacingForward: boolean;
  5068. position: Vector3;
  5069. billboardMode: number;
  5070. visibility: number;
  5071. alphaIndex: number;
  5072. infiniteDistance: boolean;
  5073. isVisible: boolean;
  5074. isPickable: boolean;
  5075. showBoundingBox: boolean;
  5076. showSubMeshesBoundingBox: boolean;
  5077. isBlocker: boolean;
  5078. renderingGroupId: number;
  5079. material: Material;
  5080. receiveShadows: boolean;
  5081. renderOutline: boolean;
  5082. outlineColor: Color3;
  5083. outlineWidth: number;
  5084. renderOverlay: boolean;
  5085. overlayColor: Color3;
  5086. overlayAlpha: number;
  5087. hasVertexAlpha: boolean;
  5088. useVertexColors: boolean;
  5089. applyFog: boolean;
  5090. computeBonesUsingShaders: boolean;
  5091. scalingDeterminant: number;
  5092. numBoneInfluencers: number;
  5093. useOctreeForRenderingSelection: boolean;
  5094. useOctreeForPicking: boolean;
  5095. useOctreeForCollisions: boolean;
  5096. layerMask: number;
  5097. alwaysSelectAsActiveMesh: boolean;
  5098. /**
  5099. * This scene's action manager
  5100. * @type {BABYLON.ActionManager}
  5101. */
  5102. actionManager: ActionManager;
  5103. physicsImpostor: BABYLON.PhysicsImpostor;
  5104. onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void;
  5105. ellipsoid: Vector3;
  5106. ellipsoidOffset: Vector3;
  5107. edgesWidth: number;
  5108. edgesColor: Color4;
  5109. subMeshes: SubMesh[];
  5110. skeleton: Skeleton;
  5111. constructor(name: string, scene: Scene);
  5112. /**
  5113. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5114. */
  5115. toString(fullDetails?: boolean): string;
  5116. /**
  5117. * Getting the rotation object.
  5118. * If rotation quaternion is set, this vector will (almost always) be the Zero vector!
  5119. */
  5120. rotation: Vector3;
  5121. scaling: Vector3;
  5122. rotationQuaternion: Quaternion;
  5123. updatePoseMatrix(matrix: Matrix): void;
  5124. getPoseMatrix(): Matrix;
  5125. disableEdgesRendering(): void;
  5126. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
  5127. isBlocked: boolean;
  5128. getLOD(camera: Camera): AbstractMesh;
  5129. getTotalVertices(): number;
  5130. getIndices(): number[] | Int32Array;
  5131. getVerticesData(kind: string): number[] | Float32Array;
  5132. isVerticesDataPresent(kind: string): boolean;
  5133. getBoundingInfo(): BoundingInfo;
  5134. setBoundingInfo(boundingInfo: BoundingInfo): void;
  5135. useBones: boolean;
  5136. getWorldMatrix(): Matrix;
  5137. worldMatrixFromCache: Matrix;
  5138. absolutePosition: Vector3;
  5139. freezeWorldMatrix(): void;
  5140. unfreezeWorldMatrix(): void;
  5141. isWorldMatrixFrozen: boolean;
  5142. rotate(axis: Vector3, amount: number, space?: Space): void;
  5143. translate(axis: Vector3, distance: number, space?: Space): void;
  5144. getAbsolutePosition(): Vector3;
  5145. setAbsolutePosition(absolutePosition: Vector3): void;
  5146. /**
  5147. * Perform relative position change from the point of view of behind the front of the mesh.
  5148. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5149. * Supports definition of mesh facing forward or backward.
  5150. * @param {number} amountRight
  5151. * @param {number} amountUp
  5152. * @param {number} amountForward
  5153. */
  5154. movePOV(amountRight: number, amountUp: number, amountForward: number): void;
  5155. /**
  5156. * Calculate relative position change from the point of view of behind the front of the mesh.
  5157. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5158. * Supports definition of mesh facing forward or backward.
  5159. * @param {number} amountRight
  5160. * @param {number} amountUp
  5161. * @param {number} amountForward
  5162. */
  5163. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  5164. /**
  5165. * Perform relative rotation change from the point of view of behind the front of the mesh.
  5166. * Supports definition of mesh facing forward or backward.
  5167. * @param {number} flipBack
  5168. * @param {number} twirlClockwise
  5169. * @param {number} tiltRight
  5170. */
  5171. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
  5172. /**
  5173. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  5174. * Supports definition of mesh facing forward or backward.
  5175. * @param {number} flipBack
  5176. * @param {number} twirlClockwise
  5177. * @param {number} tiltRight
  5178. */
  5179. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  5180. setPivotMatrix(matrix: Matrix): void;
  5181. getPivotMatrix(): Matrix;
  5182. markAsDirty(property: string): void;
  5183. computeWorldMatrix(force?: boolean): Matrix;
  5184. /**
  5185. * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
  5186. * @param func: callback function to add
  5187. */
  5188. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5189. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5190. setPositionWithLocalVector(vector3: Vector3): void;
  5191. getPositionExpressedInLocalSpace(): Vector3;
  5192. locallyTranslate(vector3: Vector3): void;
  5193. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): void;
  5194. attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
  5195. detachFromBone(): void;
  5196. isInFrustum(frustumPlanes: Plane[]): boolean;
  5197. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  5198. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
  5199. intersectsPoint(point: Vector3): boolean;
  5200. /**
  5201. * @Deprecated. Use new PhysicsImpostor instead.
  5202. * */
  5203. setPhysicsState(impostor?: any, options?: PhysicsImpostorParameters): any;
  5204. getPhysicsImpostor(): PhysicsImpostor;
  5205. /**
  5206. * @Deprecated. Use getPhysicsImpostor().getParam("mass");
  5207. */
  5208. getPhysicsMass(): number;
  5209. /**
  5210. * @Deprecated. Use getPhysicsImpostor().getParam("friction");
  5211. */
  5212. getPhysicsFriction(): number;
  5213. /**
  5214. * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
  5215. */
  5216. getPhysicsRestitution(): number;
  5217. getPositionInCameraSpace(camera?: Camera): Vector3;
  5218. getDistanceToCamera(camera?: Camera): number;
  5219. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  5220. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  5221. /**
  5222. * @Deprecated
  5223. */
  5224. updatePhysicsBodyPosition(): void;
  5225. /**
  5226. * @Deprecated
  5227. * Calling this function is not needed anymore.
  5228. * The physics engine takes care of transofmration automatically.
  5229. */
  5230. updatePhysicsBody(): void;
  5231. checkCollisions: boolean;
  5232. moveWithCollisions(velocity: Vector3): void;
  5233. /**
  5234. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  5235. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  5236. */
  5237. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  5238. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  5239. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  5240. releaseSubMeshes(): void;
  5241. dispose(doNotRecurse?: boolean): void;
  5242. }
  5243. }
  5244. declare module BABYLON {
  5245. class Buffer {
  5246. constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  5247. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  5248. isUpdatable(): boolean;
  5249. getData(): number[] | Float32Array;
  5250. getBuffer(): WebGLBuffer;
  5251. getStrideSize(): number;
  5252. getIsInstanced(): boolean;
  5253. create(data?: number[] | Float32Array): void;
  5254. update(data: number[] | Float32Array): void;
  5255. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  5256. dispose(): void;
  5257. }
  5258. }
  5259. declare module BABYLON {
  5260. class CSG {
  5261. private polygons;
  5262. matrix: Matrix;
  5263. position: Vector3;
  5264. rotation: Vector3;
  5265. rotationQuaternion: Quaternion;
  5266. scaling: Vector3;
  5267. static FromMesh(mesh: Mesh): CSG;
  5268. private static FromPolygons(polygons);
  5269. clone(): CSG;
  5270. private toPolygons();
  5271. union(csg: CSG): CSG;
  5272. unionInPlace(csg: CSG): void;
  5273. subtract(csg: CSG): CSG;
  5274. subtractInPlace(csg: CSG): void;
  5275. intersect(csg: CSG): CSG;
  5276. intersectInPlace(csg: CSG): void;
  5277. inverse(): CSG;
  5278. inverseInPlace(): void;
  5279. copyTransformAttributes(csg: CSG): CSG;
  5280. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  5281. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  5282. }
  5283. }
  5284. declare module BABYLON {
  5285. class Geometry implements IGetSetVerticesData {
  5286. id: string;
  5287. delayLoadState: number;
  5288. delayLoadingFile: string;
  5289. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  5290. /**
  5291. * The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
  5292. * @returns The Bias Vector
  5293. */
  5294. boundingBias: Vector2;
  5295. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  5296. extend: {
  5297. minimum: Vector3;
  5298. maximum: Vector3;
  5299. };
  5300. getScene(): Scene;
  5301. getEngine(): Engine;
  5302. isReady(): boolean;
  5303. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5304. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  5305. setVerticesBuffer(buffer: VertexBuffer): void;
  5306. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  5307. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  5308. private updateBoundingInfo(updateExtends, data);
  5309. getTotalVertices(): number;
  5310. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5311. getVertexBuffer(kind: string): VertexBuffer;
  5312. getVertexBuffers(): {
  5313. [key: string]: VertexBuffer;
  5314. };
  5315. isVerticesDataPresent(kind: string): boolean;
  5316. getVerticesDataKinds(): string[];
  5317. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  5318. getTotalIndices(): number;
  5319. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  5320. getIndexBuffer(): WebGLBuffer;
  5321. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  5322. applyToMesh(mesh: Mesh): void;
  5323. private updateExtend(data?, stride?);
  5324. private notifyUpdate(kind?);
  5325. load(scene: Scene, onLoaded?: () => void): void;
  5326. /**
  5327. * Invert the geometry to move from a right handed system to a left handed one.
  5328. */
  5329. toLeftHanded(): void;
  5330. isDisposed(): boolean;
  5331. dispose(): void;
  5332. copy(id: string): Geometry;
  5333. serialize(): any;
  5334. serializeVerticeData(): any;
  5335. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  5336. /**
  5337. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  5338. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  5339. * Be aware Math.random() could cause collisions, but:
  5340. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  5341. */
  5342. static RandomId(): string;
  5343. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  5344. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  5345. }
  5346. module Geometry.Primitives {
  5347. class _Primitive extends Geometry {
  5348. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  5349. canBeRegenerated(): boolean;
  5350. regenerate(): void;
  5351. asNewGeometry(id: string): Geometry;
  5352. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5353. setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void;
  5354. copy(id: string): Geometry;
  5355. serialize(): any;
  5356. }
  5357. class Ribbon extends _Primitive {
  5358. pathArray: Vector3[][];
  5359. closeArray: boolean;
  5360. closePath: boolean;
  5361. offset: number;
  5362. side: number;
  5363. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5364. copy(id: string): Geometry;
  5365. }
  5366. class Box extends _Primitive {
  5367. size: number;
  5368. side: number;
  5369. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5370. copy(id: string): Geometry;
  5371. serialize(): any;
  5372. static Parse(parsedBox: any, scene: Scene): Box;
  5373. }
  5374. class Sphere extends _Primitive {
  5375. segments: number;
  5376. diameter: number;
  5377. side: number;
  5378. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5379. copy(id: string): Geometry;
  5380. serialize(): any;
  5381. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  5382. }
  5383. class Disc extends _Primitive {
  5384. radius: number;
  5385. tessellation: number;
  5386. side: number;
  5387. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5388. copy(id: string): Geometry;
  5389. }
  5390. class Cylinder extends _Primitive {
  5391. height: number;
  5392. diameterTop: number;
  5393. diameterBottom: number;
  5394. tessellation: number;
  5395. subdivisions: number;
  5396. side: number;
  5397. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5398. copy(id: string): Geometry;
  5399. serialize(): any;
  5400. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  5401. }
  5402. class Torus extends _Primitive {
  5403. diameter: number;
  5404. thickness: number;
  5405. tessellation: number;
  5406. side: number;
  5407. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5408. copy(id: string): Geometry;
  5409. serialize(): any;
  5410. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  5411. }
  5412. class Ground extends _Primitive {
  5413. width: number;
  5414. height: number;
  5415. subdivisions: number;
  5416. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  5417. copy(id: string): Geometry;
  5418. serialize(): any;
  5419. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  5420. }
  5421. class TiledGround extends _Primitive {
  5422. xmin: number;
  5423. zmin: number;
  5424. xmax: number;
  5425. zmax: number;
  5426. subdivisions: {
  5427. w: number;
  5428. h: number;
  5429. };
  5430. precision: {
  5431. w: number;
  5432. h: number;
  5433. };
  5434. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  5435. w: number;
  5436. h: number;
  5437. }, precision: {
  5438. w: number;
  5439. h: number;
  5440. }, canBeRegenerated?: boolean, mesh?: Mesh);
  5441. copy(id: string): Geometry;
  5442. }
  5443. class Plane extends _Primitive {
  5444. size: number;
  5445. side: number;
  5446. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5447. copy(id: string): Geometry;
  5448. serialize(): any;
  5449. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  5450. }
  5451. class TorusKnot extends _Primitive {
  5452. radius: number;
  5453. tube: number;
  5454. radialSegments: number;
  5455. tubularSegments: number;
  5456. p: number;
  5457. q: number;
  5458. side: number;
  5459. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5460. copy(id: string): Geometry;
  5461. serialize(): any;
  5462. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  5463. }
  5464. }
  5465. }
  5466. declare module BABYLON {
  5467. class GroundMesh extends Mesh {
  5468. generateOctree: boolean;
  5469. constructor(name: string, scene: Scene);
  5470. subdivisions: number;
  5471. subdivisionsX: number;
  5472. subdivisionsY: number;
  5473. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  5474. /**
  5475. * Returns a height (y) value in the Worl system :
  5476. * the ground altitude at the coordinates (x, z) expressed in the World system.
  5477. * Returns the ground y position if (x, z) are outside the ground surface.
  5478. * Not pertinent if the ground is rotated.
  5479. */
  5480. getHeightAtCoordinates(x: number, z: number): number;
  5481. /**
  5482. * Returns a normalized vector (Vector3) orthogonal to the ground
  5483. * at the ground coordinates (x, z) expressed in the World system.
  5484. * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface.
  5485. * Not pertinent if the ground is rotated.
  5486. */
  5487. getNormalAtCoordinates(x: number, z: number): Vector3;
  5488. /**
  5489. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  5490. * at the ground coordinates (x, z) expressed in the World system.
  5491. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  5492. * Not pertinent if the ground is rotated.
  5493. */
  5494. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void;
  5495. /**
  5496. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  5497. * if the ground has been updated.
  5498. * This can be used in the render loop
  5499. */
  5500. updateCoordinateHeights(): void;
  5501. }
  5502. }
  5503. declare module BABYLON {
  5504. /**
  5505. * Creates an instance based on a source mesh.
  5506. */
  5507. class InstancedMesh extends AbstractMesh {
  5508. constructor(name: string, source: Mesh);
  5509. receiveShadows: boolean;
  5510. material: Material;
  5511. visibility: number;
  5512. skeleton: Skeleton;
  5513. renderingGroupId: number;
  5514. getTotalVertices(): number;
  5515. sourceMesh: Mesh;
  5516. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5517. isVerticesDataPresent(kind: string): boolean;
  5518. getIndices(): number[] | Int32Array;
  5519. refreshBoundingInfo(): void;
  5520. getLOD(camera: Camera): AbstractMesh;
  5521. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  5522. dispose(doNotRecurse?: boolean): void;
  5523. }
  5524. }
  5525. declare module BABYLON {
  5526. class LinesMesh extends Mesh {
  5527. color: Color3;
  5528. alpha: number;
  5529. /**
  5530. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  5531. * This margin is expressed in world space coordinates, so its value may vary.
  5532. * Default value is 0.1
  5533. * @returns the intersection Threshold value.
  5534. */
  5535. /**
  5536. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  5537. * This margin is expressed in world space coordinates, so its value may vary.
  5538. * @param value the new threshold to apply
  5539. */
  5540. intersectionThreshold: number;
  5541. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean);
  5542. material: Material;
  5543. checkCollisions: boolean;
  5544. createInstance(name: string): InstancedMesh;
  5545. dispose(doNotRecurse?: boolean): void;
  5546. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  5547. }
  5548. }
  5549. declare module BABYLON {
  5550. class _InstancesBatch {
  5551. mustReturn: boolean;
  5552. visibleInstances: InstancedMesh[][];
  5553. renderSelf: boolean[];
  5554. }
  5555. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  5556. /**
  5557. * Mesh side orientation : usually the external or front surface
  5558. */
  5559. static FRONTSIDE: number;
  5560. /**
  5561. * Mesh side orientation : usually the internal or back surface
  5562. */
  5563. static BACKSIDE: number;
  5564. /**
  5565. * Mesh side orientation : both internal and external or front and back surfaces
  5566. */
  5567. static DOUBLESIDE: number;
  5568. /**
  5569. * Mesh side orientation : by default, `FRONTSIDE`
  5570. */
  5571. static DEFAULTSIDE: number;
  5572. /**
  5573. * Mesh cap setting : no cap
  5574. */
  5575. static NO_CAP: number;
  5576. /**
  5577. * Mesh cap setting : one cap at the beginning of the mesh
  5578. */
  5579. static CAP_START: number;
  5580. /**
  5581. * Mesh cap setting : one cap at the end of the mesh
  5582. */
  5583. static CAP_END: number;
  5584. /**
  5585. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  5586. */
  5587. static CAP_ALL: number;
  5588. /**
  5589. * An event triggered before rendering the mesh
  5590. * @type {BABYLON.Observable}
  5591. */
  5592. onBeforeRenderObservable: Observable<Mesh>;
  5593. /**
  5594. * An event triggered after rendering the mesh
  5595. * @type {BABYLON.Observable}
  5596. */
  5597. onAfterRenderObservable: Observable<Mesh>;
  5598. /**
  5599. * An event triggered before drawing the mesh
  5600. * @type {BABYLON.Observable}
  5601. */
  5602. onBeforeDrawObservable: Observable<Mesh>;
  5603. onBeforeDraw: () => void;
  5604. delayLoadState: number;
  5605. instances: InstancedMesh[];
  5606. delayLoadingFile: string;
  5607. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  5608. /**
  5609. * @constructor
  5610. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  5611. * @param {Scene} scene The scene to add this mesh to.
  5612. * @param {Node} parent The parent of this mesh, if it has one
  5613. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  5614. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  5615. * When false, achieved by calling a clone(), also passing False.
  5616. * This will make creation of children, recursive.
  5617. */
  5618. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  5619. /**
  5620. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5621. */
  5622. toString(fullDetails?: boolean): string;
  5623. hasLODLevels: boolean;
  5624. /**
  5625. * Add a mesh as LOD level triggered at the given distance.
  5626. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  5627. * @param {number} distance The distance from the center of the object to show this level
  5628. * @param {Mesh} mesh The mesh to be added as LOD level
  5629. * @return {Mesh} This mesh (for chaining)
  5630. */
  5631. addLODLevel(distance: number, mesh: Mesh): Mesh;
  5632. /**
  5633. * Returns the LOD level mesh at the passed distance or null if not found.
  5634. * It is related to the method `addLODLevel(distance, mesh)`.
  5635. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  5636. */
  5637. getLODLevelAtDistance(distance: number): Mesh;
  5638. /**
  5639. * Remove a mesh from the LOD array
  5640. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  5641. * @param {Mesh} mesh The mesh to be removed.
  5642. * @return {Mesh} This mesh (for chaining)
  5643. */
  5644. removeLODLevel(mesh: Mesh): Mesh;
  5645. /**
  5646. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  5647. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  5648. */
  5649. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  5650. /**
  5651. * Returns the mesh internal Geometry object.
  5652. */
  5653. geometry: Geometry;
  5654. /**
  5655. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  5656. */
  5657. getTotalVertices(): number;
  5658. /**
  5659. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  5660. * If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  5661. * Returns null if the mesh has no geometry or no vertex buffer.
  5662. * Possible `kind` values :
  5663. * - BABYLON.VertexBuffer.PositionKind
  5664. * - BABYLON.VertexBuffer.UVKind
  5665. * - BABYLON.VertexBuffer.UV2Kind
  5666. * - BABYLON.VertexBuffer.UV3Kind
  5667. * - BABYLON.VertexBuffer.UV4Kind
  5668. * - BABYLON.VertexBuffer.UV5Kind
  5669. * - BABYLON.VertexBuffer.UV6Kind
  5670. * - BABYLON.VertexBuffer.ColorKind
  5671. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5672. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5673. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5674. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5675. */
  5676. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5677. /**
  5678. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  5679. * Returns `undefined` if the mesh has no geometry.
  5680. * Possible `kind` values :
  5681. * - BABYLON.VertexBuffer.PositionKind
  5682. * - BABYLON.VertexBuffer.UVKind
  5683. * - BABYLON.VertexBuffer.UV2Kind
  5684. * - BABYLON.VertexBuffer.UV3Kind
  5685. * - BABYLON.VertexBuffer.UV4Kind
  5686. * - BABYLON.VertexBuffer.UV5Kind
  5687. * - BABYLON.VertexBuffer.UV6Kind
  5688. * - BABYLON.VertexBuffer.ColorKind
  5689. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5690. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5691. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5692. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5693. */
  5694. getVertexBuffer(kind: any): VertexBuffer;
  5695. /**
  5696. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  5697. * Possible `kind` values :
  5698. * - BABYLON.VertexBuffer.PositionKind
  5699. * - BABYLON.VertexBuffer.UVKind
  5700. * - BABYLON.VertexBuffer.UV2Kind
  5701. * - BABYLON.VertexBuffer.UV3Kind
  5702. * - BABYLON.VertexBuffer.UV4Kind
  5703. * - BABYLON.VertexBuffer.UV5Kind
  5704. * - BABYLON.VertexBuffer.UV6Kind
  5705. * - BABYLON.VertexBuffer.ColorKind
  5706. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5707. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5708. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5709. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5710. */
  5711. isVerticesDataPresent(kind: string): boolean;
  5712. /**
  5713. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  5714. * Possible `kind` values :
  5715. * - BABYLON.VertexBuffer.PositionKind
  5716. * - BABYLON.VertexBuffer.UVKind
  5717. * - BABYLON.VertexBuffer.UV2Kind
  5718. * - BABYLON.VertexBuffer.UV3Kind
  5719. * - BABYLON.VertexBuffer.UV4Kind
  5720. * - BABYLON.VertexBuffer.UV5Kind
  5721. * - BABYLON.VertexBuffer.UV6Kind
  5722. * - BABYLON.VertexBuffer.ColorKind
  5723. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5724. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5725. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5726. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5727. */
  5728. getVerticesDataKinds(): string[];
  5729. /**
  5730. * Returns a positive integer : the total number of indices in this mesh geometry.
  5731. * Returns zero if the mesh has no geometry.
  5732. */
  5733. getTotalIndices(): number;
  5734. /**
  5735. * Returns an array of integers or a Int32Array populated with the mesh indices.
  5736. * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  5737. * Returns an empty array if the mesh has no geometry.
  5738. */
  5739. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  5740. isBlocked: boolean;
  5741. /**
  5742. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  5743. */
  5744. isReady(): boolean;
  5745. /**
  5746. * Boolean : true if the mesh has been disposed.
  5747. */
  5748. isDisposed(): boolean;
  5749. /**
  5750. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  5751. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  5752. */
  5753. sideOrientation: number;
  5754. /**
  5755. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  5756. * This property is pertinent only for updatable parametric shapes.
  5757. */
  5758. areNormalsFrozen: boolean;
  5759. /**
  5760. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  5761. * It has no effect at all on other shapes.
  5762. * It prevents the mesh normals from being recomputed on next `positions` array update.
  5763. */
  5764. freezeNormals(): void;
  5765. /**
  5766. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  5767. * It has no effect at all on other shapes.
  5768. * It reactivates the mesh normals computation if it was previously frozen.
  5769. */
  5770. unfreezeNormals(): void;
  5771. /**
  5772. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  5773. */
  5774. overridenInstanceCount: number;
  5775. /**
  5776. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  5777. * This means the mesh underlying bounding box and sphere are recomputed.
  5778. */
  5779. refreshBoundingInfo(): void;
  5780. subdivide(count: number): void;
  5781. /**
  5782. * Sets the vertex data of the mesh geometry for the requested `kind`.
  5783. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  5784. * The `data` are either a numeric array either a Float32Array.
  5785. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  5786. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  5787. * Note that a new underlying VertexBuffer object is created each call.
  5788. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  5789. *
  5790. * Possible `kind` values :
  5791. * - BABYLON.VertexBuffer.PositionKind
  5792. * - BABYLON.VertexBuffer.UVKind
  5793. * - BABYLON.VertexBuffer.UV2Kind
  5794. * - BABYLON.VertexBuffer.UV3Kind
  5795. * - BABYLON.VertexBuffer.UV4Kind
  5796. * - BABYLON.VertexBuffer.UV5Kind
  5797. * - BABYLON.VertexBuffer.UV6Kind
  5798. * - BABYLON.VertexBuffer.ColorKind
  5799. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5800. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5801. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5802. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5803. */
  5804. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  5805. setVerticesBuffer(buffer: VertexBuffer): void;
  5806. /**
  5807. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  5808. * If the mesh has no geometry, it is simply returned as it is.
  5809. * The `data` are either a numeric array either a Float32Array.
  5810. * No new underlying VertexBuffer object is created.
  5811. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  5812. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  5813. *
  5814. * Possible `kind` values :
  5815. * - BABYLON.VertexBuffer.PositionKind
  5816. * - BABYLON.VertexBuffer.UVKind
  5817. * - BABYLON.VertexBuffer.UV2Kind
  5818. * - BABYLON.VertexBuffer.UV3Kind
  5819. * - BABYLON.VertexBuffer.UV4Kind
  5820. * - BABYLON.VertexBuffer.UV5Kind
  5821. * - BABYLON.VertexBuffer.UV6Kind
  5822. * - BABYLON.VertexBuffer.ColorKind
  5823. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5824. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5825. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5826. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5827. */
  5828. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  5829. /**
  5830. * Deprecated since BabylonJS v2.3
  5831. */
  5832. updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
  5833. /**
  5834. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  5835. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  5836. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  5837. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  5838. */
  5839. updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
  5840. makeGeometryUnique(): void;
  5841. /**
  5842. * Sets the mesh indices.
  5843. * Expects an array populated with integers or a Int32Array.
  5844. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  5845. * This method creates a new index buffer each call.
  5846. */
  5847. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  5848. /**
  5849. * Invert the geometry to move from a right handed system to a left handed one.
  5850. */
  5851. toLeftHanded(): void;
  5852. /**
  5853. * Registers for this mesh a javascript function called just before the rendering process.
  5854. * This function is passed the current mesh and doesn't return anything.
  5855. */
  5856. registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
  5857. /**
  5858. * Disposes a previously registered javascript function called before the rendering.
  5859. * This function is passed the current mesh and doesn't return anything.
  5860. */
  5861. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
  5862. /**
  5863. * Registers for this mesh a javascript function called just after the rendering is complete.
  5864. * This function is passed the current mesh and doesn't return anything.
  5865. */
  5866. registerAfterRender(func: (mesh: AbstractMesh) => void): void;
  5867. /**
  5868. * Disposes a previously registered javascript function called after the rendering.
  5869. * This function is passed the current mesh and doesn't return anything.
  5870. */
  5871. unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
  5872. /**
  5873. * Triggers the draw call for the mesh.
  5874. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  5875. */
  5876. render(subMesh: SubMesh, enableAlphaMode: boolean): void;
  5877. /**
  5878. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  5879. */
  5880. getEmittedParticleSystems(): ParticleSystem[];
  5881. /**
  5882. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  5883. */
  5884. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  5885. /**
  5886. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  5887. */
  5888. isInFrustum(frustumPlanes: Plane[]): boolean;
  5889. /**
  5890. * Sets the mesh material by the material or multiMaterial `id` property.
  5891. * The material `id` is a string identifying the material or the multiMaterial.
  5892. * This method returns nothing.
  5893. */
  5894. setMaterialByID(id: string): void;
  5895. /**
  5896. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  5897. */
  5898. getAnimatables(): IAnimatable[];
  5899. /**
  5900. * Modifies the mesh geometry according to the passed transformation matrix.
  5901. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  5902. * The mesh normals are modified accordingly the same transformation.
  5903. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  5904. * Note that, under the hood, this method sets a new VertexBuffer each call.
  5905. */
  5906. bakeTransformIntoVertices(transform: Matrix): void;
  5907. /**
  5908. * Modifies the mesh geometry according to its own current World Matrix.
  5909. * The mesh World Matrix is then reset.
  5910. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  5911. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  5912. * Note that, under the hood, this method sets a new VertexBuffer each call.
  5913. */
  5914. bakeCurrentTransformIntoVertices(): void;
  5915. /**
  5916. * Returns a new Mesh object generated from the current mesh properties.
  5917. * This method must not get confused with createInstance().
  5918. * The parameter `name` is a string, the name given to the new mesh.
  5919. * The optional parameter `newParent` can be any Node object (default `null`).
  5920. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  5921. * The parameter `clonePhysicsImpostor` (default `true`) allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any.
  5922. */
  5923. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  5924. /**
  5925. * Disposes the mesh.
  5926. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  5927. */
  5928. dispose(doNotRecurse?: boolean): void;
  5929. /**
  5930. * Modifies the mesh geometry according to a displacement map.
  5931. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  5932. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  5933. * This method returns nothing.
  5934. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  5935. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  5936. * The parameter `onSuccess` is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
  5937. */
  5938. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
  5939. /**
  5940. * Modifies the mesh geometry according to a displacementMap buffer.
  5941. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  5942. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  5943. * This method returns nothing.
  5944. * The parameter `buffer` is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
  5945. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  5946. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  5947. */
  5948. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  5949. /**
  5950. * Modify the mesh to get a flat shading rendering.
  5951. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  5952. * This method returns nothing.
  5953. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  5954. */
  5955. convertToFlatShadedMesh(): void;
  5956. /**
  5957. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  5958. * In other words, more vertices, no more indices and a single bigger VBO.
  5959. * This method returns nothing.
  5960. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  5961. *
  5962. */
  5963. convertToUnIndexedMesh(): void;
  5964. /**
  5965. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  5966. * This method returns nothing.
  5967. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  5968. */
  5969. flipFaces(flipNormals?: boolean): void;
  5970. /**
  5971. * Creates a new InstancedMesh object from the mesh model.
  5972. * An instance shares the same properties and the same material than its model.
  5973. * Only these properties of each instance can then be set individually :
  5974. * - position
  5975. * - rotation
  5976. * - rotationQuaternion
  5977. * - setPivotMatrix
  5978. * - scaling
  5979. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  5980. * Warning : this method is not supported for Line mesh and LineSystem
  5981. */
  5982. createInstance(name: string): InstancedMesh;
  5983. /**
  5984. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  5985. * After this call, all the mesh instances have the same submeshes than the current mesh.
  5986. * This method returns nothing.
  5987. */
  5988. synchronizeInstances(): void;
  5989. /**
  5990. * Simplify the mesh according to the given array of settings.
  5991. * Function will return immediately and will simplify async. It returns nothing.
  5992. * @param settings a collection of simplification settings.
  5993. * @param parallelProcessing should all levels calculate parallel or one after the other.
  5994. * @param type the type of simplification to run.
  5995. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  5996. */
  5997. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
  5998. /**
  5999. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  6000. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  6001. * This should be used together with the simplification to avoid disappearing triangles.
  6002. * @param successCallback an optional success callback to be called after the optimization finished.
  6003. */
  6004. optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
  6005. /**
  6006. * Returns a new Mesh object what is a deep copy of the passed mesh.
  6007. * The parameter `parsedMesh` is the mesh to be copied.
  6008. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  6009. */
  6010. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  6011. /**
  6012. * Creates a ribbon mesh.
  6013. * Please consider using the same method from the MeshBuilder class instead.
  6014. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6015. *
  6016. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  6017. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  6018. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  6019. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  6020. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  6021. * It's the offset to join together the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  6022. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  6023. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6024. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6025. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6026. */
  6027. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6028. /**
  6029. * Creates a plane polygonal mesh. By default, this is a disc.
  6030. * Please consider using the same method from the MeshBuilder class instead.
  6031. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  6032. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  6033. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6034. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6035. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6036. */
  6037. static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6038. /**
  6039. * Creates a box mesh.
  6040. * Please consider using the same method from the MeshBuilder class instead.
  6041. * The parameter `size` sets the size (float) of each box side (default 1).
  6042. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6043. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6044. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6045. */
  6046. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6047. /**
  6048. * Creates a sphere mesh.
  6049. * Please consider using the same method from the MeshBuilder class instead.
  6050. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  6051. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  6052. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6053. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6054. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6055. */
  6056. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6057. /**
  6058. * Creates a cylinder or a cone mesh.
  6059. * Please consider using the same method from the MeshBuilder class instead.
  6060. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  6061. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  6062. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  6063. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  6064. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  6065. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6066. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6067. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6068. */
  6069. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
  6070. /**
  6071. * Creates a torus mesh.
  6072. * Please consider using the same method from the MeshBuilder class instead.
  6073. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  6074. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  6075. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  6076. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6077. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6078. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6079. */
  6080. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6081. /**
  6082. * Creates a torus knot mesh.
  6083. * Please consider using the same method from the MeshBuilder class instead.
  6084. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  6085. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  6086. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  6087. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  6088. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6089. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6090. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6091. */
  6092. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6093. /**
  6094. * Creates a line mesh.
  6095. * Please consider using the same method from the MeshBuilder class instead.
  6096. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6097. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6098. * The parameter `points` is an array successive Vector3.
  6099. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6100. * When updating an instance, remember that only point positions can change, not the number of points.
  6101. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6102. */
  6103. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6104. /**
  6105. * Creates a dashed line mesh.
  6106. * Please consider using the same method from the MeshBuilder class instead.
  6107. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6108. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6109. * The parameter `points` is an array successive Vector3.
  6110. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  6111. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  6112. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  6113. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6114. * When updating an instance, remember that only point positions can change, not the number of points.
  6115. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6116. */
  6117. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6118. /**
  6119. * Creates an extruded shape mesh.
  6120. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6121. * Please consider using the same method from the MeshBuilder class instead.
  6122. *
  6123. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6124. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6125. * extruded along the Z axis.
  6126. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6127. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  6128. * The parameter `scale` (float, default 1) is the value to scale the shape.
  6129. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6130. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6131. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6132. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6133. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6134. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6135. */
  6136. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6137. /**
  6138. * Creates an custom extruded shape mesh.
  6139. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6140. * Please consider using the same method from the MeshBuilder class instead.
  6141. *
  6142. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6143. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6144. * extruded along the Z axis.
  6145. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6146. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6147. * and the distance of this point from the begining of the path :
  6148. * ```javascript
  6149. * var rotationFunction = function(i, distance) {
  6150. * // do things
  6151. * return rotationValue; }
  6152. * ```
  6153. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  6154. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6155. * and the distance of this point from the begining of the path :
  6156. * ```javascript
  6157. * var scaleFunction = function(i, distance) {
  6158. * // do things
  6159. * return scaleValue;}
  6160. * ```
  6161. * It must returns a float value that will be the scale value applied to the shape on each path point.
  6162. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  6163. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  6164. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6165. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6166. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6167. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6168. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6169. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6170. */
  6171. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: Function, rotationFunction: Function, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6172. /**
  6173. * Creates lathe mesh.
  6174. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  6175. * Please consider using the same method from the MeshBuilder class instead.
  6176. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  6177. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  6178. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  6179. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  6180. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6181. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6182. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6183. */
  6184. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6185. /**
  6186. * Creates a plane mesh.
  6187. * Please consider using the same method from the MeshBuilder class instead.
  6188. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6189. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6190. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6191. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6192. */
  6193. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6194. /**
  6195. * Creates a ground mesh.
  6196. * Please consider using the same method from the MeshBuilder class instead.
  6197. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6198. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6199. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6200. */
  6201. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  6202. /**
  6203. * Creates a tiled ground mesh.
  6204. * Please consider using the same method from the MeshBuilder class instead.
  6205. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6206. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6207. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6208. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6209. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6210. * numbers of subdivisions on the ground width and height of each tile.
  6211. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6212. */
  6213. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6214. w: number;
  6215. h: number;
  6216. }, precision: {
  6217. w: number;
  6218. h: number;
  6219. }, scene: Scene, updatable?: boolean): Mesh;
  6220. /**
  6221. * Creates a ground mesh from a height map.
  6222. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6223. * Please consider using the same method from the MeshBuilder class instead.
  6224. * The parameter `url` sets the URL of the height map image resource.
  6225. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6226. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6227. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6228. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6229. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  6230. * This function is passed the newly built mesh :
  6231. * ```javascript
  6232. * function(mesh) { // do things
  6233. * return; }
  6234. * ```
  6235. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6236. */
  6237. 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;
  6238. /**
  6239. * Creates a tube mesh.
  6240. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6241. * Please consider using the same method from the MeshBuilder class instead.
  6242. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  6243. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6244. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6245. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6246. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  6247. * It must return a radius value (positive float) :
  6248. * ```javascript
  6249. * var radiusFunction = function(i, distance) {
  6250. * // do things
  6251. * return radius; }
  6252. * ```
  6253. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6254. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  6255. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6256. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6257. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6258. */
  6259. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  6260. (i: number, distance: number): number;
  6261. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6262. /**
  6263. * Creates a polyhedron mesh.
  6264. * Please consider using the same method from the MeshBuilder class instead.
  6265. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  6266. * to choose the wanted type.
  6267. * The parameter `size` (positive float, default 1) sets the polygon size.
  6268. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  6269. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  6270. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  6271. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  6272. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  6273. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  6274. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6275. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6276. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6277. */
  6278. static CreatePolyhedron(name: string, options: {
  6279. type?: number;
  6280. size?: number;
  6281. sizeX?: number;
  6282. sizeY?: number;
  6283. sizeZ?: number;
  6284. custom?: any;
  6285. faceUV?: Vector4[];
  6286. faceColors?: Color4[];
  6287. updatable?: boolean;
  6288. sideOrientation?: number;
  6289. }, scene: Scene): Mesh;
  6290. /**
  6291. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  6292. * Please consider using the same method from the MeshBuilder class instead.
  6293. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  6294. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  6295. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  6296. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  6297. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6298. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6299. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6300. */
  6301. static CreateIcoSphere(name: string, options: {
  6302. radius?: number;
  6303. flat?: boolean;
  6304. subdivisions?: number;
  6305. sideOrientation?: number;
  6306. updatable?: boolean;
  6307. }, scene: Scene): Mesh;
  6308. /**
  6309. * Creates a decal mesh.
  6310. * Please consider using the same method from the MeshBuilder class instead.
  6311. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  6312. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  6313. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  6314. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  6315. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  6316. */
  6317. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  6318. /**
  6319. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  6320. */
  6321. setPositionsForCPUSkinning(): Float32Array;
  6322. /**
  6323. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  6324. */
  6325. setNormalsForCPUSkinning(): Float32Array;
  6326. /**
  6327. * Update the vertex buffers by applying transformation from the bones
  6328. * @param {skeleton} skeleton to apply
  6329. */
  6330. applySkeleton(skeleton: Skeleton): Mesh;
  6331. /**
  6332. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  6333. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  6334. */
  6335. static MinMax(meshes: AbstractMesh[]): {
  6336. min: Vector3;
  6337. max: Vector3;
  6338. };
  6339. /**
  6340. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  6341. */
  6342. static Center(meshesOrMinMaxVector: any): Vector3;
  6343. /**
  6344. * Merge the array of meshes into a single mesh for performance reasons.
  6345. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  6346. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  6347. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  6348. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  6349. */
  6350. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
  6351. }
  6352. }
  6353. declare module BABYLON {
  6354. interface IGetSetVerticesData {
  6355. isVerticesDataPresent(kind: string): boolean;
  6356. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array;
  6357. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  6358. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  6359. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  6360. setIndices(indices: number[] | Int32Array): void;
  6361. }
  6362. class VertexData {
  6363. positions: number[] | Float32Array;
  6364. normals: number[] | Float32Array;
  6365. uvs: number[] | Float32Array;
  6366. uvs2: number[] | Float32Array;
  6367. uvs3: number[] | Float32Array;
  6368. uvs4: number[] | Float32Array;
  6369. uvs5: number[] | Float32Array;
  6370. uvs6: number[] | Float32Array;
  6371. colors: number[] | Float32Array;
  6372. matricesIndices: number[] | Float32Array;
  6373. matricesWeights: number[] | Float32Array;
  6374. matricesIndicesExtra: number[] | Float32Array;
  6375. matricesWeightsExtra: number[] | Float32Array;
  6376. indices: number[] | Int32Array;
  6377. set(data: number[] | Float32Array, kind: string): void;
  6378. applyToMesh(mesh: Mesh, updatable?: boolean): void;
  6379. applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  6380. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  6381. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  6382. transform(matrix: Matrix): void;
  6383. merge(other: VertexData): void;
  6384. serialize(): any;
  6385. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
  6386. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
  6387. static CreateRibbon(options: {
  6388. pathArray: Vector3[][];
  6389. closeArray?: boolean;
  6390. closePath?: boolean;
  6391. offset?: number;
  6392. sideOrientation?: number;
  6393. invertUV?: boolean;
  6394. }): VertexData;
  6395. static CreateBox(options: {
  6396. size?: number;
  6397. width?: number;
  6398. height?: number;
  6399. depth?: number;
  6400. faceUV?: Vector4[];
  6401. faceColors?: Color4[];
  6402. sideOrientation?: number;
  6403. }): VertexData;
  6404. static CreateSphere(options: {
  6405. segments?: number;
  6406. diameter?: number;
  6407. diameterX?: number;
  6408. diameterY?: number;
  6409. diameterZ?: number;
  6410. arc?: number;
  6411. slice?: number;
  6412. sideOrientation?: number;
  6413. }): VertexData;
  6414. static CreateCylinder(options: {
  6415. height?: number;
  6416. diameterTop?: number;
  6417. diameterBottom?: number;
  6418. diameter?: number;
  6419. tessellation?: number;
  6420. subdivisions?: number;
  6421. arc?: number;
  6422. faceColors?: Color4[];
  6423. faceUV?: Vector4[];
  6424. hasRings?: boolean;
  6425. enclose?: boolean;
  6426. sideOrientation?: number;
  6427. }): VertexData;
  6428. static CreateTorus(options: {
  6429. diameter?: number;
  6430. thickness?: number;
  6431. tessellation?: number;
  6432. sideOrientation?: number;
  6433. }): VertexData;
  6434. static CreateLineSystem(options: {
  6435. lines: Vector3[][];
  6436. }): VertexData;
  6437. static CreateDashedLines(options: {
  6438. points: Vector3[];
  6439. dashSize?: number;
  6440. gapSize?: number;
  6441. dashNb?: number;
  6442. }): VertexData;
  6443. static CreateGround(options: {
  6444. width?: number;
  6445. height?: number;
  6446. subdivisions?: number;
  6447. subdivisionsX?: number;
  6448. subdivisionsY?: number;
  6449. }): VertexData;
  6450. static CreateTiledGround(options: {
  6451. xmin: number;
  6452. zmin: number;
  6453. xmax: number;
  6454. zmax: number;
  6455. subdivisions?: {
  6456. w: number;
  6457. h: number;
  6458. };
  6459. precision?: {
  6460. w: number;
  6461. h: number;
  6462. };
  6463. }): VertexData;
  6464. static CreateGroundFromHeightMap(options: {
  6465. width: number;
  6466. height: number;
  6467. subdivisions: number;
  6468. minHeight: number;
  6469. maxHeight: number;
  6470. buffer: Uint8Array;
  6471. bufferWidth: number;
  6472. bufferHeight: number;
  6473. }): VertexData;
  6474. static CreatePlane(options: {
  6475. size?: number;
  6476. width?: number;
  6477. height?: number;
  6478. sideOrientation?: number;
  6479. }): VertexData;
  6480. static CreateDisc(options: {
  6481. radius?: number;
  6482. tessellation?: number;
  6483. arc?: number;
  6484. sideOrientation?: number;
  6485. }): VertexData;
  6486. static CreateIcoSphere(options: {
  6487. radius?: number;
  6488. radiusX?: number;
  6489. radiusY?: number;
  6490. radiusZ?: number;
  6491. flat?: boolean;
  6492. subdivisions?: number;
  6493. sideOrientation?: number;
  6494. }): VertexData;
  6495. static CreatePolyhedron(options: {
  6496. type?: number;
  6497. size?: number;
  6498. sizeX?: number;
  6499. sizeY?: number;
  6500. sizeZ?: number;
  6501. custom?: any;
  6502. faceUV?: Vector4[];
  6503. faceColors?: Color4[];
  6504. flat?: boolean;
  6505. sideOrientation?: number;
  6506. }): VertexData;
  6507. static CreateTorusKnot(options: {
  6508. radius?: number;
  6509. tube?: number;
  6510. radialSegments?: number;
  6511. tubularSegments?: number;
  6512. p?: number;
  6513. q?: number;
  6514. sideOrientation?: number;
  6515. }): VertexData;
  6516. /**
  6517. * @param {any} - positions (number[] or Float32Array)
  6518. * @param {any} - indices (number[] or Uint16Array)
  6519. * @param {any} - normals (number[] or Float32Array)
  6520. */
  6521. static ComputeNormals(positions: any, indices: any, normals: any): void;
  6522. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  6523. }
  6524. }
  6525. declare module BABYLON {
  6526. class MeshBuilder {
  6527. private static updateSideOrientation(orientation, scene);
  6528. /**
  6529. * Creates a box mesh.
  6530. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  6531. * The parameter `size` sets the size (float) of each box side (default 1).
  6532. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  6533. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
  6534. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  6535. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6536. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6537. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6538. */
  6539. static CreateBox(name: string, options: {
  6540. size?: number;
  6541. width?: number;
  6542. height?: number;
  6543. depth?: number;
  6544. faceUV?: Vector4[];
  6545. faceColors?: Color4[];
  6546. sideOrientation?: number;
  6547. updatable?: boolean;
  6548. }, scene: Scene): Mesh;
  6549. /**
  6550. * Creates a sphere mesh.
  6551. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  6552. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  6553. * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value than `diameter`).
  6554. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  6555. * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  6556. * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
  6557. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6558. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6559. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6560. */
  6561. static CreateSphere(name: string, options: {
  6562. segments?: number;
  6563. diameter?: number;
  6564. diameterX?: number;
  6565. diameterY?: number;
  6566. diameterZ?: number;
  6567. arc?: number;
  6568. slice?: number;
  6569. sideOrientation?: number;
  6570. updatable?: boolean;
  6571. }, scene: any): Mesh;
  6572. /**
  6573. * Creates a plane polygonal mesh. By default, this is a disc.
  6574. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  6575. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  6576. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  6577. * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
  6578. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6579. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6580. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6581. */
  6582. static CreateDisc(name: string, options: {
  6583. radius?: number;
  6584. tessellation?: number;
  6585. arc?: number;
  6586. updatable?: boolean;
  6587. sideOrientation?: number;
  6588. }, scene: Scene): Mesh;
  6589. /**
  6590. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  6591. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  6592. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  6593. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  6594. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  6595. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  6596. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6597. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6598. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6599. */
  6600. static CreateIcoSphere(name: string, options: {
  6601. radius?: number;
  6602. radiusX?: number;
  6603. radiusY?: number;
  6604. radiusZ?: number;
  6605. flat?: boolean;
  6606. subdivisions?: number;
  6607. sideOrientation?: number;
  6608. updatable?: boolean;
  6609. }, scene: Scene): Mesh;
  6610. /**
  6611. * Creates a ribbon mesh.
  6612. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6613. *
  6614. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  6615. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  6616. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  6617. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  6618. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  6619. * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  6620. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  6621. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6622. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6623. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  6624. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6625. */
  6626. static CreateRibbon(name: string, options: {
  6627. pathArray: Vector3[][];
  6628. closeArray?: boolean;
  6629. closePath?: boolean;
  6630. offset?: number;
  6631. updatable?: boolean;
  6632. sideOrientation?: number;
  6633. instance?: Mesh;
  6634. invertUV?: boolean;
  6635. }, scene?: Scene): Mesh;
  6636. /**
  6637. * Creates a cylinder or a cone mesh.
  6638. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  6639. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  6640. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  6641. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  6642. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  6643. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  6644. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  6645. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  6646. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  6647. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).
  6648. * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
  6649. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  6650. * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
  6651. * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
  6652. * If `enclose` is false, a ring surface is one element.
  6653. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  6654. * Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
  6655. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6656. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6657. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6658. */
  6659. static CreateCylinder(name: string, options: {
  6660. height?: number;
  6661. diameterTop?: number;
  6662. diameterBottom?: number;
  6663. diameter?: number;
  6664. tessellation?: number;
  6665. subdivisions?: number;
  6666. arc?: number;
  6667. faceColors?: Color4[];
  6668. faceUV?: Vector4[];
  6669. updatable?: boolean;
  6670. hasRings?: boolean;
  6671. enclose?: boolean;
  6672. sideOrientation?: number;
  6673. }, scene: any): Mesh;
  6674. /**
  6675. * Creates a torus mesh.
  6676. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  6677. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  6678. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  6679. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  6680. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6681. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6682. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6683. */
  6684. static CreateTorus(name: string, options: {
  6685. diameter?: number;
  6686. thickness?: number;
  6687. tessellation?: number;
  6688. updatable?: boolean;
  6689. sideOrientation?: number;
  6690. }, scene: any): Mesh;
  6691. /**
  6692. * Creates a torus knot mesh.
  6693. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  6694. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  6695. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  6696. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  6697. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  6698. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6699. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6700. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6701. */
  6702. static CreateTorusKnot(name: string, options: {
  6703. radius?: number;
  6704. tube?: number;
  6705. radialSegments?: number;
  6706. tubularSegments?: number;
  6707. p?: number;
  6708. q?: number;
  6709. updatable?: boolean;
  6710. sideOrientation?: number;
  6711. }, scene: any): Mesh;
  6712. /**
  6713. * Creates a line system mesh.
  6714. * A line system is a pool of many lines gathered in a single mesh.
  6715. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  6716. * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter.
  6717. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  6718. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  6719. * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
  6720. * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6721. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  6722. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6723. */
  6724. static CreateLineSystem(name: string, options: {
  6725. lines: Vector3[][];
  6726. updatable: boolean;
  6727. instance?: LinesMesh;
  6728. }, scene: Scene): LinesMesh;
  6729. /**
  6730. * Creates a line mesh.
  6731. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  6732. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6733. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6734. * The parameter `points` is an array successive Vector3.
  6735. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6736. * When updating an instance, remember that only point positions can change, not the number of points.
  6737. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6738. */
  6739. static CreateLines(name: string, options: {
  6740. points: Vector3[];
  6741. updatable?: boolean;
  6742. instance?: LinesMesh;
  6743. }, scene: Scene): LinesMesh;
  6744. /**
  6745. * Creates a dashed line mesh.
  6746. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  6747. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6748. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6749. * The parameter `points` is an array successive Vector3.
  6750. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  6751. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  6752. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  6753. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6754. * When updating an instance, remember that only point positions can change, not the number of points.
  6755. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6756. */
  6757. static CreateDashedLines(name: string, options: {
  6758. points: Vector3[];
  6759. dashSize?: number;
  6760. gapSize?: number;
  6761. dashNb?: number;
  6762. updatable?: boolean;
  6763. instance?: LinesMesh;
  6764. }, scene: Scene): LinesMesh;
  6765. /**
  6766. * Creates an extruded shape mesh.
  6767. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6768. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  6769. *
  6770. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6771. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6772. * extruded along the Z axis.
  6773. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6774. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  6775. * The parameter `scale` (float, default 1) is the value to scale the shape.
  6776. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6777. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6778. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6779. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6780. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6781. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  6782. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6783. */
  6784. static ExtrudeShape(name: string, options: {
  6785. shape: Vector3[];
  6786. path: Vector3[];
  6787. scale?: number;
  6788. rotation?: number;
  6789. cap?: number;
  6790. updatable?: boolean;
  6791. sideOrientation?: number;
  6792. instance?: Mesh;
  6793. invertUV?: boolean;
  6794. }, scene: Scene): Mesh;
  6795. /**
  6796. * Creates an custom extruded shape mesh.
  6797. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6798. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  6799. *
  6800. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6801. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6802. * extruded along the Z axis.
  6803. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6804. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6805. * and the distance of this point from the begining of the path :
  6806. * ```javascript
  6807. * var rotationFunction = function(i, distance) {
  6808. * // do things
  6809. * return rotationValue; }
  6810. * ```
  6811. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  6812. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6813. * and the distance of this point from the begining of the path :
  6814. * ```javascript
  6815. * var scaleFunction = function(i, distance) {
  6816. * // do things
  6817. * return scaleValue;}
  6818. * ```
  6819. * It must returns a float value that will be the scale value applied to the shape on each path point.
  6820. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  6821. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  6822. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6823. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6824. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6825. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6826. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6827. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  6828. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6829. */
  6830. static ExtrudeShapeCustom(name: string, options: {
  6831. shape: Vector3[];
  6832. path: Vector3[];
  6833. scaleFunction?: any;
  6834. rotationFunction?: any;
  6835. ribbonCloseArray?: boolean;
  6836. ribbonClosePath?: boolean;
  6837. cap?: number;
  6838. updatable?: boolean;
  6839. sideOrientation?: number;
  6840. instance?: Mesh;
  6841. invertUV?: boolean;
  6842. }, scene: Scene): Mesh;
  6843. /**
  6844. * Creates lathe mesh.
  6845. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  6846. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  6847. *
  6848. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  6849. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  6850. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  6851. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  6852. * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
  6853. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  6854. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6855. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6856. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6857. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  6858. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6859. */
  6860. static CreateLathe(name: string, options: {
  6861. shape: Vector3[];
  6862. radius?: number;
  6863. tessellation?: number;
  6864. arc?: number;
  6865. closed?: boolean;
  6866. updatable?: boolean;
  6867. sideOrientation?: number;
  6868. cap?: number;
  6869. invertUV?: boolean;
  6870. }, scene: Scene): Mesh;
  6871. /**
  6872. * Creates a plane mesh.
  6873. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  6874. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6875. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  6876. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  6877. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6878. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6879. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6880. */
  6881. static CreatePlane(name: string, options: {
  6882. size?: number;
  6883. width?: number;
  6884. height?: number;
  6885. sideOrientation?: number;
  6886. updatable?: boolean;
  6887. sourcePlane?: Plane;
  6888. }, scene: Scene): Mesh;
  6889. /**
  6890. * Creates a ground mesh.
  6891. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  6892. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6893. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6894. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6895. */
  6896. static CreateGround(name: string, options: {
  6897. width?: number;
  6898. height?: number;
  6899. subdivisions?: number;
  6900. subdivisionsX?: number;
  6901. subdivisionsY?: number;
  6902. updatable?: boolean;
  6903. }, scene: any): Mesh;
  6904. /**
  6905. * Creates a tiled ground mesh.
  6906. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  6907. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6908. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6909. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6910. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6911. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6912. * numbers of subdivisions on the ground width and height of each tile.
  6913. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6914. */
  6915. static CreateTiledGround(name: string, options: {
  6916. xmin: number;
  6917. zmin: number;
  6918. xmax: number;
  6919. zmax: number;
  6920. subdivisions?: {
  6921. w: number;
  6922. h: number;
  6923. };
  6924. precision?: {
  6925. w: number;
  6926. h: number;
  6927. };
  6928. updatable?: boolean;
  6929. }, scene: Scene): Mesh;
  6930. /**
  6931. * Creates a ground mesh from a height map.
  6932. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6933. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  6934. * The parameter `url` sets the URL of the height map image resource.
  6935. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6936. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6937. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6938. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6939. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  6940. * This function is passed the newly built mesh :
  6941. * ```javascript
  6942. * function(mesh) { // do things
  6943. * return; }
  6944. * ```
  6945. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6946. */
  6947. static CreateGroundFromHeightMap(name: string, url: string, options: {
  6948. width?: number;
  6949. height?: number;
  6950. subdivisions?: number;
  6951. minHeight?: number;
  6952. maxHeight?: number;
  6953. updatable?: boolean;
  6954. onReady?: (mesh: GroundMesh) => void;
  6955. }, scene: Scene): GroundMesh;
  6956. /**
  6957. * Creates a tube mesh.
  6958. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6959. *
  6960. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  6961. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  6962. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6963. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6964. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6965. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  6966. * It must return a radius value (positive float) :
  6967. * ```javascript
  6968. * var radiusFunction = function(i, distance) {
  6969. * // do things
  6970. * return radius; }
  6971. * ```
  6972. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  6973. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6974. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  6975. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6976. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6977. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  6978. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6979. */
  6980. static CreateTube(name: string, options: {
  6981. path: Vector3[];
  6982. radius?: number;
  6983. tessellation?: number;
  6984. radiusFunction?: {
  6985. (i: number, distance: number): number;
  6986. };
  6987. cap?: number;
  6988. arc?: number;
  6989. updatable?: boolean;
  6990. sideOrientation?: number;
  6991. instance?: Mesh;
  6992. invertUV?: boolean;
  6993. }, scene: Scene): Mesh;
  6994. /**
  6995. * Creates a polyhedron mesh.
  6996. *
  6997. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  6998. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  6999. * to choose the wanted type.
  7000. * The parameter `size` (positive float, default 1) sets the polygon size.
  7001. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  7002. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  7003. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  7004. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  7005. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7006. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  7007. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7008. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7009. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7010. */
  7011. static CreatePolyhedron(name: string, options: {
  7012. type?: number;
  7013. size?: number;
  7014. sizeX?: number;
  7015. sizeY?: number;
  7016. sizeZ?: number;
  7017. custom?: any;
  7018. faceUV?: Vector4[];
  7019. faceColors?: Color4[];
  7020. flat?: boolean;
  7021. updatable?: boolean;
  7022. sideOrientation?: number;
  7023. }, scene: Scene): Mesh;
  7024. /**
  7025. * Creates a decal mesh.
  7026. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  7027. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  7028. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  7029. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  7030. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  7031. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  7032. */
  7033. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  7034. position?: Vector3;
  7035. normal?: Vector3;
  7036. size?: Vector3;
  7037. angle?: number;
  7038. }): Mesh;
  7039. }
  7040. }
  7041. declare module BABYLON.Internals {
  7042. class MeshLODLevel {
  7043. distance: number;
  7044. mesh: Mesh;
  7045. constructor(distance: number, mesh: Mesh);
  7046. }
  7047. }
  7048. declare module BABYLON {
  7049. /**
  7050. * A simplifier interface for future simplification implementations.
  7051. */
  7052. interface ISimplifier {
  7053. /**
  7054. * Simplification of a given mesh according to the given settings.
  7055. * Since this requires computation, it is assumed that the function runs async.
  7056. * @param settings The settings of the simplification, including quality and distance
  7057. * @param successCallback A callback that will be called after the mesh was simplified.
  7058. * @param errorCallback in case of an error, this callback will be called. optional.
  7059. */
  7060. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  7061. }
  7062. /**
  7063. * Expected simplification settings.
  7064. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  7065. */
  7066. interface ISimplificationSettings {
  7067. quality: number;
  7068. distance: number;
  7069. optimizeMesh?: boolean;
  7070. }
  7071. class SimplificationSettings implements ISimplificationSettings {
  7072. quality: number;
  7073. distance: number;
  7074. optimizeMesh: boolean;
  7075. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  7076. }
  7077. interface ISimplificationTask {
  7078. settings: Array<ISimplificationSettings>;
  7079. simplificationType: SimplificationType;
  7080. mesh: Mesh;
  7081. successCallback?: () => void;
  7082. parallelProcessing: boolean;
  7083. }
  7084. class SimplificationQueue {
  7085. running: any;
  7086. constructor();
  7087. addTask(task: ISimplificationTask): void;
  7088. executeNext(): void;
  7089. runSimplification(task: ISimplificationTask): void;
  7090. private getSimplifier(task);
  7091. }
  7092. /**
  7093. * The implemented types of simplification.
  7094. * At the moment only Quadratic Error Decimation is implemented.
  7095. */
  7096. enum SimplificationType {
  7097. QUADRATIC = 0,
  7098. }
  7099. class DecimationTriangle {
  7100. vertices: Array<DecimationVertex>;
  7101. normal: Vector3;
  7102. error: Array<number>;
  7103. deleted: boolean;
  7104. isDirty: boolean;
  7105. borderFactor: number;
  7106. deletePending: boolean;
  7107. originalOffset: number;
  7108. constructor(vertices: Array<DecimationVertex>);
  7109. }
  7110. class DecimationVertex {
  7111. position: Vector3;
  7112. id: any;
  7113. q: QuadraticMatrix;
  7114. isBorder: boolean;
  7115. triangleStart: number;
  7116. triangleCount: number;
  7117. originalOffsets: Array<number>;
  7118. constructor(position: Vector3, id: any);
  7119. updatePosition(newPosition: Vector3): void;
  7120. }
  7121. class QuadraticMatrix {
  7122. data: Array<number>;
  7123. constructor(data?: Array<number>);
  7124. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  7125. addInPlace(matrix: QuadraticMatrix): void;
  7126. addArrayInPlace(data: Array<number>): void;
  7127. add(matrix: QuadraticMatrix): QuadraticMatrix;
  7128. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  7129. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  7130. }
  7131. class Reference {
  7132. vertexId: number;
  7133. triangleId: number;
  7134. constructor(vertexId: number, triangleId: number);
  7135. }
  7136. /**
  7137. * An implementation of the Quadratic Error simplification algorithm.
  7138. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  7139. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  7140. * @author RaananW
  7141. */
  7142. class QuadraticErrorSimplification implements ISimplifier {
  7143. private triangles;
  7144. private vertices;
  7145. private references;
  7146. private initialized;
  7147. syncIterations: number;
  7148. aggressiveness: number;
  7149. decimationIterations: number;
  7150. boundingBoxEpsilon: number;
  7151. constructor(_mesh: Mesh);
  7152. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  7153. private isTriangleOnBoundingBox(triangle);
  7154. private runDecimation(settings, submeshIndex, successCallback);
  7155. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  7156. private init(callback);
  7157. private reconstructMesh(submeshIndex);
  7158. private initDecimatedMesh();
  7159. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  7160. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  7161. private identifyBorder();
  7162. private updateMesh(identifyBorders?);
  7163. private vertexError(q, point);
  7164. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  7165. }
  7166. }
  7167. declare module BABYLON {
  7168. class Polygon {
  7169. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  7170. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  7171. static Parse(input: string): Vector2[];
  7172. static StartingAt(x: number, y: number): Path2;
  7173. }
  7174. class PolygonMeshBuilder {
  7175. constructor(name: string, contours: Path2, scene: Scene);
  7176. constructor(name: string, contours: Vector2[], scene: Scene);
  7177. addHole(hole: Vector2[]): PolygonMeshBuilder;
  7178. build(updatable?: boolean, depth?: number): Mesh;
  7179. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  7180. }
  7181. }
  7182. declare module BABYLON {
  7183. class SubMesh implements ICullable {
  7184. materialIndex: number;
  7185. verticesStart: number;
  7186. verticesCount: number;
  7187. indexStart: any;
  7188. indexCount: number;
  7189. linesIndexCount: number;
  7190. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  7191. IsGlobal: boolean;
  7192. getBoundingInfo(): BoundingInfo;
  7193. getMesh(): AbstractMesh;
  7194. getRenderingMesh(): Mesh;
  7195. getMaterial(): Material;
  7196. refreshBoundingInfo(): void;
  7197. updateBoundingInfo(world: Matrix): void;
  7198. isInFrustum(frustumPlanes: Plane[]): boolean;
  7199. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  7200. render(enableAlphaMode: boolean): void;
  7201. getLinesIndexBuffer(indices: number[] | Int32Array, engine: Engine): WebGLBuffer;
  7202. canIntersects(ray: Ray): boolean;
  7203. intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo;
  7204. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  7205. dispose(): void;
  7206. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  7207. }
  7208. }
  7209. declare module BABYLON {
  7210. class VertexBuffer {
  7211. constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  7212. getKind(): string;
  7213. isUpdatable(): boolean;
  7214. getData(): number[] | Float32Array;
  7215. getBuffer(): WebGLBuffer;
  7216. getStrideSize(): number;
  7217. getOffset(): number;
  7218. getSize(): number;
  7219. getIsInstanced(): boolean;
  7220. create(data?: number[] | Float32Array): void;
  7221. update(data: number[] | Float32Array): void;
  7222. updateDirectly(data: Float32Array, offset: number): void;
  7223. dispose(): void;
  7224. static PositionKind: string;
  7225. static NormalKind: string;
  7226. static UVKind: string;
  7227. static UV2Kind: string;
  7228. static UV3Kind: string;
  7229. static UV4Kind: string;
  7230. static UV5Kind: string;
  7231. static UV6Kind: string;
  7232. static ColorKind: string;
  7233. static MatricesIndicesKind: string;
  7234. static MatricesWeightsKind: string;
  7235. static MatricesIndicesExtraKind: string;
  7236. static MatricesWeightsExtraKind: string;
  7237. }
  7238. }
  7239. declare module BABYLON {
  7240. interface PhysicsImpostorJoint {
  7241. mainImpostor: PhysicsImpostor;
  7242. connectedImpostor: PhysicsImpostor;
  7243. joint: PhysicsJoint;
  7244. }
  7245. class PhysicsEngine {
  7246. gravity: Vector3;
  7247. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  7248. setGravity(gravity: Vector3): void;
  7249. /**
  7250. * Set the time step of the physics engine.
  7251. * default is 1/60.
  7252. * To slow it down, enter 1/600 for example.
  7253. * To speed it up, 1/30
  7254. * @param {number} newTimeStep the new timestep to apply to this world.
  7255. */
  7256. setTimeStep(newTimeStep?: number): void;
  7257. dispose(): void;
  7258. getPhysicsPluginName(): string;
  7259. /**
  7260. * @Deprecated
  7261. *
  7262. */
  7263. static NoImpostor: number;
  7264. static SphereImpostor: number;
  7265. static BoxImpostor: number;
  7266. static PlaneImpostor: number;
  7267. static MeshImpostor: number;
  7268. static CylinderImpostor: number;
  7269. static HeightmapImpostor: number;
  7270. static CapsuleImpostor: number;
  7271. static ConeImpostor: number;
  7272. static ConvexHullImpostor: number;
  7273. static Epsilon: number;
  7274. /**
  7275. * Adding a new impostor for the impostor tracking.
  7276. * This will be done by the impostor itself.
  7277. * @param {PhysicsImpostor} impostor the impostor to add
  7278. */
  7279. addImpostor(impostor: PhysicsImpostor): void;
  7280. /**
  7281. * Remove an impostor from the engine.
  7282. * This impostor and its mesh will not longer be updated by the physics engine.
  7283. * @param {PhysicsImpostor} impostor the impostor to remove
  7284. */
  7285. removeImpostor(impostor: PhysicsImpostor): void;
  7286. /**
  7287. * Add a joint to the physics engine
  7288. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  7289. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  7290. * @param {PhysicsJoint} the joint that will connect both impostors.
  7291. */
  7292. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  7293. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  7294. /**
  7295. * Called by the scene. no need to call it.
  7296. */
  7297. getPhysicsPlugin(): IPhysicsEnginePlugin;
  7298. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  7299. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  7300. }
  7301. interface IPhysicsEnginePlugin {
  7302. world: any;
  7303. name: string;
  7304. setGravity(gravity: Vector3): any;
  7305. setTimeStep(timeStep: number): any;
  7306. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  7307. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  7308. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  7309. generatePhysicsBody(impostor: PhysicsImpostor): any;
  7310. removePhysicsBody(impostor: PhysicsImpostor): any;
  7311. generateJoint(joint: PhysicsImpostorJoint): any;
  7312. removeJoint(joint: PhysicsImpostorJoint): any;
  7313. isSupported(): boolean;
  7314. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  7315. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  7316. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  7317. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  7318. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  7319. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  7320. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  7321. sleepBody(impostor: PhysicsImpostor): any;
  7322. wakeUpBody(impostor: PhysicsImpostor): any;
  7323. updateDistanceJoint(joint: DistanceJoint, maxDistance: number, minDistance?: number): any;
  7324. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  7325. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  7326. dispose(): any;
  7327. }
  7328. }
  7329. declare module BABYLON {
  7330. interface PhysicsImpostorParameters {
  7331. mass: number;
  7332. friction?: number;
  7333. restitution?: number;
  7334. nativeOptions?: any;
  7335. }
  7336. interface IPhysicsEnabledObject {
  7337. position: Vector3;
  7338. rotationQuaternion: Quaternion;
  7339. scaling: Vector3;
  7340. rotation?: Vector3;
  7341. parent?: any;
  7342. getBoundingInfo?(): BoundingInfo;
  7343. computeWorldMatrix?(force: boolean): void;
  7344. getChildMeshes?(): Array<AbstractMesh>;
  7345. getVerticesData?(kind: string): Array<number> | Float32Array;
  7346. getIndices?(): Array<number> | Int32Array;
  7347. getScene?(): Scene;
  7348. }
  7349. class PhysicsImpostor {
  7350. object: IPhysicsEnabledObject;
  7351. type: number;
  7352. static DEFAULT_OBJECT_SIZE: Vector3;
  7353. uniqueId: number;
  7354. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  7355. /**
  7356. * This function will completly initialize this impostor.
  7357. * It will create a new body - but only if this mesh has no parent.
  7358. * If it has, this impostor will not be used other than to define the impostor
  7359. * of the child mesh.
  7360. */
  7361. /**
  7362. * Should a new body be generated.
  7363. */
  7364. isBodyInitRequired(): boolean;
  7365. setScalingUpdated(updated: boolean): void;
  7366. /**
  7367. * Force a regeneration of this or the parent's impostor's body.
  7368. * Use under cautious - This will remove all joints already implemented.
  7369. */
  7370. forceUpdate(): void;
  7371. /**
  7372. * Gets the body that holds this impostor. Either its own, or its parent.
  7373. */
  7374. /**
  7375. * Set the physics body. Used mainly by the physics engine/plugin
  7376. */
  7377. physicsBody: any;
  7378. parent: PhysicsImpostor;
  7379. resetUpdateFlags(): void;
  7380. getObjectExtendSize(): Vector3;
  7381. getObjectCenter(): Vector3;
  7382. /**
  7383. * Get a specific parametes from the options parameter.
  7384. */
  7385. getParam(paramName: string): any;
  7386. /**
  7387. * Sets a specific parameter in the options given to the physics plugin
  7388. */
  7389. setParam(paramName: string, value: number): void;
  7390. /**
  7391. * Specifically change the body's mass option. Won't recreate the physics body object
  7392. */
  7393. setMass(mass: number): void;
  7394. getLinearVelocity(): Vector3;
  7395. /**
  7396. * Set the body's linear velocity.
  7397. */
  7398. setLinearVelocity(velocity: Vector3): void;
  7399. getAngularVelocity(): Vector3;
  7400. /**
  7401. * Set the body's linear velocity.
  7402. */
  7403. setAngularVelocity(velocity: Vector3): void;
  7404. /**
  7405. * Execute a function with the physics plugin native code.
  7406. * Provide a function the will have two variables - the world object and the physics body object.
  7407. */
  7408. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  7409. /**
  7410. * Register a function that will be executed before the physics world is stepping forward.
  7411. */
  7412. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  7413. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  7414. /**
  7415. * Register a function that will be executed after the physics step
  7416. */
  7417. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  7418. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  7419. /**
  7420. * register a function that will be executed when this impostor collides against a different body.
  7421. */
  7422. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  7423. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  7424. /**
  7425. * this function is executed by the physics engine.
  7426. */
  7427. beforeStep: () => void;
  7428. /**
  7429. * this function is executed by the physics engine.
  7430. */
  7431. afterStep: () => void;
  7432. onCollide: (e: {
  7433. body: any;
  7434. }) => void;
  7435. /**
  7436. * Apply a force
  7437. */
  7438. applyForce(force: Vector3, contactPoint: Vector3): void;
  7439. /**
  7440. * Apply an impulse
  7441. */
  7442. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  7443. /**
  7444. * A help function to create a joint.
  7445. */
  7446. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  7447. /**
  7448. * Add a joint to this impostor with a different impostor.
  7449. */
  7450. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  7451. /**
  7452. * Will keep this body still, in a sleep mode.
  7453. */
  7454. sleep(): void;
  7455. /**
  7456. * Wake the body up.
  7457. */
  7458. wakeUp(): void;
  7459. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  7460. dispose(): void;
  7461. setDeltaPosition(position: Vector3): void;
  7462. setDeltaRotation(rotation: Quaternion): void;
  7463. static NoImpostor: number;
  7464. static SphereImpostor: number;
  7465. static BoxImpostor: number;
  7466. static PlaneImpostor: number;
  7467. static MeshImpostor: number;
  7468. static CylinderImpostor: number;
  7469. static ParticleImpostor: number;
  7470. static HeightmapImpostor: number;
  7471. }
  7472. }
  7473. declare module BABYLON {
  7474. interface PhysicsJointData {
  7475. mainPivot?: Vector3;
  7476. connectedPivot?: Vector3;
  7477. mainAxis?: Vector3;
  7478. connectedAxis?: Vector3;
  7479. collision?: boolean;
  7480. nativeParams?: any;
  7481. }
  7482. /**
  7483. * This is a holder class for the physics joint created by the physics plugin.
  7484. * It holds a set of functions to control the underlying joint.
  7485. */
  7486. class PhysicsJoint {
  7487. type: number;
  7488. jointData: PhysicsJointData;
  7489. constructor(type: number, jointData: PhysicsJointData);
  7490. physicsJoint: any;
  7491. physicsPlugin: IPhysicsEnginePlugin;
  7492. /**
  7493. * Execute a function that is physics-plugin specific.
  7494. * @param {Function} func the function that will be executed.
  7495. * It accepts two parameters: the physics world and the physics joint.
  7496. */
  7497. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  7498. static DistanceJoint: number;
  7499. static HingeJoint: number;
  7500. static BallAndSocketJoint: number;
  7501. static WheelJoint: number;
  7502. static SliderJoint: number;
  7503. static PrismaticJoint: number;
  7504. static UniversalJoint: number;
  7505. static Hinge2Joint: number;
  7506. static PointToPointJoint: number;
  7507. static SpringJoint: number;
  7508. static LockJoint: number;
  7509. }
  7510. /**
  7511. * A class representing a physics distance joint.
  7512. */
  7513. class DistanceJoint extends PhysicsJoint {
  7514. constructor(jointData: DistanceJointData);
  7515. /**
  7516. * Update the predefined distance.
  7517. */
  7518. updateDistance(maxDistance: number, minDistance?: number): void;
  7519. }
  7520. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  7521. constructor(type: number, jointData: PhysicsJointData);
  7522. /**
  7523. * Set the motor values.
  7524. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7525. * @param {number} force the force to apply
  7526. * @param {number} maxForce max force for this motor.
  7527. */
  7528. setMotor(force?: number, maxForce?: number): void;
  7529. /**
  7530. * Set the motor's limits.
  7531. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7532. */
  7533. setLimit(upperLimit: number, lowerLimit?: number): void;
  7534. }
  7535. /**
  7536. * This class represents a single hinge physics joint
  7537. */
  7538. class HingeJoint extends MotorEnabledJoint {
  7539. constructor(jointData: PhysicsJointData);
  7540. /**
  7541. * Set the motor values.
  7542. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7543. * @param {number} force the force to apply
  7544. * @param {number} maxForce max force for this motor.
  7545. */
  7546. setMotor(force?: number, maxForce?: number): void;
  7547. /**
  7548. * Set the motor's limits.
  7549. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7550. */
  7551. setLimit(upperLimit: number, lowerLimit?: number): void;
  7552. }
  7553. /**
  7554. * This class represents a dual hinge physics joint (same as wheel joint)
  7555. */
  7556. class Hinge2Joint extends MotorEnabledJoint {
  7557. constructor(jointData: PhysicsJointData);
  7558. /**
  7559. * Set the motor values.
  7560. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7561. * @param {number} force the force to apply
  7562. * @param {number} maxForce max force for this motor.
  7563. * @param {motorIndex} the motor's index, 0 or 1.
  7564. */
  7565. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  7566. /**
  7567. * Set the motor limits.
  7568. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7569. * @param {number} upperLimit the upper limit
  7570. * @param {number} lowerLimit lower limit
  7571. * @param {motorIndex} the motor's index, 0 or 1.
  7572. */
  7573. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  7574. }
  7575. interface IMotorEnabledJoint {
  7576. physicsJoint: any;
  7577. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  7578. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  7579. }
  7580. interface DistanceJointData extends PhysicsJointData {
  7581. maxDistance: number;
  7582. }
  7583. interface SpringJointData extends PhysicsJointData {
  7584. length: number;
  7585. stiffness: number;
  7586. damping: number;
  7587. }
  7588. }
  7589. declare module BABYLON {
  7590. class ReflectionProbe {
  7591. name: string;
  7592. invertYAxis: boolean;
  7593. position: Vector3;
  7594. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  7595. refreshRate: number;
  7596. getScene(): Scene;
  7597. cubeTexture: RenderTargetTexture;
  7598. renderList: AbstractMesh[];
  7599. attachToMesh(mesh: AbstractMesh): void;
  7600. dispose(): void;
  7601. }
  7602. }
  7603. declare module BABYLON {
  7604. class AnaglyphPostProcess extends PostProcess {
  7605. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  7606. }
  7607. }
  7608. declare module BABYLON {
  7609. class BlackAndWhitePostProcess extends PostProcess {
  7610. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7611. }
  7612. }
  7613. declare module BABYLON {
  7614. class BlurPostProcess extends PostProcess {
  7615. direction: Vector2;
  7616. blurWidth: number;
  7617. constructor(name: string, direction: Vector2, blurWidth: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7618. }
  7619. }
  7620. declare module BABYLON {
  7621. class ColorCorrectionPostProcess extends PostProcess {
  7622. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7623. }
  7624. }
  7625. declare module BABYLON {
  7626. class ConvolutionPostProcess extends PostProcess {
  7627. kernel: number[];
  7628. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7629. static EdgeDetect0Kernel: number[];
  7630. static EdgeDetect1Kernel: number[];
  7631. static EdgeDetect2Kernel: number[];
  7632. static SharpenKernel: number[];
  7633. static EmbossKernel: number[];
  7634. static GaussianKernel: number[];
  7635. }
  7636. }
  7637. declare module BABYLON {
  7638. class DisplayPassPostProcess extends PostProcess {
  7639. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7640. }
  7641. }
  7642. declare module BABYLON {
  7643. class FilterPostProcess extends PostProcess {
  7644. kernelMatrix: Matrix;
  7645. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7646. }
  7647. }
  7648. declare module BABYLON {
  7649. class FxaaPostProcess extends PostProcess {
  7650. texelWidth: number;
  7651. texelHeight: number;
  7652. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7653. }
  7654. }
  7655. declare module BABYLON {
  7656. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  7657. /**
  7658. * Public members
  7659. */
  7660. /**
  7661. * Gaussian blur coefficient
  7662. * @type {number}
  7663. */
  7664. gaussCoeff: number;
  7665. /**
  7666. * Gaussian blur mean
  7667. * @type {number}
  7668. */
  7669. gaussMean: number;
  7670. /**
  7671. * Gaussian blur standard deviation
  7672. * @type {number}
  7673. */
  7674. gaussStandDev: number;
  7675. /**
  7676. * Gaussian blur multiplier. Multiplies the blur effect
  7677. * @type {number}
  7678. */
  7679. gaussMultiplier: number;
  7680. /**
  7681. * Exposure, controls the overall intensity of the pipeline
  7682. * @type {number}
  7683. */
  7684. exposure: number;
  7685. /**
  7686. * Minimum luminance that the post-process can output. Luminance is >= 0
  7687. * @type {number}
  7688. */
  7689. minimumLuminance: number;
  7690. /**
  7691. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  7692. * @type {number}
  7693. */
  7694. maximumLuminance: number;
  7695. /**
  7696. * Increase rate for luminance: eye adaptation speed to dark
  7697. * @type {number}
  7698. */
  7699. luminanceIncreaserate: number;
  7700. /**
  7701. * Decrease rate for luminance: eye adaptation speed to bright
  7702. * @type {number}
  7703. */
  7704. luminanceDecreaseRate: number;
  7705. /**
  7706. * Minimum luminance needed to compute HDR
  7707. * @type {number}
  7708. */
  7709. brightThreshold: number;
  7710. /**
  7711. * Private members
  7712. */
  7713. static LUM_STEPS: number;
  7714. /**
  7715. * @constructor
  7716. * @param {string} name - The rendering pipeline name
  7717. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7718. * @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)
  7719. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  7720. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7721. */
  7722. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  7723. /**
  7724. * Tells the pipeline to update its post-processes
  7725. */
  7726. update(): void;
  7727. /**
  7728. * Returns the current calculated luminance
  7729. */
  7730. getCurrentLuminance(): number;
  7731. /**
  7732. * Returns the currently drawn luminance
  7733. */
  7734. getOutputLuminance(): number;
  7735. /**
  7736. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  7737. */
  7738. dispose(): void;
  7739. /**
  7740. * Creates the HDR post-process and computes the luminance adaptation
  7741. */
  7742. /**
  7743. * Texture Adder post-process
  7744. */
  7745. /**
  7746. * Down sample X4 post-process
  7747. */
  7748. /**
  7749. * Bright pass post-process
  7750. */
  7751. /**
  7752. * Luminance generator. Creates the luminance post-process and down sample post-processes
  7753. */
  7754. /**
  7755. * Gaussian blur post-processes. Horizontal and Vertical
  7756. */
  7757. }
  7758. }
  7759. declare module BABYLON {
  7760. class LensRenderingPipeline extends PostProcessRenderPipeline {
  7761. /**
  7762. * The chromatic aberration PostProcess id in the pipeline
  7763. * @type {string}
  7764. */
  7765. LensChromaticAberrationEffect: string;
  7766. /**
  7767. * The highlights enhancing PostProcess id in the pipeline
  7768. * @type {string}
  7769. */
  7770. HighlightsEnhancingEffect: string;
  7771. /**
  7772. * The depth-of-field PostProcess id in the pipeline
  7773. * @type {string}
  7774. */
  7775. LensDepthOfFieldEffect: string;
  7776. /**
  7777. * @constructor
  7778. *
  7779. * Effect parameters are as follow:
  7780. * {
  7781. * chromatic_aberration: number; // from 0 to x (1 for realism)
  7782. * edge_blur: number; // from 0 to x (1 for realism)
  7783. * distortion: number; // from 0 to x (1 for realism)
  7784. * grain_amount: number; // from 0 to 1
  7785. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  7786. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  7787. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  7788. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  7789. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  7790. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  7791. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  7792. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  7793. * }
  7794. * Note: if an effect parameter is unset, effect is disabled
  7795. *
  7796. * @param {string} name - The rendering pipeline name
  7797. * @param {object} parameters - An object containing all parameters (see above)
  7798. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7799. * @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)
  7800. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7801. */
  7802. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  7803. setEdgeBlur(amount: number): void;
  7804. disableEdgeBlur(): void;
  7805. setGrainAmount(amount: number): void;
  7806. disableGrain(): void;
  7807. setChromaticAberration(amount: number): void;
  7808. disableChromaticAberration(): void;
  7809. setEdgeDistortion(amount: number): void;
  7810. disableEdgeDistortion(): void;
  7811. setFocusDistance(amount: number): void;
  7812. disableDepthOfField(): void;
  7813. setAperture(amount: number): void;
  7814. setDarkenOutOfFocus(amount: number): void;
  7815. enablePentagonBokeh(): void;
  7816. disablePentagonBokeh(): void;
  7817. enableNoiseBlur(): void;
  7818. disableNoiseBlur(): void;
  7819. setHighlightsGain(amount: number): void;
  7820. setHighlightsThreshold(amount: number): void;
  7821. disableHighlights(): void;
  7822. /**
  7823. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  7824. */
  7825. dispose(disableDepthRender?: boolean): void;
  7826. }
  7827. }
  7828. declare module BABYLON {
  7829. class PassPostProcess extends PostProcess {
  7830. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7831. }
  7832. }
  7833. declare module BABYLON {
  7834. type PostProcessOptions = {
  7835. width: number;
  7836. height: number;
  7837. };
  7838. class PostProcess {
  7839. name: string;
  7840. width: number;
  7841. height: number;
  7842. renderTargetSamplingMode: number;
  7843. clearColor: Color4;
  7844. enablePixelPerfectMode: boolean;
  7845. /**
  7846. * An event triggered when the postprocess is activated.
  7847. * @type {BABYLON.Observable}
  7848. */
  7849. onActivateObservable: Observable<Camera>;
  7850. onActivate: (camera: Camera) => void;
  7851. /**
  7852. * An event triggered when the postprocess changes its size.
  7853. * @type {BABYLON.Observable}
  7854. */
  7855. onSizeChangedObservable: Observable<PostProcess>;
  7856. onSizeChanged: (postProcess: PostProcess) => void;
  7857. /**
  7858. * An event triggered when the postprocess applies its effect.
  7859. * @type {BABYLON.Observable}
  7860. */
  7861. onApplyObservable: Observable<Effect>;
  7862. onApply: (effect: Effect) => void;
  7863. /**
  7864. * An event triggered before rendering the postprocess
  7865. * @type {BABYLON.Observable}
  7866. */
  7867. onBeforeRenderObservable: Observable<Effect>;
  7868. onBeforeRender: (effect: Effect) => void;
  7869. /**
  7870. * An event triggered after rendering the postprocess
  7871. * @type {BABYLON.Observable}
  7872. */
  7873. onAfterRenderObservable: Observable<Effect>;
  7874. onAfterRender: (efect: Effect) => void;
  7875. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
  7876. updateEffect(defines?: string): void;
  7877. isReusable(): boolean;
  7878. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  7879. markTextureDirty(): void;
  7880. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  7881. isSupported: boolean;
  7882. apply(): Effect;
  7883. dispose(camera?: Camera): void;
  7884. }
  7885. }
  7886. declare module BABYLON {
  7887. class PostProcessManager {
  7888. constructor(scene: Scene);
  7889. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  7890. dispose(): void;
  7891. }
  7892. }
  7893. declare module BABYLON {
  7894. class RefractionPostProcess extends PostProcess {
  7895. color: Color3;
  7896. depth: number;
  7897. colorLevel: number;
  7898. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7899. dispose(camera: Camera): void;
  7900. }
  7901. }
  7902. declare module BABYLON {
  7903. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  7904. /**
  7905. * The PassPostProcess id in the pipeline that contains the original scene color
  7906. * @type {string}
  7907. */
  7908. SSAOOriginalSceneColorEffect: string;
  7909. /**
  7910. * The SSAO PostProcess id in the pipeline
  7911. * @type {string}
  7912. */
  7913. SSAORenderEffect: string;
  7914. /**
  7915. * The horizontal blur PostProcess id in the pipeline
  7916. * @type {string}
  7917. */
  7918. SSAOBlurHRenderEffect: string;
  7919. /**
  7920. * The vertical blur PostProcess id in the pipeline
  7921. * @type {string}
  7922. */
  7923. SSAOBlurVRenderEffect: string;
  7924. /**
  7925. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  7926. * @type {string}
  7927. */
  7928. SSAOCombineRenderEffect: string;
  7929. /**
  7930. * The output strength of the SSAO post-process. Default value is 1.0.
  7931. * @type {number}
  7932. */
  7933. totalStrength: number;
  7934. /**
  7935. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  7936. * @type {number}
  7937. */
  7938. radius: number;
  7939. /**
  7940. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  7941. * Must not be equal to fallOff and superior to fallOff.
  7942. * Default value is 0.975
  7943. * @type {number}
  7944. */
  7945. area: number;
  7946. /**
  7947. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  7948. * Must not be equal to area and inferior to area.
  7949. * Default value is 0.0
  7950. * @type {number}
  7951. */
  7952. fallOff: number;
  7953. /**
  7954. * The base color of the SSAO post-process
  7955. * The final result is "base + ssao" between [0, 1]
  7956. * @type {number}
  7957. */
  7958. base: number;
  7959. /**
  7960. * @constructor
  7961. * @param {string} name - The rendering pipeline name
  7962. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7963. * @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 }
  7964. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7965. */
  7966. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  7967. /**
  7968. * Returns the horizontal blur PostProcess
  7969. * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
  7970. */
  7971. getBlurHPostProcess(): BlurPostProcess;
  7972. /**
  7973. * Returns the vertical blur PostProcess
  7974. * @return {BABYLON.BlurPostProcess} The vertical blur post-process
  7975. */
  7976. getBlurVPostProcess(): BlurPostProcess;
  7977. /**
  7978. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  7979. */
  7980. dispose(disableDepthRender?: boolean): void;
  7981. }
  7982. }
  7983. declare module BABYLON {
  7984. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  7985. /**
  7986. * Public members
  7987. */
  7988. originalPostProcess: PostProcess;
  7989. downSampleX4PostProcess: PostProcess;
  7990. brightPassPostProcess: PostProcess;
  7991. gaussianBlurHPostProcesses: PostProcess[];
  7992. gaussianBlurVPostProcesses: PostProcess[];
  7993. textureAdderPostProcess: PostProcess;
  7994. textureAdderFinalPostProcess: PostProcess;
  7995. lensFlarePostProcess: PostProcess;
  7996. lensFlareComposePostProcess: PostProcess;
  7997. depthOfFieldPostProcess: PostProcess;
  7998. brightThreshold: number;
  7999. blurWidth: number;
  8000. gaussianCoefficient: number;
  8001. gaussianMean: number;
  8002. gaussianStandardDeviation: number;
  8003. exposure: number;
  8004. lensTexture: Texture;
  8005. lensColorTexture: Texture;
  8006. lensFlareStrength: number;
  8007. lensFlareGhostDispersal: number;
  8008. lensFlareHaloWidth: number;
  8009. lensFlareDistortionStrength: number;
  8010. lensStarTexture: Texture;
  8011. lensFlareDirtTexture: Texture;
  8012. depthOfFieldDistance: number;
  8013. animations: Animation[];
  8014. /**
  8015. * Private members
  8016. */
  8017. DepthOfFieldEnabled: boolean;
  8018. LensFlareEnabled: boolean;
  8019. /**
  8020. * @constructor
  8021. * @param {string} name - The rendering pipeline name
  8022. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  8023. * @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)
  8024. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  8025. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  8026. */
  8027. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  8028. dispose(): void;
  8029. }
  8030. }
  8031. declare module BABYLON {
  8032. class StereoscopicInterlacePostProcess extends PostProcess {
  8033. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8034. }
  8035. }
  8036. declare module BABYLON {
  8037. enum TonemappingOperator {
  8038. Hable = 0,
  8039. Reinhard = 1,
  8040. HejiDawson = 2,
  8041. Photographic = 3,
  8042. }
  8043. class TonemapPostProcess extends PostProcess {
  8044. exposureAdjustment: number;
  8045. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  8046. }
  8047. }
  8048. declare module BABYLON {
  8049. class VolumetricLightScatteringPostProcess extends PostProcess {
  8050. /**
  8051. * If not undefined, the mesh position is computed from the attached node position
  8052. * @type {{position: Vector3}}
  8053. */
  8054. attachedNode: {
  8055. position: Vector3;
  8056. };
  8057. /**
  8058. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  8059. * @type {Vector3}
  8060. */
  8061. customMeshPosition: Vector3;
  8062. /**
  8063. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  8064. * @type {boolean}
  8065. */
  8066. useCustomMeshPosition: boolean;
  8067. /**
  8068. * If the post-process should inverse the light scattering direction
  8069. * @type {boolean}
  8070. */
  8071. invert: boolean;
  8072. /**
  8073. * The internal mesh used by the post-process
  8074. * @type {boolean}
  8075. */
  8076. mesh: Mesh;
  8077. useDiffuseColor: boolean;
  8078. /**
  8079. * Array containing the excluded meshes not rendered in the internal pass
  8080. */
  8081. excludedMeshes: AbstractMesh[];
  8082. /**
  8083. * Controls the overall intensity of the post-process
  8084. * @type {number}
  8085. */
  8086. exposure: number;
  8087. /**
  8088. * Dissipates each sample's contribution in range [0, 1]
  8089. * @type {number}
  8090. */
  8091. decay: number;
  8092. /**
  8093. * Controls the overall intensity of each sample
  8094. * @type {number}
  8095. */
  8096. weight: number;
  8097. /**
  8098. * Controls the density of each sample
  8099. * @type {number}
  8100. */
  8101. density: number;
  8102. /**
  8103. * @constructor
  8104. * @param {string} name - The post-process name
  8105. * @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)
  8106. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  8107. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  8108. * @param {number} samples - The post-process quality, default 100
  8109. * @param {number} samplingMode - The post-process filtering mode
  8110. * @param {BABYLON.Engine} engine - The babylon engine
  8111. * @param {boolean} reusable - If the post-process is reusable
  8112. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  8113. */
  8114. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  8115. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  8116. /**
  8117. * Sets the new light position for light scattering effect
  8118. * @param {BABYLON.Vector3} The new custom light position
  8119. */
  8120. setCustomMeshPosition(position: Vector3): void;
  8121. /**
  8122. * Returns the light position for light scattering effect
  8123. * @return {BABYLON.Vector3} The custom light position
  8124. */
  8125. getCustomMeshPosition(): Vector3;
  8126. /**
  8127. * Disposes the internal assets and detaches the post-process from the camera
  8128. */
  8129. dispose(camera: Camera): void;
  8130. /**
  8131. * Returns the render target texture used by the post-process
  8132. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  8133. */
  8134. getPass(): RenderTargetTexture;
  8135. /**
  8136. * Creates a default mesh for the Volumeric Light Scattering post-process
  8137. * @param {string} The mesh name
  8138. * @param {BABYLON.Scene} The scene where to create the mesh
  8139. * @return {BABYLON.Mesh} the default mesh
  8140. */
  8141. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  8142. }
  8143. }
  8144. declare module BABYLON {
  8145. class VRDistortionCorrectionPostProcess extends PostProcess {
  8146. aspectRatio: number;
  8147. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  8148. }
  8149. }
  8150. declare module BABYLON {
  8151. class BoundingBoxRenderer {
  8152. frontColor: Color3;
  8153. backColor: Color3;
  8154. showBackLines: boolean;
  8155. renderList: SmartArray<BoundingBox>;
  8156. constructor(scene: Scene);
  8157. reset(): void;
  8158. render(): void;
  8159. dispose(): void;
  8160. }
  8161. }
  8162. declare module BABYLON {
  8163. class DepthRenderer {
  8164. constructor(scene: Scene, type?: number);
  8165. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  8166. getDepthMap(): RenderTargetTexture;
  8167. dispose(): void;
  8168. }
  8169. }
  8170. declare module BABYLON {
  8171. class EdgesRenderer {
  8172. edgesWidthScalerForOrthographic: number;
  8173. edgesWidthScalerForPerspective: number;
  8174. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  8175. dispose(): void;
  8176. render(): void;
  8177. }
  8178. }
  8179. declare module BABYLON {
  8180. class OutlineRenderer {
  8181. constructor(scene: Scene);
  8182. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  8183. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  8184. }
  8185. }
  8186. declare module BABYLON {
  8187. class RenderingGroup {
  8188. index: number;
  8189. onBeforeTransparentRendering: () => void;
  8190. /**
  8191. * Set the opaque sort comparison function.
  8192. * If null the sub meshes will be render in the order they were created
  8193. */
  8194. opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  8195. /**
  8196. * Set the alpha test sort comparison function.
  8197. * If null the sub meshes will be render in the order they were created
  8198. */
  8199. alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  8200. /**
  8201. * Set the transparent sort comparison function.
  8202. * If null the sub meshes will be render in the order they were created
  8203. */
  8204. transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  8205. /**
  8206. * Creates a new rendering group.
  8207. * @param index The rendering group index
  8208. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  8209. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  8210. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  8211. */
  8212. constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
  8213. /**
  8214. * Render all the sub meshes contained in the group.
  8215. * @param customRenderFunction Used to override the default render behaviour of the group.
  8216. * @returns true if rendered some submeshes.
  8217. */
  8218. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
  8219. /**
  8220. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  8221. * @param subMeshes The submeshes to render
  8222. */
  8223. private renderOpaqueSorted(subMeshes);
  8224. /**
  8225. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  8226. * @param subMeshes The submeshes to render
  8227. */
  8228. private renderAlphaTestSorted(subMeshes);
  8229. /**
  8230. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  8231. * @param subMeshes The submeshes to render
  8232. */
  8233. private renderTransparentSorted(subMeshes);
  8234. /**
  8235. * Renders the submeshes in a specified order.
  8236. * @param subMeshes The submeshes to sort before render
  8237. * @param sortCompareFn The comparison function use to sort
  8238. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  8239. * @param transparent Specifies to activate blending if true
  8240. */
  8241. private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
  8242. /**
  8243. * Renders the submeshes in the order they were dispatched (no sort applied).
  8244. * @param subMeshes The submeshes to render
  8245. */
  8246. private static renderUnsorted(subMeshes);
  8247. /**
  8248. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  8249. * are rendered back to front if in the same alpha index.
  8250. *
  8251. * @param a The first submesh
  8252. * @param b The second submesh
  8253. * @returns The result of the comparison
  8254. */
  8255. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  8256. /**
  8257. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  8258. * are rendered back to front.
  8259. *
  8260. * @param a The first submesh
  8261. * @param b The second submesh
  8262. * @returns The result of the comparison
  8263. */
  8264. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  8265. /**
  8266. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  8267. * are rendered front to back (prevent overdraw).
  8268. *
  8269. * @param a The first submesh
  8270. * @param b The second submesh
  8271. * @returns The result of the comparison
  8272. */
  8273. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  8274. /**
  8275. * Resets the different lists of submeshes to prepare a new frame.
  8276. */
  8277. prepare(): void;
  8278. /**
  8279. * Inserts the submesh in its correct queue depending on its material.
  8280. * @param subMesh The submesh to dispatch
  8281. */
  8282. dispatch(subMesh: SubMesh): void;
  8283. }
  8284. }
  8285. declare module BABYLON {
  8286. class RenderingManager {
  8287. /**
  8288. * The max id used for rendering groups (not included)
  8289. */
  8290. static MAX_RENDERINGGROUPS: number;
  8291. /**
  8292. * The min id used for rendering groups (included)
  8293. */
  8294. static MIN_RENDERINGGROUPS: number;
  8295. constructor(scene: Scene);
  8296. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  8297. reset(): void;
  8298. dispatch(subMesh: SubMesh): void;
  8299. /**
  8300. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  8301. * This allowed control for front to back rendering or reversly depending of the special needs.
  8302. *
  8303. * @param renderingGroupId The rendering group id corresponding to its index
  8304. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  8305. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  8306. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  8307. */
  8308. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  8309. /**
  8310. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  8311. *
  8312. * @param renderingGroupId The rendering group id corresponding to its index
  8313. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  8314. */
  8315. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  8316. }
  8317. }
  8318. declare module BABYLON {
  8319. class Sprite {
  8320. name: string;
  8321. position: Vector3;
  8322. color: Color4;
  8323. width: number;
  8324. height: number;
  8325. angle: number;
  8326. cellIndex: number;
  8327. invertU: number;
  8328. invertV: number;
  8329. disposeWhenFinishedAnimating: boolean;
  8330. animations: Animation[];
  8331. isPickable: boolean;
  8332. actionManager: ActionManager;
  8333. size: number;
  8334. constructor(name: string, manager: SpriteManager);
  8335. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  8336. stopAnimation(): void;
  8337. dispose(): void;
  8338. }
  8339. }
  8340. declare module BABYLON {
  8341. class SpriteManager {
  8342. name: string;
  8343. sprites: Sprite[];
  8344. renderingGroupId: number;
  8345. layerMask: number;
  8346. fogEnabled: boolean;
  8347. isPickable: boolean;
  8348. cellWidth: number;
  8349. cellHeight: number;
  8350. /**
  8351. * An event triggered when the manager is disposed.
  8352. * @type {BABYLON.Observable}
  8353. */
  8354. onDisposeObservable: Observable<SpriteManager>;
  8355. onDispose: () => void;
  8356. texture: Texture;
  8357. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  8358. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  8359. render(): void;
  8360. dispose(): void;
  8361. }
  8362. }
  8363. declare module BABYLON.Internals {
  8364. class _AlphaState {
  8365. /**
  8366. * Initializes the state.
  8367. */
  8368. constructor();
  8369. isDirty: boolean;
  8370. alphaBlend: boolean;
  8371. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  8372. reset(): void;
  8373. apply(gl: WebGLRenderingContext): void;
  8374. }
  8375. }
  8376. declare module BABYLON.Internals {
  8377. class _DepthCullingState {
  8378. /**
  8379. * Initializes the state.
  8380. */
  8381. constructor();
  8382. isDirty: boolean;
  8383. zOffset: number;
  8384. cullFace: number;
  8385. cull: boolean;
  8386. depthFunc: number;
  8387. depthMask: boolean;
  8388. depthTest: boolean;
  8389. reset(): void;
  8390. apply(gl: WebGLRenderingContext): void;
  8391. }
  8392. }
  8393. declare module BABYLON.Internals {
  8394. class _StencilState {
  8395. isDirty: boolean;
  8396. stencilFunc: number;
  8397. stencilFuncRef: number;
  8398. stencilFuncMask: number;
  8399. stencilOpStencilFail: number;
  8400. stencilOpDepthFail: number;
  8401. stencilOpStencilDepthPass: number;
  8402. stencilMask: number;
  8403. stencilTest: boolean;
  8404. constructor();
  8405. reset(): void;
  8406. apply(gl: WebGLRenderingContext): void;
  8407. }
  8408. }
  8409. declare module BABYLON.Internals {
  8410. class AndOrNotEvaluator {
  8411. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  8412. }
  8413. }
  8414. declare module BABYLON {
  8415. interface IAssetTask {
  8416. onSuccess: (task: IAssetTask) => void;
  8417. onError: (task: IAssetTask) => void;
  8418. isCompleted: boolean;
  8419. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  8420. }
  8421. class MeshAssetTask implements IAssetTask {
  8422. name: string;
  8423. meshesNames: any;
  8424. rootUrl: string;
  8425. sceneFilename: string;
  8426. loadedMeshes: Array<AbstractMesh>;
  8427. loadedParticleSystems: Array<ParticleSystem>;
  8428. loadedSkeletons: Array<Skeleton>;
  8429. onSuccess: (task: IAssetTask) => void;
  8430. onError: (task: IAssetTask) => void;
  8431. isCompleted: boolean;
  8432. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  8433. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8434. }
  8435. class TextFileAssetTask implements IAssetTask {
  8436. name: string;
  8437. url: string;
  8438. onSuccess: (task: IAssetTask) => void;
  8439. onError: (task: IAssetTask) => void;
  8440. isCompleted: boolean;
  8441. text: string;
  8442. constructor(name: string, url: string);
  8443. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8444. }
  8445. class BinaryFileAssetTask implements IAssetTask {
  8446. name: string;
  8447. url: string;
  8448. onSuccess: (task: IAssetTask) => void;
  8449. onError: (task: IAssetTask) => void;
  8450. isCompleted: boolean;
  8451. data: ArrayBuffer;
  8452. constructor(name: string, url: string);
  8453. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8454. }
  8455. class ImageAssetTask implements IAssetTask {
  8456. name: string;
  8457. url: string;
  8458. onSuccess: (task: IAssetTask) => void;
  8459. onError: (task: IAssetTask) => void;
  8460. isCompleted: boolean;
  8461. image: HTMLImageElement;
  8462. constructor(name: string, url: string);
  8463. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8464. }
  8465. interface ITextureAssetTask extends IAssetTask {
  8466. onSuccess: (task: ITextureAssetTask) => void;
  8467. onError: (task: ITextureAssetTask) => void;
  8468. texture: Texture;
  8469. }
  8470. class TextureAssetTask implements ITextureAssetTask {
  8471. name: string;
  8472. url: string;
  8473. noMipmap: boolean;
  8474. invertY: boolean;
  8475. samplingMode: number;
  8476. onSuccess: (task: ITextureAssetTask) => void;
  8477. onError: (task: ITextureAssetTask) => void;
  8478. isCompleted: boolean;
  8479. texture: Texture;
  8480. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  8481. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8482. }
  8483. class CubeTextureAssetTask implements IAssetTask {
  8484. name: string;
  8485. url: string;
  8486. extensions: string[];
  8487. noMipmap: boolean;
  8488. files: string[];
  8489. onSuccess: (task: IAssetTask) => void;
  8490. onError: (task: IAssetTask) => void;
  8491. isCompleted: boolean;
  8492. texture: CubeTexture;
  8493. constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
  8494. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8495. }
  8496. class AssetsManager {
  8497. protected tasks: IAssetTask[];
  8498. protected waitingTasksCount: number;
  8499. onFinish: (tasks: IAssetTask[]) => void;
  8500. onTaskSuccess: (task: IAssetTask) => void;
  8501. onTaskError: (task: IAssetTask) => void;
  8502. useDefaultLoadingScreen: boolean;
  8503. constructor(scene: Scene);
  8504. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  8505. addTextFileTask(taskName: string, url: string): IAssetTask;
  8506. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  8507. addImageTask(taskName: string, url: string): IAssetTask;
  8508. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
  8509. reset(): AssetsManager;
  8510. load(): AssetsManager;
  8511. }
  8512. }
  8513. declare module BABYLON {
  8514. class Database {
  8515. private callbackManifestChecked;
  8516. private currentSceneUrl;
  8517. private db;
  8518. private enableSceneOffline;
  8519. private enableTexturesOffline;
  8520. private manifestVersionFound;
  8521. private mustUpdateRessources;
  8522. private hasReachedQuota;
  8523. private isSupported;
  8524. private idbFactory;
  8525. static IsUASupportingBlobStorage: boolean;
  8526. static IDBStorageEnabled: boolean;
  8527. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  8528. static parseURL: (url: string) => string;
  8529. static ReturnFullUrlLocation: (url: string) => string;
  8530. checkManifestFile(): void;
  8531. openAsync(successCallback: any, errorCallback: any): void;
  8532. loadImageFromDB(url: string, image: HTMLImageElement): void;
  8533. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  8534. }
  8535. }
  8536. declare module BABYLON {
  8537. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8538. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8539. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8540. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8541. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8542. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8543. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8544. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8545. class SerializationHelper {
  8546. static Serialize<T>(entity: T, serializationObject?: any): any;
  8547. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  8548. static Clone<T>(creationFunction: () => T, source: T): T;
  8549. }
  8550. }
  8551. declare module BABYLON {
  8552. class DynamicFloatArrayElementInfo {
  8553. offset: number;
  8554. }
  8555. /**
  8556. * The purpose of this class is to store float32 based elements of a given size (defined by the stride argument) in a dynamic fashion, that is, you can add/free elements. You can then access to a defragmented/packed version of the underlying Float32Array by calling the pack() method.
  8557. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  8558. * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
  8559. * Allocating an Element will return a instance of DynamicFloatArrayElement which contains the offset into the Float32Array of where the element starts, you are then responsible to copy your data using this offset.
  8560. * Beware, calling pack() may change the offset of some Entries because this method will defragment the Float32Array to replace empty elements by moving allocated ones at their location.
  8561. * This method will return an ArrayBufferView on the existing Float32Array that describes the used elements. Use this View to update the WebGLBuffer and NOT the "buffer" field of the class. The pack() method won't shrink/reallocate the buffer to keep it GC friendly, all the empty space will be put at the end of the buffer, the method just ensure there are no "free holes".
  8562. */
  8563. class DynamicFloatArray {
  8564. /**
  8565. * Construct an instance of the dynamic float array
  8566. * @param stride size of one element in float (i.e. not bytes!)
  8567. * @param initialElementCount the number of available entries at construction
  8568. */
  8569. constructor(stride: number, initialElementCount: number);
  8570. /**
  8571. * Allocate an element in the array.
  8572. * @return the element info instance that contains the offset into the main buffer of the element's location.
  8573. * Beware, this offset may change when you call pack()
  8574. */
  8575. allocElement(): DynamicFloatArrayElementInfo;
  8576. /**
  8577. * Free the element corresponding to the given element info
  8578. * @param elInfo the element that describe the allocated element
  8579. */
  8580. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  8581. /**
  8582. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  8583. * Instances of DynamicFloatArrayElement may have their 'offset' member changed as data could be copied from one location to another, so be sure to read/write your data based on the value inside this member after you called pack().
  8584. * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  8585. */
  8586. pack(): Float32Array;
  8587. /**
  8588. * This is the main buffer, all elements are stored inside, you use the DynamicFloatArrayElement instance of a given element to know its location into this buffer, then you have the responsibility to perform write operations in this buffer at the right location!
  8589. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  8590. */
  8591. buffer: Float32Array;
  8592. /**
  8593. * Get the total count of entries that can fit in the current buffer
  8594. * @returns the elements count
  8595. */
  8596. totalElementCount: number;
  8597. /**
  8598. * Get the count of free entries that can still be allocated without resizing the buffer
  8599. * @returns the free elements count
  8600. */
  8601. freeElementCount: number;
  8602. /**
  8603. * Get the count of allocated elements
  8604. * @returns the allocated elements count
  8605. */
  8606. usedElementCount: number;
  8607. /**
  8608. * Return the size of one element in float
  8609. * @returns the size in float
  8610. */
  8611. stride: number;
  8612. compareValueOffset: number;
  8613. sortingAscending: boolean;
  8614. sort(): boolean;
  8615. }
  8616. }
  8617. declare module Earcut {
  8618. /**
  8619. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  8620. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  8621. * @param holeIndices is an array of hole indices if any (e.g. [5, 8] for a 12- vertice input would mean one hole with vertices 5–7 and another with 8–11).
  8622. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  8623. */
  8624. function earcut(data: number[], holeIndices: number[], dim: number): any[];
  8625. /**
  8626. * return a percentage difference between the polygon area and its triangulation area;
  8627. * used to verify correctness of triangulation
  8628. */
  8629. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  8630. /**
  8631. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  8632. */
  8633. function flatten(data: number[][][]): {
  8634. vertices: any[];
  8635. holes: any[];
  8636. dimensions: number;
  8637. };
  8638. }
  8639. declare module BABYLON {
  8640. class FilesInput {
  8641. static FilesTextures: any[];
  8642. static FilesToLoad: any[];
  8643. 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);
  8644. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  8645. private renderFunction();
  8646. private drag(e);
  8647. private drop(eventDrop);
  8648. loadFiles(event: any): void;
  8649. reload(): void;
  8650. }
  8651. }
  8652. declare module BABYLON {
  8653. class Gamepads {
  8654. private babylonGamepads;
  8655. private oneGamepadConnected;
  8656. private isMonitoring;
  8657. private gamepadEventSupported;
  8658. private gamepadSupportAvailable;
  8659. private static gamepadDOMInfo;
  8660. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  8661. dispose(): void;
  8662. }
  8663. class StickValues {
  8664. x: any;
  8665. y: any;
  8666. constructor(x: any, y: any);
  8667. }
  8668. class Gamepad {
  8669. id: string;
  8670. index: number;
  8671. browserGamepad: any;
  8672. constructor(id: string, index: number, browserGamepad: any);
  8673. onleftstickchanged(callback: (values: StickValues) => void): void;
  8674. onrightstickchanged(callback: (values: StickValues) => void): void;
  8675. leftStick: StickValues;
  8676. rightStick: StickValues;
  8677. update(): void;
  8678. }
  8679. class GenericPad extends Gamepad {
  8680. id: string;
  8681. index: number;
  8682. gamepad: any;
  8683. onbuttondown(callback: (buttonPressed: number) => void): void;
  8684. onbuttonup(callback: (buttonReleased: number) => void): void;
  8685. constructor(id: string, index: number, gamepad: any);
  8686. update(): void;
  8687. }
  8688. enum Xbox360Button {
  8689. A = 0,
  8690. B = 1,
  8691. X = 2,
  8692. Y = 3,
  8693. Start = 4,
  8694. Back = 5,
  8695. LB = 6,
  8696. RB = 7,
  8697. LeftStick = 8,
  8698. RightStick = 9,
  8699. }
  8700. enum Xbox360Dpad {
  8701. Up = 0,
  8702. Down = 1,
  8703. Left = 2,
  8704. Right = 3,
  8705. }
  8706. class Xbox360Pad extends Gamepad {
  8707. onlefttriggerchanged(callback: (value: number) => void): void;
  8708. onrighttriggerchanged(callback: (value: number) => void): void;
  8709. leftTrigger: number;
  8710. rightTrigger: number;
  8711. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  8712. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  8713. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  8714. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  8715. buttonA: number;
  8716. buttonB: number;
  8717. buttonX: number;
  8718. buttonY: number;
  8719. buttonStart: number;
  8720. buttonBack: number;
  8721. buttonLB: number;
  8722. buttonRB: number;
  8723. buttonLeftStick: number;
  8724. buttonRightStick: number;
  8725. dPadUp: number;
  8726. dPadDown: number;
  8727. dPadLeft: number;
  8728. dPadRight: number;
  8729. update(): void;
  8730. }
  8731. }
  8732. interface Navigator {
  8733. getGamepads(func?: any): any;
  8734. webkitGetGamepads(func?: any): any;
  8735. msGetGamepads(func?: any): any;
  8736. webkitGamepads(func?: any): any;
  8737. }
  8738. declare module BABYLON {
  8739. interface ILoadingScreen {
  8740. displayLoadingUI: () => void;
  8741. hideLoadingUI: () => void;
  8742. loadingUIBackgroundColor: string;
  8743. loadingUIText: string;
  8744. }
  8745. class DefaultLoadingScreen implements ILoadingScreen {
  8746. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  8747. displayLoadingUI(): void;
  8748. hideLoadingUI(): void;
  8749. loadingUIText: string;
  8750. loadingUIBackgroundColor: string;
  8751. }
  8752. }
  8753. declare module BABYLON {
  8754. /**
  8755. * A class serves as a medium between the observable and its observers
  8756. */
  8757. class EventState {
  8758. /**
  8759. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  8760. */
  8761. constructor(mask: number, skipNextObservers?: boolean);
  8762. initalize(mask: number, skipNextObservers?: boolean): EventState;
  8763. /**
  8764. * An Observer can set this property to true to prevent subsequent observers of being notified
  8765. */
  8766. skipNextObservers: boolean;
  8767. /**
  8768. * Get the mask value that were used to trigger the event corresponding to this EventState object
  8769. */
  8770. mask: number;
  8771. }
  8772. /**
  8773. * Represent an Observer registered to a given Observable object.
  8774. */
  8775. class Observer<T> {
  8776. callback: (eventData: T, eventState: EventState) => void;
  8777. mask: number;
  8778. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  8779. }
  8780. /**
  8781. * The Observable class is a simple implementation of the Observable pattern.
  8782. * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
  8783. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  8784. * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
  8785. * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
  8786. */
  8787. class Observable<T> {
  8788. constructor();
  8789. /**
  8790. * Create a new Observer with the specified callback
  8791. * @param callback the callback that will be executed for that Observer
  8792. * @param mask the mask used to filter observers
  8793. * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
  8794. */
  8795. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  8796. /**
  8797. * Remove an Observer from the Observable object
  8798. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  8799. */
  8800. remove(observer: Observer<T>): boolean;
  8801. /**
  8802. * Remove a callback from the Observable object
  8803. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  8804. */
  8805. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  8806. /**
  8807. * Notify all Observers by calling their respective callback with the given data
  8808. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  8809. * @param eventData
  8810. * @param mask
  8811. */
  8812. notifyObservers(eventData: T, mask?: number): boolean;
  8813. /**
  8814. * return true is the Observable has at least one Observer registered
  8815. */
  8816. hasObservers(): boolean;
  8817. /**
  8818. * Clear the list of observers
  8819. */
  8820. clear(): void;
  8821. /**
  8822. * Clone the current observable
  8823. */
  8824. clone(): Observable<T>;
  8825. }
  8826. }
  8827. declare module BABYLON {
  8828. /**
  8829. * This class describe a rectangle that were added to the map.
  8830. * You have access to its coordinates either in pixel or normalized (UV)
  8831. */
  8832. class PackedRect {
  8833. constructor(root: PackedRect, parent: PackedRect, pos: Vector2, size: Size);
  8834. /**
  8835. * @returns the position of this node into the map
  8836. */
  8837. pos: Vector2;
  8838. /**
  8839. * @returns the size of the rectangle this node handles
  8840. */
  8841. contentSize: Size;
  8842. /**
  8843. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  8844. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  8845. */
  8846. UVs: Vector2[];
  8847. /**
  8848. * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations) and then using only a part of the PackRect.
  8849. * This method will return the UVs for this part by given the custom size of what you really use
  8850. * @param customSize must be less/equal to the allocated size, UV will be compute from this
  8851. */
  8852. getUVsForCustomSize(customSize: Size): Vector2[];
  8853. /**
  8854. * Free this rectangle from the map.
  8855. * Call this method when you no longer need the rectangle to be in the map.
  8856. */
  8857. freeContent(): void;
  8858. protected isUsed: boolean;
  8859. protected findAndSplitNode(contentSize: Size): PackedRect;
  8860. private findNode(size);
  8861. private splitNode(contentSize);
  8862. private attemptDefrag();
  8863. private clearNode();
  8864. private isRecursiveFree;
  8865. protected evalFreeSize(size: number): number;
  8866. }
  8867. /**
  8868. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
  8869. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  8870. * Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
  8871. */
  8872. class RectPackingMap extends PackedRect {
  8873. /**
  8874. * Create an instance of the object with a dimension using the given size
  8875. * @param size The dimension of the rectangle that will contain all the sub ones.
  8876. */
  8877. constructor(size: Size);
  8878. /**
  8879. * Add a rectangle, finding the best location to store it into the map
  8880. * @param size the dimension of the rectangle to store
  8881. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  8882. */
  8883. addRect(size: Size): PackedRect;
  8884. /**
  8885. * Return the current space free normalized between [0;1]
  8886. * @returns {}
  8887. */
  8888. freeSpace: number;
  8889. }
  8890. }
  8891. declare module BABYLON {
  8892. class SceneOptimization {
  8893. priority: number;
  8894. apply: (scene: Scene) => boolean;
  8895. constructor(priority?: number);
  8896. }
  8897. class TextureOptimization extends SceneOptimization {
  8898. priority: number;
  8899. maximumSize: number;
  8900. constructor(priority?: number, maximumSize?: number);
  8901. apply: (scene: Scene) => boolean;
  8902. }
  8903. class HardwareScalingOptimization extends SceneOptimization {
  8904. priority: number;
  8905. maximumScale: number;
  8906. constructor(priority?: number, maximumScale?: number);
  8907. apply: (scene: Scene) => boolean;
  8908. }
  8909. class ShadowsOptimization extends SceneOptimization {
  8910. apply: (scene: Scene) => boolean;
  8911. }
  8912. class PostProcessesOptimization extends SceneOptimization {
  8913. apply: (scene: Scene) => boolean;
  8914. }
  8915. class LensFlaresOptimization extends SceneOptimization {
  8916. apply: (scene: Scene) => boolean;
  8917. }
  8918. class ParticlesOptimization extends SceneOptimization {
  8919. apply: (scene: Scene) => boolean;
  8920. }
  8921. class RenderTargetsOptimization extends SceneOptimization {
  8922. apply: (scene: Scene) => boolean;
  8923. }
  8924. class MergeMeshesOptimization extends SceneOptimization {
  8925. static UpdateSelectionTree: boolean;
  8926. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  8927. }
  8928. class SceneOptimizerOptions {
  8929. targetFrameRate: number;
  8930. trackerDuration: number;
  8931. optimizations: SceneOptimization[];
  8932. constructor(targetFrameRate?: number, trackerDuration?: number);
  8933. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8934. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8935. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8936. }
  8937. class SceneOptimizer {
  8938. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  8939. }
  8940. }
  8941. declare module BABYLON {
  8942. class SceneSerializer {
  8943. static ClearCache(): void;
  8944. static Serialize(scene: Scene): any;
  8945. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  8946. }
  8947. }
  8948. declare module BABYLON {
  8949. class SmartArray<T> {
  8950. data: Array<T>;
  8951. length: number;
  8952. constructor(capacity: number);
  8953. push(value: any): void;
  8954. pushNoDuplicate(value: any): boolean;
  8955. sort(compareFn: any): void;
  8956. reset(): void;
  8957. concat(array: any): void;
  8958. concatWithNoDuplicate(array: any): void;
  8959. indexOf(value: any): number;
  8960. }
  8961. }
  8962. declare module BABYLON {
  8963. /**
  8964. * This class implement a typical dictionary using a string as key and the generic type T as value.
  8965. * The underlying implementation relies on an associative array to ensure the best performances.
  8966. * The value can be anything including 'null' but except 'undefined'
  8967. */
  8968. class StringDictionary<T> {
  8969. /**
  8970. * This will clear this dictionary and copy the content from the 'source' one.
  8971. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  8972. * @param source the dictionary to take the content from and copy to this dictionary
  8973. */
  8974. copyFrom(source: StringDictionary<T>): void;
  8975. /**
  8976. * Get a value based from its key
  8977. * @param key the given key to get the matching value from
  8978. * @return the value if found, otherwise undefined is returned
  8979. */
  8980. get(key: string): T;
  8981. /**
  8982. * Get a value from its key or add it if it doesn't exist.
  8983. * This method will ensure you that a given key/data will be present in the dictionary.
  8984. * @param key the given key to get the matching value from
  8985. * @param factory the factory that will create the value if the key is not present in the dictionary.
  8986. * The factory will only be invoked if there's no data for the given key.
  8987. * @return the value corresponding to the key.
  8988. */
  8989. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  8990. /**
  8991. * Get a value from its key if present in the dictionary otherwise add it
  8992. * @param key the key to get the value from
  8993. * @param val if there's no such key/value pair in the dictionary add it with this value
  8994. * @return the value corresponding to the key
  8995. */
  8996. getOrAdd(key: string, val: T): T;
  8997. /**
  8998. * Check if there's a given key in the dictionary
  8999. * @param key the key to check for
  9000. * @return true if the key is present, false otherwise
  9001. */
  9002. contains(key: any): boolean;
  9003. /**
  9004. * Add a new key and its corresponding value
  9005. * @param key the key to add
  9006. * @param value the value corresponding to the key
  9007. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  9008. */
  9009. add(key: string, value: T): boolean;
  9010. set(key: string, value: T): boolean;
  9011. /**
  9012. * Get the element of the given key and remove it from the dictionary
  9013. * @param key
  9014. */
  9015. getAndRemove(key: string): T;
  9016. /**
  9017. * Remove a key/value from the dictionary.
  9018. * @param key the key to remove
  9019. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  9020. */
  9021. remove(key: string): boolean;
  9022. /**
  9023. * Clear the whole content of the dictionary
  9024. */
  9025. clear(): void;
  9026. count: number;
  9027. /**
  9028. * Execute a callback on each key/val of the dictionary.
  9029. * Note that you can remove any element in this dictionary in the callback implementation
  9030. * @param callback the callback to execute on a given key/value pair
  9031. */
  9032. forEach(callback: (key: string, val: T) => void): void;
  9033. /**
  9034. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  9035. * If the callback returns null or undefined the method will iterate to the next key/value pair
  9036. * Note that you can remove any element in this dictionary in the callback implementation
  9037. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  9038. */
  9039. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  9040. }
  9041. }
  9042. declare module BABYLON {
  9043. class Tags {
  9044. static EnableFor(obj: any): void;
  9045. static DisableFor(obj: any): void;
  9046. static HasTags(obj: any): boolean;
  9047. static GetTags(obj: any, asString?: boolean): any;
  9048. static AddTagsTo(obj: any, tagsString: string): void;
  9049. static RemoveTagsFrom(obj: any, tagsString: string): void;
  9050. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  9051. }
  9052. }
  9053. declare module BABYLON.Internals {
  9054. interface DDSInfo {
  9055. width: number;
  9056. height: number;
  9057. mipmapCount: number;
  9058. isFourCC: boolean;
  9059. isRGB: boolean;
  9060. isLuminance: boolean;
  9061. isCube: boolean;
  9062. }
  9063. class DDSTools {
  9064. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  9065. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  9066. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  9067. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  9068. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  9069. }
  9070. }
  9071. declare module BABYLON.Internals {
  9072. class TGATools {
  9073. static GetTGAHeader(data: Uint8Array): any;
  9074. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  9075. }
  9076. }
  9077. declare module BABYLON {
  9078. interface IAnimatable {
  9079. animations: Array<Animation>;
  9080. }
  9081. class Tools {
  9082. static BaseUrl: string;
  9083. static CorsBehavior: any;
  9084. static UseFallbackTexture: boolean;
  9085. static Instantiate(className: string): any;
  9086. static SetImmediate(action: () => void): void;
  9087. static IsExponentOfTwo(value: number): boolean;
  9088. static GetExponentOfTwo(value: number, max: number): number;
  9089. static GetFilename(path: string): string;
  9090. static GetDOMTextContent(element: HTMLElement): string;
  9091. static ToDegrees(angle: number): number;
  9092. static ToRadians(angle: number): number;
  9093. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  9094. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number, bias?: Vector2): {
  9095. minimum: Vector3;
  9096. maximum: Vector3;
  9097. };
  9098. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
  9099. minimum: Vector3;
  9100. maximum: Vector3;
  9101. };
  9102. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i) => Vector2;
  9103. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
  9104. minimum: Vector2;
  9105. maximum: Vector2;
  9106. };
  9107. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  9108. static GetPointerPrefix(): string;
  9109. /**
  9110. * @param func - the function to be called
  9111. * @param requester - the object that will request the next frame. Falls back to window.
  9112. */
  9113. static QueueNewFrame(func: any, requester?: any): void;
  9114. static RequestFullscreen(element: any): void;
  9115. static ExitFullscreen(): void;
  9116. static SetCorsBehavior(url: string, img: HTMLImageElement): string;
  9117. static CleanUrl(url: string): string;
  9118. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  9119. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  9120. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  9121. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  9122. static FileAsURL(content: string): string;
  9123. static Format(value: number, decimals?: number): string;
  9124. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  9125. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  9126. static IsEmpty(obj: any): boolean;
  9127. static RegisterTopRootEvents(events: {
  9128. name: string;
  9129. handler: EventListener;
  9130. }[]): void;
  9131. static UnregisterTopRootEvents(events: {
  9132. name: string;
  9133. handler: EventListener;
  9134. }[]): void;
  9135. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
  9136. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
  9137. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  9138. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  9139. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  9140. /**
  9141. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  9142. * Be aware Math.random() could cause collisions, but:
  9143. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  9144. */
  9145. static RandomId(): string;
  9146. static errorsCount: number;
  9147. static OnNewCacheEntry: (entry: string) => void;
  9148. static NoneLogLevel: number;
  9149. static MessageLogLevel: number;
  9150. static WarningLogLevel: number;
  9151. static ErrorLogLevel: number;
  9152. static AllLogLevel: number;
  9153. static Log: (message: string) => void;
  9154. static Warn: (message: string) => void;
  9155. static Error: (message: string) => void;
  9156. static LogCache: string;
  9157. static ClearLogCache(): void;
  9158. static LogLevels: number;
  9159. static PerformanceNoneLogLevel: number;
  9160. static PerformanceUserMarkLogLevel: number;
  9161. static PerformanceConsoleLogLevel: number;
  9162. static PerformanceLogLevel: number;
  9163. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  9164. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  9165. static Now: number;
  9166. /**
  9167. * This method will return the name of the class used to create the instance of the given object.
  9168. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  9169. * @param object the object to get the class name from
  9170. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  9171. */
  9172. static getClassName(object: any, isType?: boolean): string;
  9173. static first<T>(array: Array<T>, predicate: (item) => boolean): T;
  9174. /**
  9175. * This method will return the name of the full name of the class, including its owning module (if any).
  9176. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).
  9177. * @param object the object to get the class name from
  9178. * @return a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.
  9179. */
  9180. static getFullClassName(object: any, isType?: boolean): string;
  9181. /**
  9182. * This method can be used with hashCodeFromStream when your input is an array of values that are either: number, string, boolean or custom type implementing the getHashCode():number method.
  9183. * @param array
  9184. */
  9185. static arrayOrStringFeeder(array: any): (i) => number;
  9186. /**
  9187. * Compute the hashCode of a stream of number
  9188. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  9189. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  9190. * @return the hash code computed
  9191. */
  9192. static hashCodeFromStream(feeder: (index: number) => number): number;
  9193. }
  9194. /**
  9195. * This class is used to track a performance counter which is number based.
  9196. * The user has access to many properties which give statistics of different nature
  9197. *
  9198. * The implementer can track two kinds of Performance Counter: time and count
  9199. * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
  9200. * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
  9201. */
  9202. class PerfCounter {
  9203. /**
  9204. * Returns the smallest value ever
  9205. */
  9206. min: number;
  9207. /**
  9208. * Returns the biggest value ever
  9209. */
  9210. max: number;
  9211. /**
  9212. * Returns the average value since the performance counter is running
  9213. */
  9214. average: number;
  9215. /**
  9216. * Returns the average value of the last second the counter was monitored
  9217. */
  9218. lastSecAverage: number;
  9219. /**
  9220. * Returns the current value
  9221. */
  9222. current: number;
  9223. total: number;
  9224. constructor();
  9225. /**
  9226. * Call this method to start monitoring a new frame.
  9227. * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
  9228. */
  9229. fetchNewFrame(): void;
  9230. /**
  9231. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  9232. * @param newCount the count value to add to the monitored count
  9233. * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
  9234. */
  9235. addCount(newCount: number, fetchResult: boolean): void;
  9236. /**
  9237. * Start monitoring this performance counter
  9238. */
  9239. beginMonitoring(): void;
  9240. /**
  9241. * Compute the time lapsed since the previous beginMonitoring() call.
  9242. * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
  9243. */
  9244. endMonitoring(newFrame?: boolean): void;
  9245. }
  9246. /**
  9247. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  9248. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  9249. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  9250. * @param name The name of the class, case should be preserved
  9251. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  9252. */
  9253. function className(name: string, module?: string): (target: Object) => void;
  9254. /**
  9255. * An implementation of a loop for asynchronous functions.
  9256. */
  9257. class AsyncLoop {
  9258. iterations: number;
  9259. index: number;
  9260. /**
  9261. * Constroctor.
  9262. * @param iterations the number of iterations.
  9263. * @param _fn the function to run each iteration
  9264. * @param _successCallback the callback that will be called upon succesful execution
  9265. * @param offset starting offset.
  9266. */
  9267. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  9268. /**
  9269. * Execute the next iteration. Must be called after the last iteration was finished.
  9270. */
  9271. executeNext(): void;
  9272. /**
  9273. * Break the loop and run the success callback.
  9274. */
  9275. breakLoop(): void;
  9276. /**
  9277. * Helper function
  9278. */
  9279. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  9280. /**
  9281. * A for-loop that will run a given number of iterations synchronous and the rest async.
  9282. * @param iterations total number of iterations
  9283. * @param syncedIterations number of synchronous iterations in each async iteration.
  9284. * @param fn the function to call each iteration.
  9285. * @param callback a success call back that will be called when iterating stops.
  9286. * @param breakFunction a break condition (optional)
  9287. * @param timeout timeout settings for the setTimeout function. default - 0.
  9288. * @constructor
  9289. */
  9290. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  9291. }
  9292. }
  9293. declare module BABYLON {
  9294. enum JoystickAxis {
  9295. X = 0,
  9296. Y = 1,
  9297. Z = 2,
  9298. }
  9299. class VirtualJoystick {
  9300. reverseLeftRight: boolean;
  9301. reverseUpDown: boolean;
  9302. deltaPosition: Vector3;
  9303. pressed: boolean;
  9304. private static vjCanvas;
  9305. private static vjCanvasContext;
  9306. private static vjCanvasWidth;
  9307. private static vjCanvasHeight;
  9308. private static halfWidth;
  9309. private static halfHeight;
  9310. constructor(leftJoystick?: boolean);
  9311. setJoystickSensibility(newJoystickSensibility: number): void;
  9312. /**
  9313. * Change the color of the virtual joystick
  9314. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  9315. */
  9316. setJoystickColor(newColor: string): void;
  9317. setActionOnTouch(action: () => any): void;
  9318. setAxisForLeftRight(axis: JoystickAxis): void;
  9319. setAxisForUpDown(axis: JoystickAxis): void;
  9320. releaseCanvas(): void;
  9321. }
  9322. }
  9323. declare module BABYLON {
  9324. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  9325. camera: ArcRotateCamera;
  9326. gamepad: Gamepad;
  9327. gamepadRotationSensibility: number;
  9328. gamepadMoveSensibility: number;
  9329. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9330. detachControl(element: HTMLElement): void;
  9331. checkInputs(): void;
  9332. getTypeName(): string;
  9333. getSimpleName(): string;
  9334. }
  9335. }
  9336. declare module BABYLON {
  9337. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  9338. camera: ArcRotateCamera;
  9339. keysUp: number[];
  9340. keysDown: number[];
  9341. keysLeft: number[];
  9342. keysRight: number[];
  9343. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9344. detachControl(element: HTMLElement): void;
  9345. checkInputs(): void;
  9346. getTypeName(): string;
  9347. getSimpleName(): string;
  9348. }
  9349. }
  9350. declare module BABYLON {
  9351. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  9352. camera: ArcRotateCamera;
  9353. wheelPrecision: number;
  9354. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9355. detachControl(element: HTMLElement): void;
  9356. getTypeName(): string;
  9357. getSimpleName(): string;
  9358. }
  9359. }
  9360. declare module BABYLON {
  9361. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  9362. camera: ArcRotateCamera;
  9363. buttons: number[];
  9364. angularSensibilityX: number;
  9365. angularSensibilityY: number;
  9366. pinchPrecision: number;
  9367. panningSensibility: number;
  9368. pinchInwards: boolean;
  9369. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9370. detachControl(element: HTMLElement): void;
  9371. getTypeName(): string;
  9372. getSimpleName(): string;
  9373. }
  9374. }
  9375. declare module BABYLON {
  9376. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  9377. camera: ArcRotateCamera;
  9378. alphaCorrection: number;
  9379. betaCorrection: number;
  9380. gammaCorrection: number;
  9381. constructor();
  9382. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9383. checkInputs(): void;
  9384. detachControl(element: HTMLElement): void;
  9385. getTypeName(): string;
  9386. getSimpleName(): string;
  9387. }
  9388. }
  9389. declare module BABYLON {
  9390. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  9391. constructor();
  9392. camera: FreeCamera;
  9393. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9394. detachControl(element: HTMLElement): void;
  9395. checkInputs(): void;
  9396. getTypeName(): string;
  9397. getSimpleName(): string;
  9398. }
  9399. }
  9400. declare module BABYLON {
  9401. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  9402. camera: FreeCamera;
  9403. gamepad: Gamepad;
  9404. gamepadAngularSensibility: number;
  9405. gamepadMoveSensibility: number;
  9406. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9407. detachControl(element: HTMLElement): void;
  9408. checkInputs(): void;
  9409. getTypeName(): string;
  9410. getSimpleName(): string;
  9411. }
  9412. }
  9413. declare module BABYLON {
  9414. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  9415. camera: FreeCamera;
  9416. keysUp: number[];
  9417. keysDown: number[];
  9418. keysLeft: number[];
  9419. keysRight: number[];
  9420. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9421. detachControl(element: HTMLElement): void;
  9422. checkInputs(): void;
  9423. getTypeName(): string;
  9424. getSimpleName(): string;
  9425. }
  9426. }
  9427. declare module BABYLON {
  9428. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  9429. touchEnabled: boolean;
  9430. camera: FreeCamera;
  9431. buttons: number[];
  9432. angularSensibility: number;
  9433. private previousPosition;
  9434. constructor(touchEnabled?: boolean);
  9435. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9436. detachControl(element: HTMLElement): void;
  9437. getTypeName(): string;
  9438. getSimpleName(): string;
  9439. }
  9440. }
  9441. declare module BABYLON {
  9442. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  9443. camera: FreeCamera;
  9444. touchAngularSensibility: number;
  9445. touchMoveSensibility: number;
  9446. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9447. detachControl(element: HTMLElement): void;
  9448. checkInputs(): void;
  9449. getTypeName(): string;
  9450. getSimpleName(): string;
  9451. }
  9452. }
  9453. declare module BABYLON {
  9454. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  9455. camera: FreeCamera;
  9456. getLeftJoystick(): VirtualJoystick;
  9457. getRightJoystick(): VirtualJoystick;
  9458. checkInputs(): void;
  9459. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9460. detachControl(element: HTMLElement): void;
  9461. getTypeName(): string;
  9462. getSimpleName(): string;
  9463. }
  9464. }
  9465. declare module BABYLON {
  9466. class VRCameraMetrics {
  9467. hResolution: number;
  9468. vResolution: number;
  9469. hScreenSize: number;
  9470. vScreenSize: number;
  9471. vScreenCenter: number;
  9472. eyeToScreenDistance: number;
  9473. lensSeparationDistance: number;
  9474. interpupillaryDistance: number;
  9475. distortionK: number[];
  9476. chromaAbCorrection: number[];
  9477. postProcessScaleFactor: number;
  9478. lensCenterOffset: number;
  9479. compensateDistortion: boolean;
  9480. aspectRatio: number;
  9481. aspectRatioFov: number;
  9482. leftHMatrix: Matrix;
  9483. rightHMatrix: Matrix;
  9484. leftPreViewMatrix: Matrix;
  9485. rightPreViewMatrix: Matrix;
  9486. static GetDefault(): VRCameraMetrics;
  9487. }
  9488. }
  9489. declare module BABYLON {
  9490. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  9491. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  9492. getTypeName(): string;
  9493. }
  9494. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  9495. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  9496. getTypeName(): string;
  9497. }
  9498. }
  9499. declare var HMDVRDevice: any;
  9500. declare var VRDisplay: any;
  9501. declare var VRFrameData: any;
  9502. declare module BABYLON {
  9503. interface WebVROptions {
  9504. trackPosition?: boolean;
  9505. positionScale?: number;
  9506. displayName?: string;
  9507. }
  9508. class WebVRFreeCamera extends FreeCamera {
  9509. private webVROptions;
  9510. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, webVROptions?: WebVROptions);
  9511. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9512. detachControl(element: HTMLElement): void;
  9513. requestVRFullscreen(requestPointerlock: boolean): void;
  9514. getTypeName(): string;
  9515. resetToCurrentRotation(): void;
  9516. /**
  9517. *
  9518. * Set the position offset of the VR camera
  9519. * The offset will be added to the WebVR pose, after scaling it (if set).
  9520. *
  9521. * @param {Vector3} [newPosition] an optional new position. if not provided, the current camera position will be used.
  9522. *
  9523. * @memberOf WebVRFreeCamera
  9524. */
  9525. setPositionOffset(newPosition?: Vector3): void;
  9526. }
  9527. }
  9528. declare module BABYLON {
  9529. interface IOctreeContainer<T> {
  9530. blocks: Array<OctreeBlock<T>>;
  9531. }
  9532. class Octree<T> {
  9533. maxDepth: number;
  9534. blocks: Array<OctreeBlock<T>>;
  9535. dynamicContent: T[];
  9536. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  9537. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  9538. addMesh(entry: T): void;
  9539. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  9540. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  9541. intersectsRay(ray: Ray): SmartArray<T>;
  9542. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  9543. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  9544. }
  9545. }
  9546. declare module BABYLON {
  9547. class OctreeBlock<T> {
  9548. entries: T[];
  9549. blocks: Array<OctreeBlock<T>>;
  9550. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  9551. capacity: number;
  9552. minPoint: Vector3;
  9553. maxPoint: Vector3;
  9554. addEntry(entry: T): void;
  9555. addEntries(entries: T[]): void;
  9556. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  9557. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  9558. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  9559. createInnerBlocks(): void;
  9560. }
  9561. }
  9562. declare module BABYLON {
  9563. interface IShadowGenerator {
  9564. getShadowMap(): RenderTargetTexture;
  9565. dispose(): void;
  9566. }
  9567. class ShadowGenerator implements IShadowGenerator {
  9568. static FILTER_NONE: number;
  9569. static FILTER_VARIANCESHADOWMAP: number;
  9570. static FILTER_POISSONSAMPLING: number;
  9571. static FILTER_BLURVARIANCESHADOWMAP: number;
  9572. blurScale: number;
  9573. forceBackFacesOnly: boolean;
  9574. bias: number;
  9575. blurBoxOffset: number;
  9576. filter: number;
  9577. useVarianceShadowMap: boolean;
  9578. usePoissonSampling: boolean;
  9579. useBlurVarianceShadowMap: boolean;
  9580. constructor(mapSize: number, light: IShadowLight);
  9581. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9582. getShadowMap(): RenderTargetTexture;
  9583. getShadowMapForRendering(): RenderTargetTexture;
  9584. getLight(): IShadowLight;
  9585. getTransformMatrix(): Matrix;
  9586. getDarkness(): number;
  9587. setDarkness(darkness: number): void;
  9588. setTransparencyShadow(hasShadow: boolean): void;
  9589. dispose(): void;
  9590. serialize(): any;
  9591. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  9592. }
  9593. }
  9594. declare module BABYLON.Internals {
  9595. }
  9596. declare module BABYLON {
  9597. class BaseTexture {
  9598. name: string;
  9599. hasAlpha: boolean;
  9600. getAlphaFromRGB: boolean;
  9601. level: number;
  9602. coordinatesIndex: number;
  9603. coordinatesMode: number;
  9604. wrapU: number;
  9605. wrapV: number;
  9606. anisotropicFilteringLevel: number;
  9607. isCube: boolean;
  9608. isRenderTarget: boolean;
  9609. uid: string;
  9610. toString(): string;
  9611. animations: Animation[];
  9612. /**
  9613. * An event triggered when the texture is disposed.
  9614. * @type {BABYLON.Observable}
  9615. */
  9616. onDisposeObservable: Observable<BaseTexture>;
  9617. onDispose: () => void;
  9618. delayLoadState: number;
  9619. constructor(scene: Scene);
  9620. getScene(): Scene;
  9621. getTextureMatrix(): Matrix;
  9622. getReflectionTextureMatrix(): Matrix;
  9623. getInternalTexture(): WebGLTexture;
  9624. isReady(): boolean;
  9625. getSize(): ISize;
  9626. getBaseSize(): ISize;
  9627. scale(ratio: number): void;
  9628. canRescale: boolean;
  9629. delayLoad(): void;
  9630. clone(): BaseTexture;
  9631. releaseInternalTexture(): void;
  9632. dispose(): void;
  9633. serialize(): any;
  9634. }
  9635. }
  9636. declare module BABYLON {
  9637. /**
  9638. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  9639. * It can help converting any input color in a desired output one. This can then be used to create effects
  9640. * from sepia, black and white to sixties or futuristic rendering...
  9641. *
  9642. * The only supported format is currently 3dl.
  9643. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  9644. */
  9645. class ColorGradingTexture extends BaseTexture {
  9646. /**
  9647. * The current internal texture size.
  9648. */
  9649. /**
  9650. * The current texture matrix. (will always be identity in color grading texture)
  9651. */
  9652. /**
  9653. * The texture URL.
  9654. */
  9655. url: string;
  9656. /**
  9657. * Empty line regex stored for GC.
  9658. */
  9659. /**
  9660. * Instantiates a ColorGradingTexture from the following parameters.
  9661. *
  9662. * @param url The location of the color gradind data (currently only supporting 3dl)
  9663. * @param scene The scene the texture will be used in
  9664. */
  9665. constructor(url: string, scene: Scene);
  9666. /**
  9667. * Returns the texture matrix used in most of the material.
  9668. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  9669. */
  9670. getTextureMatrix(): Matrix;
  9671. /**
  9672. * Occurs when the file being loaded is a .3dl LUT file.
  9673. */
  9674. private load3dlTexture();
  9675. /**
  9676. * Starts the loading process of the texture.
  9677. */
  9678. private loadTexture();
  9679. /**
  9680. * Clones the color gradind texture.
  9681. */
  9682. clone(): ColorGradingTexture;
  9683. /**
  9684. * Called during delayed load for textures.
  9685. */
  9686. delayLoad(): void;
  9687. /**
  9688. * Binds the color grading to the shader.
  9689. * @param colorGrading The texture to bind
  9690. * @param effect The effect to bind to
  9691. */
  9692. static Bind(colorGrading: BaseTexture, effect: Effect): void;
  9693. /**
  9694. * Prepare the list of uniforms associated with the ColorGrading effects.
  9695. * @param uniformsList The list of uniforms used in the effect
  9696. * @param samplersList The list of samplers used in the effect
  9697. */
  9698. static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
  9699. /**
  9700. * Parses a color grading texture serialized by Babylon.
  9701. * @param parsedTexture The texture information being parsedTexture
  9702. * @param scene The scene to load the texture in
  9703. * @param rootUrl The root url of the data assets to load
  9704. * @return A color gradind texture
  9705. */
  9706. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
  9707. /**
  9708. * Serializes the LUT texture to json format.
  9709. */
  9710. serialize(): any;
  9711. }
  9712. }
  9713. declare module BABYLON {
  9714. class CubeTexture extends BaseTexture {
  9715. url: string;
  9716. coordinatesMode: number;
  9717. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  9718. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void);
  9719. delayLoad(): void;
  9720. getReflectionTextureMatrix(): Matrix;
  9721. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  9722. clone(): CubeTexture;
  9723. }
  9724. }
  9725. declare module BABYLON {
  9726. class DynamicTexture extends Texture {
  9727. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  9728. canRescale: boolean;
  9729. scale(ratio: number): void;
  9730. getContext(): CanvasRenderingContext2D;
  9731. clear(): void;
  9732. update(invertY?: boolean): void;
  9733. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  9734. clone(): DynamicTexture;
  9735. }
  9736. }
  9737. declare module BABYLON {
  9738. /**
  9739. * This class given information about a given character.
  9740. */
  9741. class CharInfo {
  9742. /**
  9743. * The normalized ([0;1]) top/left position of the character in the texture
  9744. */
  9745. topLeftUV: Vector2;
  9746. /**
  9747. * The normalized ([0;1]) right/bottom position of the character in the texture
  9748. */
  9749. bottomRightUV: Vector2;
  9750. charWidth: number;
  9751. }
  9752. class FontTexture extends Texture {
  9753. isSuperSampled: boolean;
  9754. isSignedDistanceField: boolean;
  9755. spaceWidth: number;
  9756. lineHeight: number;
  9757. static GetCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): FontTexture;
  9758. static ReleaseCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): void;
  9759. /**
  9760. * Create a new instance of the FontTexture class
  9761. * @param name the name of the texture
  9762. * @param font the font to use, use the W3C CSS notation
  9763. * @param scene the scene that owns the texture
  9764. * @param maxCharCount the approximative maximum count of characters that could fit in the texture. This is an approximation because most of the fonts are proportional (each char has its own Width). The 'W' character's width is used to compute the size of the texture based on the given maxCharCount
  9765. * @param samplingMode the texture sampling mode
  9766. * @param superSample if true the FontTexture will be created with a font of a size twice bigger than the given one but all properties (lineHeight, charWidth, etc.) will be according to the original size. This is made to improve the text quality.
  9767. */
  9768. constructor(name: string, font: string, scene: Scene, maxCharCount?: number, samplingMode?: number, superSample?: boolean, signedDistanceField?: boolean);
  9769. /**
  9770. * Make sure the given char is present in the font map.
  9771. * @param char the character to get or add
  9772. * @return the CharInfo instance corresponding to the given character
  9773. */
  9774. getChar(char: string): CharInfo;
  9775. measureText(text: string, tabulationSize?: number): Size;
  9776. private getSuperSampleFont(font);
  9777. private getFontHeight(font);
  9778. canRescale: boolean;
  9779. getContext(): CanvasRenderingContext2D;
  9780. /**
  9781. * Call this method when you've call getChar() at least one time, this will update the texture if needed.
  9782. * Don't be afraid to call it, if no new character was added, this method simply does nothing.
  9783. */
  9784. update(): void;
  9785. clone(): FontTexture;
  9786. /**
  9787. * For FontTexture retrieved using GetCachedFontTexture, use this method when you transfer this object's lifetime to another party in order to share this resource.
  9788. * When the other party is done with this object, decCachedFontTextureCounter must be called.
  9789. */
  9790. incCachedFontTextureCounter(): void;
  9791. /**
  9792. * Use this method only in conjunction with incCachedFontTextureCounter, call it when you no longer need to use this shared resource.
  9793. */
  9794. decCachedFontTextureCounter(): void;
  9795. }
  9796. }
  9797. declare module BABYLON {
  9798. /**
  9799. * This represents a texture coming from an HDR input.
  9800. *
  9801. * The only supported format is currently panorama picture stored in RGBE format.
  9802. * Example of such files can be found on HDRLib: http://hdrlib.com/
  9803. */
  9804. class HDRCubeTexture extends BaseTexture {
  9805. /**
  9806. * The texture URL.
  9807. */
  9808. url: string;
  9809. /**
  9810. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  9811. */
  9812. coordinatesMode: number;
  9813. /**
  9814. * The spherical polynomial data extracted from the texture.
  9815. */
  9816. sphericalPolynomial: SphericalPolynomial;
  9817. /**
  9818. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  9819. * This is usefull at run time to apply the good shader.
  9820. */
  9821. isPMREM: boolean;
  9822. /**
  9823. * Instantiates an HDRTexture from the following parameters.
  9824. *
  9825. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  9826. * @param scene The scene the texture will be used in
  9827. * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
  9828. * @param noMipmap Forces to not generate the mipmap if true
  9829. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  9830. * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  9831. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  9832. */
  9833. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  9834. /**
  9835. * Occurs when the file is a preprocessed .babylon.hdr file.
  9836. */
  9837. private loadBabylonTexture();
  9838. /**
  9839. * Occurs when the file is raw .hdr file.
  9840. */
  9841. private loadHDRTexture();
  9842. /**
  9843. * Starts the loading process of the texture.
  9844. */
  9845. private loadTexture();
  9846. clone(): HDRCubeTexture;
  9847. delayLoad(): void;
  9848. getReflectionTextureMatrix(): Matrix;
  9849. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  9850. serialize(): any;
  9851. /**
  9852. * Saves as a file the data contained in the texture in a binary format.
  9853. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  9854. * as the spherical used in the lighting.
  9855. * @param url The HDR file url.
  9856. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  9857. * @param onError Method called if any error happens during download.
  9858. * @return The packed binary data.
  9859. */
  9860. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  9861. /**
  9862. * Serializes the data contained in the texture in a binary format.
  9863. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  9864. * as the spherical used in the lighting.
  9865. * @param url The HDR file url.
  9866. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  9867. * @param onError Method called if any error happens during download.
  9868. * @return The packed binary data.
  9869. */
  9870. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer) => void), onError?: (() => void)): void;
  9871. }
  9872. }
  9873. declare module BABYLON {
  9874. class MapTexture extends Texture {
  9875. constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean);
  9876. /**
  9877. * Allocate a rectangle of a given size in the texture map
  9878. * @param size the size of the rectangle to allocation
  9879. * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
  9880. */
  9881. allocateRect(size: Size): PackedRect;
  9882. /**
  9883. * Free a given rectangle from the texture map
  9884. * @param rectInfo the instance corresponding to the rect to free.
  9885. */
  9886. freeRect(rectInfo: PackedRect): void;
  9887. /**
  9888. * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
  9889. * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
  9890. * @returns {}
  9891. */
  9892. freeSpace: number;
  9893. /**
  9894. * Bind the texture to the rendering engine to render in the zone of a given rectangle.
  9895. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  9896. * Don't forget to call unbindTexture when you're done rendering
  9897. * @param rect the zone to render to
  9898. * @param clear true to clear the portion's color/depth data
  9899. */
  9900. bindTextureForRect(rect: PackedRect, clear: boolean): void;
  9901. /**
  9902. * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
  9903. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  9904. * Don't forget to call unbindTexture when you're done rendering
  9905. * @param pos the position into the texture
  9906. * @param size the portion to fit the clip space to
  9907. * @param clear true to clear the portion's color/depth data
  9908. */
  9909. bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
  9910. /**
  9911. * Unbind the texture map from the rendering engine.
  9912. * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
  9913. * @param dumpForDebug if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.
  9914. */
  9915. unbindTexture(dumpForDebug?: boolean): void;
  9916. canRescale: boolean;
  9917. clone(): MapTexture;
  9918. }
  9919. }
  9920. declare module BABYLON {
  9921. class MirrorTexture extends RenderTargetTexture {
  9922. mirrorPlane: Plane;
  9923. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  9924. clone(): MirrorTexture;
  9925. serialize(): any;
  9926. }
  9927. }
  9928. declare module BABYLON {
  9929. class RawTexture extends Texture {
  9930. format: number;
  9931. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  9932. update(data: ArrayBufferView): void;
  9933. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9934. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9935. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9936. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9937. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9938. }
  9939. }
  9940. declare module BABYLON {
  9941. /**
  9942. * Creates a refraction texture used by refraction channel of the standard material.
  9943. * @param name the texture name
  9944. * @param size size of the underlying texture
  9945. * @param scene root scene
  9946. */
  9947. class RefractionTexture extends RenderTargetTexture {
  9948. refractionPlane: Plane;
  9949. depth: number;
  9950. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  9951. clone(): RefractionTexture;
  9952. serialize(): any;
  9953. }
  9954. }
  9955. declare module BABYLON {
  9956. class RenderTargetTexture extends Texture {
  9957. isCube: boolean;
  9958. static REFRESHRATE_RENDER_ONCE: number;
  9959. static REFRESHRATE_RENDER_ONEVERYFRAME: number;
  9960. static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  9961. /**
  9962. * Use this predicate to dynamically define the list of mesh you want to render.
  9963. * If set, the renderList property will be overwritten.
  9964. */
  9965. renderListPredicate: (AbstractMesh) => boolean;
  9966. /**
  9967. * Use this list to define the list of mesh you want to render.
  9968. */
  9969. renderList: AbstractMesh[];
  9970. renderParticles: boolean;
  9971. renderSprites: boolean;
  9972. coordinatesMode: number;
  9973. activeCamera: Camera;
  9974. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  9975. useCameraPostProcesses: boolean;
  9976. /**
  9977. * An event triggered when the texture is unbind.
  9978. * @type {BABYLON.Observable}
  9979. */
  9980. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  9981. onAfterUnbind: () => void;
  9982. /**
  9983. * An event triggered before rendering the texture
  9984. * @type {BABYLON.Observable}
  9985. */
  9986. onBeforeRenderObservable: Observable<number>;
  9987. onBeforeRender: (faceIndex: number) => void;
  9988. /**
  9989. * An event triggered after rendering the texture
  9990. * @type {BABYLON.Observable}
  9991. */
  9992. onAfterRenderObservable: Observable<number>;
  9993. onAfterRender: (faceIndex: number) => void;
  9994. /**
  9995. * An event triggered after the texture clear
  9996. * @type {BABYLON.Observable}
  9997. */
  9998. onClearObservable: Observable<Engine>;
  9999. onClear: (Engine: Engine) => void;
  10000. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean);
  10001. resetRefreshCounter(): void;
  10002. refreshRate: number;
  10003. isReady(): boolean;
  10004. getRenderSize(): number;
  10005. canRescale: boolean;
  10006. scale(ratio: number): void;
  10007. getReflectionTextureMatrix(): Matrix;
  10008. resize(size: any, generateMipMaps?: boolean): void;
  10009. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  10010. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], currentRenderListLength: number, useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  10011. /**
  10012. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  10013. * This allowed control for front to back rendering or reversly depending of the special needs.
  10014. *
  10015. * @param renderingGroupId The rendering group id corresponding to its index
  10016. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  10017. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  10018. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  10019. */
  10020. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  10021. /**
  10022. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  10023. *
  10024. * @param renderingGroupId The rendering group id corresponding to its index
  10025. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  10026. */
  10027. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  10028. clone(): RenderTargetTexture;
  10029. serialize(): any;
  10030. }
  10031. }
  10032. declare module BABYLON {
  10033. class Texture extends BaseTexture {
  10034. static NEAREST_SAMPLINGMODE: number;
  10035. static BILINEAR_SAMPLINGMODE: number;
  10036. static TRILINEAR_SAMPLINGMODE: number;
  10037. static EXPLICIT_MODE: number;
  10038. static SPHERICAL_MODE: number;
  10039. static PLANAR_MODE: number;
  10040. static CUBIC_MODE: number;
  10041. static PROJECTION_MODE: number;
  10042. static SKYBOX_MODE: number;
  10043. static INVCUBIC_MODE: number;
  10044. static EQUIRECTANGULAR_MODE: number;
  10045. static FIXED_EQUIRECTANGULAR_MODE: number;
  10046. static CLAMP_ADDRESSMODE: number;
  10047. static WRAP_ADDRESSMODE: number;
  10048. static MIRROR_ADDRESSMODE: number;
  10049. url: string;
  10050. uOffset: number;
  10051. vOffset: number;
  10052. uScale: number;
  10053. vScale: number;
  10054. uAng: number;
  10055. vAng: number;
  10056. wAng: number;
  10057. noMipmap: boolean;
  10058. constructor(urlOrList: string | Array<string>, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
  10059. delayLoad(): void;
  10060. updateSamplingMode(samplingMode: number): void;
  10061. getTextureMatrix(): Matrix;
  10062. getReflectionTextureMatrix(): Matrix;
  10063. clone(): Texture;
  10064. onLoadObservable: Observable<boolean>;
  10065. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  10066. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  10067. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  10068. }
  10069. }
  10070. declare module BABYLON {
  10071. class VideoTexture extends Texture {
  10072. video: HTMLVideoElement;
  10073. /**
  10074. * Creates a video texture.
  10075. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  10076. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  10077. * @param {BABYLON.Scene} scene is obviously the current scene.
  10078. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  10079. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  10080. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  10081. */
  10082. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  10083. update(): boolean;
  10084. }
  10085. }
  10086. declare module BABYLON {
  10087. class CannonJSPlugin implements IPhysicsEnginePlugin {
  10088. world: any;
  10089. name: string;
  10090. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  10091. setGravity(gravity: Vector3): void;
  10092. setTimeStep(timeStep: number): void;
  10093. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  10094. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  10095. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  10096. generatePhysicsBody(impostor: PhysicsImpostor): void;
  10097. removePhysicsBody(impostor: PhysicsImpostor): void;
  10098. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  10099. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  10100. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  10101. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  10102. isSupported(): boolean;
  10103. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  10104. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  10105. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  10106. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  10107. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  10108. sleepBody(impostor: PhysicsImpostor): void;
  10109. wakeUpBody(impostor: PhysicsImpostor): void;
  10110. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  10111. private enableMotor(joint, motorIndex?);
  10112. private disableMotor(joint, motorIndex?);
  10113. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  10114. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  10115. dispose(): void;
  10116. }
  10117. }
  10118. declare module BABYLON {
  10119. class OimoJSPlugin {
  10120. world: any;
  10121. name: string;
  10122. constructor(iterations?: number);
  10123. setGravity(gravity: Vector3): void;
  10124. setTimeStep(timeStep: number): void;
  10125. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  10126. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  10127. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  10128. generatePhysicsBody(impostor: PhysicsImpostor): void;
  10129. removePhysicsBody(impostor: PhysicsImpostor): void;
  10130. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  10131. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  10132. isSupported(): boolean;
  10133. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  10134. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  10135. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  10136. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  10137. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  10138. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  10139. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  10140. sleepBody(impostor: PhysicsImpostor): void;
  10141. wakeUpBody(impostor: PhysicsImpostor): void;
  10142. updateDistanceJoint(joint: IMotorEnabledJoint, maxDistance: number, minDistance?: number): void;
  10143. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  10144. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  10145. dispose(): void;
  10146. }
  10147. }
  10148. declare module BABYLON {
  10149. class PostProcessRenderEffect {
  10150. applyParameters: (postProcess: PostProcess) => void;
  10151. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  10152. isSupported: boolean;
  10153. addPass(renderPass: PostProcessRenderPass): void;
  10154. removePass(renderPass: PostProcessRenderPass): void;
  10155. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  10156. getPass(passName: string): void;
  10157. emptyPasses(): void;
  10158. getPostProcess(camera?: Camera): PostProcess;
  10159. }
  10160. }
  10161. declare module BABYLON {
  10162. class PostProcessRenderPass {
  10163. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  10164. setRenderList(renderList: Mesh[]): void;
  10165. getRenderTexture(): RenderTargetTexture;
  10166. }
  10167. }
  10168. declare module BABYLON {
  10169. class PostProcessRenderPipeline {
  10170. private static PASS_EFFECT_NAME;
  10171. private static PASS_SAMPLER_NAME;
  10172. constructor(engine: Engine, name: string);
  10173. isSupported: boolean;
  10174. addEffect(renderEffect: PostProcessRenderEffect): void;
  10175. dispose(): void;
  10176. }
  10177. }
  10178. declare module BABYLON {
  10179. class PostProcessRenderPipelineManager {
  10180. constructor();
  10181. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  10182. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  10183. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  10184. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  10185. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  10186. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  10187. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  10188. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  10189. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  10190. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  10191. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  10192. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  10193. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  10194. update(): void;
  10195. }
  10196. }
  10197. declare module BABYLON.Internals {
  10198. /**
  10199. * Helper class dealing with the extraction of spherical polynomial dataArray
  10200. * from a cube map.
  10201. */
  10202. class CubeMapToSphericalPolynomialTools {
  10203. private static FileFaces;
  10204. /**
  10205. * Converts a cubemap to the according Spherical Polynomial data.
  10206. * This extracts the first 3 orders only as they are the only one used in the lighting.
  10207. *
  10208. * @param cubeInfo The Cube map to extract the information from.
  10209. * @return The Spherical Polynomial data.
  10210. */
  10211. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  10212. }
  10213. }
  10214. declare module BABYLON.Internals {
  10215. /**
  10216. * Header information of HDR texture files.
  10217. */
  10218. interface HDRInfo {
  10219. /**
  10220. * The height of the texture in pixels.
  10221. */
  10222. height: number;
  10223. /**
  10224. * The width of the texture in pixels.
  10225. */
  10226. width: number;
  10227. /**
  10228. * The index of the beginning of the data in the binary file.
  10229. */
  10230. dataPosition: number;
  10231. }
  10232. /**
  10233. * This groups tools to convert HDR texture to native colors array.
  10234. */
  10235. class HDRTools {
  10236. private static Ldexp(mantissa, exponent);
  10237. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  10238. private static readStringLine(uint8array, startIndex);
  10239. /**
  10240. * Reads header information from an RGBE texture stored in a native array.
  10241. * More information on this format are available here:
  10242. * https://en.wikipedia.org/wiki/RGBE_image_format
  10243. *
  10244. * @param uint8array The binary file stored in native array.
  10245. * @return The header information.
  10246. */
  10247. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  10248. /**
  10249. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  10250. * This RGBE texture needs to store the information as a panorama.
  10251. *
  10252. * More information on this format are available here:
  10253. * https://en.wikipedia.org/wiki/RGBE_image_format
  10254. *
  10255. * @param buffer The binary file stored in an array buffer.
  10256. * @param size The expected size of the extracted cubemap.
  10257. * @return The Cube Map information.
  10258. */
  10259. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  10260. /**
  10261. * Returns the pixels data extracted from an RGBE texture.
  10262. * This pixels will be stored left to right up to down in the R G B order in one array.
  10263. *
  10264. * More information on this format are available here:
  10265. * https://en.wikipedia.org/wiki/RGBE_image_format
  10266. *
  10267. * @param uint8array The binary file stored in an array buffer.
  10268. * @param hdrInfo The header information of the file.
  10269. * @return The pixels data in RGB right to left up to down order.
  10270. */
  10271. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  10272. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  10273. }
  10274. }
  10275. declare module BABYLON.Internals {
  10276. /**
  10277. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  10278. */
  10279. interface CubeMapInfo {
  10280. /**
  10281. * The pixel array for the front face.
  10282. * This is stored in RGB, left to right, up to down format.
  10283. */
  10284. front: Float32Array;
  10285. /**
  10286. * The pixel array for the back face.
  10287. * This is stored in RGB, left to right, up to down format.
  10288. */
  10289. back: Float32Array;
  10290. /**
  10291. * The pixel array for the left face.
  10292. * This is stored in RGB, left to right, up to down format.
  10293. */
  10294. left: Float32Array;
  10295. /**
  10296. * The pixel array for the right face.
  10297. * This is stored in RGB, left to right, up to down format.
  10298. */
  10299. right: Float32Array;
  10300. /**
  10301. * The pixel array for the up face.
  10302. * This is stored in RGB, left to right, up to down format.
  10303. */
  10304. up: Float32Array;
  10305. /**
  10306. * The pixel array for the down face.
  10307. * This is stored in RGB, left to right, up to down format.
  10308. */
  10309. down: Float32Array;
  10310. /**
  10311. * The size of the cubemap stored.
  10312. *
  10313. * Each faces will be size * size pixels.
  10314. */
  10315. size: number;
  10316. }
  10317. /**
  10318. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  10319. */
  10320. class PanoramaToCubeMapTools {
  10321. private static FACE_FRONT;
  10322. private static FACE_BACK;
  10323. private static FACE_RIGHT;
  10324. private static FACE_LEFT;
  10325. private static FACE_DOWN;
  10326. private static FACE_UP;
  10327. /**
  10328. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  10329. *
  10330. * @param float32Array The source data.
  10331. * @param inputWidth The width of the input panorama.
  10332. * @param inputhHeight The height of the input panorama.
  10333. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  10334. * @return The cubemap data
  10335. */
  10336. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  10337. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  10338. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  10339. }
  10340. }
  10341. declare namespace BABYLON.Internals {
  10342. /**
  10343. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  10344. * required by the glossinees of a material.
  10345. *
  10346. * This only supports the cosine drop power as well as Warp fixup generation method.
  10347. *
  10348. * This is using the process from CubeMapGen described here:
  10349. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  10350. */
  10351. class PMREMGenerator {
  10352. input: ArrayBufferView[];
  10353. inputSize: number;
  10354. outputSize: number;
  10355. maxNumMipLevels: number;
  10356. numChannels: number;
  10357. isFloat: boolean;
  10358. specularPower: number;
  10359. cosinePowerDropPerMip: number;
  10360. excludeBase: boolean;
  10361. fixup: boolean;
  10362. private static CP_MAX_MIPLEVELS;
  10363. private static CP_UDIR;
  10364. private static CP_VDIR;
  10365. private static CP_FACEAXIS;
  10366. private static CP_FACE_X_POS;
  10367. private static CP_FACE_X_NEG;
  10368. private static CP_FACE_Y_POS;
  10369. private static CP_FACE_Y_NEG;
  10370. private static CP_FACE_Z_POS;
  10371. private static CP_FACE_Z_NEG;
  10372. private static CP_EDGE_LEFT;
  10373. private static CP_EDGE_RIGHT;
  10374. private static CP_EDGE_TOP;
  10375. private static CP_EDGE_BOTTOM;
  10376. private static CP_CORNER_NNN;
  10377. private static CP_CORNER_NNP;
  10378. private static CP_CORNER_NPN;
  10379. private static CP_CORNER_NPP;
  10380. private static CP_CORNER_PNN;
  10381. private static CP_CORNER_PNP;
  10382. private static CP_CORNER_PPN;
  10383. private static CP_CORNER_PPP;
  10384. /**
  10385. * Constructor of the generator.
  10386. *
  10387. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  10388. * @param inputSize The size of the cubemap faces
  10389. * @param outputSize The size of the output cubemap faces
  10390. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  10391. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  10392. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  10393. * @param specularPower The max specular level of the desired cubemap
  10394. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  10395. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  10396. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  10397. */
  10398. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  10399. /**
  10400. * Launches the filter process and return the result.
  10401. *
  10402. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  10403. */
  10404. filterCubeMap(): ArrayBufferView[][];
  10405. private init();
  10406. private filterCubeMapMipChain();
  10407. private getBaseFilterAngle(cosinePower);
  10408. private precomputeFilterLookupTables(srcCubeMapWidth);
  10409. private buildNormalizerSolidAngleCubemap(size);
  10410. private texelCoordToVect(faceIdx, u, v, size, fixup);
  10411. private vectToTexelCoord(x, y, z, size);
  10412. private areaElement(x, y);
  10413. private texelCoordSolidAngle(faceIdx, u, v, size);
  10414. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  10415. private clearFilterExtents(filterExtents);
  10416. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  10417. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  10418. private fixupCubeEdges(cubeMap, cubeMapSize);
  10419. }
  10420. }
  10421. declare module BABYLON {
  10422. class CustomProceduralTexture extends ProceduralTexture {
  10423. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  10424. private loadJson(jsonUrl);
  10425. isReady(): boolean;
  10426. render(useCameraPostProcess?: boolean): void;
  10427. updateTextures(): void;
  10428. updateShaderUniforms(): void;
  10429. animate: boolean;
  10430. }
  10431. }
  10432. declare module BABYLON {
  10433. class ProceduralTexture extends Texture {
  10434. isCube: boolean;
  10435. isEnabled: boolean;
  10436. onGenerated: () => void;
  10437. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  10438. reset(): void;
  10439. isReady(): boolean;
  10440. resetRefreshCounter(): void;
  10441. setFragment(fragment: any): void;
  10442. refreshRate: number;
  10443. getRenderSize(): number;
  10444. resize(size: any, generateMipMaps: any): void;
  10445. setTexture(name: string, texture: Texture): ProceduralTexture;
  10446. setFloat(name: string, value: number): ProceduralTexture;
  10447. setFloats(name: string, value: number[]): ProceduralTexture;
  10448. setColor3(name: string, value: Color3): ProceduralTexture;
  10449. setColor4(name: string, value: Color4): ProceduralTexture;
  10450. setVector2(name: string, value: Vector2): ProceduralTexture;
  10451. setVector3(name: string, value: Vector3): ProceduralTexture;
  10452. setMatrix(name: string, value: Matrix): ProceduralTexture;
  10453. render(useCameraPostProcess?: boolean): void;
  10454. clone(): ProceduralTexture;
  10455. dispose(): void;
  10456. }
  10457. }
  10458. declare module BABYLON {
  10459. /**
  10460. * Stores 2D Bounding Information.
  10461. * This class handles a circle area and a bounding rectangle one.
  10462. */
  10463. class BoundingInfo2D {
  10464. /**
  10465. * The coordinate of the center of the bounding info
  10466. */
  10467. center: Vector2;
  10468. /**
  10469. * The radius of the bounding circle, from the center of the bounded object
  10470. */
  10471. radius: number;
  10472. /**
  10473. * The extent of the bounding rectangle, from the center of the bounded object.
  10474. * This is an absolute value in both X and Y of the vector which describe the right/top corner of the rectangle, you can easily reconstruct the whole rectangle by negating X &| Y.
  10475. */
  10476. extent: Vector2;
  10477. constructor();
  10478. /**
  10479. * Create a BoundingInfo2D object from a given size
  10480. * @param size the size that will be used to set the extend, radius will be computed from it.
  10481. */
  10482. static CreateFromSize(size: Size): BoundingInfo2D;
  10483. /**
  10484. * Create a BoundingInfo2D object from a given radius
  10485. * @param radius the radius to use, the extent will be computed from it.
  10486. */
  10487. static CreateFromRadius(radius: number): BoundingInfo2D;
  10488. /**
  10489. * Create a BoundingInfo2D object from a list of points.
  10490. * The resulted object will be the smallest bounding area that includes all the given points.
  10491. * @param points an array of points to compute the bounding object from.
  10492. */
  10493. static CreateFromPoints(points: Vector2[]): BoundingInfo2D;
  10494. /**
  10495. * Update a BoundingInfo2D object using the given Size as input
  10496. * @param size the bounding data will be computed from this size.
  10497. * @param b must be a valid/allocated object, it will contain the result of the operation
  10498. */
  10499. static CreateFromSizeToRef(size: Size, b: BoundingInfo2D): void;
  10500. /**
  10501. * Update a BoundingInfo2D object using the given radius as input
  10502. * @param radius the bounding data will be computed from this radius
  10503. * @param b must be a valid/allocated object, it will contain the result of the operation
  10504. */
  10505. static CreateFromRadiusToRef(radius: number, b: BoundingInfo2D): void;
  10506. /**
  10507. * Update a BoundingInfo2D object using the given points array as input
  10508. * @param points the point array to use to update the bounding data
  10509. * @param b must be a valid/allocated object, it will contain the result of the operation
  10510. */
  10511. static CreateFromPointsToRef(points: Vector2[], b: BoundingInfo2D): void;
  10512. /**
  10513. * Update a BoundingInfo2D object using the given min/max values as input
  10514. * @param xmin the smallest x coordinate
  10515. * @param xmax the biggest x coordinate
  10516. * @param ymin the smallest y coordinate
  10517. * @param ymax the buggest y coordinate
  10518. * @param b must be a valid/allocated object, it will contain the result of the operation
  10519. */
  10520. static CreateFromMinMaxToRef(xmin: number, xmax: number, ymin: number, ymax: number, b: BoundingInfo2D): void;
  10521. /**
  10522. * Duplicate this instance and return a new one
  10523. * @return the duplicated instance
  10524. */
  10525. clone(): BoundingInfo2D;
  10526. clear(): void;
  10527. copyFrom(src: BoundingInfo2D): void;
  10528. /**
  10529. * return the max extend of the bounding info
  10530. */
  10531. max(): Vector2;
  10532. /**
  10533. * Update a vector2 with the max extend of the bounding info
  10534. * @param result must be a valid/allocated vector2 that will contain the result of the operation
  10535. */
  10536. maxToRef(result: Vector2): void;
  10537. /**
  10538. * Apply a transformation matrix to this BoundingInfo2D and return a new instance containing the result
  10539. * @param matrix the transformation matrix to apply
  10540. * @return the new instance containing the result of the transformation applied on this BoundingInfo2D
  10541. */
  10542. transform(matrix: Matrix): BoundingInfo2D;
  10543. /**
  10544. * Compute the union of this BoundingInfo2D with a given one, returns a new BoundingInfo2D as a result
  10545. * @param other the second BoundingInfo2D to compute the union with this one
  10546. * @return a new instance containing the result of the union
  10547. */
  10548. union(other: BoundingInfo2D): BoundingInfo2D;
  10549. /**
  10550. * Transform this BoundingInfo2D with a given matrix and store the result in an existing BoundingInfo2D instance.
  10551. * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it every time.
  10552. * @param matrix The matrix to use to compute the transformation
  10553. * @param result A VALID (i.e. allocated) BoundingInfo2D object where the result will be stored
  10554. */
  10555. transformToRef(matrix: Matrix, result: BoundingInfo2D): void;
  10556. /**
  10557. * Compute the union of this BoundingInfo2D with another one and store the result in a third valid BoundingInfo2D object
  10558. * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it every time.
  10559. * @param other the second object used to compute the union
  10560. * @param result a VALID BoundingInfo2D instance (i.e. allocated) where the result will be stored
  10561. */
  10562. unionToRef(other: BoundingInfo2D, result: BoundingInfo2D): void;
  10563. /**
  10564. * Check if the given point is inside the BoundingInfo.
  10565. * The test is first made on the radius, then inside the rectangle described by the extent
  10566. * @param pickPosition the position to test
  10567. * @return true if the point is inside, false otherwise
  10568. */
  10569. doesIntersect(pickPosition: Vector2): boolean;
  10570. }
  10571. }
  10572. declare module BABYLON {
  10573. /**
  10574. * This interface is used to implement a lockable instance pattern.
  10575. * Classes that implements it may be locked at any time, making their content immutable from now on.
  10576. * You also can query if a given instance is locked or not.
  10577. * This allow instances to be shared among several 'consumers'.
  10578. */
  10579. interface ILockable {
  10580. /**
  10581. * Query the lock state
  10582. * @returns returns true if the object is locked and immutable, false if it's not
  10583. */
  10584. isLocked(): boolean;
  10585. /**
  10586. * A call to this method will definitely lock the instance, making its content immutable
  10587. * @returns the previous lock state of the object. so if true is returned the object were already locked and this method does nothing, if false is returned it means the object wasn't locked and this call locked it for good.
  10588. */
  10589. lock(): boolean;
  10590. }
  10591. /**
  10592. * This interface defines the IBrush2D contract.
  10593. * Classes implementing a new type of Brush2D must implement this interface
  10594. */
  10595. interface IBrush2D extends ILockable {
  10596. /**
  10597. * Define if the brush will use transparency / alpha blending
  10598. * @returns true if the brush use transparency
  10599. */
  10600. isTransparent(): boolean;
  10601. /**
  10602. * It is critical for each instance of a given Brush2D type to return a unique string that identifies it because the Border instance will certainly be part of the computed ModelKey for a given Primitive
  10603. * @returns A string identifier that uniquely identify the instance
  10604. */
  10605. toString(): string;
  10606. }
  10607. /**
  10608. * Base class implementing the ILocable interface.
  10609. * The particularity of this class is to call the protected onLock() method when the instance is about to be locked for good.
  10610. */
  10611. class LockableBase implements ILockable {
  10612. isLocked(): boolean;
  10613. lock(): boolean;
  10614. /**
  10615. * Protected handler that will be called when the instance is about to be locked.
  10616. */
  10617. protected onLock(): void;
  10618. }
  10619. class SolidColorBrush2D extends LockableBase implements IBrush2D {
  10620. constructor(color: Color4, lock?: boolean);
  10621. /**
  10622. * Return true if the brush is transparent, false if it's totally opaque
  10623. */
  10624. isTransparent(): boolean;
  10625. /**
  10626. * The color used by this instance to render
  10627. * @returns the color object. Note that it's not a clone of the actual object stored in the instance so you MUST NOT modify it, otherwise unexpected behavior might occurs.
  10628. */
  10629. color: Color4;
  10630. /**
  10631. * Return a unique identifier of the instance, which is simply the hexadecimal representation (CSS Style) of the solid color.
  10632. */
  10633. toString(): string;
  10634. }
  10635. class GradientColorBrush2D extends LockableBase implements IBrush2D {
  10636. constructor(color1: Color4, color2: Color4, translation?: Vector2, rotation?: number, scale?: number, lock?: boolean);
  10637. /**
  10638. * Return true if the brush is transparent, false if it's totally opaque
  10639. */
  10640. isTransparent(): boolean;
  10641. /**
  10642. * First color, the blend will start from this color
  10643. */
  10644. color1: Color4;
  10645. /**
  10646. * Second color, the blend will end to this color
  10647. */
  10648. color2: Color4;
  10649. /**
  10650. * Translation vector to apply on the blend
  10651. * Default is [0;0]
  10652. */
  10653. translation: Vector2;
  10654. /**
  10655. * Rotation in radian to apply to the brush
  10656. * Default direction of the brush is vertical, you can change this using this property.
  10657. * Default is 0.
  10658. */
  10659. rotation: number;
  10660. /**
  10661. * Scale factor to apply to the gradient.
  10662. * Default is 1: no scale.
  10663. */
  10664. scale: number;
  10665. /**
  10666. * Return a string describing the brush
  10667. */
  10668. toString(): string;
  10669. /**
  10670. * Build a unique key string for the given parameters
  10671. */
  10672. static BuildKey(color1: Color4, color2: Color4, translation: Vector2, rotation: number, scale: number): string;
  10673. }
  10674. }
  10675. declare module BABYLON {
  10676. class Canvas2DEngineBoundData {
  10677. GetOrAddModelCache<TInstData>(key: string, factory: (key: string) => ModelRenderCache): ModelRenderCache;
  10678. DisposeModelRenderCache(modelRenderCache: ModelRenderCache): boolean;
  10679. }
  10680. abstract class Canvas2D extends Group2D {
  10681. /**
  10682. * In this strategy only the direct children groups of the Canvas will be cached, their whole content (whatever the sub groups they have) into a single bitmap.
  10683. * This strategy doesn't allow primitives added directly as children of the Canvas.
  10684. * You typically want to use this strategy of a screenSpace fullscreen canvas: you don't want a bitmap cache taking the whole screen resolution but still want the main contents (say UI in the topLeft and rightBottom for instance) to be efficiently cached.
  10685. */
  10686. static CACHESTRATEGY_TOPLEVELGROUPS: number;
  10687. /**
  10688. * In this strategy each group will have its own cache bitmap (except if a given group explicitly defines the DONTCACHEOVERRIDE or CACHEINPARENTGROUP behaviors).
  10689. * This strategy is typically used if the canvas has some groups that are frequently animated. Unchanged ones will have a steady cache and the others will be refreshed when they change, reducing the redraw operation count to their content only.
  10690. * When using this strategy, group instances can rely on the DONTCACHEOVERRIDE or CACHEINPARENTGROUP behaviors to minimize the amount of cached bitmaps.
  10691. * Note that in this mode the Canvas itself is not cached, it only contains the sprites of its direct children group to render, there's no point to cache the whole canvas, sprites will be rendered pretty efficiently, the memory cost would be too great for the value of it.
  10692. */
  10693. static CACHESTRATEGY_ALLGROUPS: number;
  10694. /**
  10695. * In this strategy the whole canvas is cached into a single bitmap containing every primitives it owns, at the exception of the ones that are owned by a group having the DONTCACHEOVERRIDE behavior (these primitives will be directly drawn to the viewport at each render for screenSpace Canvas or be part of the Canvas cache bitmap for worldSpace Canvas).
  10696. */
  10697. static CACHESTRATEGY_CANVAS: number;
  10698. /**
  10699. * This strategy is used to recompose/redraw the canvas entirely at each viewport render.
  10700. * Use this strategy if memory is a concern above rendering performances and/or if the canvas is frequently animated (hence reducing the benefits of caching).
  10701. * Note that you can't use this strategy for WorldSpace Canvas, they need at least a top level group caching.
  10702. */
  10703. static CACHESTRATEGY_DONTCACHE: number;
  10704. /**
  10705. * Observable Mask to be notified before rendering is made
  10706. */
  10707. static RENDEROBSERVABLE_PRE: number;
  10708. /**
  10709. * Observable Mask to be notified after rendering is made
  10710. */
  10711. static RENDEROBSERVABLE_POST: number;
  10712. constructor(scene: Scene, settings?: {
  10713. id?: string;
  10714. children?: Array<Prim2DBase>;
  10715. size?: Size;
  10716. renderingPhase?: {
  10717. camera: Camera;
  10718. renderingGroupID: number;
  10719. };
  10720. designSize?: Size;
  10721. designUseHorizAxis?: boolean;
  10722. isScreenSpace?: boolean;
  10723. cachingStrategy?: number;
  10724. enableInteraction?: boolean;
  10725. origin?: Vector2;
  10726. isVisible?: boolean;
  10727. backgroundRoundRadius?: number;
  10728. backgroundFill?: IBrush2D | string;
  10729. backgroundBorder?: IBrush2D | string;
  10730. backgroundBorderThickNess?: number;
  10731. });
  10732. drawCallsOpaqueCounter: PerfCounter;
  10733. drawCallsAlphaTestCounter: PerfCounter;
  10734. drawCallsTransparentCounter: PerfCounter;
  10735. groupRenderCounter: PerfCounter;
  10736. updateTransparentDataCounter: PerfCounter;
  10737. cachedGroupRenderCounter: PerfCounter;
  10738. updateCachedStateCounter: PerfCounter;
  10739. updateLayoutCounter: PerfCounter;
  10740. updatePositioningCounter: PerfCounter;
  10741. updateLocalTransformCounter: PerfCounter;
  10742. updateGlobalTransformCounter: PerfCounter;
  10743. boundingInfoRecomputeCounter: PerfCounter;
  10744. static instances: Array<Canvas2D>;
  10745. /**
  10746. * If you set your own WorldSpaceNode to display the Canvas2D you have to provide your own implementation of this method which computes the local position in the Canvas based on the given 3D World one.
  10747. * Beware that you have to take under consideration the origin in your calculations! Good luck!
  10748. */
  10749. worldSpaceToNodeLocal: (worldPos: Vector3) => Vector2;
  10750. /**
  10751. * If you use a custom WorldSpaceCanvasNode you have to override this property to update the UV of your object to reflect the changes due to a resizing of the cached bitmap
  10752. */
  10753. worldSpaceCacheChanged: () => void;
  10754. /**
  10755. * Internal method, you should use the Prim2DBase version instead
  10756. */
  10757. /**
  10758. * Internal method, you should use the Prim2DBase version instead
  10759. */
  10760. /**
  10761. * Determine if the given pointer is captured or not
  10762. * @param pointerId the Id of the pointer
  10763. * @return true if it's captured, false otherwise
  10764. */
  10765. isPointerCaptured(pointerId: number): boolean;
  10766. private getCapturedPrimitive(pointerId);
  10767. /**
  10768. * Don't forget to call the dispose method when you're done with the Canvas instance.
  10769. * But don't worry, if you dispose its scene, the canvas will be automatically disposed too.
  10770. */
  10771. dispose(): boolean;
  10772. /**
  10773. * Accessor to the Scene that owns the Canvas
  10774. * @returns The instance of the Scene object
  10775. */
  10776. scene: Scene;
  10777. /**
  10778. * Accessor to the Engine that drives the Scene used by this Canvas
  10779. * @returns The instance of the Engine object
  10780. */
  10781. engine: Engine;
  10782. /**
  10783. * return a unique identifier for the Canvas2D
  10784. */
  10785. uid: string;
  10786. /**
  10787. * And observable called during the Canvas rendering process.
  10788. * This observable is called twice per render, each time with a different mask:
  10789. * - 1: before render is executed
  10790. * - 2: after render is executed
  10791. */
  10792. renderObservable: Observable<Canvas2D>;
  10793. /**
  10794. * Accessor of the Caching Strategy used by this Canvas.
  10795. * See Canvas2D.CACHESTRATEGY_xxxx static members for more information
  10796. * @returns the value corresponding to the used strategy.
  10797. */
  10798. cachingStrategy: number;
  10799. /**
  10800. * Return true if the Canvas is a Screen Space one, false if it's a World Space one.
  10801. * @returns {}
  10802. */
  10803. isScreenSpace: boolean;
  10804. /**
  10805. * Only valid for World Space Canvas, returns the scene node that displays the canvas
  10806. */
  10807. worldSpaceCanvasNode: Node;
  10808. /**
  10809. * Check if the WebGL Instanced Array extension is supported or not
  10810. */
  10811. supportInstancedArray: boolean;
  10812. /**
  10813. * Property that defines the fill object used to draw the background of the Canvas.
  10814. * Note that Canvas with a Caching Strategy of
  10815. * @returns If the background is not set, null will be returned, otherwise a valid fill object is returned.
  10816. */
  10817. backgroundFill: IBrush2D;
  10818. /**
  10819. * Property that defines the border object used to draw the background of the Canvas.
  10820. * @returns If the background is not set, null will be returned, otherwise a valid border object is returned.
  10821. */
  10822. backgroundBorder: IBrush2D;
  10823. /**
  10824. * Property that defines the thickness of the border object used to draw the background of the Canvas.
  10825. * @returns If the background is not set, null will be returned, otherwise a valid number matching the thickness is returned.
  10826. */
  10827. backgroundBorderThickness: number;
  10828. /**
  10829. * You can set the roundRadius of the background
  10830. * @returns The current roundRadius
  10831. */
  10832. backgroundRoundRadius: number;
  10833. /**
  10834. * Enable/Disable interaction for this Canvas
  10835. * When enabled the Prim2DBase.pointerEventObservable property will notified when appropriate events occur
  10836. */
  10837. interactionEnabled: boolean;
  10838. fitRenderingDevice: boolean;
  10839. designSize: Size;
  10840. designSizeUseHorizAxis: boolean;
  10841. /**
  10842. * Return
  10843. */
  10844. overPrim: Prim2DBase;
  10845. /**
  10846. * Access the babylon.js' engine bound data, do not invoke this method, it's for internal purpose only
  10847. * @returns {}
  10848. */
  10849. createCanvasProfileInfoCanvas(): Canvas2D;
  10850. /**
  10851. * Instanced Array will be create if there's at least this number of parts/prim that can fit into it
  10852. */
  10853. minPartCountToUseInstancedArray: number;
  10854. private checkBackgroundAvailability();
  10855. addCachedGroupRenderCounter(count: number): void;
  10856. addUpdateCachedStateCounter(count: number): void;
  10857. addUpdateLayoutCounter(count: number): void;
  10858. addUpdatePositioningCounter(count: number): void;
  10859. addupdateLocalTransformCounter(count: number): void;
  10860. addUpdateGlobalTransformCounter(count: number): void;
  10861. /**
  10862. * Call this method change you want to have layout related data computed and up to date (layout area, primitive area, local/global transformation matrices)
  10863. */
  10864. updateCanvasLayout(forceRecompute: boolean): void;
  10865. /**
  10866. * Method that renders the Canvas, you should not invoke
  10867. */
  10868. /**
  10869. * Internal method that allocate a cache for the given group.
  10870. * Caching is made using a collection of MapTexture where many groups have their bitmap cache stored inside.
  10871. * @param group The group to allocate the cache of.
  10872. * @return custom type with the PackedRect instance giving information about the cache location into the texture and also the MapTexture instance that stores the cache.
  10873. */
  10874. node: PackedRect;
  10875. texture: MapTexture;
  10876. sprite: Sprite2D;
  10877. };
  10878. /**
  10879. * Define the default size used for both the width and height of a MapTexture to allocate.
  10880. * Note that some MapTexture might be bigger than this size if the first node to allocate is bigger in width or height
  10881. */
  10882. /**
  10883. * Internal method used to register a Scene Node to track position for the given group
  10884. * Do not invoke this method, for internal purpose only.
  10885. * @param group the group to track its associated Scene Node
  10886. */
  10887. /**
  10888. * Internal method used to unregister a tracked Scene Node
  10889. * Do not invoke this method, it's for internal purpose only.
  10890. * @param group the group to unregister its tracked Scene Node from.
  10891. */
  10892. /**
  10893. * Get a Solid Color Brush instance matching the given color.
  10894. * @param color The color to retrieve
  10895. * @return A shared instance of the SolidColorBrush2D class that use the given color
  10896. */
  10897. static GetSolidColorBrush(color: Color4): IBrush2D;
  10898. /**
  10899. * Get a Solid Color Brush instance matching the given color expressed as a CSS formatted hexadecimal value.
  10900. * @param color The color to retrieve
  10901. * @return A shared instance of the SolidColorBrush2D class that uses the given color
  10902. */
  10903. static GetSolidColorBrushFromHex(hexValue: string): IBrush2D;
  10904. /**
  10905. * Get a Gradient Color Brush
  10906. * @param color1 starting color
  10907. * @param color2 engine color
  10908. * @param translation translation vector to apply. default is [0;0]
  10909. * @param rotation rotation in radian to apply to the brush, initial direction is top to bottom. rotation is counter clockwise. default is 0.
  10910. * @param scale scaling factor to apply. default is 1.
  10911. */
  10912. static GetGradientColorBrush(color1: Color4, color2: Color4, translation?: Vector2, rotation?: number, scale?: number): IBrush2D;
  10913. /**
  10914. * Create a solid or gradient brush from a string value.
  10915. * @param brushString should be either
  10916. * - "solid: #RRGGBBAA" or "#RRGGBBAA"
  10917. * - "gradient: #FF808080, #FFFFFFF[, [10:20], 180, 1]" for color1, color2, translation, rotation (degree), scale. The last three are optionals, but if specified must be is this order. "gradient:" can be omitted.
  10918. */
  10919. static GetBrushFromString(brushString: string): IBrush2D;
  10920. }
  10921. class WorldSpaceCanvas2D extends Canvas2D {
  10922. /**
  10923. * Create a new 2D WorldSpace Rendering Canvas, it is a 2D rectangle that has a size (width/height) and a world transformation information to place it in the world space.
  10924. * This kind of canvas can't have its Primitives directly drawn in the Viewport, they need to be cached in a bitmap at some point, as a consequence the DONT_CACHE strategy is unavailable. For now only CACHESTRATEGY_CANVAS is supported, but the remaining strategies will be soon.
  10925. * @param scene the Scene that owns the Canvas
  10926. * @param size the dimension of the Canvas in World Space
  10927. * @param settings a combination of settings, possible ones are
  10928. * - children: an array of direct children primitives
  10929. * - id: a text identifier, for information purpose only, default is null.
  10930. * - worldPosition the position of the Canvas in World Space, default is [0,0,0]
  10931. * - worldRotation the rotation of the Canvas in World Space, default is Quaternion.Identity()
  10932. * - sideOrientation: Unexpected behavior occur if the value is different from Mesh.DEFAULTSIDE right now, so please use this one, which is the default.
  10933. * - cachingStrategy Must be CACHESTRATEGY_CANVAS for now, which is the default.
  10934. * - enableInteraction: if true the pointer events will be listened and rerouted to the appropriate primitives of the Canvas2D through the Prim2DBase.onPointerEventObservable observable property. Default is false (the opposite of ScreenSpace).
  10935. * - isVisible: true if the canvas must be visible, false for hidden. Default is true.
  10936. * - backgroundRoundRadius: the round radius of the background, either backgroundFill or backgroundBorder must be specified.
  10937. * - backgroundFill: the brush to use to create a background fill for the canvas. can be a string value (see Canvas2D.GetBrushFromString) or a IBrush2D instance.
  10938. * - backgroundBorder: the brush to use to create a background border for the canvas. can be a string value (see Canvas2D.GetBrushFromString) or a IBrush2D instance.
  10939. * - backgroundBorderThickness: if a backgroundBorder is specified, its thickness can be set using this property
  10940. * - customWorldSpaceNode: if specified the Canvas will be rendered in this given Node. But it's the responsibility of the caller to set the "worldSpaceToNodeLocal" property to compute the hit of the mouse ray into the node (in world coordinate system) as well as rendering the cached bitmap in the node itself. The properties cachedRect and cachedTexture of Group2D will give you what you need to do that.
  10941. * - maxAdaptiveCanvasSize: set the max size (width and height) of the bitmap that will contain the cached version of the WorldSpace Canvas. Default is 1024 or less if it's not supported. In any case the value you give will be clipped by the maximum that WebGL supports on the running device. You can set any size, more than 1024 if you want, but testing proved it's a good max value for non "retina" like screens.
  10942. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  10943. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  10944. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  10945. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  10946. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  10947. */
  10948. constructor(scene: Scene, size: Size, settings?: {
  10949. children?: Array<Prim2DBase>;
  10950. id?: string;
  10951. worldPosition?: Vector3;
  10952. worldRotation?: Quaternion;
  10953. sideOrientation?: number;
  10954. cachingStrategy?: number;
  10955. enableInteraction?: boolean;
  10956. isVisible?: boolean;
  10957. backgroundRoundRadius?: number;
  10958. backgroundFill?: IBrush2D | string;
  10959. backgroundBorder?: IBrush2D | string;
  10960. backgroundBorderThickNess?: number;
  10961. customWorldSpaceNode?: Node;
  10962. maxAdaptiveCanvasSize?: number;
  10963. paddingTop?: number | string;
  10964. paddingLeft?: number | string;
  10965. paddingRight?: number | string;
  10966. paddingBottom?: number | string;
  10967. padding?: string;
  10968. });
  10969. dispose(): boolean;
  10970. }
  10971. class ScreenSpaceCanvas2D extends Canvas2D {
  10972. /**
  10973. * Create a new 2D ScreenSpace Rendering Canvas, it is a 2D rectangle that has a size (width/height) and a position relative to the bottom/left corner of the screen.
  10974. * ScreenSpace Canvas will be drawn in the Viewport as a 2D Layer lying to the top of the 3D Scene. Typically used for traditional UI.
  10975. * All caching strategies will be available.
  10976. * PLEASE NOTE: the origin of a Screen Space Canvas is set to [0;0] (bottom/left) which is different than the default origin of a Primitive which is centered [0.5;0.5]
  10977. * @param scene the Scene that owns the Canvas
  10978. * @param settings a combination of settings, possible ones are
  10979. * - children: an array of direct children primitives
  10980. * - id: a text identifier, for information purpose only
  10981. * - x: the position along the x axis (horizontal), relative to the left edge of the viewport. you can alternatively use the position setting.
  10982. * - y: the position along the y axis (vertically), relative to the bottom edge of the viewport. you can alternatively use the position setting.
  10983. * - position: the position of the canvas, relative from the bottom/left of the scene's viewport. Alternatively you can set the x and y properties directly. Default value is [0, 0]
  10984. * - width: the width of the Canvas. you can alternatively use the size setting.
  10985. * - height: the height of the Canvas. you can alternatively use the size setting.
  10986. * - size: the Size of the canvas. Alternatively the width and height properties can be set. If null two behaviors depend on the cachingStrategy: if it's CACHESTRATEGY_CACHECANVAS then it will always auto-fit the rendering device, in all the other modes it will fit the content of the Canvas
  10987. * - renderingPhase: you can specify for which camera and which renderGroup this canvas will render to enable interleaving of 3D/2D content through the use of renderinGroup. As a rendering Group is rendered for each camera, you have to specify in the scope of which camera you want the canvas' render to be made. Default behavior will render the Canvas at the very end of the render loop.
  10988. * - designSize: if you want to set the canvas content based on fixed coordinates whatever the final canvas dimension would be, set this. For instance a designSize of 360*640 will give you the possibility to specify all the children element in this frame. The Canvas' true size will be the HTMLCanvas' size: for instance it could be 720*1280, then a uniform scale of 2 will be applied on the Canvas to keep the absolute coordinates working as expecting. If the ratios of the designSize and the true Canvas size are not the same, then the scale is computed following the designUseHorizAxis member by using either the size of the horizontal axis or the vertical axis.
  10989. * - designUseHorizAxis: you can set this member if you use designSize to specify which axis is priority to compute the scale when the ratio of the canvas' size is different from the designSize's one.
  10990. * - cachingStrategy: either CACHESTRATEGY_TOPLEVELGROUPS, CACHESTRATEGY_ALLGROUPS, CACHESTRATEGY_CANVAS, CACHESTRATEGY_DONTCACHE. Please refer to their respective documentation for more information. Default is Canvas2D.CACHESTRATEGY_DONTCACHE
  10991. * - enableInteraction: if true the pointer events will be listened and rerouted to the appropriate primitives of the Canvas2D through the Prim2DBase.onPointerEventObservable observable property. Default is true.
  10992. * - isVisible: true if the canvas must be visible, false for hidden. Default is true.
  10993. * - backgroundRoundRadius: the round radius of the background, either backgroundFill or backgroundBorder must be specified.
  10994. * - backgroundFill: the brush to use to create a background fill for the canvas. can be a string value (see BABYLON.Canvas2D.GetBrushFromString) or a IBrush2D instance.
  10995. * - backgroundBorder: the brush to use to create a background border for the canvas. can be a string value (see BABYLON.Canvas2D.GetBrushFromString) or a IBrush2D instance.
  10996. * - backgroundBorderThickness: if a backgroundBorder is specified, its thickness can be set using this property
  10997. * - customWorldSpaceNode: if specified the Canvas will be rendered in this given Node. But it's the responsibility of the caller to set the "worldSpaceToNodeLocal" property to compute the hit of the mouse ray into the node (in world coordinate system) as well as rendering the cached bitmap in the node itself. The properties cachedRect and cachedTexture of Group2D will give you what you need to do that.
  10998. * - paddingTop: top padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
  10999. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
  11000. * - paddingRight: right padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
  11001. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
  11002. * - padding: top, left, right and bottom padding formatted as a single string (see BABYLON.PrimitiveThickness.fromString)
  11003. */
  11004. constructor(scene: Scene, settings?: {
  11005. children?: Array<Prim2DBase>;
  11006. id?: string;
  11007. x?: number;
  11008. y?: number;
  11009. position?: Vector2;
  11010. origin?: Vector2;
  11011. width?: number;
  11012. height?: number;
  11013. size?: Size;
  11014. renderingPhase?: {
  11015. camera: Camera;
  11016. renderingGroupID: number;
  11017. };
  11018. designSize?: Size;
  11019. designUseHorizAxis?: boolean;
  11020. cachingStrategy?: number;
  11021. cacheBehavior?: number;
  11022. enableInteraction?: boolean;
  11023. isVisible?: boolean;
  11024. backgroundRoundRadius?: number;
  11025. backgroundFill?: IBrush2D | string;
  11026. backgroundBorder?: IBrush2D | string;
  11027. backgroundBorderThickNess?: number;
  11028. paddingTop?: number | string;
  11029. paddingLeft?: number | string;
  11030. paddingRight?: number | string;
  11031. paddingBottom?: number | string;
  11032. padding?: string;
  11033. });
  11034. }
  11035. }
  11036. declare module BABYLON {
  11037. class LayoutEngineBase implements ILockable {
  11038. constructor();
  11039. updateLayout(prim: Prim2DBase): void;
  11040. isChildPositionAllowed: boolean;
  11041. isLocked(): boolean;
  11042. lock(): boolean;
  11043. layoutDirtyOnPropertyChangedMask: any;
  11044. }
  11045. class CanvasLayoutEngine extends LayoutEngineBase {
  11046. static Singleton: CanvasLayoutEngine;
  11047. updateLayout(prim: Prim2DBase): void;
  11048. isChildPositionAllowed: boolean;
  11049. }
  11050. class StackPanelLayoutEngine extends LayoutEngineBase {
  11051. constructor();
  11052. static Horizontal: StackPanelLayoutEngine;
  11053. static Vertical: StackPanelLayoutEngine;
  11054. isHorizontal: boolean;
  11055. private static dstOffset;
  11056. private static dstArea;
  11057. updateLayout(prim: Prim2DBase): void;
  11058. isChildPositionAllowed: boolean;
  11059. }
  11060. }
  11061. declare module BABYLON {
  11062. class Ellipse2DRenderCache extends ModelRenderCache {
  11063. effectsReady: boolean;
  11064. fillVB: WebGLBuffer;
  11065. fillIB: WebGLBuffer;
  11066. fillIndicesCount: number;
  11067. instancingFillAttributes: InstancingAttributeInfo[];
  11068. effectFillInstanced: Effect;
  11069. effectFill: Effect;
  11070. borderVB: WebGLBuffer;
  11071. borderIB: WebGLBuffer;
  11072. borderIndicesCount: number;
  11073. instancingBorderAttributes: InstancingAttributeInfo[];
  11074. effectBorderInstanced: Effect;
  11075. effectBorder: Effect;
  11076. constructor(engine: Engine, modelKey: string);
  11077. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  11078. dispose(): boolean;
  11079. }
  11080. class Ellipse2DInstanceData extends Shape2DInstanceData {
  11081. constructor(partId: number);
  11082. properties: Vector3;
  11083. }
  11084. class Ellipse2D extends Shape2D {
  11085. static acutalSizeProperty: Prim2DPropInfo;
  11086. static subdivisionsProperty: Prim2DPropInfo;
  11087. actualSize: Size;
  11088. subdivisions: number;
  11089. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  11090. protected updateLevelBoundingInfo(): void;
  11091. /**
  11092. * Create an Ellipse 2D Shape primitive
  11093. * @param settings a combination of settings, possible ones are
  11094. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  11095. * - children: an array of direct children
  11096. * - id: a text identifier, for information purpose
  11097. * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
  11098. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  11099. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  11100. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  11101. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  11102. * - zOrder: override the zOrder with the specified value
  11103. * - origin: define the normalized origin point location, default [0.5;0.5]
  11104. * - size: the size of the group. Alternatively the width and height properties can be set. Default will be [10;10].
  11105. * - subdivision: the number of subdivision to create the ellipse perimeter, default is 64.
  11106. * - fill: the brush used to draw the fill content of the ellipse, you can set null to draw nothing (but you will have to set a border brush), default is a SolidColorBrush of plain white. can also be a string value (see Canvas2D.GetBrushFromString)
  11107. * - border: the brush used to draw the border of the ellipse, you can set null to draw nothing (but you will have to set a fill brush), default is null. can be a string value (see Canvas2D.GetBrushFromString)
  11108. * - borderThickness: the thickness of the drawn border, default is 1.
  11109. * - isVisible: true if the group must be visible, false for hidden. Default is true.
  11110. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  11111. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  11112. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  11113. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11114. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11115. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11116. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11117. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  11118. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  11119. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  11120. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  11121. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11122. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11123. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11124. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11125. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  11126. */
  11127. constructor(settings?: {
  11128. parent?: Prim2DBase;
  11129. children?: Array<Prim2DBase>;
  11130. id?: string;
  11131. position?: Vector2;
  11132. x?: number;
  11133. y?: number;
  11134. rotation?: number;
  11135. scale?: number;
  11136. scaleX?: number;
  11137. scaleY?: number;
  11138. dontInheritParentScale?: boolean;
  11139. opacity?: number;
  11140. zOrder?: number;
  11141. origin?: Vector2;
  11142. size?: Size;
  11143. width?: number;
  11144. height?: number;
  11145. subdivisions?: number;
  11146. fill?: IBrush2D | string;
  11147. border?: IBrush2D | string;
  11148. borderThickness?: number;
  11149. isVisible?: boolean;
  11150. isPickable?: boolean;
  11151. isContainer?: boolean;
  11152. childrenFlatZOrder?: boolean;
  11153. marginTop?: number | string;
  11154. marginLeft?: number | string;
  11155. marginRight?: number | string;
  11156. marginBottom?: number | string;
  11157. margin?: number | string;
  11158. marginHAlignment?: number;
  11159. marginVAlignment?: number;
  11160. marginAlignment?: string;
  11161. paddingTop?: number | string;
  11162. paddingLeft?: number | string;
  11163. paddingRight?: number | string;
  11164. paddingBottom?: number | string;
  11165. padding?: string;
  11166. });
  11167. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  11168. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Ellipse2DRenderCache;
  11169. protected createInstanceDataParts(): InstanceDataBase[];
  11170. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  11171. }
  11172. }
  11173. declare module BABYLON {
  11174. class Group2D extends Prim2DBase {
  11175. static GROUP2D_PROPCOUNT: number;
  11176. static sizeProperty: Prim2DPropInfo;
  11177. static actualSizeProperty: Prim2DPropInfo;
  11178. /**
  11179. * Default behavior, the group will use the caching strategy defined at the Canvas Level
  11180. */
  11181. static GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY: number;
  11182. /**
  11183. * When used, this group's content won't be cached, no matter which strategy used.
  11184. * If the group is part of a WorldSpace Canvas, its content will be drawn in the Canvas cache bitmap.
  11185. */
  11186. static GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE: number;
  11187. /**
  11188. * When used, the group's content will be cached in the nearest cached parent group/canvas
  11189. */
  11190. static GROUPCACHEBEHAVIOR_CACHEINPARENTGROUP: number;
  11191. /**
  11192. * You can specify this behavior to any cached Group2D to indicate that you don't want the cached content to be resized when the Group's actualScale is changing. It will draw the content stretched or shrink which is faster than a resize. This setting is obviously for performance consideration, don't use it if you want the best rendering quality
  11193. */
  11194. static GROUPCACHEBEHAVIOR_NORESIZEONSCALE: number;
  11195. private static GROUPCACHEBEHAVIOR_OPTIONMASK;
  11196. /**
  11197. * Create an Logical or Renderable Group.
  11198. * @param settings a combination of settings, possible ones are
  11199. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  11200. * - children: an array of direct children
  11201. * - id a text identifier, for information purpose
  11202. * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
  11203. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  11204. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  11205. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  11206. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  11207. * - zOrder: override the zOrder with the specified value
  11208. * - origin: define the normalized origin point location, default [0.5;0.5]
  11209. * - size: the size of the group. Alternatively the width and height properties can be set. If null the size will be computed from its content, default is null.
  11210. * - cacheBehavior: Define how the group should behave regarding the Canvas's cache strategy, default is Group2D.GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY
  11211. * - layoutEngine: either an instance of a layout engine based class (StackPanel.Vertical, StackPanel.Horizontal) or a string ('canvas' for Canvas layout, 'StackPanel' or 'HorizontalStackPanel' for horizontal Stack Panel layout, 'VerticalStackPanel' for vertical Stack Panel layout).
  11212. * - isVisible: true if the group must be visible, false for hidden. Default is true.
  11213. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  11214. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  11215. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  11216. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11217. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11218. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11219. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11220. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  11221. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  11222. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  11223. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  11224. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11225. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11226. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11227. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11228. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  11229. */
  11230. constructor(settings?: {
  11231. parent?: Prim2DBase;
  11232. children?: Array<Prim2DBase>;
  11233. id?: string;
  11234. position?: Vector2;
  11235. x?: number;
  11236. y?: number;
  11237. scale?: number;
  11238. scaleX?: number;
  11239. scaleY?: number;
  11240. dontInheritParentScale?: boolean;
  11241. trackNode?: Node;
  11242. opacity?: number;
  11243. zOrder?: number;
  11244. origin?: Vector2;
  11245. size?: Size;
  11246. width?: number;
  11247. height?: number;
  11248. cacheBehavior?: number;
  11249. layoutEngine?: LayoutEngineBase | string;
  11250. isVisible?: boolean;
  11251. isPickable?: boolean;
  11252. isContainer?: boolean;
  11253. childrenFlatZOrder?: boolean;
  11254. marginTop?: number | string;
  11255. marginLeft?: number | string;
  11256. marginRight?: number | string;
  11257. marginBottom?: number | string;
  11258. margin?: number | string;
  11259. marginHAlignment?: number;
  11260. marginVAlignment?: number;
  11261. marginAlignment?: string;
  11262. paddingTop?: number | string;
  11263. paddingLeft?: number | string;
  11264. paddingRight?: number | string;
  11265. paddingBottom?: number | string;
  11266. padding?: string;
  11267. });
  11268. protected applyCachedTexture(vertexData: VertexData, material: StandardMaterial): void;
  11269. /**
  11270. * Allow you to access the information regarding the cached rectangle of the Group2D into the MapTexture.
  11271. * If the `noWorldSpaceNode` options was used at the creation of a WorldSpaceCanvas, the rendering of the canvas must be made by the caller, so typically you want to bind the cacheTexture property to some material/mesh and you MUST use the Group2D.cachedUVs property to get the UV coordinates to use for your quad that will display the Canvas and NOT the PackedRect.UVs property which are incorrect because the allocated surface may be bigger (due to over-provisioning or shrinking without deallocating) than what the Group is actually using.
  11272. */
  11273. cachedRect: PackedRect;
  11274. /**
  11275. * The UVs into the MapTexture that map the cached group
  11276. */
  11277. cachedUVs: Vector2[];
  11278. cachedUVsChanged: Observable<Vector2[]>;
  11279. /**
  11280. * Access the texture that maintains a cached version of the Group2D.
  11281. * This is useful only if you're not using a WorldSpaceNode for your WorldSpace Canvas and therefore need to perform the rendering yourself.
  11282. */
  11283. cacheTexture: MapTexture;
  11284. /**
  11285. * Call this method to remove this Group and its children from the Canvas
  11286. */
  11287. dispose(): boolean;
  11288. /**
  11289. * @returns Returns true if the Group render content, false if it's a logical group only
  11290. */
  11291. isRenderableGroup: boolean;
  11292. /**
  11293. * @returns only meaningful for isRenderableGroup, will be true if the content of the Group is cached into a texture, false if it's rendered every time
  11294. */
  11295. isCachedGroup: boolean;
  11296. /**
  11297. * Get/Set the size of the group. If null the size of the group will be determine from its content.
  11298. * BEWARE: if the Group is a RenderableGroup and its content is cache the texture will be resized each time the group is getting bigger. For performance reason the opposite won't be true: the texture won't shrink if the group does.
  11299. */
  11300. size: Size;
  11301. viewportSize: ISize;
  11302. actualSize: Size;
  11303. /**
  11304. * Get/set the Cache Behavior, used in case the Canvas Cache Strategy is set to CACHESTRATEGY_ALLGROUPS. Can be either GROUPCACHEBEHAVIOR_CACHEINPARENTGROUP, GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE or GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY. See their documentation for more information.
  11305. * GROUPCACHEBEHAVIOR_NORESIZEONSCALE can also be set if you set it at creation time.
  11306. * It is critical to understand than you HAVE TO play with this behavior in order to achieve a good performance/memory ratio. Caching all groups would certainly be the worst strategy of all.
  11307. */
  11308. cacheBehavior: number;
  11309. /**
  11310. * Get/set the Scene's Node that should be tracked, the group's position will follow the projected position of the Node.
  11311. */
  11312. trackedNode: Node;
  11313. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  11314. protected updateLevelBoundingInfo(): void;
  11315. protected static _unS: Vector2;
  11316. protected handleGroupChanged(prop: Prim2DPropInfo): void;
  11317. private detectGroupStates();
  11318. }
  11319. class RenderableGroupData {
  11320. constructor();
  11321. dispose(owner: Canvas2D): void;
  11322. addNewTransparentPrimitiveInfo(prim: RenderablePrim2D, gii: GroupInstanceInfo): TransparentPrimitiveInfo;
  11323. removeTransparentPrimitiveInfo(tpi: TransparentPrimitiveInfo): void;
  11324. transparentPrimitiveZChanged(tpi: TransparentPrimitiveInfo): void;
  11325. }
  11326. class TransparentPrimitiveInfo {
  11327. }
  11328. }
  11329. declare module BABYLON {
  11330. class Lines2DRenderCache extends ModelRenderCache {
  11331. effectsReady: boolean;
  11332. fillVB: WebGLBuffer;
  11333. fillIB: WebGLBuffer;
  11334. fillIndicesCount: number;
  11335. instancingFillAttributes: InstancingAttributeInfo[];
  11336. effectFill: Effect;
  11337. effectFillInstanced: Effect;
  11338. borderVB: WebGLBuffer;
  11339. borderIB: WebGLBuffer;
  11340. borderIndicesCount: number;
  11341. instancingBorderAttributes: InstancingAttributeInfo[];
  11342. effectBorder: Effect;
  11343. effectBorderInstanced: Effect;
  11344. constructor(engine: Engine, modelKey: string);
  11345. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  11346. dispose(): boolean;
  11347. }
  11348. class Lines2DInstanceData extends Shape2DInstanceData {
  11349. constructor(partId: number);
  11350. boundingMin: Vector2;
  11351. boundingMax: Vector2;
  11352. }
  11353. class Lines2D extends Shape2D {
  11354. /**
  11355. * No Cap to apply on the extremity
  11356. */
  11357. static NoCap: number;
  11358. /**
  11359. * A round cap, will use the line thickness as diameter
  11360. */
  11361. static RoundCap: number;
  11362. /**
  11363. * Creates a triangle at the extremity.
  11364. */
  11365. static TriangleCap: number;
  11366. /**
  11367. * Creates a Square anchor at the extremity, the square size is twice the thickness of the line
  11368. */
  11369. static SquareAnchorCap: number;
  11370. /**
  11371. * Creates a round anchor at the extremity, the diameter is twice the thickness of the line
  11372. */
  11373. static RoundAnchorCap: number;
  11374. /**
  11375. * Creates a diamond anchor at the extremity.
  11376. */
  11377. static DiamondAnchorCap: number;
  11378. /**
  11379. * Creates an arrow anchor at the extremity. the arrow base size is twice the thickness of the line
  11380. */
  11381. static ArrowCap: number;
  11382. static pointsProperty: Prim2DPropInfo;
  11383. static fillThicknessProperty: Prim2DPropInfo;
  11384. static closedProperty: Prim2DPropInfo;
  11385. static startCapProperty: Prim2DPropInfo;
  11386. static endCapProperty: Prim2DPropInfo;
  11387. points: Vector2[];
  11388. fillThickness: number;
  11389. closed: boolean;
  11390. startCap: number;
  11391. endCap: number;
  11392. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  11393. protected boundingMin: Vector2;
  11394. protected boundingMax: Vector2;
  11395. protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
  11396. protected updateLevelBoundingInfo(): void;
  11397. /**
  11398. * Create an 2D Lines Shape primitive. The defined lines may be opened or closed (see below)
  11399. * @param points an array that describe the points to use to draw the line, must contain at least two entries.
  11400. * @param settings a combination of settings, possible ones are
  11401. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  11402. * - children: an array of direct children
  11403. * - id a text identifier, for information purpose
  11404. * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
  11405. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  11406. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  11407. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  11408. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  11409. * - zOrder: override the zOrder with the specified value
  11410. * - origin: define the normalized origin point location, default [0.5;0.5]
  11411. * - fillThickness: the thickness of the fill part of the line, can be null to draw nothing (but a border brush must be given), default is 1.
  11412. * - closed: if false the lines are said to be opened, the first point and the latest DON'T connect. if true the lines are said to be closed, the first and last point will be connected by a line. For instance you can define the 4 points of a rectangle, if you set closed to true a 4 edges rectangle will be drawn. If you set false, only three edges will be drawn, the edge formed by the first and last point won't exist. Default is false.
  11413. * - startCap: Draw a cap of the given type at the start of the first line, you can't define a Cap if the Lines2D is closed. Default is Lines2D.NoCap.
  11414. * - endCap: Draw a cap of the given type at the end of the last line, you can't define a Cap if the Lines2D is closed. Default is Lines2D.NoCap.
  11415. * - fill: the brush used to draw the fill content of the lines, you can set null to draw nothing (but you will have to set a border brush), default is a SolidColorBrush of plain white. can be a string value (see Canvas2D.GetBrushFromString)
  11416. * - border: the brush used to draw the border of the lines, you can set null to draw nothing (but you will have to set a fill brush), default is null. can be a string value (see Canvas2D.GetBrushFromString)
  11417. * - borderThickness: the thickness of the drawn border, default is 1.
  11418. * - isVisible: true if the primitive must be visible, false for hidden. Default is true.
  11419. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  11420. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  11421. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  11422. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11423. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11424. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11425. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11426. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  11427. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  11428. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  11429. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  11430. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11431. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11432. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11433. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  11434. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  11435. */
  11436. constructor(points: Vector2[], settings?: {
  11437. parent?: Prim2DBase;
  11438. children?: Array<Prim2DBase>;
  11439. id?: string;
  11440. position?: Vector2;
  11441. x?: number;
  11442. y?: number;
  11443. rotation?: number;
  11444. scale?: number;
  11445. scaleX?: number;
  11446. scaleY?: number;
  11447. dontInheritParentScale?: boolean;
  11448. opacity?: number;
  11449. zOrder?: number;
  11450. origin?: Vector2;
  11451. fillThickness?: number;
  11452. closed?: boolean;
  11453. startCap?: number;
  11454. endCap?: number;
  11455. fill?: IBrush2D | string;
  11456. border?: IBrush2D | string;
  11457. borderThickness?: number;
  11458. isVisible?: boolean;
  11459. isPickable?: boolean;
  11460. isContainer?: boolean;
  11461. childrenFlatZOrder?: boolean;
  11462. marginTop?: number | string;
  11463. marginLeft?: number | string;
  11464. marginRight?: number | string;
  11465. marginBottom?: number | string;
  11466. margin?: number | string;
  11467. marginHAlignment?: number;
  11468. marginVAlignment?: number;
  11469. marginAlignment?: string;
  11470. paddingTop?: number | string;
  11471. paddingLeft?: number | string;
  11472. paddingRight?: number | string;
  11473. paddingBottom?: number | string;
  11474. padding?: string;
  11475. });
  11476. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  11477. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Lines2DRenderCache;
  11478. size: Size;
  11479. protected createInstanceDataParts(): InstanceDataBase[];
  11480. protected applyActualScaleOnTransform(): boolean;
  11481. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  11482. }
  11483. }
  11484. declare module BABYLON {
  11485. const enum ShaderDataType {
  11486. Vector2 = 0,
  11487. Vector3 = 1,
  11488. Vector4 = 2,
  11489. Matrix = 3,
  11490. float = 4,
  11491. Color3 = 5,
  11492. Color4 = 6,
  11493. Size = 7,
  11494. }
  11495. class GroupInstanceInfo {
  11496. constructor(owner: Group2D, mrc: ModelRenderCache, partCount: number);
  11497. dispose(): boolean;
  11498. owner: Group2D;
  11499. modelRenderCache: ModelRenderCache;
  11500. partIndexFromId: StringDictionary<number>;
  11501. hasOpaqueData: boolean;
  11502. hasAlphaTestData: boolean;
  11503. hasTransparentData: boolean;
  11504. opaqueDirty: boolean;
  11505. opaqueData: GroupInfoPartData[];
  11506. alphaTestDirty: boolean;
  11507. alphaTestData: GroupInfoPartData[];
  11508. transparentOrderDirty: boolean;
  11509. transparentDirty: boolean;
  11510. transparentData: TransparentGroupInfoPartData[];
  11511. sortTransparentData(): void;
  11512. usedShaderCategories: string[];
  11513. strides: number[];
  11514. }
  11515. class TransparentSegment {
  11516. constructor();
  11517. dispose(engine: Engine): void;
  11518. groupInsanceInfo: GroupInstanceInfo;
  11519. startZ: number;
  11520. endZ: number;
  11521. startDataIndex: number;
  11522. endDataIndex: number;
  11523. partBuffers: WebGLBuffer[];
  11524. }
  11525. class GroupInfoPartData {
  11526. constructor(stride: number);
  11527. dispose(engine: Engine): boolean;
  11528. }
  11529. class TransparentGroupInfoPartData extends GroupInfoPartData {
  11530. constructor(stride: number, zoff: number);
  11531. }
  11532. class ModelRenderCache {
  11533. constructor(engine: Engine, modelKey: string);
  11534. dispose(): boolean;
  11535. isDisposed: boolean;
  11536. addRef(): number;
  11537. modelKey: string;
  11538. /**
  11539. * Render the model instances
  11540. * @param instanceInfo
  11541. * @param context
  11542. * @return must return true is the rendering succeed, false if the rendering couldn't be done (asset's not yet ready, like Effect)
  11543. */
  11544. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  11545. protected getPartIndexFromId(partId: number): number;
  11546. protected loadInstancingAttributes(partId: number, effect: Effect): InstancingAttributeInfo[];
  11547. private static v2;
  11548. private static v3;
  11549. private static v4;
  11550. protected setupUniforms(effect: Effect, partIndex: number, data: DynamicFloatArray, elementCount: number): void;
  11551. }
  11552. class ModelRenderCachePartData {
  11553. }
  11554. }
  11555. declare module BABYLON {
  11556. class PrepareRender2DContext {
  11557. constructor();
  11558. /**
  11559. * True if the primitive must be refreshed no matter what
  11560. * This mode is needed because sometimes the primitive doesn't change by itself, but external changes make a refresh of its InstanceData necessary
  11561. */
  11562. forceRefreshPrimitive: boolean;
  11563. }
  11564. class Render2DContext {
  11565. constructor(renderMode: number);
  11566. /**
  11567. * Define which render Mode should be used to render the primitive: one of Render2DContext.RenderModeXxxx property
  11568. */
  11569. renderMode: number;
  11570. /**
  11571. * If true hardware instancing is supported and must be used for the rendering. The groupInfoPartData._partBuffer must be used.
  11572. * If false rendering on a per primitive basis must be made. The following properties must be used
  11573. * - groupInfoPartData._partData: contains the primitive instances data to render
  11574. * - partDataStartIndex: the index into instanceArrayData of the first instance to render.
  11575. * - partDataCount: the number of primitive to render
  11576. */
  11577. useInstancing: boolean;
  11578. /**
  11579. * If specified, must take precedence from the groupInfoPartData. partIndex is the same as groupInfoPardData
  11580. */
  11581. instancedBuffers: WebGLBuffer[];
  11582. /**
  11583. * To use when instancedBuffers is specified, gives the count of instances to draw
  11584. */
  11585. instancesCount: number;
  11586. /**
  11587. * Contains the data related to the primitives instances to render
  11588. */
  11589. groupInfoPartData: GroupInfoPartData[];
  11590. /**
  11591. * The index into groupInfoPartData._partData of the first primitive to render. This is an index, not an offset: it represent the nth primitive which is the first to render.
  11592. */
  11593. partDataStartIndex: number;
  11594. /**
  11595. * The exclusive end index, you have to render the primitive instances until you reach this one, but don't render this one!
  11596. */
  11597. partDataEndIndex: number;
  11598. /**
  11599. * The set of primitives to render is opaque.
  11600. * This is the first rendering pass. All Opaque primitives are rendered. Depth Compare and Write are both enabled.
  11601. */
  11602. static RenderModeOpaque: number;
  11603. /**
  11604. * The set of primitives to render is using Alpha Test (aka masking).
  11605. * Alpha Blend is enabled, the AlphaMode must be manually set, the render occurs after the RenderModeOpaque and is depth independent (i.e. primitives are not sorted by depth). Depth Compare and Write are both enabled.
  11606. */
  11607. static RenderModeAlphaTest: number;
  11608. /**
  11609. * The set of primitives to render is transparent.
  11610. * Alpha Blend is enabled, the AlphaMode must be manually set, the render occurs after the RenderModeAlphaTest and is depth dependent (i.e. primitives are stored by depth and rendered back to front). Depth Compare is on, but Depth write is Off.
  11611. */
  11612. static RenderModeTransparent: number;
  11613. }
  11614. /**
  11615. * This class store information for the pointerEventObservable Observable.
  11616. * The Observable is divided into many sub events (using the Mask feature of the Observable pattern): PointerOver, PointerEnter, PointerDown, PointerMouseWheel, PointerMove, PointerUp, PointerDown, PointerLeave, PointerGotCapture and PointerLostCapture.
  11617. */
  11618. class PrimitivePointerInfo {
  11619. /**
  11620. * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive.
  11621. * Bubbles: yes
  11622. */
  11623. static PointerOver: number;
  11624. /**
  11625. * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive or one of its descendants.
  11626. * Bubbles: no
  11627. */
  11628. static PointerEnter: number;
  11629. /**
  11630. * This event type is raised when a pointer enters the active button state (non-zero value in the buttons property). For mouse it's when the device transitions from no buttons depressed to at least one button depressed. For touch/pen this is when a physical contact is made.
  11631. * Bubbles: yes
  11632. */
  11633. static PointerDown: number;
  11634. /**
  11635. * This event type is raised when the pointer is a mouse and it's wheel is rolling
  11636. * Bubbles: yes
  11637. */
  11638. static PointerMouseWheel: number;
  11639. /**
  11640. * This event type is raised when a pointer change coordinates or when a pointer changes button state, pressure, tilt, or contact geometry and the circumstances produce no other pointers events.
  11641. * Bubbles: yes
  11642. */
  11643. static PointerMove: number;
  11644. /**
  11645. * This event type is raised when the pointer leaves the active buttons states (zero value in the buttons property). For mouse, this is when the device transitions from at least one button depressed to no buttons depressed. For touch/pen, this is when physical contact is removed.
  11646. * Bubbles: yes
  11647. */
  11648. static PointerUp: number;
  11649. /**
  11650. * This event type is raised when a pointing device is moved out of the hit test the boundaries of a primitive.
  11651. * Bubbles: yes
  11652. */
  11653. static PointerOut: number;
  11654. /**
  11655. * This event type is raised when a pointing device is moved out of the hit test boundaries of a primitive and all its descendants.
  11656. * Bubbles: no
  11657. */
  11658. static PointerLeave: number;
  11659. /**
  11660. * This event type is raised when a primitive receives the pointer capture. This event is fired at the element that is receiving pointer capture. Subsequent events for that pointer will be fired at this element.
  11661. * Bubbles: yes
  11662. */
  11663. static PointerGotCapture: number;
  11664. /**
  11665. * This event type is raised after pointer capture is released for a pointer.
  11666. * Bubbles: yes
  11667. */
  11668. static PointerLostCapture: number;
  11669. static MouseWheelPrecision: number;
  11670. /**
  11671. * Event Type, one of the static PointerXXXX property defined above (PrimitivePointerInfo.PointerOver to PrimitivePointerInfo.PointerLostCapture)
  11672. */
  11673. eventType: number;
  11674. /**
  11675. * Position of the pointer relative to the bottom/left of the Canvas
  11676. */
  11677. canvasPointerPos: Vector2;
  11678. /**
  11679. * Position of the pointer relative to the bottom/left of the primitive that registered the Observer
  11680. */
  11681. primitivePointerPos: Vector2;
  11682. /**
  11683. * The primitive where the event was initiated first (in case of bubbling)
  11684. */
  11685. relatedTarget: Prim2DBase;
  11686. /**
  11687. * Position of the pointer relative to the bottom/left of the relatedTarget
  11688. */
  11689. relatedTargetPointerPos: Vector2;
  11690. /**
  11691. * An observable can set this property to true to stop bubbling on the upper levels
  11692. */
  11693. cancelBubble: boolean;
  11694. /**
  11695. * True if the Control keyboard key is down
  11696. */
  11697. ctrlKey: boolean;
  11698. /**
  11699. * true if the Shift keyboard key is down
  11700. */
  11701. shiftKey: boolean;
  11702. /**
  11703. * true if the Alt keyboard key is down
  11704. */
  11705. altKey: boolean;
  11706. /**
  11707. * true if the Meta keyboard key is down
  11708. */
  11709. metaKey: boolean;
  11710. /**
  11711. * For button, buttons, refer to https://www.w3.org/TR/pointerevents/#button-states
  11712. */
  11713. button: number;
  11714. /**
  11715. * For button, buttons, refer to https://www.w3.org/TR/pointerevents/#button-states
  11716. */
  11717. buttons: number;
  11718. /**
  11719. * The amount of mouse wheel rolled
  11720. */
  11721. mouseWheelDelta: number;
  11722. /**
  11723. * Id of the Pointer involved in the event
  11724. */
  11725. pointerId: number;
  11726. width: number;
  11727. height: number;
  11728. presssure: number;
  11729. tilt: Vector2;
  11730. /**
  11731. * true if the involved pointer is captured for a particular primitive, false otherwise.
  11732. */
  11733. isCaptured: boolean;
  11734. constructor();
  11735. updateRelatedTarget(prim: Prim2DBase, primPointerPos: Vector2): void;
  11736. static getEventTypeName(mask: number): string;
  11737. }
  11738. /**
  11739. * Defines the horizontal and vertical alignment information for a Primitive.
  11740. */
  11741. class PrimitiveAlignment {
  11742. constructor(changeCallback?: () => void);
  11743. /**
  11744. * Alignment is made relative to the left edge of the Primitive. Valid for horizontal alignment only.
  11745. */
  11746. static AlignLeft: number;
  11747. /**
  11748. * Alignment is made relative to the top edge of the Primitive. Valid for vertical alignment only.
  11749. */
  11750. static AlignTop: number;
  11751. /**
  11752. * Alignment is made relative to the right edge of the Primitive. Valid for horizontal alignment only.
  11753. */
  11754. static AlignRight: number;
  11755. /**
  11756. * Alignment is made relative to the bottom edge of the Primitive. Valid for vertical alignment only.
  11757. */
  11758. static AlignBottom: number;
  11759. /**
  11760. * Alignment is made to center the content from equal distance to the opposite edges of the Primitive
  11761. */
  11762. static AlignCenter: number;
  11763. /**
  11764. * The content is stretched toward the opposite edges of the Primitive
  11765. */
  11766. static AlignStretch: number;
  11767. /**
  11768. * Get/set the horizontal alignment. Use one of the AlignXXX static properties of this class
  11769. */
  11770. horizontal: number;
  11771. /**
  11772. * Get/set the vertical alignment. Use one of the AlignXXX static properties of this class
  11773. */
  11774. vertical: number;
  11775. private onChangeCallback();
  11776. /**
  11777. * Set the horizontal alignment from a string value.
  11778. * @param text can be either: 'left','right','center','stretch'
  11779. */
  11780. setHorizontal(text: string): void;
  11781. /**
  11782. * Set the vertical alignment from a string value.
  11783. * @param text can be either: 'top','bottom','center','stretch'
  11784. */
  11785. setVertical(text: string): void;
  11786. /**
  11787. * Set the horizontal and or vertical alignments from a string value.
  11788. * @param text can be: [<h:|horizontal:><left|right|center|stretch>], [<v:|vertical:><top|bottom|center|stretch>]
  11789. */
  11790. fromString(value: string): void;
  11791. copyFrom(pa: PrimitiveAlignment): void;
  11792. isDefault: boolean;
  11793. }
  11794. /**
  11795. * Stores information about a Primitive that was intersected
  11796. */
  11797. class PrimitiveIntersectedInfo {
  11798. prim: Prim2DBase;
  11799. intersectionLocation: Vector2;
  11800. constructor(prim: Prim2DBase, intersectionLocation: Vector2);
  11801. }
  11802. /**
  11803. * Define a thickness toward every edges of a Primitive to allow margin and padding.
  11804. * The thickness can be expressed as pixels, percentages, inherit the value of the parent primitive or be auto.
  11805. */
  11806. class PrimitiveThickness {
  11807. constructor(parentAccess: () => PrimitiveThickness, changedCallback?: () => void);
  11808. /**
  11809. * Set the thickness from a string value
  11810. * @param thickness format is "top: <value>, left:<value>, right:<value>, bottom:<value>" or "<value>" (same for all edges) each are optional, auto will be set if it's omitted.
  11811. * Values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11812. */
  11813. fromString(thickness: string): void;
  11814. /**
  11815. * Set the thickness from multiple string
  11816. * Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11817. * @param top the top thickness to set
  11818. * @param left the left thickness to set
  11819. * @param right the right thickness to set
  11820. * @param bottom the bottom thickness to set
  11821. */
  11822. fromStrings(top: string, left: string, right: string, bottom: string): PrimitiveThickness;
  11823. /**
  11824. * Set the thickness from pixel values
  11825. * @param top the top thickness in pixels to set
  11826. * @param left the left thickness in pixels to set
  11827. * @param right the right thickness in pixels to set
  11828. * @param bottom the bottom thickness in pixels to set
  11829. */
  11830. fromPixels(top: number, left: number, right: number, bottom: number): PrimitiveThickness;
  11831. /**
  11832. * Apply the same pixel value to all edges
  11833. * @param margin the value to set, in pixels.
  11834. */
  11835. fromUniformPixels(margin: number): PrimitiveThickness;
  11836. copyFrom(pt: PrimitiveThickness): void;
  11837. /**
  11838. * Set all edges in auto
  11839. */
  11840. auto(): PrimitiveThickness;
  11841. setTop(value: number | string): void;
  11842. setLeft(value: number | string): void;
  11843. setRight(value: number | string): void;
  11844. setBottom(value: number | string): void;
  11845. /**
  11846. * Get/set the top thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11847. */
  11848. top: string;
  11849. /**
  11850. * Get/set the left thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11851. */
  11852. left: string;
  11853. /**
  11854. * Get/set the right thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11855. */
  11856. right: string;
  11857. /**
  11858. * Get/set the bottom thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
  11859. */
  11860. bottom: string;
  11861. /**
  11862. * Get/set the top thickness in pixel.
  11863. */
  11864. topPixels: number;
  11865. /**
  11866. * Get/set the left thickness in pixel.
  11867. */
  11868. leftPixels: number;
  11869. /**
  11870. * Get/set the right thickness in pixel.
  11871. */
  11872. rightPixels: number;
  11873. /**
  11874. * Get/set the bottom thickness in pixel.
  11875. */
  11876. bottomPixels: number;
  11877. /**
  11878. * Get/set the top thickness in percentage.
  11879. * The get will return a valid value only if the edge type is percentage.
  11880. * The Set will change the edge mode if needed
  11881. */
  11882. topPercentage: number;
  11883. /**
  11884. * Get/set the left thickness in percentage.
  11885. * The get will return a valid value only if the edge mode is percentage.
  11886. * The Set will change the edge mode if needed
  11887. */
  11888. leftPercentage: number;
  11889. /**
  11890. * Get/set the right thickness in percentage.
  11891. * The get will return a valid value only if the edge mode is percentage.
  11892. * The Set will change the edge mode if needed
  11893. */
  11894. rightPercentage: number;
  11895. /**
  11896. * Get/set the bottom thickness in percentage.
  11897. * The get will return a valid value only if the edge mode is percentage.
  11898. * The Set will change the edge mode if needed
  11899. */
  11900. bottomPercentage: number;
  11901. /**
  11902. * Get/set the top mode. The setter shouldn't be used, other setters with value should be preferred
  11903. */
  11904. topMode: number;
  11905. /**
  11906. * Get/set the left mode. The setter shouldn't be used, other setters with value should be preferred
  11907. */
  11908. leftMode: number;
  11909. /**
  11910. * Get/set the right mode. The setter shouldn't be used, other setters with value should be preferred
  11911. */
  11912. rightMode: number;
  11913. /**
  11914. * Get/set the bottom mode. The setter shouldn't be used, other setters with value should be preferred
  11915. */
  11916. bottomMode: number;
  11917. isDefault: boolean;
  11918. static Auto: number;
  11919. static Inherit: number;
  11920. static Percentage: number;
  11921. static Pixel: number;
  11922. private onChangeCallback();
  11923. /**
  11924. * Compute the positioning/size of an area considering the thickness of this object and a given alignment
  11925. * @param sourceArea the source area where the content must be sized/positioned
  11926. * @param contentSize the content size to position/resize
  11927. * @param alignment the alignment setting
  11928. * @param dstOffset the position of the content, x, y, z, w are left, bottom, right, top
  11929. * @param dstArea the new size of the content
  11930. */
  11931. computeWithAlignment(sourceArea: Size, contentSize: Size, alignment: PrimitiveAlignment, dstOffset: Vector4, dstArea: Size, computeLayoutArea?: boolean): void;
  11932. /**
  11933. * Compute an area and its position considering this thickness properties based on a given source area
  11934. * @param sourceArea the source area
  11935. * @param dstOffset the position of the resulting area
  11936. * @param dstArea the size of the resulting area
  11937. */
  11938. compute(sourceArea: Size, dstOffset: Vector4, dstArea: Size): void;
  11939. /**
  11940. * Compute an area considering this thickness properties based on a given source area
  11941. * @param sourceArea the source area
  11942. * @param result the resulting area
  11943. */
  11944. computeArea(sourceArea: Size, result: Size): void;
  11945. enlarge(sourceArea: Size, dstOffset: Vector4, enlargedArea: Size): void;
  11946. }
  11947. /**
  11948. * Main class used for the Primitive Intersection API
  11949. */
  11950. class IntersectInfo2D {
  11951. constructor();
  11952. /**
  11953. * Set the pick position, relative to the primitive where the intersection test is made
  11954. */
  11955. pickPosition: Vector2;
  11956. /**
  11957. * If true the intersection will stop at the first hit, if false all primitives will be tested and the intersectedPrimitives array will be filled accordingly (false default)
  11958. */
  11959. findFirstOnly: boolean;
  11960. /**
  11961. * If true the intersection test will also be made on hidden primitive (false default)
  11962. */
  11963. intersectHidden: boolean;
  11964. /**
  11965. * The topmost intersected primitive
  11966. */
  11967. topMostIntersectedPrimitive: PrimitiveIntersectedInfo;
  11968. /**
  11969. * The array containing all intersected primitive, in no particular order.
  11970. */
  11971. intersectedPrimitives: Array<PrimitiveIntersectedInfo>;
  11972. /**
  11973. * true if at least one primitive intersected during the test
  11974. */
  11975. isIntersected: boolean;
  11976. isPrimIntersected(prim: Prim2DBase): Vector2;
  11977. }
  11978. class Prim2DBase extends SmartPropertyPrim {
  11979. static PRIM2DBASE_PROPCOUNT: number;
  11980. constructor(settings: {
  11981. parent?: Prim2DBase;
  11982. id?: string;
  11983. children?: Array<Prim2DBase>;
  11984. position?: Vector2;
  11985. x?: number;
  11986. y?: number;
  11987. rotation?: number;
  11988. scale?: number;
  11989. scaleX?: number;
  11990. scaleY?: number;
  11991. dontInheritParentScale?: boolean;
  11992. opacity?: number;
  11993. zOrder?: number;
  11994. origin?: Vector2;
  11995. layoutEngine?: LayoutEngineBase | string;
  11996. isVisible?: boolean;
  11997. isPickable?: boolean;
  11998. isContainer?: boolean;
  11999. childrenFlatZOrder?: boolean;
  12000. marginTop?: number | string;
  12001. marginLeft?: number | string;
  12002. marginRight?: number | string;
  12003. marginBottom?: number | string;
  12004. margin?: number | string;
  12005. marginHAlignment?: number;
  12006. marginVAlignment?: number;
  12007. marginAlignment?: string;
  12008. paddingTop?: number | string;
  12009. paddingLeft?: number | string;
  12010. paddingRight?: number | string;
  12011. paddingBottom?: number | string;
  12012. padding?: string;
  12013. });
  12014. actionManager: ActionManager;
  12015. /**
  12016. * From 'this' primitive, traverse up (from parent to parent) until the given predicate is true
  12017. * @param predicate the predicate to test on each parent
  12018. * @return the first primitive where the predicate was successful
  12019. */
  12020. traverseUp(predicate: (p: Prim2DBase) => boolean): Prim2DBase;
  12021. /**
  12022. * Retrieve the owner Canvas2D
  12023. */
  12024. owner: Canvas2D;
  12025. /**
  12026. * Get the parent primitive (can be the Canvas, only the Canvas has no parent)
  12027. */
  12028. parent: Prim2DBase;
  12029. /**
  12030. * The array of direct children primitives
  12031. */
  12032. children: Prim2DBase[];
  12033. /**
  12034. * The identifier of this primitive, may not be unique, it's for information purpose only
  12035. */
  12036. id: string;
  12037. /**
  12038. * Metadata of the position property
  12039. */
  12040. static positionProperty: Prim2DPropInfo;
  12041. /**
  12042. * Metadata of the left property
  12043. */
  12044. static xProperty: Prim2DPropInfo;
  12045. /**
  12046. * Metadata of the bottom property
  12047. */
  12048. static yProperty: Prim2DPropInfo;
  12049. /**
  12050. * Metadata of the actualPosition property
  12051. */
  12052. static actualPositionProperty: Prim2DPropInfo;
  12053. /**
  12054. * Metadata of the actualX (Left) property
  12055. */
  12056. static actualXProperty: Prim2DPropInfo;
  12057. /**
  12058. * Metadata of the actualY (Bottom) property
  12059. */
  12060. static actualYProperty: Prim2DPropInfo;
  12061. /**
  12062. * Metadata of the size property
  12063. */
  12064. static sizeProperty: Prim2DPropInfo;
  12065. /**
  12066. * Metadata of the width property
  12067. */
  12068. static widthProperty: Prim2DPropInfo;
  12069. /**
  12070. * Metadata of the height property
  12071. */
  12072. static heightProperty: Prim2DPropInfo;
  12073. /**
  12074. * Metadata of the rotation property
  12075. */
  12076. static rotationProperty: Prim2DPropInfo;
  12077. /**
  12078. * Metadata of the scale property
  12079. */
  12080. static scaleProperty: Prim2DPropInfo;
  12081. /**
  12082. * Metadata of the actualSize property
  12083. */
  12084. static actualSizeProperty: Prim2DPropInfo;
  12085. /**
  12086. * Metadata of the actualWidth property
  12087. */
  12088. static actualWidthProperty: Prim2DPropInfo;
  12089. /**
  12090. * Metadata of the actualHeight property
  12091. */
  12092. static actualHeightProperty: Prim2DPropInfo;
  12093. /**
  12094. * Metadata of the origin property
  12095. */
  12096. static originProperty: Prim2DPropInfo;
  12097. /**
  12098. * Metadata of the levelVisible property
  12099. */
  12100. static levelVisibleProperty: Prim2DPropInfo;
  12101. /**
  12102. * Metadata of the isVisible property
  12103. */
  12104. static isVisibleProperty: Prim2DPropInfo;
  12105. /**
  12106. * Metadata of the zOrder property
  12107. */
  12108. static zOrderProperty: Prim2DPropInfo;
  12109. /**
  12110. * Metadata of the margin property
  12111. */
  12112. static marginProperty: Prim2DPropInfo;
  12113. /**
  12114. * Metadata of the margin property
  12115. */
  12116. static paddingProperty: Prim2DPropInfo;
  12117. /**
  12118. * Metadata of the marginAlignment property
  12119. */
  12120. static marginAlignmentProperty: Prim2DPropInfo;
  12121. /**
  12122. * Metadata of the opacity property
  12123. */
  12124. static opacityProperty: Prim2DPropInfo;
  12125. /**
  12126. * Metadata of the scaleX property
  12127. */
  12128. static scaleXProperty: Prim2DPropInfo;
  12129. /**
  12130. * Metadata of the scaleY property
  12131. */
  12132. static scaleYProperty: Prim2DPropInfo;
  12133. /**
  12134. * Metadata of the actualScale property
  12135. */
  12136. static actualScaleProperty: Prim2DPropInfo;
  12137. /**
  12138. * DO NOT INVOKE for internal purpose only
  12139. */
  12140. actualPosition: Vector2;
  12141. /**
  12142. * Shortcut to actualPosition.x
  12143. */
  12144. actualX: number;
  12145. /**
  12146. * Shortcut to actualPosition.y
  12147. */
  12148. actualY: number;
  12149. /**
  12150. * Position of the primitive, relative to its parent.
  12151. * BEWARE: if you change only position.x or y it won't trigger a property change and you won't have the expected behavior.
  12152. * Use this property to set a new Vector2 object, otherwise to change only the x/y use Prim2DBase.x or y properties.
  12153. * Setting this property may have no effect is specific alignment are in effect.
  12154. */
  12155. position: Vector2;
  12156. /**
  12157. * Direct access to the position.x value of the primitive
  12158. * Use this property when you only want to change one component of the position property
  12159. */
  12160. x: number;
  12161. /**
  12162. * Direct access to the position.y value of the primitive
  12163. * Use this property when you only want to change one component of the position property
  12164. */
  12165. y: number;
  12166. private static boundinbBoxReentrency;
  12167. protected static nullSize: Size;
  12168. /**
  12169. * Size of the primitive or its bounding area
  12170. * BEWARE: if you change only size.width or height it won't trigger a property change and you won't have the expected behavior.
  12171. * Use this property to set a new Size object, otherwise to change only the width/height use Prim2DBase.width or height properties.
  12172. */
  12173. size: Size;
  12174. /**
  12175. * Direct access to the size.width value of the primitive
  12176. * Use this property when you only want to change one component of the size property
  12177. */
  12178. width: number;
  12179. /**
  12180. * Direct access to the size.height value of the primitive
  12181. * Use this property when you only want to change one component of the size property
  12182. */
  12183. height: number;
  12184. rotation: number;
  12185. scale: number;
  12186. /**
  12187. * Return the size of the primitive as it's being rendered into the target.
  12188. * This value may be different of the size property when layout/alignment is used or specific primitive types can implement a custom logic through this property.
  12189. * BEWARE: don't use the setter, it's for internal purpose only
  12190. * Note to implementers: you have to override this property and declare if necessary a @xxxxInstanceLevel decorator
  12191. */
  12192. actualSize: Size;
  12193. /**
  12194. * Shortcut to actualSize.width
  12195. */
  12196. actualWidth: number;
  12197. /**
  12198. * Shortcut to actualPosition.height
  12199. */
  12200. actualHeight: number;
  12201. actualZOffset: number;
  12202. /**
  12203. * Get or set the minimal size the Layout Engine should respect when computing the primitive's actualSize.
  12204. * The Primitive's size won't be less than specified.
  12205. * The default value depends of the Primitive type
  12206. */
  12207. minSize: Size;
  12208. /**
  12209. * Get or set the maximal size the Layout Engine should respect when computing the primitive's actualSize.
  12210. * The Primitive's size won't be more than specified.
  12211. * The default value depends of the Primitive type
  12212. */
  12213. maxSize: Size;
  12214. /**
  12215. * The origin defines the normalized coordinate of the center of the primitive, from the bottom/left corner.
  12216. * The origin is used only to compute transformation of the primitive, it has no meaning in the primitive local frame of reference
  12217. * For instance:
  12218. * 0,0 means the center is bottom/left. Which is the default for Canvas2D instances
  12219. * 0.5,0.5 means the center is at the center of the primitive, which is default of all types of Primitives
  12220. * 0,1 means the center is top/left
  12221. * @returns The normalized center.
  12222. */
  12223. origin: Vector2;
  12224. levelVisible: boolean;
  12225. isVisible: boolean;
  12226. zOrder: number;
  12227. isManualZOrder: boolean;
  12228. margin: PrimitiveThickness;
  12229. /**
  12230. * Check for both margin and marginAlignment, return true if at least one of them is specified with a non default value
  12231. */
  12232. padding: PrimitiveThickness;
  12233. marginAlignment: PrimitiveAlignment;
  12234. /**
  12235. * Check if there a marginAlignment specified (non null and not default)
  12236. */
  12237. opacity: number;
  12238. scaleX: number;
  12239. scaleY: number;
  12240. /**
  12241. * Returns the actual scale of this Primitive, the value is computed from the scale property of this primitive, multiplied by the actualScale of its parent one (if any). The Vector2 object returned contains the scale for both X and Y axis
  12242. */
  12243. actualScale: Vector2;
  12244. /**
  12245. * Get the actual Scale of the X axis, shortcut for this.actualScale.x
  12246. */
  12247. actualScaleX: number;
  12248. /**
  12249. * Get the actual Scale of the Y axis, shortcut for this.actualScale.y
  12250. */
  12251. actualScaleY: number;
  12252. /**
  12253. * Get the actual opacity level, this property is computed from the opacity property, multiplied by the actualOpacity of its parent (if any)
  12254. */
  12255. actualOpacity: number;
  12256. /**
  12257. * Get/set the layout engine to use for this primitive.
  12258. * The default layout engine is the CanvasLayoutEngine.
  12259. */
  12260. layoutEngine: LayoutEngineBase;
  12261. /**
  12262. * Get/set the layout are of this primitive.
  12263. * The Layout area is the zone allocated by the Layout Engine for this particular primitive. Margins/Alignment will be computed based on this area.
  12264. * The setter should only be called by a Layout Engine class.
  12265. */
  12266. layoutArea: Size;
  12267. /**
  12268. * Get/set the layout area position (relative to the parent primitive).
  12269. * The setter should only be called by a Layout Engine class.
  12270. */
  12271. layoutAreaPos: Vector2;
  12272. /**
  12273. * Define if the Primitive can be subject to intersection test or not (default is true)
  12274. */
  12275. isPickable: boolean;
  12276. /**
  12277. * Define if the Primitive acts as a container or not
  12278. * A container will encapsulate its children for interaction event.
  12279. * If it's not a container events will be process down to children if the primitive is not pickable.
  12280. * Default value is true
  12281. */
  12282. isContainer: boolean;
  12283. /**
  12284. * Return the depth level of the Primitive into the Canvas' Graph. A Canvas will be 0, its direct children 1, and so on.
  12285. */
  12286. hierarchyDepth: number;
  12287. /**
  12288. * Retrieve the Group that is responsible to render this primitive
  12289. */
  12290. renderGroup: Group2D;
  12291. /**
  12292. * Get the global transformation matrix of the primitive
  12293. */
  12294. globalTransform: Matrix;
  12295. /**
  12296. * return the global position of the primitive, relative to its canvas
  12297. */
  12298. getGlobalPosition(): Vector2;
  12299. /**
  12300. * return the global position of the primitive, relative to its canvas
  12301. * @param v the valid Vector2 object where the global position will be stored
  12302. */
  12303. getGlobalPositionByRef(v: Vector2): void;
  12304. /**
  12305. * Get invert of the global transformation matrix of the primitive
  12306. */
  12307. invGlobalTransform: Matrix;
  12308. /**
  12309. * Get the local transformation of the primitive
  12310. */
  12311. localTransform: Matrix;
  12312. /**
  12313. * Get the boundingInfo associated to the primitive and its children.
  12314. * The value is supposed to be always up to date
  12315. */
  12316. boundingInfo: BoundingInfo2D;
  12317. /**
  12318. * Get the boundingInfo of the primitive's content arranged by a layout Engine
  12319. * If a particular child is not arranged by layout, it's boundingInfo is used instead to produce something as accurate as possible
  12320. */
  12321. layoutBoundingInfo: BoundingInfo2D;
  12322. /**
  12323. * Determine if the size is automatically computed or fixed because manually specified.
  12324. * Use the actualSize property to get the final/real size of the primitive
  12325. * @returns true if the size is automatically computed, false if it were manually specified.
  12326. */
  12327. isSizeAuto: boolean;
  12328. /**
  12329. * Return true if this prim has an auto size which is set by the children's global bounding box
  12330. */
  12331. isSizedByContent: boolean;
  12332. /**
  12333. * Determine if the position is automatically computed or fixed because manually specified.
  12334. * Use the actualPosition property to get the final/real position of the primitive
  12335. * @returns true if the position is automatically computed, false if it were manually specified.
  12336. */
  12337. isPositionAuto: boolean;
  12338. /**
  12339. * Interaction with the primitive can be create using this Observable. See the PrimitivePointerInfo class for more information
  12340. */
  12341. pointerEventObservable: Observable<PrimitivePointerInfo>;
  12342. zActualOrderChangedObservable: Observable<number>;
  12343. displayDebugAreas: boolean;
  12344. findById(id: string): Prim2DBase;
  12345. protected onZOrderChanged(): void;
  12346. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  12347. /**
  12348. * Capture all the Events of the given PointerId for this primitive.
  12349. * Don't forget to call releasePointerEventsCapture when done.
  12350. * @param pointerId the Id of the pointer to capture the events from.
  12351. */
  12352. setPointerEventCapture(pointerId: number): boolean;
  12353. /**
  12354. * Release a captured pointer made with setPointerEventCapture.
  12355. * @param pointerId the Id of the pointer to release the capture from.
  12356. */
  12357. releasePointerEventsCapture(pointerId: number): boolean;
  12358. /**
  12359. * Make an intersection test with the primitive, all inputs/outputs are stored in the IntersectInfo2D class, see its documentation for more information.
  12360. * @param intersectInfo contains the settings of the intersection to perform, to setup before calling this method as well as the result, available after a call to this method.
  12361. */
  12362. intersect(intersectInfo: IntersectInfo2D): boolean;
  12363. /**
  12364. * Move a child object into a new position regarding its siblings to change its rendering order.
  12365. * You can also use the shortcut methods to move top/bottom: moveChildToTop, moveChildToBottom, moveToTop, moveToBottom.
  12366. * @param child the object to move
  12367. * @param previous the object which will be before "child", if child has to be the first among sibling, set "previous" to null.
  12368. */
  12369. moveChild(child: Prim2DBase, previous: Prim2DBase): boolean;
  12370. /**
  12371. * Move the given child so it's displayed on the top of all its siblings
  12372. * @param child the primitive to move to the top
  12373. */
  12374. moveChildToTop(child: Prim2DBase): boolean;
  12375. /**
  12376. * Move the given child so it's displayed on the bottom of all its siblings
  12377. * @param child the primitive to move to the top
  12378. */
  12379. moveChildToBottom(child: Prim2DBase): boolean;
  12380. /**
  12381. * Move this primitive to be at the top among all its sibling
  12382. */
  12383. moveToTop(): boolean;
  12384. /**
  12385. * Move this primitive to be at the bottom among all its sibling
  12386. */
  12387. moveToBottom(): boolean;
  12388. private addChild(child);
  12389. /**
  12390. * Dispose the primitive, remove it from its parent.
  12391. */
  12392. dispose(): boolean;
  12393. protected onPrimBecomesDirty(): void;
  12394. protected static _isCanvasInit: boolean;
  12395. protected static CheckParent(parent: Prim2DBase): void;
  12396. protected updateCachedStatesOf(list: Prim2DBase[], recurse: boolean): void;
  12397. protected updateCachedStates(recurse: boolean): void;
  12398. /**
  12399. * Get the content are of this primitive, this area is computed using the padding property and also possibly the primitive type itself.
  12400. * Children of this primitive will be positioned relative to the bottom/left corner of this area.
  12401. */
  12402. contentArea: Size;
  12403. /**
  12404. * This method is used to alter the contentArea of the Primitive before margin is applied.
  12405. * In most of the case you won't need to override this method, but it can prove some usefulness, check the Rectangle2D class for a concrete application.
  12406. * @param primSize the current size of the primitive
  12407. * @param initialContentPosition the position of the initial content area to compute, a valid object is passed, you have to set its properties. PLEASE ROUND the values, we're talking about pixels and fraction of them is not a good thing! x, y, z, w area left, bottom, right, top
  12408. * @param initialContentArea the size of the initial content area to compute, a valid object is passed, you have to set its properties. PLEASE ROUND the values, we're talking about pixels and fraction of them is not a good thing!
  12409. */
  12410. /**
  12411. * This method is used to calculate the new size of the primitive based on the content which must stay the same
  12412. * Check the Rectangle2D implementation for a concrete application.
  12413. * @param primSize the current size of the primitive
  12414. * @param newPrimSize the new size of the primitive. PLEASE ROUND THE values, we're talking about pixels and fraction of them are not our friends!
  12415. */
  12416. }
  12417. }
  12418. declare module BABYLON {
  12419. class Rectangle2DRenderCache extends ModelRenderCache {
  12420. effectsReady: boolean;
  12421. fillVB: WebGLBuffer;
  12422. fillIB: WebGLBuffer;
  12423. fillIndicesCount: number;
  12424. instancingFillAttributes: InstancingAttributeInfo[];
  12425. effectFill: Effect;
  12426. effectFillInstanced: Effect;
  12427. borderVB: WebGLBuffer;
  12428. borderIB: WebGLBuffer;
  12429. borderIndicesCount: number;
  12430. instancingBorderAttributes: InstancingAttributeInfo[];
  12431. effectBorder: Effect;
  12432. effectBorderInstanced: Effect;
  12433. constructor(engine: Engine, modelKey: string);
  12434. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  12435. dispose(): boolean;
  12436. }
  12437. class Rectangle2DInstanceData extends Shape2DInstanceData {
  12438. constructor(partId: number);
  12439. properties: Vector3;
  12440. }
  12441. class Rectangle2D extends Shape2D {
  12442. static actualSizeProperty: Prim2DPropInfo;
  12443. static notRoundedProperty: Prim2DPropInfo;
  12444. static roundRadiusProperty: Prim2DPropInfo;
  12445. actualSize: Size;
  12446. notRounded: boolean;
  12447. roundRadius: number;
  12448. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  12449. protected updateLevelBoundingInfo(): void;
  12450. /**
  12451. * Create an Rectangle 2D Shape primitive. May be a sharp rectangle (with sharp corners), or a rounded one.
  12452. * @param settings a combination of settings, possible ones are
  12453. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  12454. * - children: an array of direct children
  12455. * - id a text identifier, for information purpose
  12456. * - position: the X & Y positions relative to its parent. Alternatively the x and y settings can be set. Default is [0;0]
  12457. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  12458. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  12459. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  12460. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  12461. * - zOrder: override the zOrder with the specified value
  12462. * - origin: define the normalized origin point location, default [0.5;0.5]
  12463. * - size: the size of the group. Alternatively the width and height settings can be set. Default will be [10;10].
  12464. * - roundRadius: if the rectangle has rounded corner, set their radius, default is 0 (to get a sharp edges rectangle).
  12465. * - fill: the brush used to draw the fill content of the rectangle, you can set null to draw nothing (but you will have to set a border brush), default is a SolidColorBrush of plain white. can also be a string value (see Canvas2D.GetBrushFromString)
  12466. * - border: the brush used to draw the border of the rectangle, you can set null to draw nothing (but you will have to set a fill brush), default is null. can also be a string value (see Canvas2D.GetBrushFromString)
  12467. * - borderThickness: the thickness of the drawn border, default is 1.
  12468. * - isVisible: true if the primitive must be visible, false for hidden. Default is true.
  12469. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  12470. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  12471. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  12472. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12473. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12474. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12475. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12476. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  12477. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  12478. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  12479. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  12480. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12481. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12482. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12483. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  12484. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  12485. */
  12486. constructor(settings?: {
  12487. parent?: Prim2DBase;
  12488. children?: Array<Prim2DBase>;
  12489. id?: string;
  12490. position?: Vector2;
  12491. x?: number;
  12492. y?: number;
  12493. rotation?: number;
  12494. scale?: number;
  12495. scaleX?: number;
  12496. scaleY?: number;
  12497. dontInheritParentScale?: boolean;
  12498. opacity?: number;
  12499. zOrder?: number;
  12500. origin?: Vector2;
  12501. size?: Size;
  12502. width?: number;
  12503. height?: number;
  12504. roundRadius?: number;
  12505. fill?: IBrush2D | string;
  12506. border?: IBrush2D | string;
  12507. borderThickness?: number;
  12508. isVisible?: boolean;
  12509. isPickable?: boolean;
  12510. isContainer?: boolean;
  12511. childrenFlatZOrder?: boolean;
  12512. marginTop?: number | string;
  12513. marginLeft?: number | string;
  12514. marginRight?: number | string;
  12515. marginBottom?: number | string;
  12516. margin?: number | string;
  12517. marginHAlignment?: number;
  12518. marginVAlignment?: number;
  12519. marginAlignment?: string;
  12520. paddingTop?: number | string;
  12521. paddingLeft?: number | string;
  12522. paddingRight?: number | string;
  12523. paddingBottom?: number | string;
  12524. padding?: string;
  12525. });
  12526. static roundSubdivisions: number;
  12527. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  12528. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Rectangle2DRenderCache;
  12529. protected createInstanceDataParts(): InstanceDataBase[];
  12530. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  12531. }
  12532. }
  12533. declare module BABYLON {
  12534. class InstanceClassInfo {
  12535. constructor(base: InstanceClassInfo);
  12536. mapProperty(propInfo: InstancePropInfo, push: boolean): void;
  12537. getInstancingAttributeInfos(effect: Effect, categories: string[]): InstancingAttributeInfo[];
  12538. getShaderAttributes(categories: string[]): string[];
  12539. }
  12540. class InstancePropInfo {
  12541. attributeName: string;
  12542. category: string;
  12543. size: number;
  12544. shaderOffset: number;
  12545. instanceOffset: StringDictionary<number>;
  12546. dataType: ShaderDataType;
  12547. delimitedCategory: string;
  12548. constructor();
  12549. setSize(val: any): void;
  12550. writeData(array: Float32Array, offset: number, val: any): void;
  12551. }
  12552. function instanceData<T>(category?: string, shaderAttributeName?: string): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12553. class InstanceDataBase {
  12554. constructor(partId: number, dataElementCount: number);
  12555. id: number;
  12556. isVisible: boolean;
  12557. zBias: Vector2;
  12558. transformX: Vector4;
  12559. transformY: Vector4;
  12560. opacity: number;
  12561. getClassTreeInfo(): ClassTreeInfo<InstanceClassInfo, InstancePropInfo>;
  12562. allocElements(): void;
  12563. freeElements(): void;
  12564. dataElementCount: number;
  12565. groupInstanceInfo: GroupInstanceInfo;
  12566. arrayLengthChanged: boolean;
  12567. curElement: number;
  12568. renderMode: number;
  12569. dataElements: DynamicFloatArrayElementInfo[];
  12570. dataBuffer: DynamicFloatArray;
  12571. typeInfo: ClassTreeInfo<InstanceClassInfo, InstancePropInfo>;
  12572. }
  12573. abstract class RenderablePrim2D extends Prim2DBase {
  12574. static RENDERABLEPRIM2D_PROPCOUNT: number;
  12575. static isAlphaTestProperty: Prim2DPropInfo;
  12576. static isTransparentProperty: Prim2DPropInfo;
  12577. isAlphaTest: boolean;
  12578. isTransparent: boolean;
  12579. renderMode: number;
  12580. constructor(settings?: {
  12581. parent?: Prim2DBase;
  12582. id?: string;
  12583. origin?: Vector2;
  12584. isVisible?: boolean;
  12585. });
  12586. /**
  12587. * Dispose the primitive and its resources, remove it from its parent
  12588. */
  12589. dispose(): boolean;
  12590. protected onZOrderChanged(): void;
  12591. /**
  12592. * Transform a given point using the Primitive's origin setting.
  12593. * This method requires the Primitive's actualSize to be accurate
  12594. * @param p the point to transform
  12595. * @param originOffset an offset applied on the current origin before performing the transformation. Depending on which frame of reference your data is expressed you may have to apply a offset. (if you data is expressed from the bottom/left, no offset is required. If it's expressed from the center the a [-0.5;-0.5] offset has to be applied.
  12596. * @param res an allocated Vector2 that will receive the transformed content
  12597. */
  12598. protected transformPointWithOriginByRef(p: Vector2, originOffset: Vector2, res: Vector2): void;
  12599. protected transformPointWithOriginToRef(p: Vector2, originOffset: Vector2, res: Vector2): Vector2;
  12600. /**
  12601. * Get the info for a given effect based on the dataPart metadata
  12602. * @param dataPartId partId in part list to get the info
  12603. * @param vertexBufferAttributes vertex buffer attributes to manually add
  12604. * @param uniforms uniforms to manually add
  12605. * @param useInstanced specified if Instanced Array should be used, if null the engine caps will be used (so true if WebGL supports it, false otherwise), but you have the possibility to override the engine capability. However, if you manually set true but the engine does not support Instanced Array, this method will return null
  12606. */
  12607. protected getDataPartEffectInfo(dataPartId: number, vertexBufferAttributes: string[], uniforms?: string[], useInstanced?: boolean): {
  12608. attributes: string[];
  12609. uniforms: string[];
  12610. defines: string;
  12611. };
  12612. protected modelRenderCache: ModelRenderCache;
  12613. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  12614. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): void;
  12615. protected createInstanceDataParts(): InstanceDataBase[];
  12616. protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
  12617. protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
  12618. protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
  12619. protected applyActualScaleOnTransform(): boolean;
  12620. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  12621. /**
  12622. * Update the instanceDataBase level properties of a part
  12623. * @param part the part to update
  12624. * @param positionOffset to use in multi part per primitive (e.g. the Text2D has N parts for N letter to display), this give the offset to apply (e.g. the position of the letter from the bottom/left corner of the text).
  12625. */
  12626. protected updateInstanceDataPart(part: InstanceDataBase, positionOffset?: Vector2): void;
  12627. }
  12628. }
  12629. declare module BABYLON {
  12630. abstract class Shape2D extends RenderablePrim2D {
  12631. static SHAPE2D_BORDERPARTID: number;
  12632. static SHAPE2D_FILLPARTID: number;
  12633. static SHAPE2D_CATEGORY_BORDER: string;
  12634. static SHAPE2D_CATEGORY_BORDERSOLID: string;
  12635. static SHAPE2D_CATEGORY_BORDERGRADIENT: string;
  12636. static SHAPE2D_CATEGORY_FILLSOLID: string;
  12637. static SHAPE2D_CATEGORY_FILLGRADIENT: string;
  12638. static SHAPE2D_PROPCOUNT: number;
  12639. static borderProperty: Prim2DPropInfo;
  12640. static fillProperty: Prim2DPropInfo;
  12641. static borderThicknessProperty: Prim2DPropInfo;
  12642. border: IBrush2D;
  12643. /**
  12644. * Get/set the brush to render the Fill part of the Primitive
  12645. */
  12646. fill: IBrush2D;
  12647. borderThickness: number;
  12648. constructor(settings?: {
  12649. fill?: IBrush2D | string;
  12650. border?: IBrush2D | string;
  12651. borderThickness?: number;
  12652. });
  12653. protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
  12654. protected applyActualScaleOnTransform(): boolean;
  12655. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  12656. }
  12657. class Shape2DInstanceData extends InstanceDataBase {
  12658. fillSolidColor: Color4;
  12659. fillGradientColor1: Color4;
  12660. fillGradientColor2: Color4;
  12661. fillGradientTY: Vector4;
  12662. borderThickness: number;
  12663. borderSolidColor: Color4;
  12664. borderGradientColor1: Color4;
  12665. borderGradientColor2: Color4;
  12666. borderGradientTY: Vector4;
  12667. }
  12668. }
  12669. declare module BABYLON {
  12670. class Prim2DClassInfo {
  12671. }
  12672. class Prim2DPropInfo {
  12673. static PROPKIND_MODEL: number;
  12674. static PROPKIND_INSTANCE: number;
  12675. static PROPKIND_DYNAMIC: number;
  12676. id: number;
  12677. flagId: number;
  12678. kind: number;
  12679. name: string;
  12680. dirtyBoundingInfo: boolean;
  12681. dirtyParentBoundingInfo: boolean;
  12682. typeLevelCompare: boolean;
  12683. bindingMode: number;
  12684. bindingUpdateSourceTrigger: number;
  12685. }
  12686. class ClassTreeInfo<TClass, TProp> {
  12687. constructor(baseClass: ClassTreeInfo<TClass, TProp>, type: Object, classContentFactory: (base: TClass) => TClass);
  12688. classContent: TClass;
  12689. type: Object;
  12690. levelContent: StringDictionary<TProp>;
  12691. fullContent: StringDictionary<TProp>;
  12692. getLevelOf(type: Object): ClassTreeInfo<TClass, TProp>;
  12693. getOrAddType(baseType: Object, type: Object): ClassTreeInfo<TClass, TProp>;
  12694. static get<TClass, TProp>(type: Object): ClassTreeInfo<TClass, TProp>;
  12695. static getOrRegister<TClass, TProp>(type: Object, classContentFactory: (base: TClass) => TClass): ClassTreeInfo<TClass, TProp>;
  12696. }
  12697. class DataBinding {
  12698. /**
  12699. * Use the mode specified in the SmartProperty declaration
  12700. */
  12701. static MODE_DEFAULT: number;
  12702. /**
  12703. * Update the binding target only once when the Smart Property's value is first accessed
  12704. */
  12705. static MODE_ONETIME: number;
  12706. /**
  12707. * Update the smart property when the source changes.
  12708. * The source won't be updated if the smart property value is set.
  12709. */
  12710. static MODE_ONEWAY: number;
  12711. /**
  12712. * Only update the source when the target's data is changing.
  12713. */
  12714. static MODE_ONEWAYTOSOURCE: number;
  12715. /**
  12716. * Update the bind target when the source changes and update the source when the Smart Property value is set.
  12717. */
  12718. static MODE_TWOWAY: number;
  12719. /**
  12720. * Use the Update Source Trigger defined in the SmartProperty declaration
  12721. */
  12722. static UPDATESOURCETRIGGER_DEFAULT: number;
  12723. /**
  12724. * Update the source as soon as the Smart Property has a value change
  12725. */
  12726. static UPDATESOURCETRIGGER_PROPERTYCHANGED: number;
  12727. /**
  12728. * Update the source when the binding target loses focus
  12729. */
  12730. static UPDATESOURCETRIGGER_LOSTFOCUS: number;
  12731. /**
  12732. * Update the source will be made by explicitly calling the UpdateFromDataSource method
  12733. */
  12734. static UPDATESOURCETRIGGER_EXPLICIT: number;
  12735. constructor();
  12736. /**
  12737. * Provide a callback that will convert the value obtained by the Data Binding to the type of the SmartProperty it's bound to.
  12738. * If no value are set, then it's assumed that the sourceValue is of the same type as the SmartProperty's one.
  12739. * If the SmartProperty type is a basic data type (string, boolean or number) and no converter is specified but the sourceValue is of a different type, the conversion will be implicitly made, if possible.
  12740. * @param sourceValue the source object retrieve by the Data Binding mechanism
  12741. * @returns the object of a compatible type with the SmartProperty it's bound to
  12742. */
  12743. converter: (sourceValue: any) => any;
  12744. /**
  12745. * Set the mode to use for the data flow in the binding. Set one of the MODE_xxx static member of this class. If not specified then MODE_DEFAULT will be used
  12746. */
  12747. mode: number;
  12748. /**
  12749. * You can override the Data Source object with this member which is the Id of a uiElement existing in the UI Logical tree.
  12750. * If not set and source no set too, then the dataSource property will be used.
  12751. */
  12752. uiElementId: string;
  12753. /**
  12754. * You can override the Data Source object with this member which is the source object to use directly.
  12755. * If not set and uiElement no set too, then the dataSource property of the SmartPropertyBase object will be used.
  12756. */
  12757. dataSource: IPropertyChanged;
  12758. /**
  12759. * The path & name of the property to get from the source object.
  12760. * Once the Source object is evaluated (it's either the one got from uiElementId, source or dataSource) you can specify which property of this object is the value to bind to the smartProperty.
  12761. * If nothing is set then the source object will be used.
  12762. * You can specify an indirect property using the format "firstProperty.indirectProperty" like "address.postalCode" if the source is a Customer object which contains an address property and the Address class contains a postalCode property.
  12763. * If the property is an Array and you want to address a particular element then use the 'arrayProperty[index]' notation. For example "phoneNumbers[0]" to get the first element of the phoneNumber property which is an array.
  12764. */
  12765. propertyPathName: string;
  12766. /**
  12767. * If the Smart Property is of the string type, you can use the string interpolation notation to provide how the sourceValue will be formatted, reference to the source value must be made via the token: ${value}. For instance `Customer Name: ${value}`
  12768. */
  12769. stringFormat: (value: any) => string;
  12770. /**
  12771. * Specify how the source should be updated, use one of the UPDATESOURCETRIGGER_xxx member of this class, if not specified then UPDATESOURCETRIGGER_DEFAULT will be used.
  12772. */
  12773. updateSourceTrigger: number;
  12774. canUpdateTarget(resetUpdateCounter: boolean): boolean;
  12775. updateTarget(): void;
  12776. /**
  12777. * The PropInfo of the property the binding is bound to
  12778. */
  12779. }
  12780. abstract class SmartPropertyBase extends PropertyChangedBase {
  12781. constructor();
  12782. disposeObservable: Observable<SmartPropertyBase>;
  12783. /**
  12784. * Check if the object is disposed or not.
  12785. * @returns true if the object is dispose, false otherwise.
  12786. */
  12787. isDisposed: boolean;
  12788. /**
  12789. * Disposable pattern, this method must be overloaded by derived types in order to clean up hardware related resources.
  12790. * @returns false if the object is already dispose, true otherwise. Your implementation must call super.dispose() and check for a false return and return immediately if it's the case.
  12791. */
  12792. dispose(): boolean;
  12793. /**
  12794. * Check if a given set of properties are dirty or not.
  12795. * @param flags a ORed combination of Prim2DPropInfo.flagId values
  12796. * @return true if at least one property is dirty, false if none of them are.
  12797. */
  12798. checkPropertiesDirty(flags: number): boolean;
  12799. /**
  12800. * Clear a given set of properties.
  12801. * @param flags a ORed combination of Prim2DPropInfo.flagId values
  12802. * @return the new set of property still marked as dirty
  12803. */
  12804. protected clearPropertiesDirty(flags: number): number;
  12805. /**
  12806. * Add an externally attached data from its key.
  12807. * This method call will fail and return false, if such key already exists.
  12808. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  12809. * @param key the unique key that identifies the data
  12810. * @param data the data object to associate to the key for this Engine instance
  12811. * @return true if no such key were already present and the data was added successfully, false otherwise
  12812. */
  12813. addExternalData<T>(key: string, data: T): boolean;
  12814. /**
  12815. * Get an externally attached data from its key
  12816. * @param key the unique key that identifies the data
  12817. * @return the associated data, if present (can be null), or undefined if not present
  12818. */
  12819. getExternalData<T>(key: string): T;
  12820. /**
  12821. * Get an externally attached data from its key, create it using a factory if it's not already present
  12822. * @param key the unique key that identifies the data
  12823. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  12824. * @return the associated data, can be null if the factory returned null.
  12825. */
  12826. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  12827. /**
  12828. * Remove an externally attached data from the Engine instance
  12829. * @param key the unique key that identifies the data
  12830. * @return true if the data was successfully removed, false if it doesn't exist
  12831. */
  12832. removeExternalData(key: any): boolean;
  12833. bindingMode?: number;
  12834. bindingUpdateSourceTrigger?: number;
  12835. typeLevelCompare?: boolean;
  12836. dirtyBoundingInfo?: boolean;
  12837. dirtyParentBoundingBox?: boolean;
  12838. }): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12839. /**
  12840. * Access the dictionary of properties metadata. Only properties decorated with XXXXLevelProperty are concerned
  12841. * @returns the dictionary, the key is the property name as declared in Javascript, the value is the metadata object
  12842. */
  12843. protected propDic: StringDictionary<Prim2DPropInfo>;
  12844. private static propChangedInfo;
  12845. private static propChangeGuarding;
  12846. /**
  12847. * Set the object from which Smart Properties using Binding will take/update their data from/to.
  12848. * When the object is part of a graph (with parent/children relationship) if the dataSource of a given instance is not specified, then the parent's one is used.
  12849. */
  12850. dataSource: IPropertyChanged;
  12851. createSimpleDataBinding(propInfo: Prim2DPropInfo, propertyPathName: string, mode?: number): DataBinding;
  12852. createDataBinding(propInfo: Prim2DPropInfo, binding: DataBinding): DataBinding;
  12853. removeDataBinding(propInfo: Prim2DPropInfo): boolean;
  12854. updateFromDataSource(): void;
  12855. }
  12856. abstract class SmartPropertyPrim extends SmartPropertyBase {
  12857. static SMARTPROPERTYPRIM_PROPCOUNT: number;
  12858. constructor();
  12859. /**
  12860. * Disposable pattern, this method must be overloaded by derived types in order to clean up hardware related resources.
  12861. * @returns false if the object is already dispose, true otherwise. Your implementation must call super.dispose() and check for a false return and return immediately if it's the case.
  12862. */
  12863. dispose(): boolean;
  12864. /**
  12865. * Animation array, more info: http://doc.babylonjs.com/tutorials/Animations
  12866. */
  12867. animations: Animation[];
  12868. /**
  12869. * Returns as a new array populated with the Animatable used by the primitive. Must be overloaded by derived primitives.
  12870. * Look at Sprite2D for more information
  12871. */
  12872. getAnimatables(): IAnimatable[];
  12873. /**
  12874. * Property giving the Model Key associated to the property.
  12875. * This value is constructed from the type of the primitive and all the name/value of its properties declared with the modelLevelProperty decorator
  12876. * @returns the model key string.
  12877. */
  12878. modelKey: string;
  12879. /**
  12880. * States if the Primitive is dirty and should be rendered again next time.
  12881. * @returns true is dirty, false otherwise
  12882. */
  12883. isDirty: boolean;
  12884. protected onPrimitivePropertyDirty(propFlagId: number): void;
  12885. protected handleGroupChanged(prop: Prim2DPropInfo): void;
  12886. /**
  12887. * Retrieve the boundingInfo for this Primitive, computed based on the primitive itself and NOT its children
  12888. */
  12889. levelBoundingInfo: BoundingInfo2D;
  12890. /**
  12891. * This method must be overridden by a given Primitive implementation to compute its boundingInfo
  12892. */
  12893. protected updateLevelBoundingInfo(): void;
  12894. /**
  12895. * Property method called when the Primitive becomes dirty
  12896. */
  12897. protected onPrimBecomesDirty(): void;
  12898. /**
  12899. * Check if a given flag is set
  12900. * @param flag the flag value
  12901. * @return true if set, false otherwise
  12902. */
  12903. /**
  12904. * Check if all given flags are set
  12905. * @param flags the flags ORed
  12906. * @return true if all the flags are set, false otherwise
  12907. */
  12908. /**
  12909. * Check if at least one flag of the given flags is set
  12910. * @param flags the flags ORed
  12911. * @return true if at least one flag is set, false otherwise
  12912. */
  12913. /**
  12914. * Clear the given flags
  12915. * @param flags the flags to clear
  12916. */
  12917. /**
  12918. * Set the given flags to true state
  12919. * @param flags the flags ORed to set
  12920. * @return the flags state before this call
  12921. */
  12922. /**
  12923. * Change the state of the given flags
  12924. * @param flags the flags ORed to change
  12925. * @param state true to set them, false to clear them
  12926. */
  12927. static flagNoPartOfLayout: number;
  12928. static flagLevelBoundingInfoDirty: number;
  12929. static flagModelDirty: number;
  12930. static flagLayoutDirty: number;
  12931. static flagLevelVisible: number;
  12932. static flagBoundingInfoDirty: number;
  12933. static flagIsPickable: number;
  12934. static flagIsVisible: number;
  12935. static flagVisibilityChanged: number;
  12936. static flagPositioningDirty: number;
  12937. static flagTrackedGroup: number;
  12938. static flagWorldCacheChanged: number;
  12939. static flagChildrenFlatZOrder: number;
  12940. static flagZOrderDirty: number;
  12941. static flagActualOpacityDirty: number;
  12942. static flagPrimInDirtyList: number;
  12943. static flagIsContainer: number;
  12944. static flagNeedRefresh: number;
  12945. static flagActualScaleDirty: number;
  12946. static flagDontInheritParentScale: number;
  12947. static flagGlobalTransformDirty: number;
  12948. static flagLayoutBoundingInfoDirty: number;
  12949. }
  12950. function dependencyProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, mode?: number, updateSourceTrigger?: number): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12951. function modelLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12952. function instanceLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12953. function dynamicLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
  12954. }
  12955. declare module BABYLON {
  12956. class Sprite2DRenderCache extends ModelRenderCache {
  12957. effectsReady: boolean;
  12958. vb: WebGLBuffer;
  12959. ib: WebGLBuffer;
  12960. instancingAttributes: InstancingAttributeInfo[];
  12961. texture: Texture;
  12962. effect: Effect;
  12963. effectInstanced: Effect;
  12964. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  12965. dispose(): boolean;
  12966. }
  12967. class Sprite2DInstanceData extends InstanceDataBase {
  12968. constructor(partId: number);
  12969. topLeftUV: Vector2;
  12970. sizeUV: Vector2;
  12971. scaleFactor: Vector2;
  12972. textureSize: Vector2;
  12973. properties: Vector3;
  12974. }
  12975. class Sprite2D extends RenderablePrim2D {
  12976. static SPRITE2D_MAINPARTID: number;
  12977. static textureProperty: Prim2DPropInfo;
  12978. static useAlphaFromTextureProperty: Prim2DPropInfo;
  12979. static actualSizeProperty: Prim2DPropInfo;
  12980. static spriteLocationProperty: Prim2DPropInfo;
  12981. static spriteFrameProperty: Prim2DPropInfo;
  12982. static invertYProperty: Prim2DPropInfo;
  12983. static spriteScaleFactorProperty: Prim2DPropInfo;
  12984. texture: Texture;
  12985. useAlphaFromTexture: boolean;
  12986. actualSize: Size;
  12987. spriteLocation: Vector2;
  12988. spriteFrame: number;
  12989. invertY: boolean;
  12990. spriteScaleFactor: Vector2;
  12991. /**
  12992. * Sets the scale of the sprite using a BABYLON.Size(w,h).
  12993. * Keeps proportion by taking the maximum of the two scale for x and y.
  12994. * @param {Size} size Size(width,height)
  12995. */
  12996. scaleToSize(size: Size): void;
  12997. /**
  12998. * Get/set if the sprite rendering should be aligned to the target rendering device pixel or not
  12999. */
  13000. alignToPixel: boolean;
  13001. protected updateLevelBoundingInfo(): void;
  13002. /**
  13003. * Get the animatable array (see http://doc.babylonjs.com/tutorials/Animations)
  13004. */
  13005. getAnimatables(): IAnimatable[];
  13006. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  13007. /**
  13008. * Create an 2D Sprite primitive
  13009. * @param texture the texture that stores the sprite to render
  13010. * @param settings a combination of settings, possible ones are
  13011. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  13012. * - children: an array of direct children
  13013. * - id a text identifier, for information purpose
  13014. * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
  13015. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  13016. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  13017. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  13018. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  13019. * - zOrder: override the zOrder with the specified value
  13020. * - origin: define the normalized origin point location, default [0.5;0.5]
  13021. * - spriteSize: the size of the sprite (in pixels), if null the size of the given texture will be used, default is null.
  13022. * - spriteLocation: the location (in pixels) in the texture of the top/left corner of the Sprite to display, default is null (0,0)
  13023. * - spriteScaleFactor: say you want to display a sprite twice as big as its bitmap which is 64,64, you set the spriteSize to 128,128 and have to set the spriteScaleFactory to 0.5,0.5 in order to address only the 64,64 pixels of the bitmaps. Default is 1,1.
  13024. * - invertY: if true the texture Y will be inverted, default is false.
  13025. * - alignToPixel: if true the sprite's texels will be aligned to the rendering viewport pixels, ensuring the best rendering quality but slow animations won't be done as smooth as if you set false. If false a texel could lies between two pixels, being blended by the texture sampling mode you choose, the rendering result won't be as good, but very slow animation will be overall better looking. Default is true: content will be aligned.
  13026. * - isVisible: true if the sprite must be visible, false for hidden. Default is true.
  13027. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  13028. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  13029. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  13030. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13031. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13032. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13033. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13034. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  13035. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  13036. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  13037. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  13038. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13039. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13040. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13041. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13042. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  13043. */
  13044. constructor(texture: Texture, settings?: {
  13045. parent?: Prim2DBase;
  13046. children?: Array<Prim2DBase>;
  13047. id?: string;
  13048. position?: Vector2;
  13049. x?: number;
  13050. y?: number;
  13051. rotation?: number;
  13052. scale?: number;
  13053. scaleX?: number;
  13054. scaleY?: number;
  13055. dontInheritParentScale?: boolean;
  13056. opacity?: number;
  13057. zOrder?: number;
  13058. origin?: Vector2;
  13059. spriteSize?: Size;
  13060. spriteLocation?: Vector2;
  13061. spriteScaleFactor?: Vector2;
  13062. invertY?: boolean;
  13063. alignToPixel?: boolean;
  13064. isVisible?: boolean;
  13065. isPickable?: boolean;
  13066. isContainer?: boolean;
  13067. childrenFlatZOrder?: boolean;
  13068. marginTop?: number | string;
  13069. marginLeft?: number | string;
  13070. marginRight?: number | string;
  13071. marginBottom?: number | string;
  13072. margin?: number | string;
  13073. marginHAlignment?: number;
  13074. marginVAlignment?: number;
  13075. marginAlignment?: string;
  13076. paddingTop?: number | string;
  13077. paddingLeft?: number | string;
  13078. paddingRight?: number | string;
  13079. paddingBottom?: number | string;
  13080. padding?: string;
  13081. });
  13082. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  13083. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Sprite2DRenderCache;
  13084. protected createInstanceDataParts(): InstanceDataBase[];
  13085. private static layoutConstructMode;
  13086. protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
  13087. protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
  13088. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  13089. }
  13090. }
  13091. declare module BABYLON {
  13092. class Text2DRenderCache extends ModelRenderCache {
  13093. effectsReady: boolean;
  13094. vb: WebGLBuffer;
  13095. ib: WebGLBuffer;
  13096. instancingAttributes: InstancingAttributeInfo[];
  13097. fontTexture: FontTexture;
  13098. effect: Effect;
  13099. effectInstanced: Effect;
  13100. render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
  13101. dispose(): boolean;
  13102. }
  13103. class Text2DInstanceData extends InstanceDataBase {
  13104. constructor(partId: number, dataElementCount: number);
  13105. topLeftUV: Vector2;
  13106. sizeUV: Vector2;
  13107. textureSize: Vector2;
  13108. color: Color4;
  13109. superSampleFactor: number;
  13110. }
  13111. class Text2D extends RenderablePrim2D {
  13112. static TEXT2D_MAINPARTID: number;
  13113. static TEXT2D_CATEGORY_SDF: string;
  13114. static fontProperty: Prim2DPropInfo;
  13115. static defaultFontColorProperty: Prim2DPropInfo;
  13116. static textProperty: Prim2DPropInfo;
  13117. static sizeProperty: Prim2DPropInfo;
  13118. static fontSuperSampleProperty: Prim2DPropInfo;
  13119. static fontSignedDistanceFieldProperty: Prim2DPropInfo;
  13120. fontName: string;
  13121. defaultFontColor: Color4;
  13122. text: string;
  13123. size: Size;
  13124. fontSuperSample: boolean;
  13125. fontSignedDistanceField: boolean;
  13126. isSizeAuto: boolean;
  13127. /**
  13128. * Get the actual size of the Text2D primitive
  13129. */
  13130. actualSize: Size;
  13131. /**
  13132. * Get the area that bounds the text associated to the primitive
  13133. */
  13134. textSize: Size;
  13135. protected fontTexture: FontTexture;
  13136. /**
  13137. * Dispose the primitive, remove it from its parent
  13138. */
  13139. dispose(): boolean;
  13140. protected updateLevelBoundingInfo(): void;
  13141. /**
  13142. * Create a Text primitive
  13143. * @param text the text to display
  13144. * @param settings a combination of settings, possible ones are
  13145. * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
  13146. * - children: an array of direct children
  13147. * - id a text identifier, for information purpose
  13148. * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
  13149. * - rotation: the initial rotation (in radian) of the primitive. default is 0
  13150. * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
  13151. * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
  13152. * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
  13153. * - zOrder: override the zOrder with the specified value
  13154. * - origin: define the normalized origin point location, default [0.5;0.5]
  13155. * - fontName: the name/size/style of the font to use, following the CSS notation. Default is "12pt Arial".
  13156. * - fontSuperSample: if true the text will be rendered with a superSampled font (the font is twice the given size). Use this settings if the text lies in world space or if it's scaled in.
  13157. * - signedDistanceField: if true the text will be rendered using the SignedDistanceField technique. This technique has the advantage to be rendered order independent (then much less drawing calls), but only works on font that are a little more than one pixel wide on the screen but the rendering quality is excellent whatever the font size is on the screen (which is the purpose of this technique). Outlining/Shadow is not supported right now. If you can, you should use this mode, the quality and the performances are the best. Note that fontSuperSample has no effect when this mode is on.
  13158. * - defaultFontColor: the color by default to apply on each letter of the text to display, default is plain white.
  13159. * - areaSize: the size of the area in which to display the text, default is auto-fit from text content.
  13160. * - tabulationSize: number of space character to insert when a tabulation is encountered, default is 4
  13161. * - isVisible: true if the text must be visible, false for hidden. Default is true.
  13162. * - isPickable: if true the Primitive can be used with interaction mode and will issue Pointer Event. If false it will be ignored for interaction/intersection test. Default value is true.
  13163. * - isContainer: if true the Primitive acts as a container for interaction, if the primitive is not pickable or doesn't intersection, no further test will be perform on its children. If set to false, children will always be considered for intersection/interaction. Default value is true.
  13164. * - childrenFlatZOrder: if true all the children (direct and indirect) will share the same Z-Order. Use this when there's a lot of children which don't overlap. The drawing order IS NOT GUARANTED!
  13165. * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13166. * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13167. * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13168. * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13169. * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
  13170. * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
  13171. * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
  13172. * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
  13173. * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13174. * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13175. * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13176. * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
  13177. * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
  13178. */
  13179. constructor(text: string, settings?: {
  13180. parent?: Prim2DBase;
  13181. children?: Array<Prim2DBase>;
  13182. id?: string;
  13183. position?: Vector2;
  13184. x?: number;
  13185. y?: number;
  13186. rotation?: number;
  13187. scale?: number;
  13188. scaleX?: number;
  13189. scaleY?: number;
  13190. dontInheritParentScale?: boolean;
  13191. opacity?: number;
  13192. zOrder?: number;
  13193. origin?: Vector2;
  13194. fontName?: string;
  13195. fontSuperSample?: boolean;
  13196. fontSignedDistanceField?: boolean;
  13197. defaultFontColor?: Color4;
  13198. size?: Size;
  13199. tabulationSize?: number;
  13200. isVisible?: boolean;
  13201. isPickable?: boolean;
  13202. isContainer?: boolean;
  13203. childrenFlatZOrder?: boolean;
  13204. marginTop?: number | string;
  13205. marginLeft?: number | string;
  13206. marginRight?: number | string;
  13207. marginBottom?: number | string;
  13208. margin?: number | string;
  13209. marginHAlignment?: number;
  13210. marginVAlignment?: number;
  13211. marginAlignment?: string;
  13212. paddingTop?: number | string;
  13213. paddingLeft?: number | string;
  13214. paddingRight?: number | string;
  13215. paddingBottom?: number | string;
  13216. padding?: string;
  13217. });
  13218. protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
  13219. protected createModelRenderCache(modelKey: string): ModelRenderCache;
  13220. protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Text2DRenderCache;
  13221. protected createInstanceDataParts(): InstanceDataBase[];
  13222. protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
  13223. protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
  13224. protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
  13225. protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
  13226. }
  13227. }
  13228. declare module BABYLON {
  13229. /**
  13230. * This is the class that is used to display a World Space Canvas into a 3D scene
  13231. */
  13232. class WorldSpaceCanvas2DNode extends Mesh {
  13233. constructor(name: string, scene: Scene, canvas: Canvas2D);
  13234. dispose(): void;
  13235. }
  13236. }
  13237. declare module BABYLON {
  13238. class Button extends ContentControl {
  13239. static pushedState: string;
  13240. static BUTTON_PROPCOUNT: number;
  13241. static isPushedProperty: Prim2DPropInfo;
  13242. static isDefaultProperty: Prim2DPropInfo;
  13243. static isOutlineProperty: Prim2DPropInfo;
  13244. constructor(settings?: {
  13245. id?: string;
  13246. parent?: UIElement;
  13247. templateName?: string;
  13248. styleName?: string;
  13249. content?: any;
  13250. marginTop?: number | string;
  13251. marginLeft?: number | string;
  13252. marginRight?: number | string;
  13253. marginBottom?: number | string;
  13254. margin?: number | string;
  13255. marginHAlignment?: number;
  13256. marginVAlignment?: number;
  13257. marginAlignment?: string;
  13258. paddingTop?: number | string;
  13259. paddingLeft?: number | string;
  13260. paddingRight?: number | string;
  13261. paddingBottom?: number | string;
  13262. padding?: string;
  13263. paddingHAlignment?: number;
  13264. paddingVAlignment?: number;
  13265. paddingAlignment?: string;
  13266. });
  13267. isPushed: boolean;
  13268. isDefault: boolean;
  13269. isOutline: boolean;
  13270. clickObservable: Observable<Button>;
  13271. protected createVisualTree(): void;
  13272. normalStateBackground: ObservableStringDictionary<IBrush2D>;
  13273. defaultStateBackground: ObservableStringDictionary<IBrush2D>;
  13274. normalStateBorder: ObservableStringDictionary<IBrush2D>;
  13275. defaultStateBorder: ObservableStringDictionary<IBrush2D>;
  13276. }
  13277. class DefaultButtonRenderingTemplate extends UIElementRenderingTemplateBase {
  13278. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  13279. root: Prim2DBase;
  13280. contentPlaceholder: Prim2DBase;
  13281. };
  13282. attach(owner: UIElement): void;
  13283. stateChange(): void;
  13284. }
  13285. }
  13286. declare module BABYLON {
  13287. abstract class ContentControl extends Control {
  13288. static CONTENTCONTROL_PROPCOUNT: number;
  13289. static contentProperty: Prim2DPropInfo;
  13290. constructor(settings?: {
  13291. id?: string;
  13292. templateName?: string;
  13293. styleName?: string;
  13294. content?: any;
  13295. });
  13296. dispose(): boolean;
  13297. content: any;
  13298. }
  13299. }
  13300. declare module BABYLON {
  13301. abstract class Control extends UIElement {
  13302. static CONTROL_PROPCOUNT: number;
  13303. static backgroundProperty: Prim2DPropInfo;
  13304. static borderProperty: Prim2DPropInfo;
  13305. static borderThicknessProperty: Prim2DPropInfo;
  13306. static fontNameProperty: Prim2DPropInfo;
  13307. static foregroundProperty: Prim2DPropInfo;
  13308. constructor(settings: {
  13309. id?: string;
  13310. templateName?: string;
  13311. styleName?: string;
  13312. });
  13313. background: StringDictionary<IBrush2D>;
  13314. border: IBrush2D;
  13315. borderThickness: number;
  13316. fontName: string;
  13317. foreground: IBrush2D;
  13318. }
  13319. }
  13320. declare module BABYLON {
  13321. class Label extends Control {
  13322. static textProperty: Prim2DPropInfo;
  13323. constructor(settings?: {
  13324. id?: string;
  13325. parent?: UIElement;
  13326. templateName?: string;
  13327. styleName?: string;
  13328. text?: string;
  13329. marginTop?: number | string;
  13330. marginLeft?: number | string;
  13331. marginRight?: number | string;
  13332. marginBottom?: number | string;
  13333. margin?: number | string;
  13334. marginHAlignment?: number;
  13335. marginVAlignment?: number;
  13336. marginAlignment?: string;
  13337. paddingTop?: number | string;
  13338. paddingLeft?: number | string;
  13339. paddingRight?: number | string;
  13340. paddingBottom?: number | string;
  13341. padding?: string;
  13342. });
  13343. protected createVisualTree(): void;
  13344. text: string;
  13345. }
  13346. class DefaultLabelRenderingTemplate extends UIElementRenderingTemplateBase {
  13347. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  13348. root: Prim2DBase;
  13349. contentPlaceholder: Prim2DBase;
  13350. };
  13351. }
  13352. }
  13353. declare module BABYLON {
  13354. interface ICommand {
  13355. canExecute(parameter: any): boolean;
  13356. execute(parameter: any): void;
  13357. canExecuteChanged: Observable<void>;
  13358. }
  13359. class Command implements ICommand {
  13360. constructor(execute: (p) => void, canExecute: (p) => boolean);
  13361. canExecute(parameter: any): boolean;
  13362. execute(parameter: any): void;
  13363. canExecuteChanged: Observable<void>;
  13364. }
  13365. abstract class UIElement extends SmartPropertyBase {
  13366. static enabledState: string;
  13367. static disabledState: string;
  13368. static mouseOverState: string;
  13369. static UIELEMENT_PROPCOUNT: number;
  13370. static parentProperty: Prim2DPropInfo;
  13371. static widthProperty: Prim2DPropInfo;
  13372. static heightProperty: Prim2DPropInfo;
  13373. static minWidthProperty: Prim2DPropInfo;
  13374. static minHeightProperty: Prim2DPropInfo;
  13375. static maxWidthProperty: Prim2DPropInfo;
  13376. static maxHeightProperty: Prim2DPropInfo;
  13377. static actualWidthProperty: Prim2DPropInfo;
  13378. static actualHeightProperty: Prim2DPropInfo;
  13379. static marginProperty: Prim2DPropInfo;
  13380. static paddingProperty: Prim2DPropInfo;
  13381. static marginAlignmentProperty: Prim2DPropInfo;
  13382. static paddingAlignmentProperty: Prim2DPropInfo;
  13383. static isEnabledProperty: Prim2DPropInfo;
  13384. static isFocusedProperty: Prim2DPropInfo;
  13385. static isMouseOverProperty: Prim2DPropInfo;
  13386. constructor(settings: {
  13387. id?: string;
  13388. parent?: UIElement;
  13389. templateName?: string;
  13390. styleName?: string;
  13391. minWidth?: number;
  13392. minHeight?: number;
  13393. maxWidth?: number;
  13394. maxHeight?: number;
  13395. width?: number;
  13396. height?: number;
  13397. marginTop?: number | string;
  13398. marginLeft?: number | string;
  13399. marginRight?: number | string;
  13400. marginBottom?: number | string;
  13401. margin?: number | string;
  13402. marginHAlignment?: number;
  13403. marginVAlignment?: number;
  13404. marginAlignment?: string;
  13405. paddingTop?: number | string;
  13406. paddingLeft?: number | string;
  13407. paddingRight?: number | string;
  13408. paddingBottom?: number | string;
  13409. padding?: string;
  13410. paddingHAlignment?: number;
  13411. paddingVAlignment?: number;
  13412. paddingAlignment?: string;
  13413. });
  13414. dispose(): boolean;
  13415. /**
  13416. * Animation array, more info: http://doc.babylonjs.com/tutorials/Animations
  13417. */
  13418. animations: Animation[];
  13419. /**
  13420. * Returns as a new array populated with the Animatable used by the primitive. Must be overloaded by derived primitives.
  13421. * Look at Sprite2D for more information
  13422. */
  13423. getAnimatables(): IAnimatable[];
  13424. findById(id: string): UIElement;
  13425. ownerWindow: Window;
  13426. style: string;
  13427. /**
  13428. * A string that identifies the UIElement.
  13429. * The id is optional and there's possible collision with other UIElement's id as the uniqueness is not supported.
  13430. */
  13431. id: string;
  13432. /**
  13433. * Return a unique id automatically generated.
  13434. * This property is mainly used for serialization to ensure a perfect way of identifying a UIElement
  13435. */
  13436. uid: string;
  13437. hierarchyDepth: number;
  13438. parent: UIElement;
  13439. width: number;
  13440. height: number;
  13441. minWidth: number;
  13442. minHheight: number;
  13443. minHeight: number;
  13444. maxWidth: number;
  13445. maxHeight: number;
  13446. actualWidth: number;
  13447. actualHeight: number;
  13448. margin: PrimitiveThickness;
  13449. padding: PrimitiveThickness;
  13450. marginAlignment: PrimitiveAlignment;
  13451. /**
  13452. * Check if there a marginAlignment specified (non null and not default)
  13453. */
  13454. paddingAlignment: PrimitiveAlignment;
  13455. /**
  13456. * Check if there a marginAlignment specified (non null and not default)
  13457. */
  13458. isVisible: boolean;
  13459. isEnabled: boolean;
  13460. isFocused: boolean;
  13461. isMouseOver: boolean;
  13462. isFocusScope: boolean;
  13463. isFocusable: boolean;
  13464. protected getFocusScope(): UIElement;
  13465. /**
  13466. * Check if a given flag is set
  13467. * @param flag the flag value
  13468. * @return true if set, false otherwise
  13469. */
  13470. /**
  13471. * Check if all given flags are set
  13472. * @param flags the flags ORed
  13473. * @return true if all the flags are set, false otherwise
  13474. */
  13475. /**
  13476. * Check if at least one flag of the given flags is set
  13477. * @param flags the flags ORed
  13478. * @return true if at least one flag is set, false otherwise
  13479. */
  13480. /**
  13481. * Clear the given flags
  13482. * @param flags the flags to clear
  13483. */
  13484. /**
  13485. * Set the given flags to true state
  13486. * @param flags the flags ORed to set
  13487. * @return the flags state before this call
  13488. */
  13489. /**
  13490. * Change the state of the given flags
  13491. * @param flags the flags ORed to change
  13492. * @param state true to set them, false to clear them
  13493. */
  13494. protected createVisualTree(): void;
  13495. protected visualPlaceholder: Prim2DBase;
  13496. protected visualTemplateRoot: Prim2DBase;
  13497. protected visualChildrenPlaceholder: Prim2DBase;
  13498. protected abstract _getChildren(): Array<UIElement>;
  13499. static flagVisualToBuild: number;
  13500. static flagIsVisible: number;
  13501. static flagIsFocus: number;
  13502. static flagIsFocusScope: number;
  13503. static flagIsFocusable: number;
  13504. static flagIsEnabled: number;
  13505. static flagIsMouseOver: number;
  13506. }
  13507. abstract class UIElementStyle {
  13508. abstract removeStyle(uiel: UIElement): any;
  13509. abstract applyStyle(uiel: UIElement): any;
  13510. name: string;
  13511. }
  13512. class GUIManager {
  13513. static registerDataTemplate(className: string, factory: (parent: UIElement, dataObject: any) => UIElement): void;
  13514. static getStyle(uiElType: string, styleName: string): UIElementStyle;
  13515. static registerStyle(uiElType: string, templateName: string, style: UIElementStyle): void;
  13516. static stylesByUIElement: StringDictionary<StringDictionary<UIElementStyle>>;
  13517. static DefaultStyleName: string;
  13518. static getRenderingTemplate(uiElType: string, templateName: string): () => UIElementRenderingTemplateBase;
  13519. static registerRenderingTemplate(uiElType: string, templateName: string, factory: () => UIElementRenderingTemplateBase): void;
  13520. static renderingTemplatesByUIElement: StringDictionary<StringDictionary<() => UIElementRenderingTemplateBase>>;
  13521. static DefaultTemplateName: string;
  13522. }
  13523. abstract class UIElementRenderingTemplateBase {
  13524. attach(owner: UIElement): void;
  13525. detach(): void;
  13526. owner: UIElement;
  13527. abstract createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  13528. root: Prim2DBase;
  13529. contentPlaceholder: Prim2DBase;
  13530. };
  13531. }
  13532. function registerWindowRenderingTemplate(uiElType: string, templateName: string, factory: () => UIElementRenderingTemplateBase): (target: Object) => void;
  13533. }
  13534. declare module BABYLON {
  13535. class FocusManager {
  13536. constructor();
  13537. setFocusOn(el: UIElement, focusScope: UIElement): void;
  13538. }
  13539. class Window extends ContentControl {
  13540. static WINDOW_PROPCOUNT: number;
  13541. static leftProperty: Prim2DPropInfo;
  13542. static bottomProperty: Prim2DPropInfo;
  13543. static positionProperty: Prim2DPropInfo;
  13544. static isActiveProperty: Prim2DPropInfo;
  13545. constructor(scene: Scene, settings?: {
  13546. id?: string;
  13547. templateName?: string;
  13548. styleName?: string;
  13549. content?: any;
  13550. left?: number;
  13551. bottom?: number;
  13552. minWidth?: number;
  13553. minHeight?: number;
  13554. maxWidth?: number;
  13555. maxHeight?: number;
  13556. width?: number;
  13557. height?: number;
  13558. worldPosition?: Vector3;
  13559. worldRotation?: Quaternion;
  13560. marginTop?: number | string;
  13561. marginLeft?: number | string;
  13562. marginRight?: number | string;
  13563. marginBottom?: number | string;
  13564. margin?: number | string;
  13565. marginHAlignment?: number;
  13566. marginVAlignment?: number;
  13567. marginAlignment?: string;
  13568. paddingTop?: number | string;
  13569. paddingLeft?: number | string;
  13570. paddingRight?: number | string;
  13571. paddingBottom?: number | string;
  13572. padding?: string;
  13573. paddingHAlignment?: number;
  13574. paddingVAlignment?: number;
  13575. paddingAlignment?: string;
  13576. });
  13577. canvas: Canvas2D;
  13578. left: number;
  13579. bottom: number;
  13580. position: Vector2;
  13581. isActive: boolean;
  13582. focusManager: FocusManager;
  13583. protected createVisualTree(): void;
  13584. private static getSceneData(scene);
  13585. }
  13586. class DefaultWindowRenderingTemplate extends UIElementRenderingTemplateBase {
  13587. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  13588. root: Prim2DBase;
  13589. contentPlaceholder: Prim2DBase;
  13590. };
  13591. }
  13592. }
  13593. declare module BABYLON {
  13594. class PropertyChangedInfo {
  13595. /**
  13596. * Previous value of the property
  13597. */
  13598. oldValue: any;
  13599. /**
  13600. * New value of the property
  13601. */
  13602. newValue: any;
  13603. /**
  13604. * Name of the property that changed its value
  13605. */
  13606. propertyName: string;
  13607. }
  13608. /**
  13609. * Custom type of the propertyChanged observable
  13610. */
  13611. /**
  13612. * Property Changed interface
  13613. */
  13614. interface IPropertyChanged {
  13615. /**
  13616. * PropertyChanged observable
  13617. */
  13618. propertyChanged: Observable<PropertyChangedInfo>;
  13619. }
  13620. /**
  13621. * The purpose of this class is to provide a base implementation of the IPropertyChanged interface for the user to avoid rewriting a code needlessly.
  13622. * Typical use of this class is to check for equality in a property set(), then call the onPropertyChanged method if values are different after the new value is set. The protected method will notify observers of the change.
  13623. * Remark: onPropertyChanged detects reentrant code and acts in a way to make sure everything is fine, fast and allocation friendly (when there no reentrant code which should be 99% of the time)
  13624. */
  13625. abstract class PropertyChangedBase implements IPropertyChanged {
  13626. /**
  13627. * Protected method to call when there's a change of value in a property set
  13628. * @param propName the name of the concerned property
  13629. * @param oldValue its old value
  13630. * @param newValue its new value
  13631. * @param mask an optional observable mask
  13632. */
  13633. protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
  13634. /**
  13635. * An observable that is triggered when a property (using of the XXXXLevelProperty decorator) has its value changing.
  13636. * You can add an observer that will be triggered only for a given set of Properties using the Mask feature of the Observable and the corresponding Prim2DPropInfo.flagid value (e.g. Prim2DBase.positionProperty.flagid|Prim2DBase.rotationProperty.flagid to be notified only about position or rotation change)
  13637. */
  13638. propertyChanged: Observable<PropertyChangedInfo>;
  13639. private static pci;
  13640. private static calling;
  13641. }
  13642. }
  13643. declare module BABYLON {
  13644. /**
  13645. * Class for the ObservableArray.onArrayChanged observable
  13646. */
  13647. class ArrayChanged<T> {
  13648. constructor();
  13649. /**
  13650. * Contain the action that were made on the ObservableArray, it's one of the ArrayChanged.xxxAction members.
  13651. * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
  13652. */
  13653. action: number;
  13654. /**
  13655. * Only valid if the action is newItemsAction
  13656. */
  13657. newItems: {
  13658. index: number;
  13659. value: T;
  13660. }[];
  13661. /**
  13662. * Only valid if the action is removedItemsAction
  13663. */
  13664. removedItems: {
  13665. index: number;
  13666. value: T;
  13667. }[];
  13668. /**
  13669. * Only valid if the action is changedItemAction
  13670. */
  13671. changedItems: {
  13672. index: number;
  13673. value: T;
  13674. }[];
  13675. /**
  13676. * Get the index of the first item inserted
  13677. */
  13678. newStartingIndex: number;
  13679. /**
  13680. * Get the index of the first item removed
  13681. */
  13682. removedStartingIndex: number;
  13683. /**
  13684. * Get the index of the first changed item
  13685. */
  13686. changedStartingIndex: number;
  13687. /**
  13688. * The content of the array was totally cleared
  13689. */
  13690. static clearAction: number;
  13691. /**
  13692. * A new item was added, the newItems field contains the key/value pairs
  13693. */
  13694. static newItemsAction: number;
  13695. /**
  13696. * An existing item was removed, the removedKey field contains its key
  13697. */
  13698. static removedItemsAction: number;
  13699. /**
  13700. * One or many items in the array were changed, the
  13701. */
  13702. static changedItemAction: number;
  13703. /**
  13704. * The array's content was totally changed
  13705. * Depending on the method that used this mode the ChangedArray object may contains more information
  13706. */
  13707. static replacedArrayAction: number;
  13708. /**
  13709. * The length of the array changed
  13710. */
  13711. static lengthChangedAction: number;
  13712. clear(): void;
  13713. }
  13714. class OAWatchedObjectChangedInfo<T> {
  13715. object: T;
  13716. propertyChanged: PropertyChangedInfo;
  13717. }
  13718. /**
  13719. * This class mimics the Javascript Array and TypeScript Array<T> classes, adding new features concerning the Observable pattern.
  13720. *
  13721. */
  13722. class ObservableArray<T> extends PropertyChangedBase {
  13723. /**
  13724. * Create an Observable Array.
  13725. * @param watchObjectsPropertyChange
  13726. * @param array and optional array that will be encapsulated by this ObservableArray instance. That's right, it's NOT a copy!
  13727. */
  13728. constructor(watchObjectsPropertyChange: boolean, array?: Array<T>);
  13729. /**
  13730. * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
  13731. */
  13732. length: number;
  13733. getAt(index: number): T;
  13734. setAt(index: number, value: T): boolean;
  13735. /**
  13736. * Returns a string representation of an array.
  13737. */
  13738. toString(): string;
  13739. toLocaleString(): string;
  13740. /**
  13741. * Appends new elements to an array, and returns the new length of the array.
  13742. * @param items New elements of the Array.
  13743. */
  13744. push(...items: T[]): number;
  13745. /**
  13746. * Removes the last element from an array and returns it.
  13747. */
  13748. pop(): T;
  13749. /**
  13750. * Combines two or more arrays.
  13751. * @param items Additional items to add to the end of array1.
  13752. */
  13753. concat(...items: T[]): ObservableArray<T>;
  13754. /**
  13755. * Adds all the elements of an array separated by the specified separator string.
  13756. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
  13757. */
  13758. join(separator?: string): string;
  13759. /**
  13760. * Reverses the elements in an Array.
  13761. * The arrayChanged action is
  13762. */
  13763. reverse(): T[];
  13764. /**
  13765. * Removes the first element from an array and returns it, shift all subsequents element one element before.
  13766. * The ArrayChange action is replacedArrayAction, the whole array changes and must be reevaluate as such, the removed element is in removedItems.
  13767. *
  13768. */
  13769. shift(): T;
  13770. /**
  13771. * Returns a section of an array.
  13772. * @param start The beginning of the specified portion of the array.
  13773. * @param end The end of the specified portion of the array.
  13774. */
  13775. slice(start?: number, end?: number): ObservableArray<T>;
  13776. /**
  13777. * Sorts an array.
  13778. * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
  13779. * On the contrary of the Javascript Array's implementation, this method returns nothing
  13780. */
  13781. sort(compareFn?: (a: T, b: T) => number): void;
  13782. /**
  13783. * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
  13784. * @param start The zero-based location in the array from which to start removing elements.
  13785. * @param deleteCount The number of elements to remove.
  13786. * @param items Elements to insert into the array in place of the deleted elements.
  13787. */
  13788. splice(start: number, deleteCount: number, ...items: T[]): T[];
  13789. /**
  13790. * Inserts new elements at the start of an array.
  13791. * @param items Elements to insert at the start of the Array.
  13792. * The ChangedArray action is replacedArrayAction, newItems contains the list of the added items
  13793. */
  13794. unshift(...items: T[]): number;
  13795. /**
  13796. * Returns the index of the first occurrence of a value in an array.
  13797. * @param searchElement The value to locate in the array.
  13798. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
  13799. */
  13800. indexOf(searchElement: T, fromIndex?: number): number;
  13801. /**
  13802. * Returns the index of the last occurrence of a specified value in an array.
  13803. * @param searchElement The value to locate in the array.
  13804. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
  13805. */
  13806. lastIndexOf(searchElement: T, fromIndex?: number): number;
  13807. /**
  13808. * Determines whether all the members of an array satisfy the specified test.
  13809. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
  13810. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  13811. */
  13812. every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
  13813. /**
  13814. * Determines whether the specified callback function returns true for any element of an array.
  13815. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
  13816. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  13817. */
  13818. some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
  13819. /**
  13820. * Performs the specified action for each element in an array.
  13821. * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
  13822. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  13823. */
  13824. forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
  13825. /**
  13826. * Calls a defined callback function on each element of an array, and returns an array that contains the results.
  13827. * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
  13828. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  13829. */
  13830. map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
  13831. /**
  13832. * Returns the elements of an array that meet the condition specified in a callback function.
  13833. * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
  13834. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  13835. */
  13836. filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
  13837. /**
  13838. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  13839. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  13840. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  13841. */
  13842. reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
  13843. /**
  13844. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  13845. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  13846. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  13847. */
  13848. reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
  13849. arrayChanged: Observable<ArrayChanged<T>>;
  13850. protected getArrayChangedObject(): ArrayChanged<T>;
  13851. protected feedNotifArray(array: {
  13852. index: number;
  13853. value: T;
  13854. }[], startindIndex: number, ...items: T[]): void;
  13855. protected callArrayChanged(ac: ArrayChanged<T>): void;
  13856. watchedObjectChanged: Observable<OAWatchedObjectChangedInfo<T>>;
  13857. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  13858. private dci;
  13859. }
  13860. }
  13861. declare module BABYLON {
  13862. /**
  13863. * Class for the ObservableStringDictionary.onDictionaryChanged observable
  13864. */
  13865. class DictionaryChanged<T> {
  13866. /**
  13867. * Contain the action that were made on the dictionary, it's one of the DictionaryChanged.xxxAction members.
  13868. * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
  13869. */
  13870. action: number;
  13871. /**
  13872. * Only valid if the action is newItemAction
  13873. */
  13874. newItem: {
  13875. key: string;
  13876. value: T;
  13877. };
  13878. /**
  13879. * Only valid if the action is removedItemAction
  13880. */
  13881. removedKey: string;
  13882. /**
  13883. * Only valid if the action is itemValueChangedAction
  13884. */
  13885. changedItem: {
  13886. key: string;
  13887. oldValue: T;
  13888. newValue: T;
  13889. };
  13890. /**
  13891. * The content of the dictionary was totally cleared
  13892. */
  13893. static clearAction: number;
  13894. /**
  13895. * A new item was added, the newItem field contains the key/value pair
  13896. */
  13897. static newItemAction: number;
  13898. /**
  13899. * An existing item was removed, the removedKey field contains its key
  13900. */
  13901. static removedItemAction: number;
  13902. /**
  13903. * An existing item had a value change, the changedItem field contains the key/value
  13904. */
  13905. static itemValueChangedAction: number;
  13906. /**
  13907. * The dictionary's content was reset and replaced by the content of another dictionary.
  13908. * DictionaryChanged<T> contains no further information about this action
  13909. */
  13910. static replacedAction: number;
  13911. }
  13912. class OSDWatchedObjectChangedInfo<T> {
  13913. key: string;
  13914. object: T;
  13915. propertyChanged: PropertyChangedInfo;
  13916. }
  13917. class ObservableStringDictionary<T> extends StringDictionary<T> implements IPropertyChanged {
  13918. constructor(watchObjectsPropertyChange: boolean);
  13919. /**
  13920. * This will clear this dictionary and copy the content from the 'source' one.
  13921. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  13922. * @param source the dictionary to take the content from and copy to this dictionary
  13923. */
  13924. copyFrom(source: StringDictionary<T>): void;
  13925. /**
  13926. * Get a value from its key or add it if it doesn't exist.
  13927. * This method will ensure you that a given key/data will be present in the dictionary.
  13928. * @param key the given key to get the matching value from
  13929. * @param factory the factory that will create the value if the key is not present in the dictionary.
  13930. * The factory will only be invoked if there's no data for the given key.
  13931. * @return the value corresponding to the key.
  13932. */
  13933. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  13934. /**
  13935. * Add a new key and its corresponding value
  13936. * @param key the key to add
  13937. * @param value the value corresponding to the key
  13938. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  13939. */
  13940. add(key: string, value: T): boolean;
  13941. getAndRemove(key: string): T;
  13942. set(key: string, value: T): boolean;
  13943. /**
  13944. * Remove a key/value from the dictionary.
  13945. * @param key the key to remove
  13946. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  13947. */
  13948. remove(key: string): boolean;
  13949. /**
  13950. * Clear the whole content of the dictionary
  13951. */
  13952. clear(): void;
  13953. propertyChanged: Observable<PropertyChangedInfo>;
  13954. protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
  13955. dictionaryChanged: Observable<DictionaryChanged<T>>;
  13956. protected onDictionaryChanged(action: number, newItem: {
  13957. key: string;
  13958. value: T;
  13959. }, removedKey: string, changedItem: {
  13960. key: string;
  13961. oldValue: T;
  13962. newValue: T;
  13963. }): void;
  13964. watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
  13965. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  13966. private static pci;
  13967. private static callingPropChanged;
  13968. private dci;
  13969. }
  13970. }
  13971. declare module BABYLON {
  13972. class StackPanel extends UIElement {
  13973. static STACKPANEL_PROPCOUNT: number;
  13974. static orientationHorizontalProperty: Prim2DPropInfo;
  13975. constructor(settings?: {
  13976. id?: string;
  13977. parent?: UIElement;
  13978. children?: Array<UIElement>;
  13979. templateName?: string;
  13980. styleName?: string;
  13981. isOrientationHorizontal?: any;
  13982. marginTop?: number | string;
  13983. marginLeft?: number | string;
  13984. marginRight?: number | string;
  13985. marginBottom?: number | string;
  13986. margin?: number | string;
  13987. marginHAlignment?: number;
  13988. marginVAlignment?: number;
  13989. marginAlignment?: string;
  13990. paddingTop?: number | string;
  13991. paddingLeft?: number | string;
  13992. paddingRight?: number | string;
  13993. paddingBottom?: number | string;
  13994. padding?: string;
  13995. paddingHAlignment?: number;
  13996. paddingVAlignment?: number;
  13997. paddingAlignment?: string;
  13998. });
  13999. isOrientationHorizontal: boolean;
  14000. protected createVisualTree(): void;
  14001. children: Array<UIElement>;
  14002. }
  14003. class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
  14004. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  14005. root: Prim2DBase;
  14006. contentPlaceholder: Prim2DBase;
  14007. };
  14008. attach(owner: UIElement): void;
  14009. }
  14010. }
  14011. implements IPropertyChanged {
  14012. constructor(watchObjectsPropertyChange: boolean);
  14013. /**
  14014. * This will clear this dictionary and copy the content from the 'source' one.
  14015. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  14016. * @param source the dictionary to take the content from and copy to this dictionary
  14017. */
  14018. copyFrom(source: StringDictionary<T>): void;
  14019. /**
  14020. * Get a value from its key or add it if it doesn't exist.
  14021. * This method will ensure you that a given key/data will be present in the dictionary.
  14022. * @param key the given key to get the matching value from
  14023. * @param factory the factory that will create the value if the key is not present in the dictionary.
  14024. * The factory will only be invoked if there's no data for the given key.
  14025. * @return the value corresponding to the key.
  14026. */
  14027. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  14028. /**
  14029. * Add a new key and its corresponding value
  14030. * @param key the key to add
  14031. * @param value the value corresponding to the key
  14032. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  14033. */
  14034. add(key: string, value: T): boolean;
  14035. getAndRemove(key: string): T;
  14036. set(key: string, value: T): boolean;
  14037. /**
  14038. * Remove a key/value from the dictionary.
  14039. * @param key the key to remove
  14040. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  14041. */
  14042. remove(key: string): boolean;
  14043. /**
  14044. * Clear the whole content of the dictionary
  14045. */
  14046. clear(): void;
  14047. propertyChanged: Observable<PropertyChangedInfo>;
  14048. protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
  14049. dictionaryChanged: Observable<DictionaryChanged<T>>;
  14050. protected onDictionaryChanged(action: number, newItem: {
  14051. key: string;
  14052. value: T;
  14053. }, removedKey: string, changedItem: {
  14054. key: string;
  14055. oldValue: T;
  14056. newValue: T;
  14057. }): void;
  14058. watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
  14059. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  14060. private static pci;
  14061. private static callingPropChanged;
  14062. private dci;
  14063. }
  14064. }
  14065. declare module BABYLON {
  14066. class StackPanel extends UIElement {
  14067. static STACKPANEL_PROPCOUNT: number;
  14068. static orientationHorizontalProperty: Prim2DPropInfo;
  14069. constructor(settings?: {
  14070. id?: string;
  14071. parent?: UIElement;
  14072. children?: Array<UIElement>;
  14073. templateName?: string;
  14074. styleName?: string;
  14075. isOrientationHorizontal?: any;
  14076. marginTop?: number | string;
  14077. marginLeft?: number | string;
  14078. marginRight?: number | string;
  14079. marginBottom?: number | string;
  14080. margin?: number | string;
  14081. marginHAlignment?: number;
  14082. marginVAlignment?: number;
  14083. marginAlignment?: string;
  14084. paddingTop?: number | string;
  14085. paddingLeft?: number | string;
  14086. paddingRight?: number | string;
  14087. paddingBottom?: number | string;
  14088. padding?: string;
  14089. paddingHAlignment?: number;
  14090. paddingVAlignment?: number;
  14091. paddingAlignment?: string;
  14092. });
  14093. isOrientationHorizontal: boolean;
  14094. protected createVisualTree(): void;
  14095. children: Array<UIElement>;
  14096. protected _getChildren(): Array<UIElement>;
  14097. }
  14098. class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
  14099. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  14100. root: Prim2DBase;
  14101. contentPlaceholder: Prim2DBase;
  14102. };
  14103. attach(owner: UIElement): void;
  14104. }
  14105. }
  14106. he given key to get the matching value from
  14107. * @param factory the factory that will create the value if the key is not present in the dictionary.
  14108. * The factory will only be invoked if there's no data for the given key.
  14109. * @return the value corresponding to the key.
  14110. */
  14111. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  14112. /**
  14113. * Add a new key and its corresponding value
  14114. * @param key the key to add
  14115. * @param value the value corresponding to the key
  14116. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  14117. */
  14118. add(key: string, value: T): boolean;
  14119. getAndRemove(key: string): T;
  14120. set(key: string, value: T): boolean;
  14121. /**
  14122. * Remove a key/value from the dictionary.
  14123. * @param key the key to remove
  14124. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  14125. */
  14126. remove(key: string): boolean;
  14127. /**
  14128. * Clear the whole content of the dictionary
  14129. */
  14130. clear(): void;
  14131. propertyChanged: Observable<PropertyChangedInfo>;
  14132. protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
  14133. dictionaryChanged: Observable<DictionaryChanged<T>>;
  14134. protected onDictionaryChanged(action: number, newItem: {
  14135. key: string;
  14136. value: T;
  14137. }, removedKey: string, changedItem: {
  14138. key: string;
  14139. oldValue: T;
  14140. newValue: T;
  14141. }): void;
  14142. watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
  14143. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  14144. private static pci;
  14145. private static callingPropChanged;
  14146. private dci;
  14147. }
  14148. }
  14149. declare module BABYLON {
  14150. class StackPanel extends UIElement {
  14151. static STACKPANEL_PROPCOUNT: number;
  14152. static orientationHorizontalProperty: Prim2DPropInfo;
  14153. constructor(settings?: {
  14154. id?: string;
  14155. parent?: UIElement;
  14156. children?: Array<UIElement>;
  14157. templateName?: string;
  14158. styleName?: string;
  14159. isOrientationHorizontal?: any;
  14160. marginTop?: number | string;
  14161. marginLeft?: number | string;
  14162. marginRight?: number | string;
  14163. marginBottom?: number | string;
  14164. margin?: number | string;
  14165. marginHAlignment?: number;
  14166. marginVAlignment?: number;
  14167. marginAlignment?: string;
  14168. paddingTop?: number | string;
  14169. paddingLeft?: number | string;
  14170. paddingRight?: number | string;
  14171. paddingBottom?: number | string;
  14172. padding?: string;
  14173. paddingHAlignment?: number;
  14174. paddingVAlignment?: number;
  14175. paddingAlignment?: string;
  14176. });
  14177. isOrientationHorizontal: boolean;
  14178. protected createVisualTree(): void;
  14179. children: Array<UIElement>;
  14180. protected _getChildren(): Array<UIElement>;
  14181. }
  14182. class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
  14183. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  14184. root: Prim2DBase;
  14185. contentPlaceholder: Prim2DBase;
  14186. };
  14187. attach(owner: UIElement): void;
  14188. }
  14189. }
  14190. an array satisfy the specified test.
  14191. * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
  14192. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  14193. */
  14194. every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
  14195. /**
  14196. * Determines whether the specified callback function returns true for any element of an array.
  14197. * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
  14198. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  14199. */
  14200. some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
  14201. /**
  14202. * Performs the specified action for each element in an array.
  14203. * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
  14204. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  14205. */
  14206. forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
  14207. /**
  14208. * Calls a defined callback function on each element of an array, and returns an array that contains the results.
  14209. * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
  14210. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  14211. */
  14212. map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
  14213. /**
  14214. * Returns the elements of an array that meet the condition specified in a callback function.
  14215. * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
  14216. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  14217. */
  14218. filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
  14219. /**
  14220. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  14221. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  14222. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  14223. */
  14224. reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
  14225. /**
  14226. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  14227. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  14228. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  14229. */
  14230. reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
  14231. arrayChanged: Observable<ArrayChanged<T>>;
  14232. protected getArrayChangedObject(): ArrayChanged<T>;
  14233. protected feedNotifArray(array: {
  14234. index: number;
  14235. value: T;
  14236. }[], startindIndex: number, ...items: T[]): void;
  14237. protected callArrayChanged(ac: ArrayChanged<T>): void;
  14238. watchedObjectChanged: Observable<OAWatchedObjectChangedInfo<T>>;
  14239. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  14240. private dci;
  14241. }
  14242. }
  14243. declare module BABYLON {
  14244. /**
  14245. * Class for the ObservableStringDictionary.onDictionaryChanged observable
  14246. */
  14247. class DictionaryChanged<T> {
  14248. /**
  14249. * Contain the action that were made on the dictionary, it's one of the DictionaryChanged.xxxAction members.
  14250. * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
  14251. */
  14252. action: number;
  14253. /**
  14254. * Only valid if the action is newItemAction
  14255. */
  14256. newItem: {
  14257. key: string;
  14258. value: T;
  14259. };
  14260. /**
  14261. * Only valid if the action is removedItemAction
  14262. */
  14263. removedKey: string;
  14264. /**
  14265. * Only valid if the action is itemValueChangedAction
  14266. */
  14267. changedItem: {
  14268. key: string;
  14269. oldValue: T;
  14270. newValue: T;
  14271. };
  14272. /**
  14273. * The content of the dictionary was totally cleared
  14274. */
  14275. static clearAction: number;
  14276. /**
  14277. * A new item was added, the newItem field contains the key/value pair
  14278. */
  14279. static newItemAction: number;
  14280. /**
  14281. * An existing item was removed, the removedKey field contains its key
  14282. */
  14283. static removedItemAction: number;
  14284. /**
  14285. * An existing item had a value change, the changedItem field contains the key/value
  14286. */
  14287. static itemValueChangedAction: number;
  14288. /**
  14289. * The dictionary's content was reset and replaced by the content of another dictionary.
  14290. * DictionaryChanged<T> contains no further information about this action
  14291. */
  14292. static replacedAction: number;
  14293. private static _clearAction;
  14294. private static _newItemAction;
  14295. private static _removedItemAction;
  14296. private static _itemValueChangedAction;
  14297. private static _replacedAction;
  14298. }
  14299. class OSDWatchedObjectChangedInfo<T> {
  14300. key: string;
  14301. object: T;
  14302. propertyChanged: PropertyChangedInfo;
  14303. }
  14304. class ObservableStringDictionary<T> extends StringDictionary<T> implements IPropertyChanged {
  14305. constructor(watchObjectsPropertyChange: boolean);
  14306. /**
  14307. * This will clear this dictionary and copy the content from the 'source' one.
  14308. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  14309. * @param source the dictionary to take the content from and copy to this dictionary
  14310. */
  14311. copyFrom(source: StringDictionary<T>): void;
  14312. /**
  14313. * Get a value from its key or add it if it doesn't exist.
  14314. * This method will ensure you that a given key/data will be present in the dictionary.
  14315. * @param key the given key to get the matching value from
  14316. * @param factory the factory that will create the value if the key is not present in the dictionary.
  14317. * The factory will only be invoked if there's no data for the given key.
  14318. * @return the value corresponding to the key.
  14319. */
  14320. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  14321. /**
  14322. * Add a new key and its corresponding value
  14323. * @param key the key to add
  14324. * @param value the value corresponding to the key
  14325. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  14326. */
  14327. add(key: string, value: T): boolean;
  14328. getAndRemove(key: string): T;
  14329. set(key: string, value: T): boolean;
  14330. /**
  14331. * Remove a key/value from the dictionary.
  14332. * @param key the key to remove
  14333. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  14334. */
  14335. remove(key: string): boolean;
  14336. /**
  14337. * Clear the whole content of the dictionary
  14338. */
  14339. clear(): void;
  14340. propertyChanged: Observable<PropertyChangedInfo>;
  14341. protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
  14342. dictionaryChanged: Observable<DictionaryChanged<T>>;
  14343. protected onDictionaryChanged(action: number, newItem: {
  14344. key: string;
  14345. value: T;
  14346. }, removedKey: string, changedItem: {
  14347. key: string;
  14348. oldValue: T;
  14349. newValue: T;
  14350. }): void;
  14351. watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
  14352. protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
  14353. private static pci;
  14354. private static callingPropChanged;
  14355. private dci;
  14356. }
  14357. }
  14358. declare module BABYLON {
  14359. class StackPanel extends UIElement {
  14360. static STACKPANEL_PROPCOUNT: number;
  14361. static orientationHorizontalProperty: Prim2DPropInfo;
  14362. constructor(settings?: {
  14363. id?: string;
  14364. parent?: UIElement;
  14365. children?: Array<UIElement>;
  14366. templateName?: string;
  14367. styleName?: string;
  14368. isOrientationHorizontal?: any;
  14369. marginTop?: number | string;
  14370. marginLeft?: number | string;
  14371. marginRight?: number | string;
  14372. marginBottom?: number | string;
  14373. margin?: number | string;
  14374. marginHAlignment?: number;
  14375. marginVAlignment?: number;
  14376. marginAlignment?: string;
  14377. paddingTop?: number | string;
  14378. paddingLeft?: number | string;
  14379. paddingRight?: number | string;
  14380. paddingBottom?: number | string;
  14381. padding?: string;
  14382. paddingHAlignment?: number;
  14383. paddingVAlignment?: number;
  14384. paddingAlignment?: string;
  14385. });
  14386. isOrientationHorizontal: boolean;
  14387. protected createVisualTree(): void;
  14388. children: Array<UIElement>;
  14389. protected _getChildren(): Array<UIElement>;
  14390. }
  14391. class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
  14392. createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
  14393. root: Prim2DBase;
  14394. contentPlaceholder: Prim2DBase;
  14395. };
  14396. attach(owner: UIElement): void;
  14397. }
  14398. }