123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613 |
- declare var engine: BABYLON.Engine;
- declare var canvas: HtmlCanvasElement;
- declare module BABYLON {
- class InstancingAttributeInfo {
- /**
- * Index/offset of the attribute in the vertex shader
- */
- index: number;
- /**
- * size of the attribute, 1, 2, 3 or 4
- */
- attributeSize: number;
- /**
- * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
- * default is FLOAT
- */
- attribyteType: number;
- /**
- * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
- */
- normalized: boolean;
- /**
- * Offset of the data in the Vertex Buffer acting as the instancing buffer
- */
- offset: number;
- /**
- * Name of the GLSL attribute, for debugging purpose only
- */
- attributeName: string;
- }
- class EngineCapabilities {
- maxTexturesImageUnits: number;
- maxTextureSize: number;
- maxCubemapTextureSize: number;
- maxRenderTextureSize: number;
- maxVertexAttribs: number;
- standardDerivatives: boolean;
- s3tc: WEBGL_compressed_texture_s3tc;
- textureFloat: boolean;
- textureAnisotropicFilterExtension: EXT_texture_filter_anisotropic;
- maxAnisotropy: number;
- instancedArrays: ANGLE_instanced_arrays;
- uintIndices: boolean;
- highPrecisionShaderSupported: boolean;
- fragmentDepthSupported: boolean;
- textureFloatLinearFiltering: boolean;
- textureFloatRender: boolean;
- textureHalfFloat: boolean;
- textureHalfFloatLinearFiltering: boolean;
- textureHalfFloatRender: boolean;
- textureLOD: boolean;
- drawBuffersExtension: any;
- }
- interface EngineOptions extends WebGLContextAttributes {
- limitDeviceRatio?: number;
- autoEnableWebVR?: boolean;
- }
- /**
- * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
- */
- class Engine {
- static NEVER: number;
- static ALWAYS: number;
- static LESS: number;
- static EQUAL: number;
- static LEQUAL: number;
- static GREATER: number;
- static GEQUAL: number;
- static NOTEQUAL: number;
- static KEEP: number;
- static REPLACE: number;
- static INCR: number;
- static DECR: number;
- static INVERT: number;
- static INCR_WRAP: number;
- static DECR_WRAP: number;
- static ALPHA_DISABLE: number;
- static ALPHA_ONEONE: number;
- static ALPHA_ADD: number;
- static ALPHA_COMBINE: number;
- static ALPHA_SUBTRACT: number;
- static ALPHA_MULTIPLY: number;
- static ALPHA_MAXIMIZED: number;
- static DELAYLOADSTATE_NONE: number;
- static DELAYLOADSTATE_LOADED: number;
- static DELAYLOADSTATE_LOADING: number;
- static DELAYLOADSTATE_NOTLOADED: number;
- static TEXTUREFORMAT_ALPHA: number;
- static TEXTUREFORMAT_LUMINANCE: number;
- static TEXTUREFORMAT_LUMINANCE_ALPHA: number;
- static TEXTUREFORMAT_RGB: number;
- static TEXTUREFORMAT_RGBA: number;
- static TEXTURETYPE_UNSIGNED_INT: number;
- static TEXTURETYPE_FLOAT: number;
- static TEXTURETYPE_HALF_FLOAT: number;
- static Version: string;
- static CollisionsEpsilon: number;
- static CodeRepository: string;
- static ShadersRepository: string;
- isFullscreen: boolean;
- isPointerLock: boolean;
- cullBackFaces: boolean;
- renderEvenInBackground: boolean;
- enableOfflineSupport: boolean;
- scenes: Scene[];
- vrDisplaysPromise: any;
- static audioEngine: AudioEngine;
- private fpsRange;
- private previousFramesDuration;
- private fps;
- private deltaTime;
- /**
- * @constructor
- * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
- * @param {boolean} [antialias] - enable antialias
- * @param options - further options to be sent to the getContext function
- */
- constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
- webGLVersion: string;
- /**
- * Returns true if the stencil buffer has been enabled through the creation option of the context.
- */
- isStencilEnable: boolean;
- resetTextureCache(): void;
- getGlInfo(): {
- vendor: string;
- renderer: string;
- version: string;
- };
- getAspectRatio(camera: Camera, useScreen?: boolean): number;
- getRenderWidth(useScreen?: boolean): number;
- getRenderHeight(useScreen?: boolean): number;
- getRenderingCanvas(): HTMLCanvasElement;
- getRenderingCanvasClientRect(): ClientRect;
- setHardwareScalingLevel(level: number): void;
- getHardwareScalingLevel(): number;
- getLoadedTexturesCache(): WebGLTexture[];
- getCaps(): EngineCapabilities;
- drawCalls: number;
- drawCallsPerfCounter: PerfCounter;
- getDepthFunction(): number;
- setDepthFunction(depthFunc: number): void;
- setDepthFunctionToGreater(): void;
- setDepthFunctionToGreaterOrEqual(): void;
- setDepthFunctionToLess(): void;
- setDepthFunctionToLessOrEqual(): void;
- getStencilBuffer(): boolean;
- setStencilBuffer(enable: boolean): void;
- getStencilMask(): number;
- setStencilMask(mask: number): void;
- getStencilFunction(): number;
- getStencilFunctionReference(): number;
- getStencilFunctionMask(): number;
- setStencilFunction(stencilFunc: number): void;
- setStencilFunctionReference(reference: number): void;
- setStencilFunctionMask(mask: number): void;
- getStencilOperationFail(): number;
- getStencilOperationDepthFail(): number;
- getStencilOperationPass(): number;
- setStencilOperationFail(operation: number): void;
- setStencilOperationDepthFail(operation: number): void;
- setStencilOperationPass(operation: number): void;
- /**
- * stop executing a render loop function and remove it from the execution array
- * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
- */
- stopRenderLoop(renderFunction?: () => void): void;
- /**
- * Register and execute a render loop. The engine can have more than one render function.
- * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
- * @example
- * engine.runRenderLoop(function () {
- * scene.render()
- * })
- */
- runRenderLoop(renderFunction: () => void): void;
- /**
- * Toggle full screen mode.
- * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
- * @param {any} options - an options object to be sent to the requestFullscreen function
- */
- switchFullscreen(requestPointerLock: boolean): void;
- clear(color: any, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
- scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
- /**
- * Set the WebGL's viewport
- * @param {BABYLON.Viewport} viewport - the viewport element to be used.
- * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
- * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
- */
- setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
- /**
- * Directly set the WebGL Viewport
- * The x, y, width & height are directly passed to the WebGL call
- * @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.
- */
- setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
- beginFrame(): void;
- endFrame(): void;
- /**
- * resize the view according to the canvas' size.
- * @example
- * window.addEventListener("resize", function () {
- * engine.resize();
- * });
- */
- resize(): void;
- /**
- * force a specific size of the canvas
- * @param {number} width - the new canvas' width
- * @param {number} height - the new canvas' height
- */
- setSize(width: number, height: number): void;
- initWebVR(): void;
- enableVR(vrDevice: any): void;
- disableVR(): void;
- bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
- private bindUnboundFramebuffer(framebuffer);
- unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
- generateMipMapsForCubemap(texture: WebGLTexture): void;
- flushFramebuffer(): void;
- restoreDefaultFramebuffer(): void;
- createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
- createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
- updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
- createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer;
- bindArrayBuffer(buffer: WebGLBuffer): void;
- private bindIndexBuffer(buffer);
- private bindBuffer(buffer, target);
- updateArrayBuffer(data: Float32Array): void;
- private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
- bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
- bindBuffers(vertexBuffers: {
- [key: string]: VertexBuffer;
- }, indexBuffer: WebGLBuffer, effect: Effect): void;
- unbindInstanceAttributes(): void;
- createInstancesBuffer(capacity: number): WebGLBuffer;
- deleteInstancesBuffer(buffer: WebGLBuffer): void;
- updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
- applyStates(): void;
- draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
- drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
- drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
- 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;
- createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
- createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
- getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
- getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
- enableEffect(effect: Effect): void;
- setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
- setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
- setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
- setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
- setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
- setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
- setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
- setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
- setArray(uniform: WebGLUniformLocation, array: number[]): void;
- setArray2(uniform: WebGLUniformLocation, array: number[]): void;
- setArray3(uniform: WebGLUniformLocation, array: number[]): void;
- setArray4(uniform: WebGLUniformLocation, array: number[]): void;
- setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
- setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
- setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
- setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
- setFloat(uniform: WebGLUniformLocation, value: number): void;
- setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
- setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
- setBool(uniform: WebGLUniformLocation, bool: number): void;
- setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
- setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
- setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
- setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
- setDepthBuffer(enable: boolean): void;
- getDepthWrite(): boolean;
- setDepthWrite(enable: boolean): void;
- setColorWrite(enable: boolean): void;
- setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
- getAlphaMode(): number;
- setAlphaTesting(enable: boolean): void;
- getAlphaTesting(): boolean;
- wipeCaches(): void;
- setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
- createTexture(urlOrList: string | Array<string>, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
- updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
- createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
- createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
- updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
- updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean): void;
- updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
- createRenderTargetTexture(size: any, options: any): WebGLTexture;
- createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
- createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void): WebGLTexture;
- updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
- createRawCubeTexture(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][])): WebGLTexture;
- private setProgram(program);
- bindSamplers(effect: Effect): void;
- private activateTexture(texture);
- setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
- unbindAllTextures(): void;
- setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
- setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
- readPixels(x: number, y: number, width: number, height: number): Uint8Array;
- /**
- * Add an externaly attached data from its key.
- * This method call will fail and return false, if such key already exists.
- * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
- * @param key the unique key that identifies the data
- * @param data the data object to associate to the key for this Engine instance
- * @return true if no such key were already present and the data was added successfully, false otherwise
- */
- addExternalData<T>(key: string, data: T): boolean;
- /**
- * Get an externaly attached data from its key
- * @param key the unique key that identifies the data
- * @return the associated data, if present (can be null), or undefined if not present
- */
- getExternalData<T>(key: string): T;
- /**
- * Get an externaly attached data from its key, create it using a factory if it's not already present
- * @param key the unique key that identifies the data
- * @param factory the factory that will be called to create the instance if and only if it doesn't exists
- * @return the associated data, can be null if the factory returned null.
- */
- getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
- /**
- * Remove an externaly attached data from the Engine instance
- * @param key the unique key that identifies the data
- * @return true if the data was successfully removed, false if it doesn't exist
- */
- removeExternalData(key: any): boolean;
- releaseInternalTexture(texture: WebGLTexture): void;
- unbindAllAttributes(): void;
- dispose(): void;
- displayLoadingUI(): void;
- hideLoadingUI(): void;
- loadingScreen: ILoadingScreen;
- loadingUIText: string;
- loadingUIBackgroundColor: string;
- attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
- attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
- getVertexShaderSource(program: WebGLProgram): string;
- getFragmentShaderSource(program: WebGLProgram): string;
- getFps(): number;
- getDeltaTime(): number;
- static isSupported(): boolean;
- }
- }
- interface Window {
- mozIndexedDB(func: any): any;
- webkitIndexedDB(func: any): any;
- msIndexedDB: IDBFactory;
- IDBTransaction(func: any): any;
- webkitIDBTransaction(func: any): any;
- msIDBTransaction(func: any): any;
- IDBKeyRange(func: any): any;
- webkitIDBKeyRange(func: any): any;
- msIDBKeyRange(func: any): any;
- webkitURL: HTMLURL;
- webkitRequestAnimationFrame(func: any): any;
- mozRequestAnimationFrame(func: any): any;
- oRequestAnimationFrame(func: any): any;
- WebGLRenderingContext: WebGLRenderingContext;
- MSGesture: MSGesture;
- CANNON: any;
- SIMD: any;
- AudioContext: AudioContext;
- webkitAudioContext: AudioContext;
- PointerEvent: any;
- Math: Math;
- Uint8Array: Uint8ArrayConstructor;
- Float32Array: Float32ArrayConstructor;
- }
- interface AudioContext extends EventTarget {
- decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: any): void;
- }
- interface HTMLURL {
- createObjectURL(param1: any, param2?: any): any;
- }
- interface Document {
- exitFullscreen(): void;
- webkitCancelFullScreen(): void;
- mozCancelFullScreen(): void;
- msCancelFullScreen(): void;
- mozFullScreen: boolean;
- msIsFullScreen: boolean;
- fullscreen: boolean;
- mozPointerLockElement: HTMLElement;
- msPointerLockElement: HTMLElement;
- webkitPointerLockElement: HTMLElement;
- }
- interface HTMLCanvasElement {
- requestPointerLock(): void;
- msRequestPointerLock?(): void;
- mozRequestPointerLock?(): void;
- webkitRequestPointerLock?(): void;
- }
- interface CanvasRenderingContext2D {
- imageSmoothingEnabled: boolean;
- mozImageSmoothingEnabled: boolean;
- oImageSmoothingEnabled: boolean;
- webkitImageSmoothingEnabled: boolean;
- }
- interface WebGLTexture {
- isReady: boolean;
- isCube: boolean;
- url: string;
- noMipmap: boolean;
- samplingMode: number;
- references: number;
- generateMipMaps: boolean;
- type: number;
- onLoadedCallbacks: Array<Function>;
- }
- interface WebGLBuffer {
- references: number;
- capacity: number;
- is32Bits: boolean;
- }
- interface MouseEvent {
- mozMovementX: number;
- mozMovementY: number;
- webkitMovementX: number;
- webkitMovementY: number;
- msMovementX: number;
- msMovementY: number;
- }
- interface MSStyleCSSProperties {
- webkitTransform: string;
- webkitTransition: string;
- }
- interface Navigator {
- getVRDisplays: () => any;
- mozGetVRDevices: (any: any) => any;
- isCocoonJS: boolean;
- }
- interface Screen {
- orientation: string;
- mozOrientation: string;
- }
- interface HTMLMediaElement {
- crossOrigin: string;
- }
- interface Math {
- fround(x: number): number;
- imul(a: number, b: number): number;
- }
- interface SIMDglobal {
- SIMD: SIMD;
- Math: Math;
- Uint8Array: Uint8ArrayConstructor;
- Float32Array: Float32ArrayConstructor;
- }
- interface SIMD {
- Float32x4: SIMD.Float32x4Constructor;
- Int32x4: SIMD.Int32x4Constructor;
- Int16x8: SIMD.Int16x8Constructor;
- Int8x16: SIMD.Int8x16Constructor;
- Uint32x4: SIMD.Uint32x4Constructor;
- Uint16x8: SIMD.Uint16x8Constructor;
- Uint8x16: SIMD.Uint8x16Constructor;
- Bool32x4: SIMD.Bool32x4Constructor;
- Bool16x8: SIMD.Bool16x8Constructor;
- Bool8x16: SIMD.Bool8x16Constructor;
- }
- declare namespace SIMD {
- interface Float32x4 {
- constructor: Float32x4Constructor;
- valueOf(): Float32x4;
- toLocaleString(): string;
- toString(): string;
- }
- interface Float32x4Constructor {
- (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
- prototype: Float32x4;
- extractLane(simd: SIMD.Float32x4, lane: number): number;
- swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
- shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
- check(a: SIMD.Float32x4): SIMD.Float32x4;
- splat(n: number): SIMD.Float32x4;
- replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
- select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
- add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- neg(a: SIMD.Float32x4): SIMD.Float32x4;
- abs(a: SIMD.Float32x4): SIMD.Float32x4;
- min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
- reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
- reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
- sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
- load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
- load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
- load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
- store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
- store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
- store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
- fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
- fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
- }
- interface Int32x4 {
- constructor: Int32x4Constructor;
- valueOf(): Int32x4;
- toLocaleString(): string;
- toString(): string;
- }
- interface Int32x4Constructor {
- (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
- prototype: Int32x4;
- extractLane(simd: SIMD.Int32x4, lane: number): number;
- swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
- shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
- check(a: SIMD.Int32x4): SIMD.Int32x4;
- splat(n: number): SIMD.Int32x4;
- replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
- select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
- and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
- neg(a: SIMD.Int32x4): SIMD.Int32x4;
- shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
- shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
- load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
- load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
- load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
- store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
- store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
- store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
- fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
- fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
- }
- interface Int16x8 {
- constructor: Int16x8Constructor;
- valueOf(): Int16x8;
- toLocaleString(): string;
- toString(): string;
- }
- interface Int16x8Constructor {
- (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
- prototype: Int16x8;
- extractLane(simd: SIMD.Int16x8, lane: number): number;
- swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
- 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;
- check(a: SIMD.Int16x8): SIMD.Int16x8;
- splat(n: number): SIMD.Int16x8;
- replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
- select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
- and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- neg(a: SIMD.Int16x8): SIMD.Int16x8;
- shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
- shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
- addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
- fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
- }
- interface Int8x16 {
- constructor: Int8x16Constructor;
- valueOf(): Int8x16;
- toLocaleString(): string;
- toString(): string;
- }
- interface Int8x16Constructor {
- (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;
- prototype: Int8x16;
- extractLane(simd: SIMD.Int8x16, lane: number): number;
- 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;
- 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;
- check(a: SIMD.Int8x16): SIMD.Int8x16;
- splat(n: number): SIMD.Int8x16;
- replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
- select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
- and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- neg(a: SIMD.Int8x16): SIMD.Int8x16;
- shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
- shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
- addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
- fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
- }
- interface Uint32x4 {
- constructor: Uint32x4Constructor;
- valueOf(): Uint32x4;
- toLocaleString(): string;
- toString(): string;
- }
- interface Uint32x4Constructor {
- (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
- prototype: Uint32x4;
- extractLane(simd: SIMD.Uint32x4, lane: number): number;
- swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
- shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
- check(a: SIMD.Uint32x4): SIMD.Uint32x4;
- splat(n: number): SIMD.Uint32x4;
- replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
- select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
- and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
- shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
- shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
- load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
- load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
- load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
- store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
- store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
- store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
- fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
- fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
- }
- interface Uint16x8 {
- constructor: Uint16x8Constructor;
- valueOf(): Uint16x8;
- toLocaleString(): string;
- toString(): string;
- }
- interface Uint16x8Constructor {
- (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
- prototype: Uint16x8;
- extractLane(simd: SIMD.Uint16x8, lane: number): number;
- swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
- 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;
- check(a: SIMD.Uint16x8): SIMD.Uint16x8;
- splat(n: number): SIMD.Uint16x8;
- replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
- select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
- and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
- shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
- addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
- fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
- fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
- }
- interface Uint8x16 {
- constructor: Uint8x16Constructor;
- valueOf(): Uint8x16;
- toLocaleString(): string;
- toString(): string;
- }
- interface Uint8x16Constructor {
- (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;
- prototype: Uint8x16;
- extractLane(simd: SIMD.Uint8x16, lane: number): number;
- 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;
- 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;
- check(a: SIMD.Uint8x16): SIMD.Uint8x16;
- splat(n: number): SIMD.Uint8x16;
- replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
- select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
- and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
- shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
- addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
- load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
- store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
- fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
- fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
- fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
- fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
- fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
- fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
- fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
- }
- interface Bool32x4 {
- constructor: Bool32x4Constructor;
- valueOf(): Bool32x4;
- toLocaleString(): string;
- toString(): string;
- }
- interface Bool32x4Constructor {
- (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
- prototype: Bool32x4;
- extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
- check(a: SIMD.Bool32x4): SIMD.Bool32x4;
- splat(n: boolean): SIMD.Bool32x4;
- replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
- allTrue(a: SIMD.Bool32x4): boolean;
- anyTrue(a: SIMD.Bool32x4): boolean;
- and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
- or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
- xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
- not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
- }
- interface Bool16x8 {
- constructor: Bool16x8Constructor;
- valueOf(): Bool16x8;
- toLocaleString(): string;
- toString(): string;
- }
- interface Bool16x8Constructor {
- (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
- prototype: Bool16x8;
- extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
- check(a: SIMD.Bool16x8): SIMD.Bool16x8;
- splat(n: boolean): SIMD.Bool16x8;
- replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
- allTrue(a: SIMD.Bool16x8): boolean;
- anyTrue(a: SIMD.Bool16x8): boolean;
- and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
- or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
- xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
- not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
- }
- interface Bool8x16 {
- constructor: Bool8x16Constructor;
- valueOf(): Bool8x16;
- toLocaleString(): string;
- toString(): string;
- }
- interface Bool8x16Constructor {
- (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;
- prototype: Bool8x16;
- extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
- check(a: SIMD.Bool8x16): SIMD.Bool8x16;
- splat(n: boolean): SIMD.Bool8x16;
- replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
- allTrue(a: SIMD.Bool8x16): boolean;
- anyTrue(a: SIMD.Bool8x16): boolean;
- and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
- or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
- xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
- not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
- }
- }
- declare module BABYLON {
- /**
- * Node is the basic class for all scene objects (Mesh, Light Camera).
- */
- class Node {
- name: string;
- id: string;
- uniqueId: number;
- state: string;
- metadata: any;
- doNotSerialize: boolean;
- animations: Animation[];
- onReady: (node: Node) => void;
- parent: Node;
- /**
- * An event triggered when the mesh is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<Node>;
- onDispose: () => void;
- /**
- * @constructor
- * @param {string} name - the name and id to be given to this node
- * @param {BABYLON.Scene} the scene this node will be added to
- */
- constructor(name: string, scene: Scene);
- getScene(): Scene;
- getEngine(): Engine;
- getWorldMatrix(): Matrix;
- updateCache(force?: boolean): void;
- isSynchronizedWithParent(): boolean;
- isSynchronized(updateCache?: boolean): boolean;
- hasNewParent(update?: boolean): boolean;
- /**
- * Is this node ready to be used/rendered
- * @return {boolean} is it ready
- */
- isReady(): boolean;
- /**
- * Is this node enabled.
- * If the node has a parent and is enabled, the parent will be inspected as well.
- * @return {boolean} whether this node (and its parent) is enabled.
- * @see setEnabled
- */
- isEnabled(): boolean;
- /**
- * Set the enabled state of this node.
- * @param {boolean} value - the new enabled state
- * @see isEnabled
- */
- setEnabled(value: boolean): void;
- /**
- * Is this node a descendant of the given node.
- * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
- * @param {BABYLON.Node} ancestor - The parent node to inspect
- * @see parent
- */
- isDescendantOf(ancestor: Node): boolean;
- /**
- * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
- * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
- * @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.
- * @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.
- */
- /**
- * Will return all nodes that have this node as ascendant.
- * @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.
- * @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.
- * @return {BABYLON.Node[]} all children nodes of all types.
- */
- getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
- /**
- * @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.
- * @Deprecated, legacy support.
- * use getDecendants instead.
- */
- getChildren(predicate?: (node: Node) => boolean): Node[];
- /**
- * Get all child-meshes of this node.
- */
- getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
- getAnimationByName(name: string): Animation;
- createAnimationRange(name: string, from: number, to: number): void;
- deleteAnimationRange(name: string, deleteFrames?: boolean): void;
- getAnimationRange(name: string): AnimationRange;
- beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
- serializeAnimationRanges(): any;
- dispose(): void;
- getDirection(localAxis: BABYLON.Vector3): BABYLON.Vector3;
- getDirectionToRef(localAxis: BABYLON.Vector3, result: BABYLON.Vector3): void;
- static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
- }
- }
- declare module BABYLON {
- interface IDisposable {
- dispose(): void;
- }
- class PointerEventTypes {
- static POINTERDOWN: number;
- static POINTERUP: number;
- static POINTERMOVE: number;
- static POINTERWHEEL: number;
- static POINTERPICK: number;
- }
- class PointerInfoBase {
- type: number;
- event: PointerEvent | MouseWheelEvent;
- constructor(type: number, event: PointerEvent | MouseWheelEvent);
- }
- /**
- * This class is used to store pointer related info for the onPrePointerObservable event.
- * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
- */
- class PointerInfoPre extends PointerInfoBase {
- constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
- localPosition: Vector2;
- skipOnPointerObservable: boolean;
- }
- /**
- * This type contains all the data related to a pointer event in Babylon.js.
- * 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.
- */
- class PointerInfo extends PointerInfoBase {
- pickInfo: PickingInfo;
- constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
- }
- /**
- * This class is used by the onRenderingGroupObservable
- */
- class RenderingGroupInfo {
- /**
- * The Scene that being rendered
- */
- scene: Scene;
- /**
- * The camera currently used for the rendering pass
- */
- camera: Camera;
- /**
- * The ID of the renderingGroup being processed
- */
- renderingGroupId: number;
- /**
- * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
- */
- renderStage: number;
- /**
- * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
- * This stage will be fired no matter what
- */
- static STAGE_PRECLEAR: number;
- /**
- * Called before opaque object are rendered.
- * This stage will be fired only if there's 3D Opaque content to render
- */
- static STAGE_PREOPAQUE: number;
- /**
- * Called after the opaque objects are rendered and before the transparent ones
- * This stage will be fired only if there's 3D transparent content to render
- */
- static STAGE_PRETRANSPARENT: number;
- /**
- * Called after the transparent object are rendered, last hook of the renderingGroup phase
- * This stage will be fired no matter what
- */
- static STAGE_POSTTRANSPARENT: number;
- }
- /**
- * Represents a scene to be rendered by the engine.
- * @see http://doc.babylonjs.com/page.php?p=21911
- */
- class Scene implements IAnimatable {
- static MinDeltaTime: number;
- static MaxDeltaTime: number;
- static FOGMODE_NONE: number;
- static FOGMODE_EXP: number;
- static FOGMODE_EXP2: number;
- static FOGMODE_LINEAR: number;
- autoClear: boolean;
- clearColor: any;
- ambientColor: Color3;
- forceWireframe: boolean;
- forcePointsCloud: boolean;
- forceShowBoundingBoxes: boolean;
- clipPlane: Plane;
- animationsEnabled: boolean;
- constantlyUpdateMeshUnderPointer: boolean;
- useRightHandedSystem: boolean;
- hoverCursor: string;
- metadata: any;
- /**
- * An event triggered when the scene is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<Scene>;
- onDispose: () => void;
- /**
- * An event triggered before rendering the scene
- * @type {BABYLON.Observable}
- */
- onBeforeRenderObservable: Observable<Scene>;
- beforeRender: () => void;
- /**
- * An event triggered after rendering the scene
- * @type {BABYLON.Observable}
- */
- onAfterRenderObservable: Observable<Scene>;
- afterRender: () => void;
- /**
- * An event triggered when the scene is ready
- * @type {BABYLON.Observable}
- */
- onReadyObservable: Observable<Scene>;
- /**
- * An event triggered before rendering a camera
- * @type {BABYLON.Observable}
- */
- onBeforeCameraRenderObservable: Observable<Camera>;
- beforeCameraRender: () => void;
- /**
- * An event triggered after rendering a camera
- * @type {BABYLON.Observable}
- */
- onAfterCameraRenderObservable: Observable<Camera>;
- afterCameraRender: () => void;
- /**
- * An event triggered when a camera is created
- * @type {BABYLON.Observable}
- */
- onNewCameraAddedObservable: Observable<Camera>;
- /**
- * An event triggered when a camera is removed
- * @type {BABYLON.Observable}
- */
- onCameraRemovedObservable: Observable<Camera>;
- /**
- * An event triggered when a light is created
- * @type {BABYLON.Observable}
- */
- onNewLightAddedObservable: Observable<Light>;
- /**
- * An event triggered when a light is removed
- * @type {BABYLON.Observable}
- */
- onLightRemovedObservable: Observable<Light>;
- /**
- * An event triggered when a geometry is created
- * @type {BABYLON.Observable}
- */
- onNewGeometryAddedObservable: Observable<Geometry>;
- /**
- * An event triggered when a geometry is removed
- * @type {BABYLON.Observable}
- */
- onGeometryRemovedObservable: Observable<Geometry>;
- /**
- * An event triggered when a mesh is created
- * @type {BABYLON.Observable}
- */
- onNewMeshAddedObservable: Observable<AbstractMesh>;
- /**
- * An event triggered when a mesh is removed
- * @type {BABYLON.Observable}
- */
- onMeshRemovedObservable: Observable<AbstractMesh>;
- /**
- * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
- * The RenderinGroupInfo class contains all the information about the context in which the observable is called
- * 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)
- */
- onRenderingGroupObservable: Observable<RenderingGroupInfo>;
- animations: Animation[];
- pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
- pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
- pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
- /**
- * @deprecated Use onPointerObservable instead
- */
- onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
- /**
- * @deprecated Use onPointerObservable instead
- */
- onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
- /**
- * @deprecated Use onPointerObservable instead
- */
- onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
- /**
- * @deprecated Use onPointerObservable instead
- */
- onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
- /**
- * 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).
- * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
- */
- onPrePointerObservable: Observable<PointerInfoPre>;
- /**
- * Observable event triggered each time an input event is received from the rendering canvas
- */
- onPointerObservable: Observable<PointerInfo>;
- unTranslatedPointer: Vector2;
- cameraToUseForPointers: Camera;
- /**
- * is fog enabled on this scene.
- * @type {boolean}
- */
- fogEnabled: boolean;
- fogMode: number;
- fogColor: Color3;
- fogDensity: number;
- fogStart: number;
- fogEnd: number;
- /**
- * is shadow enabled on this scene.
- * @type {boolean}
- */
- shadowsEnabled: boolean;
- /**
- * is light enabled on this scene.
- * @type {boolean}
- */
- lightsEnabled: boolean;
- /**
- * All of the lights added to this scene.
- * @see BABYLON.Light
- * @type {BABYLON.Light[]}
- */
- lights: Light[];
- /**
- * All of the cameras added to this scene.
- * @see BABYLON.Camera
- * @type {BABYLON.Camera[]}
- */
- cameras: Camera[];
- activeCameras: Camera[];
- activeCamera: Camera;
- /**
- * All of the (abstract) meshes added to this scene.
- * @see BABYLON.AbstractMesh
- * @type {BABYLON.AbstractMesh[]}
- */
- meshes: AbstractMesh[];
- materials: Material[];
- multiMaterials: MultiMaterial[];
- defaultMaterial: StandardMaterial;
- texturesEnabled: boolean;
- textures: BaseTexture[];
- particlesEnabled: boolean;
- particleSystems: ParticleSystem[];
- spritesEnabled: boolean;
- spriteManagers: SpriteManager[];
- layers: Layer[];
- highlightLayers: HighlightLayer[];
- skeletonsEnabled: boolean;
- skeletons: Skeleton[];
- lensFlaresEnabled: boolean;
- lensFlareSystems: LensFlareSystem[];
- collisionsEnabled: boolean;
- collisionCoordinator: ICollisionCoordinator;
- gravity: Vector3;
- postProcessesEnabled: boolean;
- postProcessManager: PostProcessManager;
- postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
- renderTargetsEnabled: boolean;
- dumpNextRenderTargets: boolean;
- customRenderTargets: RenderTargetTexture[];
- useDelayedTextureLoading: boolean;
- importedMeshesFiles: String[];
- probesEnabled: boolean;
- reflectionProbes: ReflectionProbe[];
- database: any;
- /**
- * This scene's action manager
- * @type {BABYLON.ActionManager}
- */
- actionManager: ActionManager;
- proceduralTexturesEnabled: boolean;
- mainSoundTrack: SoundTrack;
- soundTracks: SoundTrack[];
- simplificationQueue: SimplificationQueue;
- /**
- * @constructor
- * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
- */
- constructor(engine: Engine);
- debugLayer: DebugLayer;
- workerCollisions: boolean;
- SelectionOctree: Octree<AbstractMesh>;
- /**
- * The mesh that is currently under the pointer.
- * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
- */
- meshUnderPointer: AbstractMesh;
- /**
- * Current on-screen X position of the pointer
- * @return {number} X position of the pointer
- */
- pointerX: number;
- /**
- * Current on-screen Y position of the pointer
- * @return {number} Y position of the pointer
- */
- pointerY: number;
- getCachedMaterial(): Material;
- getBoundingBoxRenderer(): BoundingBoxRenderer;
- getOutlineRenderer(): OutlineRenderer;
- getEngine(): Engine;
- getTotalVertices(): number;
- totalVerticesPerfCounter: PerfCounter;
- getActiveIndices(): number;
- totalActiveIndicesPerfCounter: PerfCounter;
- getActiveParticles(): number;
- activeParticlesPerfCounter: PerfCounter;
- getActiveBones(): number;
- activeBonesPerfCounter: PerfCounter;
- getLastFrameDuration(): number;
- lastFramePerfCounter: PerfCounter;
- getEvaluateActiveMeshesDuration(): number;
- evaluateActiveMeshesDurationPerfCounter: PerfCounter;
- getActiveMeshes(): SmartArray<Mesh>;
- getRenderTargetsDuration(): number;
- getRenderDuration(): number;
- renderDurationPerfCounter: PerfCounter;
- getParticlesDuration(): number;
- particlesDurationPerfCounter: PerfCounter;
- getSpritesDuration(): number;
- spriteDuractionPerfCounter: PerfCounter;
- getAnimationRatio(): number;
- getRenderId(): number;
- incrementRenderId(): void;
- /**
- * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
- * @param attachUp defines if you want to attach events to pointerup
- * @param attachDown defines if you want to attach events to pointerdown
- * @param attachMove defines if you want to attach events to pointermove
- */
- attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
- detachControl(): void;
- isReady(): boolean;
- resetCachedMaterial(): void;
- registerBeforeRender(func: () => void): void;
- unregisterBeforeRender(func: () => void): void;
- registerAfterRender(func: () => void): void;
- unregisterAfterRender(func: () => void): void;
- getWaitingItemsCount(): number;
- /**
- * Registers a function to be executed when the scene is ready.
- * @param {Function} func - the function to be executed.
- */
- executeWhenReady(func: () => void): void;
- /**
- * Will start the animation sequence of a given target
- * @param target - the target
- * @param {number} from - from which frame should animation start
- * @param {number} to - till which frame should animation run.
- * @param {boolean} [loop] - should the animation loop
- * @param {number} [speedRatio] - the speed in which to run the animation
- * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
- * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
- * @return {BABYLON.Animatable} the animatable object created for this animation
- * @see BABYLON.Animatable
- * @see http://doc.babylonjs.com/page.php?p=22081
- */
- beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
- beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
- getAnimatableByTarget(target: any): Animatable;
- Animatables: Animatable[];
- /**
- * Will stop the animation of the given target
- * @param target - the target
- * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
- * @see beginAnimation
- */
- stopAnimation(target: any, animationName?: string): void;
- getViewMatrix(): Matrix;
- getProjectionMatrix(): Matrix;
- getTransformMatrix(): Matrix;
- setTransformMatrix(view: Matrix, projection: Matrix): void;
- addMesh(newMesh: AbstractMesh): void;
- removeMesh(toRemove: AbstractMesh): number;
- removeSkeleton(toRemove: Skeleton): number;
- removeLight(toRemove: Light): number;
- removeCamera(toRemove: Camera): number;
- addLight(newLight: Light): void;
- addCamera(newCamera: Camera): void;
- /**
- * Switch active camera
- * @param {Camera} newCamera - new active camera
- * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
- */
- switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
- /**
- * sets the active camera of the scene using its ID
- * @param {string} id - the camera's ID
- * @return {BABYLON.Camera|null} the new active camera or null if none found.
- * @see activeCamera
- */
- setActiveCameraByID(id: string): Camera;
- /**
- * sets the active camera of the scene using its name
- * @param {string} name - the camera's name
- * @return {BABYLON.Camera|null} the new active camera or null if none found.
- * @see activeCamera
- */
- setActiveCameraByName(name: string): Camera;
- /**
- * get a material using its id
- * @param {string} the material's ID
- * @return {BABYLON.Material|null} the material or null if none found.
- */
- getMaterialByID(id: string): Material;
- /**
- * get a material using its name
- * @param {string} the material's name
- * @return {BABYLON.Material|null} the material or null if none found.
- */
- getMaterialByName(name: string): Material;
- getLensFlareSystemByName(name: string): LensFlareSystem;
- getLensFlareSystemByID(id: string): LensFlareSystem;
- getCameraByID(id: string): Camera;
- getCameraByUniqueID(uniqueId: number): Camera;
- /**
- * get a camera using its name
- * @param {string} the camera's name
- * @return {BABYLON.Camera|null} the camera or null if none found.
- */
- getCameraByName(name: string): Camera;
- /**
- * get a bone using its id
- * @param {string} the bone's id
- * @return {BABYLON.Bone|null} the bone or null if not found
- */
- getBoneByID(id: string): Bone;
- /**
- * get a bone using its id
- * @param {string} the bone's name
- * @return {BABYLON.Bone|null} the bone or null if not found
- */
- getBoneByName(name: string): Bone;
- /**
- * get a light node using its name
- * @param {string} the light's name
- * @return {BABYLON.Light|null} the light or null if none found.
- */
- getLightByName(name: string): Light;
- /**
- * get a light node using its ID
- * @param {string} the light's id
- * @return {BABYLON.Light|null} the light or null if none found.
- */
- getLightByID(id: string): Light;
- /**
- * get a light node using its scene-generated unique ID
- * @param {number} the light's unique id
- * @return {BABYLON.Light|null} the light or null if none found.
- */
- getLightByUniqueID(uniqueId: number): Light;
- /**
- * get a particle system by id
- * @param id {number} the particle system id
- * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
- */
- getParticleSystemByID(id: string): ParticleSystem;
- /**
- * get a geometry using its ID
- * @param {string} the geometry's id
- * @return {BABYLON.Geometry|null} the geometry or null if none found.
- */
- getGeometryByID(id: string): Geometry;
- /**
- * add a new geometry to this scene.
- * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
- * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
- * @return {boolean} was the geometry added or not
- */
- pushGeometry(geometry: Geometry, force?: boolean): boolean;
- /**
- * Removes an existing geometry
- * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
- * @return {boolean} was the geometry removed or not
- */
- removeGeometry(geometry: Geometry): boolean;
- getGeometries(): Geometry[];
- /**
- * Get the first added mesh found of a given ID
- * @param {string} id - the id to search for
- * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
- */
- getMeshByID(id: string): AbstractMesh;
- getMeshesByID(id: string): Array<AbstractMesh>;
- /**
- * Get a mesh with its auto-generated unique id
- * @param {number} uniqueId - the unique id to search for
- * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
- */
- getMeshByUniqueID(uniqueId: number): AbstractMesh;
- /**
- * Get a the last added mesh found of a given ID
- * @param {string} id - the id to search for
- * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
- */
- getLastMeshByID(id: string): AbstractMesh;
- /**
- * Get a the last added node (Mesh, Camera, Light) found of a given ID
- * @param {string} id - the id to search for
- * @return {BABYLON.Node|null} the node found or null if not found at all.
- */
- getLastEntryByID(id: string): Node;
- getNodeByID(id: string): Node;
- getNodeByName(name: string): Node;
- getMeshByName(name: string): AbstractMesh;
- getSoundByName(name: string): Sound;
- getLastSkeletonByID(id: string): Skeleton;
- getSkeletonById(id: string): Skeleton;
- getSkeletonByName(name: string): Skeleton;
- isActiveMesh(mesh: Mesh): boolean;
- /**
- * Return a unique id as a string which can serve as an identifier for the scene
- */
- uid: string;
- /**
- * Add an externaly attached data from its key.
- * This method call will fail and return false, if such key already exists.
- * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
- * @param key the unique key that identifies the data
- * @param data the data object to associate to the key for this Engine instance
- * @return true if no such key were already present and the data was added successfully, false otherwise
- */
- addExternalData<T>(key: string, data: T): boolean;
- /**
- * Get an externaly attached data from its key
- * @param key the unique key that identifies the data
- * @return the associated data, if present (can be null), or undefined if not present
- */
- getExternalData<T>(key: string): T;
- /**
- * Get an externaly attached data from its key, create it using a factory if it's not already present
- * @param key the unique key that identifies the data
- * @param factory the factory that will be called to create the instance if and only if it doesn't exists
- * @return the associated data, can be null if the factory returned null.
- */
- getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
- /**
- * Remove an externaly attached data from the Engine instance
- * @param key the unique key that identifies the data
- * @return true if the data was successfully removed, false if it doesn't exist
- */
- removeExternalData(key: any): boolean;
- updateTransformMatrix(force?: boolean): void;
- render(): void;
- audioEnabled: boolean;
- headphone: boolean;
- enableDepthRenderer(): DepthRenderer;
- disableDepthRenderer(): void;
- freezeMaterials(): void;
- unfreezeMaterials(): void;
- dispose(): void;
- disposeSounds(): void;
- getWorldExtends(): {
- min: Vector3;
- max: Vector3;
- };
- createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
- createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
- createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
- pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
- pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
- pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
- multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): PickingInfo[];
- multiPickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean): PickingInfo[];
- setPointerOverMesh(mesh: AbstractMesh): void;
- getPointerOverMesh(): AbstractMesh;
- setPointerOverSprite(sprite: Sprite): void;
- getPointerOverSprite(): Sprite;
- getPhysicsEngine(): PhysicsEngine;
- /**
- * Enables physics to the current scene
- * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
- * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
- * @return {boolean} was the physics engine initialized
- */
- enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
- disablePhysicsEngine(): void;
- isPhysicsEnabled(): boolean;
- /**
- *
- * Sets the gravity of the physics engine (and NOT of the scene)
- * @param {BABYLON.Vector3} [gravity] - the new gravity to be used
- */
- setGravity(gravity: Vector3): void;
- /**
- * Legacy support, using the new API
- * @Deprecated
- */
- createCompoundImpostor(parts: any, options: PhysicsImpostorParameters): any;
- deleteCompoundImpostor(compound: any): void;
- createDefaultCameraOrLight(): void;
- getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
- getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
- getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
- getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
- /**
- * Overrides the default sort function applied in the renderging group to prepare the meshes.
- * This allowed control for front to back rendering or reversly depending of the special needs.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
- * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
- * @param transparentSortCompareFn The transparent queue comparison function use to sort.
- */
- setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
- /**
- * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
- */
- setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
- }
- }
- declare module BABYLON {
- class Action {
- triggerOptions: any;
- trigger: number;
- constructor(triggerOptions: any, condition?: Condition);
- getTriggerParameter(): any;
- execute(evt: ActionEvent): void;
- skipToNextActiveAction(): void;
- then(action: Action): Action;
- serialize(parent: any): any;
- name: string;
- targetType: string;
- value: string;
- };
- }
- }
- declare module BABYLON {
- /**
- * ActionEvent is the event beint sent when an action is triggered.
- */
- class ActionEvent {
- source: any;
- pointerX: number;
- pointerY: number;
- meshUnderPointer: AbstractMesh;
- sourceEvent: any;
- additionalData: any;
- /**
- * @constructor
- * @param source The mesh or sprite that triggered the action.
- * @param pointerX The X mouse cursor position at the time of the event
- * @param pointerY The Y mouse cursor position at the time of the event
- * @param meshUnderPointer The mesh that is currently pointed at (can be null)
- * @param sourceEvent the original (browser) event that triggered the ActionEvent
- */
- constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
- /**
- * Helper function to auto-create an ActionEvent from a source mesh.
- * @param source The source mesh that triggered the event
- * @param evt {Event} The original (browser) event
- */
- static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
- /**
- * Helper function to auto-create an ActionEvent from a source mesh.
- * @param source The source sprite that triggered the event
- * @param scene Scene associated with the sprite
- * @param evt {Event} The original (browser) event
- */
- static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
- /**
- * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
- * @param scene the scene where the event occurred
- * @param evt {Event} The original (browser) event
- */
- static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
- static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
- }
- /**
- * Action Manager manages all events to be triggered on a given mesh or the global scene.
- * A single scene can have many Action Managers to handle predefined actions on specific meshes.
- */
- class ActionManager {
- static NothingTrigger: number;
- static OnPickTrigger: number;
- static OnLeftPickTrigger: number;
- static OnRightPickTrigger: number;
- static OnCenterPickTrigger: number;
- static OnPickDownTrigger: number;
- static OnPickUpTrigger: number;
- static OnPickOutTrigger: number;
- static OnLongPressTrigger: number;
- static OnPointerOverTrigger: number;
- static OnPointerOutTrigger: number;
- static OnEveryFrameTrigger: number;
- static OnIntersectionEnterTrigger: number;
- static OnIntersectionExitTrigger: number;
- static OnKeyDownTrigger: number;
- static OnKeyUpTrigger: number;
- static DragMovementThreshold: number;
- static LongPressDelay: number;
- actions: Action[];
- hoverCursor: string;
- constructor(scene: Scene);
- dispose(): void;
- getScene(): Scene;
- /**
- * Does this action manager handles actions of any of the given triggers
- * @param {number[]} triggers - the triggers to be tested
- * @return {boolean} whether one (or more) of the triggers is handeled
- */
- hasSpecificTriggers(triggers: number[]): boolean;
- /**
- * Does this action manager handles actions of a given trigger
- * @param {number} trigger - the trigger to be tested
- * @return {boolean} whether the trigger is handeled
- */
- hasSpecificTrigger(trigger: number): boolean;
- /**
- * Does this action manager has pointer triggers
- * @return {boolean} whether or not it has pointer triggers
- */
- hasPointerTriggers: boolean;
- /**
- * Does this action manager has pick triggers
- * @return {boolean} whether or not it has pick triggers
- */
- hasPickTriggers: boolean;
- /**
- * Registers an action to this action manager
- * @param {BABYLON.Action} action - the action to be registered
- * @return {BABYLON.Action} the action amended (prepared) after registration
- */
- registerAction(action: Action): Action;
- /**
- * Process a specific trigger
- * @param {number} trigger - the trigger to process
- * @param evt {BABYLON.ActionEvent} the event details to be processed
- */
- processTrigger(trigger: number, evt: ActionEvent): void;
- serialize(name: string): any;
- static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
- static GetTriggerName(trigger: number): string;
- }
- }
- declare module BABYLON {
- class Condition {
- constructor(actionManager: ActionManager);
- isValid(): boolean;
- serialize(): any;
- }
- class ValueCondition extends Condition {
- propertyPath: string;
- value: any;
- operator: number;
- static IsEqual: number;
- static IsDifferent: number;
- static IsGreater: number;
- static IsLesser: number;
- constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
- isValid(): boolean;
- serialize(): any;
- static GetOperatorName(operator: number): string;
- }
- class PredicateCondition extends Condition {
- predicate: () => boolean;
- constructor(actionManager: ActionManager, predicate: () => boolean);
- isValid(): boolean;
- }
- class StateCondition extends Condition {
- value: string;
- constructor(actionManager: ActionManager, target: any, value: string);
- isValid(): boolean;
- serialize(): any;
- }
- }
- declare module BABYLON {
- class SwitchBooleanAction extends Action {
- propertyPath: string;
- constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class SetStateAction extends Action {
- value: string;
- constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class SetValueAction extends Action {
- propertyPath: string;
- value: any;
- constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class IncrementValueAction extends Action {
- propertyPath: string;
- value: any;
- constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class PlayAnimationAction extends Action {
- from: number;
- to: number;
- loop: boolean;
- constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class StopAnimationAction extends Action {
- constructor(triggerOptions: any, target: any, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class DoNothingAction extends Action {
- constructor(triggerOptions?: any, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class CombineAction extends Action {
- children: Action[];
- constructor(triggerOptions: any, children: Action[], condition?: Condition);
- execute(evt: ActionEvent): void;
- serialize(parent: any): any;
- }
- class ExecuteCodeAction extends Action {
- func: (evt: ActionEvent) => void;
- constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
- execute(evt: ActionEvent): void;
- }
- class SetParentAction extends Action {
- constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class PlaySoundAction extends Action {
- constructor(triggerOptions: any, sound: Sound, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- class StopSoundAction extends Action {
- constructor(triggerOptions: any, sound: Sound, condition?: Condition);
- execute(): void;
- serialize(parent: any): any;
- }
- }
- declare module BABYLON {
- class InterpolateValueAction extends Action {
- propertyPath: string;
- value: any;
- duration: number;
- stopOtherAnimations: boolean;
- onInterpolationDone: () => void;
- constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
- execute(): void;
- serialize(parent: any): any;
- }
- }
- declare module BABYLON {
- class Animatable {
- target: any;
- fromFrame: number;
- toFrame: number;
- loopAnimation: boolean;
- speedRatio: number;
- onAnimationEnd: any;
- animationStarted: boolean;
- constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
- getAnimations(): Animation[];
- appendAnimations(target: any, animations: Animation[]): void;
- getAnimationByTargetProperty(property: string): Animation;
- reset(): void;
- enableBlending(blendingSpeed: number): void;
- disableBlending(): void;
- goToFrame(frame: number): void;
- pause(): void;
- restart(): void;
- stop(animationName?: string): void;
- }
- }
- declare module BABYLON {
- class AnimationRange {
- name: string;
- from: number;
- to: number;
- constructor(name: string, from: number, to: number);
- clone(): AnimationRange;
- }
- /**
- * Composed of a frame, and an action function
- */
- class AnimationEvent {
- frame: number;
- action: () => void;
- onlyOnce: boolean;
- isDone: boolean;
- constructor(frame: number, action: () => void, onlyOnce?: boolean);
- }
- class PathCursor {
- private path;
- value: number;
- animations: Animation[];
- constructor(path: Path2);
- getPoint(): Vector3;
- moveAhead(step?: number): PathCursor;
- moveBack(step?: number): PathCursor;
- move(step: number): PathCursor;
- private ensureLimits();
- private markAsDirty(propertyName);
- private raiseOnChange();
- onchange(f: (cursor: PathCursor) => void): PathCursor;
- }
- class Animation {
- name: string;
- targetProperty: string;
- framePerSecond: number;
- dataType: number;
- loopMode: number;
- enableBlending: boolean;
- targetPropertyPath: string[];
- currentFrame: number;
- allowMatricesInterpolation: boolean;
- blendingSpeed: number;
- static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
- static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
- constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- /**
- * Add an event to this animation.
- */
- addEvent(event: AnimationEvent): void;
- /**
- * Remove all events found at the given frame
- * @param frame
- */
- removeEvents(frame: number): void;
- createRange(name: string, from: number, to: number): void;
- deleteRange(name: string, deleteFrames?: boolean): void;
- getRange(name: string): AnimationRange;
- reset(): void;
- isStopped(): boolean;
- getKeys(): Array<{
- frame: number;
- value: any;
- }>;
- getHighestFrame(): number;
- getEasingFunction(): IEasingFunction;
- setEasingFunction(easingFunction: EasingFunction): void;
- floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
- quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
- vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
- vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
- sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
- color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
- matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
- clone(): Animation;
- setKeys(values: Array<{
- frame: number;
- value: any;
- }>): void;
- setValue(currentValue: any, blend?: boolean): void;
- goToFrame(frame: number): void;
- animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
- serialize(): any;
- static ANIMATIONTYPE_FLOAT: number;
- static ANIMATIONTYPE_VECTOR3: number;
- static ANIMATIONTYPE_VECTOR2: number;
- static ANIMATIONTYPE_SIZE: number;
- static ANIMATIONTYPE_QUATERNION: number;
- static ANIMATIONTYPE_MATRIX: number;
- static ANIMATIONTYPE_COLOR3: number;
- static ANIMATIONLOOPMODE_RELATIVE: number;
- static ANIMATIONLOOPMODE_CYCLE: number;
- static ANIMATIONLOOPMODE_CONSTANT: number;
- static Parse(parsedAnimation: any): Animation;
- static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
- }
- }
- declare module BABYLON {
- interface IEasingFunction {
- ease(gradient: number): number;
- }
- class EasingFunction implements IEasingFunction {
- static EASINGMODE_EASEIN: number;
- static EASINGMODE_EASEOUT: number;
- static EASINGMODE_EASEINOUT: number;
- setEasingMode(easingMode: number): void;
- getEasingMode(): number;
- easeInCore(gradient: number): number;
- ease(gradient: number): number;
- }
- class CircleEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class BackEase extends EasingFunction implements IEasingFunction {
- amplitude: number;
- constructor(amplitude?: number);
- easeInCore(gradient: number): number;
- }
- class BounceEase extends EasingFunction implements IEasingFunction {
- bounces: number;
- bounciness: number;
- constructor(bounces?: number, bounciness?: number);
- easeInCore(gradient: number): number;
- }
- class CubicEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class ElasticEase extends EasingFunction implements IEasingFunction {
- oscillations: number;
- springiness: number;
- constructor(oscillations?: number, springiness?: number);
- easeInCore(gradient: number): number;
- }
- class ExponentialEase extends EasingFunction implements IEasingFunction {
- exponent: number;
- constructor(exponent?: number);
- easeInCore(gradient: number): number;
- }
- class PowerEase extends EasingFunction implements IEasingFunction {
- power: number;
- constructor(power?: number);
- easeInCore(gradient: number): number;
- }
- class QuadraticEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class QuarticEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class QuinticEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class SineEase extends EasingFunction implements IEasingFunction {
- easeInCore(gradient: number): number;
- }
- class BezierCurveEase extends EasingFunction implements IEasingFunction {
- x1: number;
- y1: number;
- x2: number;
- y2: number;
- constructor(x1?: number, y1?: number, x2?: number, y2?: number);
- easeInCore(gradient: number): number;
- }
- }
- declare module BABYLON {
- class Analyser {
- SMOOTHING: number;
- FFT_SIZE: number;
- BARGRAPHAMPLITUDE: number;
- DEBUGCANVASPOS: {
- x: number;
- y: number;
- };
- DEBUGCANVASSIZE: {
- width: number;
- height: number;
- };
- constructor(scene: Scene);
- getFrequencyBinCount(): number;
- getByteFrequencyData(): Uint8Array;
- getByteTimeDomainData(): Uint8Array;
- getFloatFrequencyData(): Uint8Array;
- drawDebugCanvas(): void;
- stopDebugCanvas(): void;
- connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class AudioEngine {
- canUseWebAudio: boolean;
- masterGain: GainNode;
- WarnedWebAudioUnsupported: boolean;
- unlocked: boolean;
- onAudioUnlocked: () => any;
- isMP3supported: boolean;
- isOGGsupported: boolean;
- audioContext: AudioContext;
- constructor();
- dispose(): void;
- getGlobalVolume(): number;
- setGlobalVolume(newVolume: number): void;
- connectToAnalyser(analyser: Analyser): void;
- }
- }
- declare module BABYLON {
- class Sound {
- name: string;
- autoplay: boolean;
- loop: boolean;
- useCustomAttenuation: boolean;
- soundTrackId: number;
- spatialSound: boolean;
- refDistance: number;
- rolloffFactor: number;
- maxDistance: number;
- distanceModel: string;
- onended: () => any;
- isPlaying: boolean;
- isPaused: boolean;
- /**
- * Create a sound and attach it to a scene
- * @param name Name of your sound
- * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
- * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
- * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
- */
- constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
- dispose(): void;
- setAudioBuffer(audioBuffer: AudioBuffer): void;
- updateOptions(options: any): void;
- switchPanningModelToHRTF(): void;
- switchPanningModelToEqualPower(): void;
- connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
- /**
- * Transform this sound into a directional source
- * @param coneInnerAngle Size of the inner cone in degree
- * @param coneOuterAngle Size of the outer cone in degree
- * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
- */
- setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
- setPosition(newPosition: Vector3): void;
- setLocalDirectionToMesh(newLocalDirection: Vector3): void;
- updateDistanceFromListener(): void;
- setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
- /**
- * Play the sound
- * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
- * @param offset (optional) Start the sound setting it at a specific time
- */
- play(time?: number, offset?: number): void;
- /**
- * Stop the sound
- * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
- */
- stop(time?: number): void;
- pause(): void;
- setVolume(newVolume: number, time?: number): void;
- setPlaybackRate(newPlaybackRate: number): void;
- getVolume(): number;
- attachToMesh(meshToConnectTo: AbstractMesh): void;
- detachFromMesh(): void;
- clone(): Sound;
- getAudioBuffer(): AudioBuffer;
- serialize(): any;
- static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
- }
- }
- declare module BABYLON {
- class SoundTrack {
- id: number;
- soundCollection: Array<Sound>;
- constructor(scene: Scene, options?: any);
- dispose(): void;
- AddSound(sound: Sound): void;
- RemoveSound(sound: Sound): void;
- setVolume(newVolume: number): void;
- switchPanningModelToHRTF(): void;
- switchPanningModelToEqualPower(): void;
- connectToAnalyser(analyser: Analyser): void;
- }
- }
- declare module BABYLON {
- class Bone extends Node {
- name: string;
- children: Bone[];
- animations: Animation[];
- length: number;
- constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
- getParent(): Bone;
- getLocalMatrix(): Matrix;
- getBaseMatrix(): Matrix;
- getRestPose(): Matrix;
- returnToRest(): void;
- getWorldMatrix(): Matrix;
- getInvertedAbsoluteTransform(): Matrix;
- getAbsoluteTransform(): Matrix;
- updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
- markAsDirty(): void;
- copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
- translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
- setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
- setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
- setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
- scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
- setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
- rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
- setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
- setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
- setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
- setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
- getScale(): Vector3;
- getScaleToRef(result: Vector3): void;
- getPosition(space?: Space, mesh?: AbstractMesh): Vector3;
- getPositionToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
- getAbsolutePosition(mesh?: AbstractMesh): Vector3;
- getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
- computeAbsoluteTransforms(): void;
- getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
- getDirectionToRef(localAxis: Vector3, result: Vector3, mesh?: AbstractMesh): void;
- getRotation(space?: Space, mesh?: AbstractMesh): Vector3;
- getRotationToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
- getRotationQuaternion(space?: Space, mesh?: AbstractMesh): Quaternion;
- getRotationQuaternionToRef(space: Space, mesh: AbstractMesh, result: Quaternion): void;
- }
- }
- declare module BABYLON {
- class BoneIKController {
- target: AbstractMesh;
- poleTarget: AbstractMesh;
- poleAngle: number;
- mesh: AbstractMesh;
- maxAngle: number;
- constructor(mesh: AbstractMesh, bone: Bone, target: AbstractMesh, poleTarget: AbstractMesh, poleAngle?: number);
- update(): void;
- }
- }
- declare module BABYLON {
- class BoneLookController {
- target: Vector3;
- mesh: AbstractMesh;
- bone: Bone;
- upAxis: Vector3;
- adjustYaw: number;
- adjustPitch: number;
- adjustRoll: number;
- constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, adjustYaw?: number, adjustPitch?: number, adjustRoll?: number);
- update(): void;
- }
- }
- declare module BABYLON {
- class Skeleton {
- name: string;
- id: string;
- bones: Bone[];
- dimensionsAtRest: Vector3;
- needInitialSkinMatrix: boolean;
- constructor(name: string, id: string, scene: Scene);
- getTransformMatrices(mesh: AbstractMesh): Float32Array;
- getScene(): Scene;
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- /**
- * Get bone's index searching by name
- * @param {string} name is bone's name to search for
- * @return {number} Indice of the bone. Returns -1 if not found
- */
- getBoneIndexByName(name: string): number;
- createAnimationRange(name: string, from: number, to: number): void;
- deleteAnimationRange(name: string, deleteFrames?: boolean): void;
- getAnimationRange(name: string): AnimationRange;
- /**
- * Returns as an Array, all AnimationRanges defined on this skeleton
- */
- getAnimationRanges(): AnimationRange[];
- /**
- * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
- */
- copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
- returnToRest(): void;
- beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
- prepare(): void;
- getAnimatables(): IAnimatable[];
- clone(name: string, id: string): Skeleton;
- enableBlending(blendingSpeed?: number): void;
- dispose(): void;
- serialize(): any;
- static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
- computeAbsoluteTransforms(forceUpdate?: boolean): void;
- getPoseMatrix(): Matrix;
- }
- }
- declare module BABYLON {
- class Collider {
- radius: Vector3;
- retry: number;
- velocity: Vector3;
- basePoint: Vector3;
- epsilon: number;
- collisionFound: boolean;
- velocityWorldLength: number;
- basePointWorld: Vector3;
- velocityWorld: Vector3;
- normalizedVelocity: Vector3;
- initialVelocity: Vector3;
- initialPosition: Vector3;
- nearestDistance: number;
- intersectionPoint: Vector3;
- collidedMesh: AbstractMesh;
- }
- }
- declare module BABYLON {
- var CollisionWorker: string;
- interface ICollisionCoordinator {
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
- init(scene: Scene): void;
- destroy(): void;
- onMeshAdded(mesh: AbstractMesh): any;
- onMeshUpdated(mesh: AbstractMesh): any;
- onMeshRemoved(mesh: AbstractMesh): any;
- onGeometryAdded(geometry: Geometry): any;
- onGeometryUpdated(geometry: Geometry): any;
- onGeometryDeleted(geometry: Geometry): any;
- }
- interface SerializedMesh {
- id: string;
- name: string;
- uniqueId: number;
- geometryId: string;
- sphereCenter: Array<number>;
- sphereRadius: number;
- boxMinimum: Array<number>;
- boxMaximum: Array<number>;
- worldMatrixFromCache: any;
- subMeshes: Array<SerializedSubMesh>;
- checkCollisions: boolean;
- }
- interface SerializedSubMesh {
- position: number;
- verticesStart: number;
- verticesCount: number;
- indexStart: number;
- indexCount: number;
- hasMaterial: boolean;
- sphereCenter: Array<number>;
- sphereRadius: number;
- boxMinimum: Array<number>;
- boxMaximum: Array<number>;
- }
- interface SerializedGeometry {
- id: string;
- positions: Float32Array;
- indices: Int32Array;
- normals: Float32Array;
- }
- interface BabylonMessage {
- taskType: WorkerTaskType;
- payload: InitPayload | CollidePayload | UpdatePayload;
- }
- interface SerializedColliderToWorker {
- position: Array<number>;
- velocity: Array<number>;
- radius: Array<number>;
- }
- enum WorkerTaskType {
- INIT = 0,
- UPDATE = 1,
- COLLIDE = 2,
- }
- interface WorkerReply {
- error: WorkerReplyType;
- taskType: WorkerTaskType;
- payload?: any;
- }
- interface CollisionReplyPayload {
- newPosition: Array<number>;
- collisionId: number;
- collidedMeshUniqueId: number;
- }
- interface InitPayload {
- }
- interface CollidePayload {
- collisionId: number;
- collider: SerializedColliderToWorker;
- maximumRetry: number;
- excludedMeshUniqueId?: number;
- }
- interface UpdatePayload {
- updatedMeshes: {
- [n: number]: SerializedMesh;
- };
- updatedGeometries: {
- [s: string]: SerializedGeometry;
- };
- removedMeshes: Array<number>;
- removedGeometries: Array<string>;
- }
- enum WorkerReplyType {
- SUCCESS = 0,
- UNKNOWN_ERROR = 1,
- }
- class CollisionCoordinatorWorker implements ICollisionCoordinator {
- constructor();
- static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
- static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
- init(scene: Scene): void;
- destroy(): void;
- onMeshAdded(mesh: AbstractMesh): void;
- onMeshUpdated: (mesh: AbstractMesh) => void;
- onMeshRemoved(mesh: AbstractMesh): void;
- onGeometryAdded(geometry: Geometry): void;
- onGeometryUpdated: (geometry: Geometry) => void;
- onGeometryDeleted(geometry: Geometry): void;
- }
- class CollisionCoordinatorLegacy implements ICollisionCoordinator {
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
- init(scene: Scene): void;
- destroy(): void;
- onMeshAdded(mesh: AbstractMesh): void;
- onMeshUpdated(mesh: AbstractMesh): void;
- onMeshRemoved(mesh: AbstractMesh): void;
- onGeometryAdded(geometry: Geometry): void;
- onGeometryUpdated(geometry: Geometry): void;
- onGeometryDeleted(geometry: Geometry): void;
- }
- }
- declare module BABYLON {
- var WorkerIncluded: boolean;
- class CollisionCache {
- getMeshes(): {
- [n: number]: SerializedMesh;
- };
- getGeometries(): {
- [s: number]: SerializedGeometry;
- };
- getMesh(id: any): SerializedMesh;
- addMesh(mesh: SerializedMesh): void;
- removeMesh(uniqueId: number): void;
- getGeometry(id: string): SerializedGeometry;
- addGeometry(geometry: SerializedGeometry): void;
- removeGeometry(id: string): void;
- }
- class CollideWorker {
- collider: Collider;
- private finalPosition;
- private collisionsScalingMatrix;
- private collisionTranformationMatrix;
- constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
- collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
- private checkCollision(mesh);
- private processCollisionsForSubMeshes(transformMatrix, mesh);
- private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
- private checkSubmeshCollision(subMesh);
- }
- interface ICollisionDetector {
- onInit(payload: InitPayload): void;
- onUpdate(payload: UpdatePayload): void;
- onCollision(payload: CollidePayload): void;
- }
- class CollisionDetectorTransferable implements ICollisionDetector {
- onInit(payload: InitPayload): void;
- onUpdate(payload: UpdatePayload): void;
- onCollision(payload: CollidePayload): void;
- }
- }
- declare module BABYLON {
- class IntersectionInfo {
- bu: number;
- bv: number;
- distance: number;
- faceId: number;
- subMeshId: number;
- constructor(bu: number, bv: number, distance: number);
- }
- class PickingInfo {
- hit: boolean;
- distance: number;
- pickedPoint: Vector3;
- pickedMesh: AbstractMesh;
- bu: number;
- bv: number;
- faceId: number;
- subMeshId: number;
- pickedSprite: Sprite;
- getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
- getTextureCoordinates(): Vector2;
- }
- }
- declare module BABYLON {
- class ArcRotateCamera extends TargetCamera {
- alpha: number;
- beta: number;
- radius: number;
- target: Vector3;
- inertialAlphaOffset: number;
- inertialBetaOffset: number;
- inertialRadiusOffset: number;
- lowerAlphaLimit: any;
- upperAlphaLimit: any;
- lowerBetaLimit: number;
- upperBetaLimit: number;
- lowerRadiusLimit: any;
- upperRadiusLimit: any;
- inertialPanningX: number;
- inertialPanningY: number;
- angularSensibilityX: number;
- angularSensibilityY: number;
- pinchPrecision: number;
- panningSensibility: number;
- keysUp: number[];
- keysDown: number[];
- keysLeft: number[];
- keysRight: number[];
- wheelPrecision: number;
- zoomOnFactor: number;
- targetScreenOffset: Vector2;
- allowUpsideDown: boolean;
- inputs: ArcRotateCameraInputsManager;
- panningAxis: Vector3;
- onCollide: (collidedMesh: AbstractMesh) => void;
- checkCollisions: boolean;
- collisionRadius: Vector3;
- constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
- attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
- detachControl(element: HTMLElement): void;
- rebuildAnglesAndRadius(): void;
- setPosition(position: Vector3): void;
- setTarget(target: Vector3, toBoundingCenter?: boolean): void;
- zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
- focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
- /**
- * @override
- * Override Camera.createRigCamera
- */
- createRigCamera(name: string, cameraIndex: number): Camera;
- /**
- * @override
- * Override Camera._updateRigCameras
- */
- dispose(): void;
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
- constructor(camera: ArcRotateCamera);
- addMouseWheel(): ArcRotateCameraInputsManager;
- addPointers(): ArcRotateCameraInputsManager;
- addKeyboard(): ArcRotateCameraInputsManager;
- addGamepad(): ArcRotateCameraInputsManager;
- addVRDeviceOrientation(): ArcRotateCameraInputsManager;
- }
- }
- declare module BABYLON {
- class Camera extends Node {
- inputs: CameraInputsManager<Camera>;
- static PERSPECTIVE_CAMERA: number;
- static ORTHOGRAPHIC_CAMERA: number;
- static FOVMODE_VERTICAL_FIXED: number;
- static FOVMODE_HORIZONTAL_FIXED: number;
- static RIG_MODE_NONE: number;
- static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
- static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
- static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
- static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
- static RIG_MODE_VR: number;
- static RIG_MODE_WEBVR: number;
- static ForceAttachControlToAlwaysPreventDefault: boolean;
- position: Vector3;
- upVector: Vector3;
- orthoLeft: any;
- orthoRight: any;
- orthoBottom: any;
- orthoTop: any;
- fov: number;
- minZ: number;
- maxZ: number;
- inertia: number;
- mode: number;
- isIntermediate: boolean;
- viewport: Viewport;
- layerMask: number;
- fovMode: number;
- cameraRigMode: number;
- interaxialDistance: number;
- isStereoscopicSideBySide: boolean;
- constructor(name: string, position: Vector3, scene: Scene);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- globalPosition: Vector3;
- getActiveMeshes(): SmartArray<Mesh>;
- isActiveMesh(mesh: Mesh): boolean;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- update(): void;
- attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
- detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
- getWorldMatrix(): Matrix;
- getViewMatrix(force?: boolean): Matrix;
- freezeProjectionMatrix(projection?: Matrix): void;
- unfreezeProjectionMatrix(): void;
- getProjectionMatrix(force?: boolean): Matrix;
- getTranformationMatrix(): Matrix;
- private updateFrustumPlanes();
- isInFrustum(target: ICullable): boolean;
- isCompletelyInFrustum(target: ICullable): boolean;
- dispose(): void;
- setCameraRigMode(mode: number, rigParams: any): void;
- setCameraRigParameter(name: string, value: any): void;
- /**
- * needs to be overridden by children so sub has required properties to be copied
- */
- createRigCamera(name: string, cameraIndex: number): Camera;
- /**
- * May need to be overridden by children
- */
- serialize(): any;
- getTypeName(): string;
- clone(name: string): Camera;
- static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
- static Parse(parsedCamera: any, scene: Scene): Camera;
- }
- }
- declare module BABYLON {
- var CameraInputTypes: {};
- interface ICameraInput<TCamera extends BABYLON.Camera> {
- camera: TCamera;
- getTypeName(): string;
- getSimpleName(): string;
- attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
- detachControl: (element: HTMLElement) => void;
- checkInputs?: () => void;
- }
- interface CameraInputsMap<TCamera extends BABYLON.Camera> {
- [name: string]: ICameraInput<TCamera>;
- [idx: number]: ICameraInput<TCamera>;
- }
- class CameraInputsManager<TCamera extends BABYLON.Camera> {
- attached: CameraInputsMap<TCamera>;
- attachedElement: HTMLElement;
- noPreventDefault: boolean;
- camera: TCamera;
- checkInputs: () => void;
- constructor(camera: TCamera);
- add(input: ICameraInput<TCamera>): void;
- remove(inputToRemove: ICameraInput<TCamera>): void;
- removeByType(inputType: string): void;
- attachInput(input: ICameraInput<TCamera>): void;
- attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
- detachElement(element: HTMLElement): void;
- rebuildInputCheck(): void;
- clear(): void;
- serialize(serializedCamera: any): void;
- parse(parsedCamera: any): void;
- }
- }
- declare module BABYLON {
- class DeviceOrientationCamera extends FreeCamera {
- constructor(name: string, position: Vector3, scene: Scene);
- getTypeName(): string;
- resetToCurrentRotation(axis?: Axis): void;
- }
- }
- declare module BABYLON {
- class FollowCamera extends TargetCamera {
- radius: number;
- rotationOffset: number;
- heightOffset: number;
- cameraAcceleration: number;
- maxCameraSpeed: number;
- target: AbstractMesh;
- constructor(name: string, position: Vector3, scene: Scene, target?: AbstractMesh);
- private getRadians(degrees);
- private follow(cameraTarget);
- getTypeName(): string;
- }
- class ArcFollowCamera extends TargetCamera {
- alpha: number;
- beta: number;
- radius: number;
- target: AbstractMesh;
- constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
- private follow();
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class FreeCamera extends TargetCamera {
- ellipsoid: Vector3;
- checkCollisions: boolean;
- applyGravity: boolean;
- inputs: FreeCameraInputsManager;
- angularSensibility: number;
- keysUp: number[];
- keysDown: number[];
- keysLeft: number[];
- keysRight: number[];
- onCollide: (collidedMesh: AbstractMesh) => void;
- constructor(name: string, position: Vector3, scene: Scene);
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- dispose(): void;
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
- constructor(camera: FreeCamera);
- addKeyboard(): FreeCameraInputsManager;
- addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
- addGamepad(): FreeCameraInputsManager;
- addDeviceOrientation(): FreeCameraInputsManager;
- addTouch(): FreeCameraInputsManager;
- addVirtualJoystick(): FreeCameraInputsManager;
- }
- }
- declare module BABYLON {
- class GamepadCamera extends UniversalCamera {
- gamepadAngularSensibility: number;
- gamepadMoveSensibility: number;
- constructor(name: string, position: Vector3, scene: Scene);
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class AnaglyphFreeCamera extends FreeCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
- getTypeName(): string;
- }
- class AnaglyphArcRotateCamera extends ArcRotateCamera {
- constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
- getTypeName(): string;
- }
- class AnaglyphGamepadCamera extends GamepadCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
- getTypeName(): string;
- }
- class AnaglyphUniversalCamera extends UniversalCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
- getTypeName(): string;
- }
- class StereoscopicFreeCamera extends FreeCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
- getTypeName(): string;
- }
- class StereoscopicArcRotateCamera extends ArcRotateCamera {
- constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
- getTypeName(): string;
- }
- class StereoscopicGamepadCamera extends GamepadCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
- getTypeName(): string;
- }
- class StereoscopicUniversalCamera extends UniversalCamera {
- constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class TargetCamera extends Camera {
- cameraDirection: Vector3;
- cameraRotation: Vector2;
- rotation: Vector3;
- rotationQuaternion: Quaternion;
- speed: number;
- noRotationConstraint: boolean;
- lockedTarget: any;
- constructor(name: string, position: Vector3, scene: Scene);
- getFrontPosition(distance: number): Vector3;
- setTarget(target: Vector3): void;
- getTarget(): Vector3;
- /**
- * @override
- * Override Camera.createRigCamera
- */
- createRigCamera(name: string, cameraIndex: number): Camera;
- /**
- * @override
- * Override Camera._updateRigCameras
- */
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class TouchCamera extends FreeCamera {
- touchAngularSensibility: number;
- touchMoveSensibility: number;
- constructor(name: string, position: Vector3, scene: Scene);
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class UniversalCamera extends TouchCamera {
- gamepadAngularSensibility: number;
- gamepadMoveSensibility: number;
- constructor(name: string, position: Vector3, scene: Scene);
- getTypeName(): string;
- }
- }
- declare module BABYLON {
- class VirtualJoysticksCamera extends FreeCamera {
- constructor(name: string, position: Vector3, scene: Scene);
- }
- }
- declare module BABYLON {
- class DebugLayer {
- shouldDisplayLabel: (node: Node) => boolean;
- shouldDisplayAxis: (mesh: Mesh) => boolean;
- axisRatio: number;
- accentColor: string;
- customStatsFunction: () => string;
- constructor(scene: Scene);
- isVisible(): boolean;
- hide(): void;
- show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void;
- }
- }
- declare module BABYLON.Debug {
- /**
- * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
- */
- class SkeletonViewer {
- skeleton: Skeleton;
- mesh: AbstractMesh;
- autoUpdateBonesMatrices: boolean;
- renderingGroupId: number;
- color: Color3;
- constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
- isEnabled: boolean;
- update(): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- /**
- * Highlight layer options. This helps customizing the behaviour
- * of the highlight layer.
- */
- interface IHighlightLayerOptions {
- /**
- * Multiplication factor apply to the canvas size to compute the render target size
- * used to generated the glowing objects (the smaller the faster).
- */
- mainTextureRatio?: number;
- /**
- * Enforces a fixed size texture to ensure resize independant blur.
- */
- mainTextureFixedSize?: number;
- /**
- * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
- * of the picture to blur (the smaller the faster).
- */
- blurTextureSizeRatio?: number;
- /**
- * How big in texel of the blur texture is the vertical blur.
- */
- blurVerticalSize?: number;
- /**
- * How big in texel of the blur texture is the horizontal blur.
- */
- blurHorizontalSize?: number;
- /**
- * Alpha blending mode used to apply the blur. Default is combine.
- */
- alphaBlendingMode?: number;
- /**
- * The camera attached to the layer.
- */
- camera?: Camera;
- }
- /**
- * The highlight layer Helps adding a glow effect around a mesh.
- *
- * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
- * glowy meshes to your scene.
- *
- * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
- */
- class HighlightLayer {
- /**
- * The neutral color used during the preparation of the glow effect.
- * This is black by default as the blend operation is a blend operation.
- */
- static neutralColor: Color4;
- /**
- * Stencil value used for glowing meshes.
- */
- static glowingMeshStencilReference: number;
- /**
- * Stencil value used for the other meshes in the scene.
- */
- static normalMeshStencilReference: number;
- /**
- * Specifies whether or not the inner glow is ACTIVE in the layer.
- */
- innerGlow: boolean;
- /**
- * Specifies whether or not the outer glow is ACTIVE in the layer.
- */
- outerGlow: boolean;
- /**
- * Specifies wether the highlight layer is enabled or not.
- */
- isEnabled: boolean;
- /**
- * Gets the horizontal size of the blur.
- */
- /**
- * Specifies the horizontal size of the blur.
- */
- blurHorizontalSize: number;
- /**
- * Gets the vertical size of the blur.
- */
- /**
- * Specifies the vertical size of the blur.
- */
- blurVerticalSize: number;
- /**
- * Gets the camera attached to the layer.
- */
- camera: Camera;
- /**
- * An event triggered when the highlight layer has been disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
- * @type {BABYLON.Observable}
- */
- onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the highlight layer is being blurred.
- * @type {BABYLON.Observable}
- */
- onBeforeBlurObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the highlight layer has been blurred.
- * @type {BABYLON.Observable}
- */
- onAfterBlurObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the glowing blurred texture is being merged in the scene.
- * @type {BABYLON.Observable}
- */
- onBeforeComposeObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the glowing blurred texture has been merged in the scene.
- * @type {BABYLON.Observable}
- */
- onAfterComposeObservable: Observable<HighlightLayer>;
- /**
- * An event triggered when the highlight layer changes its size.
- * @type {BABYLON.Observable}
- */
- onSizeChangedObservable: Observable<HighlightLayer>;
- /**
- * Instantiates a new highlight Layer and references it to the scene..
- * @param name The name of the layer
- * @param scene The scene to use the layer in
- * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
- */
- constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
- /**
- * Creates the render target textures and post processes used in the highlight layer.
- */
- private createTextureAndPostProcesses();
- /**
- * Checks for the readiness of the element composing the layer.
- * @param subMesh the mesh to check for
- * @param useInstances specify wether or not to use instances to render the mesh
- * @param emissiveTexture the associated emissive texture used to generate the glow
- * @return true if ready otherwise, false
- */
- private isReady(subMesh, useInstances, emissiveTexture);
- /**
- * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
- */
- render(): void;
- /**
- * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
- * @param mesh The mesh to exclude from the highlight layer
- */
- addExcludedMesh(mesh: Mesh): void;
- /**
- * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
- * @param mesh The mesh to highlight
- */
- removeExcludedMesh(mesh: Mesh): void;
- /**
- * Add a mesh in the highlight layer in order to make it glow with the chosen color.
- * @param mesh The mesh to highlight
- * @param color The color of the highlight
- * @param glowEmissiveOnly Extract the glow from the emissive texture
- */
- addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
- /**
- * Remove a mesh from the highlight layer in order to make it stop glowing.
- * @param mesh The mesh to highlight
- */
- removeMesh(mesh: Mesh): void;
- /**
- * Returns true if the layer contains information to display, otherwise false.
- */
- shouldRender(): boolean;
- /**
- * Sets the main texture desired size which is the closest power of two
- * of the engine canvas size.
- */
- private setMainTextureSize();
- /**
- * Force the stencil to the normal expected value for none glowing parts
- */
- private defaultStencilReference(mesh);
- /**
- * Dispose only the render target textures and post process.
- */
- private disposeTextureAndPostProcesses();
- /**
- * Dispose the highlight layer and free resources.
- */
- dispose(): void;
- }
- }
- declare module BABYLON {
- class Layer {
- name: string;
- texture: Texture;
- isBackground: boolean;
- color: Color4;
- scale: Vector2;
- offset: Vector2;
- alphaBlendingMode: number;
- alphaTest: boolean;
- /**
- * An event triggered when the layer is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<Layer>;
- onDispose: () => void;
- /**
- * An event triggered before rendering the scene
- * @type {BABYLON.Observable}
- */
- onBeforeRenderObservable: Observable<Layer>;
- onBeforeRender: () => void;
- /**
- * An event triggered after rendering the scene
- * @type {BABYLON.Observable}
- */
- onAfterRenderObservable: Observable<Layer>;
- onAfterRender: () => void;
- constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
- render(): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class BoundingBox implements ICullable {
- minimum: Vector3;
- maximum: Vector3;
- vectors: Vector3[];
- center: Vector3;
- extendSize: Vector3;
- directions: Vector3[];
- vectorsWorld: Vector3[];
- minimumWorld: Vector3;
- maximumWorld: Vector3;
- constructor(minimum: Vector3, maximum: Vector3);
- getWorldMatrix(): Matrix;
- setWorldMatrix(matrix: Matrix): BoundingBox;
- isInFrustum(frustumPlanes: Plane[]): boolean;
- isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
- intersectsPoint(point: Vector3): boolean;
- intersectsSphere(sphere: BoundingSphere): boolean;
- intersectsMinMax(min: Vector3, max: Vector3): boolean;
- static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
- static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
- static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
- static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
- }
- }
- declare module BABYLON {
- interface ICullable {
- isInFrustum(frustumPlanes: Plane[]): boolean;
- isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
- }
- class BoundingInfo implements ICullable {
- minimum: Vector3;
- maximum: Vector3;
- boundingBox: BoundingBox;
- boundingSphere: BoundingSphere;
- constructor(minimum: Vector3, maximum: Vector3);
- isLocked: boolean;
- update(world: Matrix): void;
- isInFrustum(frustumPlanes: Plane[]): boolean;
- isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
- intersectsPoint(point: Vector3): boolean;
- intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
- }
- }
- declare module BABYLON {
- class BoundingSphere {
- minimum: Vector3;
- maximum: Vector3;
- center: Vector3;
- radius: number;
- centerWorld: Vector3;
- radiusWorld: number;
- constructor(minimum: Vector3, maximum: Vector3);
- isInFrustum(frustumPlanes: Plane[]): boolean;
- intersectsPoint(point: Vector3): boolean;
- static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
- }
- }
- declare module BABYLON {
- class Ray {
- origin: Vector3;
- direction: Vector3;
- length: number;
- constructor(origin: Vector3, direction: Vector3, length?: number);
- intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
- intersectsBox(box: BoundingBox): boolean;
- intersectsSphere(sphere: BoundingSphere): boolean;
- intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
- intersectsPlane(plane: Plane): number;
- private static smallnum;
- private static rayl;
- /**
- * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
- * @param sega the first point of the segment to test the intersection against
- * @param segb the second point of the segment to test the intersection against
- * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
- * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
- */
- intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
- static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
- /**
- * 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
- * transformed to the given world matrix.
- * @param origin The origin point
- * @param end The end point
- * @param world a matrix to transform the ray to. Default is the identity matrix.
- */
- static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
- static Transform(ray: Ray, matrix: Matrix): Ray;
- }
- }
- declare module BABYLON {
- class LensFlare {
- size: number;
- position: number;
- color: Color3;
- texture: Texture;
- alphaMode: number;
- constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
- dispose: () => void;
- }
- }
- declare module BABYLON {
- class LensFlareSystem {
- name: string;
- lensFlares: LensFlare[];
- borderLimit: number;
- viewportBorder: number;
- meshesSelectionPredicate: (mesh: Mesh) => boolean;
- layerMask: number;
- id: string;
- constructor(name: string, emitter: any, scene: Scene);
- isEnabled: boolean;
- getScene(): Scene;
- getEmitter(): any;
- setEmitter(newEmitter: any): void;
- getEmitterPosition(): Vector3;
- computeEffectivePosition(globalViewport: Viewport): boolean;
- render(): boolean;
- dispose(): void;
- static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
- serialize(): any;
- }
- }
- declare module BABYLON {
- class DirectionalLight extends Light implements IShadowLight {
- position: Vector3;
- direction: Vector3;
- transformedPosition: Vector3;
- shadowOrthoScale: number;
- autoUpdateExtends: boolean;
- constructor(name: string, direction: Vector3, scene: Scene);
- getAbsolutePosition(): Vector3;
- setDirectionToTarget(target: Vector3): Vector3;
- setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
- supportsVSM(): boolean;
- needRefreshPerFrame(): boolean;
- needCube(): boolean;
- getShadowDirection(faceIndex?: number): Vector3;
- computeTransformedPosition(): boolean;
- transferToEffect(effect: Effect, directionUniformName: string): void;
- getTypeID(): number;
- }
- }
- declare module BABYLON {
- class HemisphericLight extends Light {
- groundColor: Color3;
- direction: Vector3;
- constructor(name: string, direction: Vector3, scene: Scene);
- setDirectionToTarget(target: Vector3): Vector3;
- getShadowGenerator(): ShadowGenerator;
- transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
- getTypeID(): number;
- }
- }
- declare module BABYLON {
- interface IShadowLight {
- id: string;
- position: Vector3;
- transformedPosition: Vector3;
- name: string;
- computeTransformedPosition(): boolean;
- getScene(): Scene;
- setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
- supportsVSM(): boolean;
- needRefreshPerFrame(): boolean;
- needCube(): boolean;
- getShadowDirection(faceIndex?: number): Vector3;
- }
- class Light extends Node {
- /**
- * If every light affecting the material is in this lightmapMode,
- * material.lightmapTexture adds or multiplies
- * (depends on material.useLightmapAsShadowmap)
- * after every other light calculations.
- */
- static LIGHTMAP_DEFAULT: number;
- /**
- * material.lightmapTexture as only diffuse lighting from this light
- * adds pnly specular lighting from this light
- * adds dynamic shadows
- */
- static LIGHTMAP_SPECULAR: number;
- /**
- * material.lightmapTexture as only lighting
- * no light calculation from this light
- * only adds dynamic shadows from this light
- */
- static LIGHTMAP_SHADOWSONLY: number;
- diffuse: Color3;
- specular: Color3;
- intensity: number;
- range: number;
- includeOnlyWithLayerMask: number;
- includedOnlyMeshes: AbstractMesh[];
- excludedMeshes: AbstractMesh[];
- excludeWithLayerMask: number;
- lightmapMode: number;
- radius: number;
- constructor(name: string, scene: Scene);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- getShadowGenerator(): IShadowGenerator;
- getAbsolutePosition(): Vector3;
- transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
- canAffectMesh(mesh: AbstractMesh): boolean;
- getWorldMatrix(): Matrix;
- dispose(): void;
- getTypeID(): number;
- clone(name: string): Light;
- serialize(): any;
- static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
- static Parse(parsedLight: any, scene: Scene): Light;
- }
- }
- declare module BABYLON {
- class PointLight extends Light implements IShadowLight {
- transformedPosition: Vector3;
- position: Vector3;
- constructor(name: string, position: Vector3, scene: Scene);
- getAbsolutePosition(): Vector3;
- computeTransformedPosition(): boolean;
- transferToEffect(effect: Effect, positionUniformName: string): void;
- needCube(): boolean;
- supportsVSM(): boolean;
- needRefreshPerFrame(): boolean;
- getShadowDirection(faceIndex?: number): Vector3;
- setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
- getTypeID(): number;
- }
- }
- declare module BABYLON {
- class SpotLight extends Light implements IShadowLight {
- position: Vector3;
- direction: Vector3;
- angle: number;
- exponent: number;
- transformedPosition: Vector3;
- constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
- getAbsolutePosition(): Vector3;
- setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
- needCube(): boolean;
- supportsVSM(): boolean;
- needRefreshPerFrame(): boolean;
- getShadowDirection(faceIndex?: number): Vector3;
- setDirectionToTarget(target: Vector3): Vector3;
- computeTransformedPosition(): boolean;
- transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
- getTypeID(): number;
- getRotation(): Vector3;
- }
- }
- declare module BABYLON {
- interface ISceneLoaderPluginExtensions {
- [extension: string]: {
- isBinary: boolean;
- };
- }
- interface ISceneLoaderPlugin {
- extensions: string | ISceneLoaderPluginExtensions;
- importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
- load: (scene: Scene, data: string, rootUrl: string) => boolean;
- }
- interface ISceneLoaderPluginAsync {
- extensions: string | ISceneLoaderPluginExtensions;
- importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror?: () => void) => void;
- loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => boolean;
- }
- class SceneLoader {
- static NO_LOGGING: number;
- static MINIMAL_LOGGING: number;
- static SUMMARY_LOGGING: number;
- static DETAILED_LOGGING: number;
- static ForceFullSceneLoadingForIncremental: boolean;
- static ShowLoadingScreen: boolean;
- static loggingLevel: number;
- static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
- static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
- 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;
- /**
- * Load a scene
- * @param rootUrl a string that defines the root url for scene and resources
- * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
- * @param engine is the instance of BABYLON.Engine to use to create the scene
- */
- static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
- /**
- * Append a scene
- * @param rootUrl a string that defines the root url for scene and resources
- * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
- * @param scene is the instance of BABYLON.Scene to append to
- */
- static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
- }
- }
- declare module BABYLON {
- /**
- * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
- * 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;
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
- */
- class ColorCurves {
- /**
- * Gets the global Hue value.
- * 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).
- */
- /**
- * Sets the global Hue value.
- * 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).
- */
- GlobalHue: number;
- /**
- * Gets the global Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- /**
- * Sets the global Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- GlobalDensity: number;
- /**
- * Gets the global Saturation value.
- * 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.
- */
- /**
- * Sets the global Saturation value.
- * 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.
- */
- GlobalSaturation: number;
- /**
- * Gets the highlights Hue value.
- * 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).
- */
- /**
- * Sets the highlights Hue value.
- * 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).
- */
- HighlightsHue: number;
- /**
- * Gets the highlights Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- /**
- * Sets the highlights Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- HighlightsDensity: number;
- /**
- * Gets the highlights Saturation value.
- * 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.
- */
- /**
- * Sets the highlights Saturation value.
- * 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.
- */
- HighlightsSaturation: number;
- /**
- * Gets the highlights Exposure value.
- * 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.
- */
- /**
- * Sets the highlights Exposure value.
- * 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.
- */
- HighlightsExposure: number;
- /**
- * Gets the midtones Hue value.
- * 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).
- */
- /**
- * Sets the midtones Hue value.
- * 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).
- */
- MidtonesHue: number;
- /**
- * Gets the midtones Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- /**
- * Sets the midtones Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- MidtonesDensity: number;
- /**
- * Gets the midtones Saturation value.
- * 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.
- */
- /**
- * Sets the midtones Saturation value.
- * 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.
- */
- MidtonesSaturation: number;
- /**
- * Gets the midtones Exposure value.
- * 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.
- */
- /**
- * Sets the midtones Exposure value.
- * 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.
- */
- MidtonesExposure: number;
- /**
- * Gets the shadows Hue value.
- * 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).
- */
- /**
- * Sets the shadows Hue value.
- * 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).
- */
- ShadowsHue: number;
- /**
- * Gets the shadows Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- /**
- * Sets the shadows Density value.
- * 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.
- * Values less than zero provide a filter of opposite hue.
- */
- ShadowsDensity: number;
- /**
- * Gets the shadows Saturation value.
- * 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.
- */
- /**
- * Sets the shadows Saturation value.
- * 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.
- */
- ShadowsSaturation: number;
- /**
- * Gets the shadows Exposure value.
- * 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.
- */
- /**
- * Sets the shadows Exposure value.
- * 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.
- */
- ShadowsExposure: number;
- /**
- * Binds the color curves to the shader.
- * @param colorCurves The color curve to bind
- * @param effect The effect to bind to
- */
- static Bind(colorCurves: ColorCurves, effect: Effect): void;
- /**
- * Prepare the list of uniforms associated with the ColorCurves effects.
- * @param uniformsList The list of uniforms used in the effect
- */
- static PrepareUniforms(uniformsList: string[]): void;
- /**
- * Returns color grading data based on a hue, density, saturation and exposure value.
- * @param filterHue The hue of the color filter.
- * @param filterDensity The density of the color filter.
- * @param saturation The saturation.
- * @param exposure The exposure.
- * @param result The result data container.
- */
- private getColorGradingDataToRef(hue, density, saturation, exposure, result);
- /**
- * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
- * @param value The input slider value in range [-100,100].
- * @returns Adjusted value.
- */
- private static applyColorGradingSliderNonlinear(value);
- /**
- * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
- * @param hue The hue (H) input.
- * @param saturation The saturation (S) input.
- * @param brightness The brightness (B) input.
- * @result An RGBA color represented as Vector4.
- */
- private static fromHSBToRef(hue, saturation, brightness, result);
- /**
- * Returns a value clamped between min and max
- * @param value The value to clamp
- * @param min The minimum of value
- * @param max The maximum of value
- * @returns The clamped value.
- */
- private static clamp(value, min, max);
- /**
- * Clones the current color curve instance.
- * @return The cloned curves
- */
- clone(): ColorCurves;
- /**
- * Serializes the current color curve instance to a json representation.
- * @return a JSON representation
- */
- serialize(): any;
- /**
- * Parses the color curve from a json representation.
- * @param source the JSON source to parse
- * @return The parsed curves
- */
- static Parse(source: any): ColorCurves;
- }
- }
- declare module BABYLON {
- class EffectFallbacks {
- addFallback(rank: number, define: string): void;
- addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
- isMoreFallbacks: boolean;
- reduce(currentDefines: string): string;
- }
- class Effect {
- name: any;
- defines: string;
- onCompiled: (effect: Effect) => void;
- onError: (effect: Effect, errors: string) => void;
- onBind: (effect: Effect) => void;
- 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);
- isReady(): boolean;
- getProgram(): WebGLProgram;
- getAttributesNames(): string[];
- getAttributeLocation(index: number): number;
- getAttributeLocationByName(name: string): number;
- getAttributesCount(): number;
- getUniformIndex(uniformName: string): number;
- getUniform(uniformName: string): WebGLUniformLocation;
- getSamplers(): string[];
- getCompilationError(): string;
- getVertexShaderSource(): string;
- getFragmentShaderSource(): string;
- isSupported: boolean;
- setTexture(channel: string, texture: BaseTexture): void;
- setTextureArray(channel: string, textures: BaseTexture[]): void;
- setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
- setIntArray(uniformName: string, array: Int32Array): Effect;
- setIntArray2(uniformName: string, array: Int32Array): Effect;
- setIntArray3(uniformName: string, array: Int32Array): Effect;
- setIntArray4(uniformName: string, array: Int32Array): Effect;
- setFloatArray(uniformName: string, array: Float32Array): Effect;
- setFloatArray2(uniformName: string, array: Float32Array): Effect;
- setFloatArray3(uniformName: string, array: Float32Array): Effect;
- setFloatArray4(uniformName: string, array: Float32Array): Effect;
- setArray(uniformName: string, array: number[]): Effect;
- setArray2(uniformName: string, array: number[]): Effect;
- setArray3(uniformName: string, array: number[]): Effect;
- setArray4(uniformName: string, array: number[]): Effect;
- setMatrices(uniformName: string, matrices: Float32Array): Effect;
- setMatrix(uniformName: string, matrix: Matrix): Effect;
- setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
- setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
- setFloat(uniformName: string, value: number): Effect;
- setBool(uniformName: string, bool: boolean): Effect;
- setVector2(uniformName: string, vector2: Vector2): Effect;
- setFloat2(uniformName: string, x: number, y: number): Effect;
- setVector3(uniformName: string, vector3: Vector3): Effect;
- setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
- setVector4(uniformName: string, vector4: Vector4): Effect;
- setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
- setColor3(uniformName: string, color3: Color3): Effect;
- setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
- static ShadersStore: {};
- static IncludesShadersStore: {};
- }
- }
- declare module BABYLON {
- class FresnelParameters {
- isEnabled: boolean;
- leftColor: Color3;
- rightColor: Color3;
- bias: number;
- power: number;
- clone(): FresnelParameters;
- serialize(): any;
- static Parse(parsedFresnelParameters: any): FresnelParameters;
- }
- }
- declare module BABYLON {
- class MaterialDefines {
- rebuild(): void;
- isEqual(other: MaterialDefines): boolean;
- cloneTo(other: MaterialDefines): void;
- reset(): void;
- toString(): string;
- }
- class Material {
- name: string;
- static TriangleFillMode: number;
- static WireFrameFillMode: number;
- static PointFillMode: number;
- static ClockWiseSideOrientation: number;
- static CounterClockWiseSideOrientation: number;
- id: string;
- checkReadyOnEveryCall: boolean;
- checkReadyOnlyOnce: boolean;
- state: string;
- alpha: number;
- backFaceCulling: boolean;
- sideOrientation: number;
- onCompiled: (effect: Effect) => void;
- onError: (effect: Effect, errors: string) => void;
- getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
- /**
- * An event triggered when the material is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<Material>;
- onDispose: () => void;
- /**
- * An event triggered when the material is bound.
- * @type {BABYLON.Observable}
- */
- onBindObservable: Observable<AbstractMesh>;
- onBind: (Mesh: AbstractMesh) => void;
- /**
- * An event triggered when the material is unbound.
- * @type {BABYLON.Observable}
- */
- onUnBindObservable: Observable<Material>;
- alphaMode: number;
- disableDepthWrite: boolean;
- fogEnabled: boolean;
- pointSize: number;
- zOffset: number;
- wireframe: boolean;
- pointsCloud: boolean;
- fillMode: number;
- constructor(name: string, scene: Scene, doNotAdd?: boolean);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- * subclasses should override adding information pertainent to themselves
- */
- toString(fullDetails?: boolean): string;
- isFrozen: boolean;
- freeze(): void;
- unfreeze(): void;
- isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
- getEffect(): Effect;
- getScene(): Scene;
- needAlphaBlending(): boolean;
- needAlphaTesting(): boolean;
- getAlphaTestTexture(): BaseTexture;
- markDirty(): void;
- bind(world: Matrix, mesh?: Mesh): void;
- bindOnlyWorldMatrix(world: Matrix): void;
- unbind(): void;
- clone(name: string): Material;
- getBindedMeshes(): AbstractMesh[];
- dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
- serialize(): any;
- static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
- static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
- }
- }
- declare module BABYLON {
- class MaterialHelper {
- static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, maxSimultaneousLights?: number): boolean;
- static PrepareUniformsAndSamplersList(uniformsList: string[], samplersList: string[], defines: MaterialDefines, maxSimultaneousLights?: number): void;
- static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
- static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
- static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
- static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: number, effect: Effect, depthValuesAlreadySet: boolean): boolean;
- static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
- static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
- static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
- static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
- static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
- static BindClipPlane(effect: Effect, scene: Scene): void;
- }
- }
- declare module BABYLON {
- class MultiMaterial extends Material {
- subMaterials: Material[];
- constructor(name: string, scene: Scene);
- getSubMaterial(index: any): Material;
- isReady(mesh?: AbstractMesh): boolean;
- clone(name: string, cloneChildren?: boolean): MultiMaterial;
- serialize(): any;
- }
- }
- declare module BABYLON {
- /**
- * The Physically based material of BJS.
- *
- * This offers the main features of a standard PBR material.
- * For more information, please refer to the documentation :
- * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
- */
- class PBRMaterial extends BABYLON.Material {
- /**
- * Intensity of the direct lights e.g. the four lights available in your scene.
- * This impacts both the direct diffuse and specular highlights.
- */
- directIntensity: number;
- /**
- * Intensity of the emissive part of the material.
- * This helps controlling the emissive effect without modifying the emissive color.
- */
- emissiveIntensity: number;
- /**
- * Intensity of the environment e.g. how much the environment will light the object
- * either through harmonics for rough material or through the refelction for shiny ones.
- */
- environmentIntensity: number;
- /**
- * This is a special control allowing the reduction of the specular highlights coming from the
- * four lights of the scene. Those highlights may not be needed in full environment lighting.
- */
- specularIntensity: number;
- /**
- * Debug Control allowing disabling the bump map on this material.
- */
- disableBumpMap: boolean;
- /**
- * Debug Control helping enforcing or dropping the darkness of shadows.
- * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
- */
- overloadedShadowIntensity: number;
- /**
- * Debug Control helping dropping the shading effect coming from the diffuse lighting.
- * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
- */
- overloadedShadeIntensity: number;
- /**
- * The camera exposure used on this material.
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
- * This corresponds to a photographic exposure.
- */
- cameraExposure: number;
- /**
- * The camera contrast used on this material.
- * This property is here and not in the camera to allow controlling contrast without full screen post process.
- */
- cameraContrast: number;
- /**
- * Color Grading 2D Lookup Texture.
- * This allows special effects like sepia, black and white to sixties rendering style.
- */
- cameraColorGradingTexture: BaseTexture;
- /**
- * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
- * 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;
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
- */
- cameraColorCurves: ColorCurves;
- /**
- * Debug Control allowing to overload the ambient color.
- * This as to be use with the overloadedAmbientIntensity parameter.
- */
- overloadedAmbient: Color3;
- /**
- * Debug Control indicating how much the overloaded ambient color is used against the default one.
- */
- overloadedAmbientIntensity: number;
- /**
- * Debug Control allowing to overload the albedo color.
- * This as to be use with the overloadedAlbedoIntensity parameter.
- */
- overloadedAlbedo: Color3;
- /**
- * Debug Control indicating how much the overloaded albedo color is used against the default one.
- */
- overloadedAlbedoIntensity: number;
- /**
- * Debug Control allowing to overload the reflectivity color.
- * This as to be use with the overloadedReflectivityIntensity parameter.
- */
- overloadedReflectivity: Color3;
- /**
- * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
- */
- overloadedReflectivityIntensity: number;
- /**
- * Debug Control allowing to overload the emissive color.
- * This as to be use with the overloadedEmissiveIntensity parameter.
- */
- overloadedEmissive: Color3;
- /**
- * Debug Control indicating how much the overloaded emissive color is used against the default one.
- */
- overloadedEmissiveIntensity: number;
- /**
- * Debug Control allowing to overload the reflection color.
- * This as to be use with the overloadedReflectionIntensity parameter.
- */
- overloadedReflection: Color3;
- /**
- * Debug Control indicating how much the overloaded reflection color is used against the default one.
- */
- overloadedReflectionIntensity: number;
- /**
- * Debug Control allowing to overload the microsurface.
- * This as to be use with the overloadedMicroSurfaceIntensity parameter.
- */
- overloadedMicroSurface: number;
- /**
- * Debug Control indicating how much the overloaded microsurface is used against the default one.
- */
- overloadedMicroSurfaceIntensity: number;
- /**
- * AKA Diffuse Texture in standard nomenclature.
- */
- albedoTexture: BaseTexture;
- /**
- * AKA Occlusion Texture in other nomenclature.
- */
- ambientTexture: BaseTexture;
- /**
- * AKA Occlusion Texture Intensity in other nomenclature.
- */
- ambientTextureStrength: number;
- opacityTexture: BaseTexture;
- reflectionTexture: BaseTexture;
- emissiveTexture: BaseTexture;
- /**
- * AKA Specular texture in other nomenclature.
- */
- reflectivityTexture: BaseTexture;
- bumpTexture: BaseTexture;
- lightmapTexture: BaseTexture;
- refractionTexture: BaseTexture;
- ambientColor: Color3;
- /**
- * AKA Diffuse Color in other nomenclature.
- */
- albedoColor: Color3;
- /**
- * AKA Specular Color in other nomenclature.
- */
- reflectivityColor: Color3;
- reflectionColor: Color3;
- emissiveColor: Color3;
- /**
- * AKA Glossiness in other nomenclature.
- */
- microSurface: number;
- /**
- * source material index of refraction (IOR)' / 'destination material IOR.
- */
- indexOfRefraction: number;
- /**
- * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
- */
- invertRefractionY: boolean;
- opacityFresnelParameters: FresnelParameters;
- emissiveFresnelParameters: FresnelParameters;
- /**
- * This parameters will make the material used its opacity to control how much it is refracting aginst not.
- * Materials half opaque for instance using refraction could benefit from this control.
- */
- linkRefractionWithTransparency: boolean;
- /**
- * The emissive and albedo are linked to never be more than one (Energy conservation).
- */
- linkEmissiveWithAlbedo: boolean;
- useLightmapAsShadowmap: boolean;
- /**
- * In this mode, the emissive informtaion will always be added to the lighting once.
- * A light for instance can be thought as emissive.
- */
- useEmissiveAsIllumination: boolean;
- /**
- * Secifies that the alpha is coming form the albedo channel alpha channel.
- */
- useAlphaFromAlbedoTexture: boolean;
- /**
- * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
- * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
- */
- useSpecularOverAlpha: boolean;
- /**
- * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
- */
- useMicroSurfaceFromReflectivityMapAlpha: boolean;
- /**
- * In case the reflectivity map does not contain the microsurface information in its alpha channel,
- * The material will try to infer what glossiness each pixel should be.
- */
- useAutoMicroSurfaceFromReflectivityMap: boolean;
- /**
- * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
- * the creation of the material.
- */
- useScalarInLinearSpace: boolean;
- /**
- * BJS is using an harcoded light falloff based on a manually sets up range.
- * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
- * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
- */
- usePhysicalLightFalloff: boolean;
- /**
- * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
- * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
- */
- useRadianceOverAlpha: boolean;
- /**
- * Allows using the bump map in parallax mode.
- */
- useParallax: boolean;
- /**
- * Allows using the bump map in parallax occlusion mode.
- */
- useParallaxOcclusion: boolean;
- /**
- * Controls the scale bias of the parallax mode.
- */
- parallaxScaleBias: number;
- /**
- * If sets to true, disables all the lights affecting the material.
- */
- disableLighting: boolean;
- /**
- * Number of Simultaneous lights allowed on the material.
- */
- maxSimultaneousLights: number;
- /**
- * If sets to true, x component of normal map value will invert (x = 1.0 - x).
- */
- invertNormalMapX: boolean;
- /**
- * If sets to true, y component of normal map value will invert (y = 1.0 - y).
- */
- invertNormalMapY: boolean;
- /**
- * Instantiates a new PBRMaterial instance.
- *
- * @param name The material name
- * @param scene The scene the material will be use in.
- */
- constructor(name: string, scene: Scene);
- useLogarithmicDepth: boolean;
- needAlphaBlending(): boolean;
- needAlphaTesting(): boolean;
- getAlphaTestTexture(): BaseTexture;
- private convertColorToLinearSpaceToRef(color, ref);
- private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
- static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
- isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
- unbind(): void;
- bindOnlyWorldMatrix(world: Matrix): void;
- bind(world: Matrix, mesh?: Mesh): void;
- getAnimatables(): IAnimatable[];
- dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
- clone(name: string): PBRMaterial;
- serialize(): any;
- static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
- }
- }
- declare module BABYLON {
- class ShaderMaterial extends Material {
- constructor(name: string, scene: Scene, shaderPath: any, options: any);
- needAlphaBlending(): boolean;
- needAlphaTesting(): boolean;
- setTexture(name: string, texture: Texture): ShaderMaterial;
- setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
- setFloat(name: string, value: number): ShaderMaterial;
- setFloats(name: string, value: number[]): ShaderMaterial;
- setColor3(name: string, value: Color3): ShaderMaterial;
- setColor4(name: string, value: Color4): ShaderMaterial;
- setVector2(name: string, value: Vector2): ShaderMaterial;
- setVector3(name: string, value: Vector3): ShaderMaterial;
- setVector4(name: string, value: Vector4): ShaderMaterial;
- setMatrix(name: string, value: Matrix): ShaderMaterial;
- setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
- setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
- setArray3(name: string, value: number[]): ShaderMaterial;
- isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
- bindOnlyWorldMatrix(world: Matrix): void;
- bind(world: Matrix, mesh?: Mesh): void;
- clone(name: string): ShaderMaterial;
- dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
- serialize(): any;
- static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
- }
- }
- declare module BABYLON {
- class StandardMaterial extends Material {
- diffuseTexture: BaseTexture;
- ambientTexture: BaseTexture;
- opacityTexture: BaseTexture;
- reflectionTexture: BaseTexture;
- emissiveTexture: BaseTexture;
- specularTexture: BaseTexture;
- bumpTexture: BaseTexture;
- lightmapTexture: BaseTexture;
- refractionTexture: BaseTexture;
- ambientColor: Color3;
- diffuseColor: Color3;
- specularColor: Color3;
- emissiveColor: Color3;
- specularPower: number;
- useAlphaFromDiffuseTexture: boolean;
- useEmissiveAsIllumination: boolean;
- linkEmissiveWithDiffuse: boolean;
- useReflectionFresnelFromSpecular: boolean;
- useSpecularOverAlpha: boolean;
- useReflectionOverAlpha: boolean;
- disableLighting: boolean;
- useParallax: boolean;
- useParallaxOcclusion: boolean;
- parallaxScaleBias: number;
- roughness: number;
- indexOfRefraction: number;
- invertRefractionY: boolean;
- useLightmapAsShadowmap: boolean;
- diffuseFresnelParameters: FresnelParameters;
- opacityFresnelParameters: FresnelParameters;
- reflectionFresnelParameters: FresnelParameters;
- refractionFresnelParameters: FresnelParameters;
- emissiveFresnelParameters: FresnelParameters;
- useGlossinessFromSpecularMapAlpha: boolean;
- maxSimultaneousLights: number;
- /**
- * If sets to true, x component of normal map value will invert (x = 1.0 - x).
- */
- invertNormalMapX: boolean;
- /**
- * If sets to true, y component of normal map value will invert (y = 1.0 - y).
- */
- invertNormalMapY: boolean;
- /**
- * Color Grading 2D Lookup Texture.
- * This allows special effects like sepia, black and white to sixties rendering style.
- */
- cameraColorGradingTexture: BaseTexture;
- /**
- * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
- * 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;
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
- */
- cameraColorCurves: ColorCurves;
- constructor(name: string, scene: Scene);
- useLogarithmicDepth: boolean;
- needAlphaBlending(): boolean;
- needAlphaTesting(): boolean;
- getAlphaTestTexture(): BaseTexture;
- isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
- unbind(): void;
- bindOnlyWorldMatrix(world: Matrix): void;
- bind(world: Matrix, mesh?: Mesh): void;
- getAnimatables(): IAnimatable[];
- dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
- clone(name: string): StandardMaterial;
- serialize(): any;
- static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
- static DiffuseTextureEnabled: boolean;
- static AmbientTextureEnabled: boolean;
- static OpacityTextureEnabled: boolean;
- static ReflectionTextureEnabled: boolean;
- static EmissiveTextureEnabled: boolean;
- static SpecularTextureEnabled: boolean;
- static BumpTextureEnabled: boolean;
- static FresnelEnabled: boolean;
- static LightmapTextureEnabled: boolean;
- static RefractionTextureEnabled: boolean;
- static ColorGradingTextureEnabled: boolean;
- }
- }
- declare module BABYLON {
- class SIMDHelper {
- static IsEnabled: boolean;
- static DisableSIMD(): void;
- static EnableSIMD(): void;
- }
- }
- declare module BABYLON {
- const ToGammaSpace: number;
- const ToLinearSpace: number;
- const Epsilon: number;
- class MathTools {
- static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
- static ToHex(i: number): string;
- static Sign(value: number): number;
- static Clamp(value: number, min?: number, max?: number): number;
- }
- class Color3 {
- r: number;
- g: number;
- b: number;
- constructor(r?: number, g?: number, b?: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- toArray(array: number[], index?: number): Color3;
- toColor4(alpha?: number): Color4;
- asArray(): number[];
- toLuminance(): number;
- multiply(otherColor: Color3): Color3;
- multiplyToRef(otherColor: Color3, result: Color3): Color3;
- equals(otherColor: Color3): boolean;
- equalsFloats(r: number, g: number, b: number): boolean;
- scale(scale: number): Color3;
- scaleToRef(scale: number, result: Color3): Color3;
- add(otherColor: Color3): Color3;
- addToRef(otherColor: Color3, result: Color3): Color3;
- subtract(otherColor: Color3): Color3;
- subtractToRef(otherColor: Color3, result: Color3): Color3;
- clone(): Color3;
- copyFrom(source: Color3): Color3;
- copyFromFloats(r: number, g: number, b: number): Color3;
- toHexString(): string;
- toLinearSpace(): Color3;
- toLinearSpaceToRef(convertedColor: Color3): Color3;
- toGammaSpace(): Color3;
- toGammaSpaceToRef(convertedColor: Color3): Color3;
- static FromHexString(hex: string): Color3;
- static FromArray(array: number[], offset?: number): Color3;
- static FromInts(r: number, g: number, b: number): Color3;
- static Lerp(start: Color3, end: Color3, amount: number): Color3;
- static Red(): Color3;
- static Green(): Color3;
- static Blue(): Color3;
- static Black(): Color3;
- static White(): Color3;
- static Purple(): Color3;
- static Magenta(): Color3;
- static Yellow(): Color3;
- static Gray(): Color3;
- }
- class Color4 {
- r: number;
- g: number;
- b: number;
- a: number;
- constructor(r: number, g: number, b: number, a: number);
- addInPlace(right: any): Color4;
- asArray(): number[];
- toArray(array: number[], index?: number): Color4;
- add(right: Color4): Color4;
- subtract(right: Color4): Color4;
- subtractToRef(right: Color4, result: Color4): Color4;
- scale(scale: number): Color4;
- scaleToRef(scale: number, result: Color4): Color4;
- /**
- * Multipy an RGBA Color4 value by another and return a new Color4 object
- * @param color The Color4 (RGBA) value to multiply by
- * @returns A new Color4.
- */
- multiply(color: Color4): Color4;
- /**
- * Multipy an RGBA Color4 value by another and push the result in a reference value
- * @param color The Color4 (RGBA) value to multiply by
- * @param result The Color4 (RGBA) to fill the result in
- * @returns the result Color4.
- */
- multiplyToRef(color: Color4, result: Color4): Color4;
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- clone(): Color4;
- copyFrom(source: Color4): Color4;
- toHexString(): string;
- static FromHexString(hex: string): Color4;
- static Lerp(left: Color4, right: Color4, amount: number): Color4;
- static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
- static FromArray(array: number[], offset?: number): Color4;
- static FromInts(r: number, g: number, b: number, a: number): Color4;
- static CheckColors4(colors: number[], count: number): number[];
- }
- class Vector2 {
- x: number;
- y: number;
- constructor(x: number, y: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- toArray(array: number[] | Float32Array, index?: number): Vector2;
- asArray(): number[];
- copyFrom(source: Vector2): Vector2;
- copyFromFloats(x: number, y: number): Vector2;
- add(otherVector: Vector2): Vector2;
- addToRef(otherVector: Vector2, result: Vector2): Vector2;
- addInPlace(otherVector: Vector2): Vector2;
- addVector3(otherVector: Vector3): Vector2;
- subtract(otherVector: Vector2): Vector2;
- subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
- subtractInPlace(otherVector: Vector2): Vector2;
- multiplyInPlace(otherVector: Vector2): Vector2;
- multiply(otherVector: Vector2): Vector2;
- multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
- multiplyByFloats(x: number, y: number): Vector2;
- divide(otherVector: Vector2): Vector2;
- divideToRef(otherVector: Vector2, result: Vector2): Vector2;
- negate(): Vector2;
- scaleInPlace(scale: number): Vector2;
- scale(scale: number): Vector2;
- equals(otherVector: Vector2): boolean;
- equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
- length(): number;
- lengthSquared(): number;
- normalize(): Vector2;
- clone(): Vector2;
- static Zero(): Vector2;
- static FromArray(array: number[] | Float32Array, offset?: number): Vector2;
- static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void;
- static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
- static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
- static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
- static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
- static Dot(left: Vector2, right: Vector2): number;
- static Normalize(vector: Vector2): Vector2;
- static Minimize(left: Vector2, right: Vector2): Vector2;
- static Maximize(left: Vector2, right: Vector2): Vector2;
- static Transform(vector: Vector2, transformation: Matrix): Vector2;
- static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
- static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
- static Distance(value1: Vector2, value2: Vector2): number;
- static DistanceSquared(value1: Vector2, value2: Vector2): number;
- static Center(value1: Vector2, value2: Vector2): Vector2;
- static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
- }
- class Vector3 {
- x: number;
- y: number;
- z: number;
- constructor(x: number, y: number, z: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- asArray(): number[];
- toArray(array: number[] | Float32Array, index?: number): Vector3;
- toQuaternion(): Quaternion;
- addInPlace(otherVector: Vector3): Vector3;
- add(otherVector: Vector3): Vector3;
- addToRef(otherVector: Vector3, result: Vector3): Vector3;
- subtractInPlace(otherVector: Vector3): Vector3;
- subtract(otherVector: Vector3): Vector3;
- subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
- subtractFromFloats(x: number, y: number, z: number): Vector3;
- subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
- negate(): Vector3;
- scaleInPlace(scale: number): Vector3;
- scale(scale: number): Vector3;
- scaleToRef(scale: number, result: Vector3): void;
- equals(otherVector: Vector3): boolean;
- equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
- equalsToFloats(x: number, y: number, z: number): boolean;
- multiplyInPlace(otherVector: Vector3): Vector3;
- multiply(otherVector: Vector3): Vector3;
- multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
- multiplyByFloats(x: number, y: number, z: number): Vector3;
- divide(otherVector: Vector3): Vector3;
- divideToRef(otherVector: Vector3, result: Vector3): Vector3;
- MinimizeInPlace(other: Vector3): Vector3;
- MaximizeInPlace(other: Vector3): Vector3;
- length(): number;
- lengthSquared(): number;
- normalize(): Vector3;
- clone(): Vector3;
- copyFrom(source: Vector3): Vector3;
- copyFromFloats(x: number, y: number, z: number): Vector3;
- static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
- static FromArray(array: number[] | Float32Array, offset?: number): Vector3;
- static FromFloatArray(array: Float32Array, offset?: number): Vector3;
- static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void;
- static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
- static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
- static Zero(): Vector3;
- static Up(): Vector3;
- static Forward(): Vector3;
- static Right(): Vector3;
- static Left(): Vector3;
- static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
- static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
- static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
- static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
- static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
- static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
- static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
- static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
- static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
- static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
- static Dot(left: Vector3, right: Vector3): number;
- static Cross(left: Vector3, right: Vector3): Vector3;
- static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
- static Normalize(vector: Vector3): Vector3;
- static NormalizeToRef(vector: Vector3, result: Vector3): void;
- static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
- static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
- static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
- static Minimize(left: Vector3, right: Vector3): Vector3;
- static Maximize(left: Vector3, right: Vector3): Vector3;
- static Distance(value1: Vector3, value2: Vector3): number;
- static DistanceSquared(value1: Vector3, value2: Vector3): number;
- static Center(value1: Vector3, value2: Vector3): Vector3;
- /**
- * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
- * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
- * to something in order to rotate it from its local system to the given target system.
- */
- static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
- /**
- * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
- */
- static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
- }
- class Vector4 {
- x: number;
- y: number;
- z: number;
- w: number;
- constructor(x: number, y: number, z: number, w: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- asArray(): number[];
- toArray(array: number[], index?: number): Vector4;
- addInPlace(otherVector: Vector4): Vector4;
- add(otherVector: Vector4): Vector4;
- addToRef(otherVector: Vector4, result: Vector4): Vector4;
- subtractInPlace(otherVector: Vector4): Vector4;
- subtract(otherVector: Vector4): Vector4;
- subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
- subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
- subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
- negate(): Vector4;
- scaleInPlace(scale: number): Vector4;
- scale(scale: number): Vector4;
- scaleToRef(scale: number, result: Vector4): void;
- equals(otherVector: Vector4): boolean;
- equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
- equalsToFloats(x: number, y: number, z: number, w: number): boolean;
- multiplyInPlace(otherVector: Vector4): Vector4;
- multiply(otherVector: Vector4): Vector4;
- multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
- multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
- divide(otherVector: Vector4): Vector4;
- divideToRef(otherVector: Vector4, result: Vector4): Vector4;
- MinimizeInPlace(other: Vector4): Vector4;
- MaximizeInPlace(other: Vector4): Vector4;
- length(): number;
- lengthSquared(): number;
- normalize(): Vector4;
- toVector3(): Vector3;
- clone(): Vector4;
- copyFrom(source: Vector4): Vector4;
- copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
- static FromArray(array: number[], offset?: number): Vector4;
- static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
- static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
- static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
- static Zero(): Vector4;
- static Normalize(vector: Vector4): Vector4;
- static NormalizeToRef(vector: Vector4, result: Vector4): void;
- static Minimize(left: Vector4, right: Vector4): Vector4;
- static Maximize(left: Vector4, right: Vector4): Vector4;
- static Distance(value1: Vector4, value2: Vector4): number;
- static DistanceSquared(value1: Vector4, value2: Vector4): number;
- static Center(value1: Vector4, value2: Vector4): Vector4;
- }
- interface ISize {
- width: number;
- height: number;
- }
- class Size implements ISize {
- width: number;
- height: number;
- constructor(width: number, height: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- copyFrom(src: Size): void;
- copyFromFloats(width: number, height: number): void;
- multiplyByFloats(w: number, h: number): Size;
- clone(): Size;
- equals(other: Size): boolean;
- surface: number;
- static Zero(): Size;
- add(otherSize: Size): Size;
- substract(otherSize: Size): Size;
- static Lerp(start: Size, end: Size, amount: number): Size;
- }
- class Quaternion {
- x: number;
- y: number;
- z: number;
- w: number;
- constructor(x?: number, y?: number, z?: number, w?: number);
- toString(): string;
- getClassName(): string;
- getHashCode(): number;
- asArray(): number[];
- equals(otherQuaternion: Quaternion): boolean;
- clone(): Quaternion;
- copyFrom(other: Quaternion): Quaternion;
- copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
- add(other: Quaternion): Quaternion;
- subtract(other: Quaternion): Quaternion;
- scale(value: number): Quaternion;
- multiply(q1: Quaternion): Quaternion;
- multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
- multiplyInPlace(q1: Quaternion): Quaternion;
- conjugateToRef(ref: Quaternion): Quaternion;
- conjugateInPlace(): Quaternion;
- conjugate(): Quaternion;
- length(): number;
- normalize(): Quaternion;
- toEulerAngles(order?: string): Vector3;
- toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
- toRotationMatrix(result: Matrix): Quaternion;
- fromRotationMatrix(matrix: Matrix): Quaternion;
- static FromRotationMatrix(matrix: Matrix): Quaternion;
- static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
- static Inverse(q: Quaternion): Quaternion;
- static Identity(): Quaternion;
- static RotationAxis(axis: Vector3, angle: number): Quaternion;
- static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
- static FromArray(array: number[], offset?: number): Quaternion;
- static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
- static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
- static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
- static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
- static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
- }
- class Matrix {
- m: Float32Array;
- isIdentity(): boolean;
- determinant(): number;
- toArray(): Float32Array;
- asArray(): Float32Array;
- invert(): Matrix;
- reset(): Matrix;
- add(other: Matrix): Matrix;
- addToRef(other: Matrix, result: Matrix): Matrix;
- addToSelf(other: Matrix): Matrix;
- invertToRef(other: Matrix): Matrix;
- setTranslation(vector3: Vector3): Matrix;
- getTranslation(): Vector3;
- multiply(other: Matrix): Matrix;
- copyFrom(other: Matrix): Matrix;
- copyToArray(array: Float32Array, offset?: number): Matrix;
- multiplyToRef(other: Matrix, result: Matrix): Matrix;
- multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
- equals(value: Matrix): boolean;
- clone(): Matrix;
- getClassName(): string;
- getHashCode(): number;
- decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
- static FromArray(array: number[], offset?: number): Matrix;
- static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
- static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
- 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;
- getRow(index: number): Vector4;
- setRow(index: number, row: Vector4): Matrix;
- 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;
- static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
- static Identity(): Matrix;
- static IdentityToRef(result: Matrix): void;
- static Zero(): Matrix;
- static RotationX(angle: number): Matrix;
- static Invert(source: Matrix): Matrix;
- static RotationXToRef(angle: number, result: Matrix): void;
- static RotationY(angle: number): Matrix;
- static RotationYToRef(angle: number, result: Matrix): void;
- static RotationZ(angle: number): Matrix;
- static RotationZToRef(angle: number, result: Matrix): void;
- static RotationAxis(axis: Vector3, angle: number): Matrix;
- static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
- static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
- static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
- static Scaling(x: number, y: number, z: number): Matrix;
- static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
- static Translation(x: number, y: number, z: number): Matrix;
- static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
- static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
- static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
- static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
- static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
- static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
- static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
- static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
- static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
- static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
- static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
- static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
- static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
- static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
- static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
- static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
- static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
- static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
- static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
- static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
- static GetAsMatrix2x2(matrix: Matrix): Float32Array;
- static GetAsMatrix3x3(matrix: Matrix): Float32Array;
- static Transpose(matrix: Matrix): Matrix;
- static Reflection(plane: Plane): Matrix;
- static ReflectionToRef(plane: Plane, result: Matrix): void;
- static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, mat: Matrix): void;
- static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
- }
- class Plane {
- normal: Vector3;
- d: number;
- constructor(a: number, b: number, c: number, d: number);
- asArray(): number[];
- clone(): Plane;
- getClassName(): string;
- getHashCode(): number;
- normalize(): Plane;
- transform(transformation: Matrix): Plane;
- dotCoordinate(point: any): number;
- copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
- isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
- signedDistanceTo(point: Vector3): number;
- static FromArray(array: number[]): Plane;
- static FromPoints(point1: any, point2: any, point3: any): Plane;
- static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
- static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
- }
- class Viewport {
- x: number;
- y: number;
- width: number;
- height: number;
- constructor(x: number, y: number, width: number, height: number);
- toGlobal(renderWidth: number, renderHeight: number): Viewport;
- }
- class Frustum {
- static GetPlanes(transform: Matrix): Plane[];
- static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
- }
- enum Space {
- LOCAL = 0,
- WORLD = 1,
- }
- class Axis {
- static X: Vector3;
- static Y: Vector3;
- static Z: Vector3;
- }
- class BezierCurve {
- static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
- }
- enum Orientation {
- CW = 0,
- CCW = 1,
- }
- class Angle {
- constructor(radians: number);
- degrees: () => number;
- radians: () => number;
- static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
- static FromRadians(radians: number): Angle;
- static FromDegrees(degrees: number): Angle;
- }
- class Arc2 {
- startPoint: Vector2;
- midPoint: Vector2;
- endPoint: Vector2;
- centerPoint: Vector2;
- radius: number;
- angle: Angle;
- startAngle: Angle;
- orientation: Orientation;
- constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
- }
- class Path2 {
- closed: boolean;
- constructor(x: number, y: number);
- addLineTo(x: number, y: number): Path2;
- addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
- close(): Path2;
- length(): number;
- getPoints(): Vector2[];
- getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
- static StartingAt(x: number, y: number): Path2;
- }
- class Path3D {
- path: Vector3[];
- /**
- * new Path3D(path, normal, raw)
- * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
- * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
- * path : an array of Vector3, the curve axis of the Path3D
- * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
- * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
- */
- constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
- /**
- * Returns the Path3D array of successive Vector3 designing its curve.
- */
- getCurve(): Vector3[];
- /**
- * Returns an array populated with tangent vectors on each Path3D curve point.
- */
- getTangents(): Vector3[];
- /**
- * Returns an array populated with normal vectors on each Path3D curve point.
- */
- getNormals(): Vector3[];
- /**
- * Returns an array populated with binormal vectors on each Path3D curve point.
- */
- getBinormals(): Vector3[];
- /**
- * Returns an array populated with distances (float) of the i-th point from the first curve point.
- */
- getDistances(): number[];
- /**
- * Forces the Path3D tangent, normal, binormal and distance recomputation.
- * Returns the same object updated.
- */
- update(path: Vector3[], firstNormal?: Vector3): Path3D;
- }
- class Curve3 {
- /**
- * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
- * @param v0 (Vector3) the origin point of the Quadratic Bezier
- * @param v1 (Vector3) the control point
- * @param v2 (Vector3) the end point of the Quadratic Bezier
- * @param nbPoints (integer) the wanted number of points in the curve
- */
- static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
- /**
- * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
- * @param v0 (Vector3) the origin point of the Cubic Bezier
- * @param v1 (Vector3) the first control point
- * @param v2 (Vector3) the second control point
- * @param v3 (Vector3) the end point of the Cubic Bezier
- * @param nbPoints (integer) the wanted number of points in the curve
- */
- static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
- /**
- * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
- * @param p1 (Vector3) the origin point of the Hermite Spline
- * @param t1 (Vector3) the tangent vector at the origin point
- * @param p2 (Vector3) the end point of the Hermite Spline
- * @param t2 (Vector3) the tangent vector at the end point
- * @param nbPoints (integer) the wanted number of points in the curve
- */
- static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
- /**
- * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
- * A Curve3 is designed from a series of successive Vector3.
- * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
- */
- constructor(points: Vector3[]);
- /**
- * Returns the Curve3 stored array of successive Vector3
- */
- getPoints(): Vector3[];
- /**
- * Returns the computed length (float) of the curve.
- */
- length(): number;
- /**
- * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
- * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
- * curveA and curveB keep unchanged.
- */
- continue(curve: Curve3): Curve3;
- }
- class SphericalHarmonics {
- L00: Vector3;
- L1_1: Vector3;
- L10: Vector3;
- L11: Vector3;
- L2_2: Vector3;
- L2_1: Vector3;
- L20: Vector3;
- L21: Vector3;
- L22: Vector3;
- addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
- scale(scale: number): void;
- }
- class SphericalPolynomial {
- x: Vector3;
- y: Vector3;
- z: Vector3;
- xx: Vector3;
- yy: Vector3;
- zz: Vector3;
- xy: Vector3;
- yz: Vector3;
- zx: Vector3;
- addAmbient(color: Color3): void;
- static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
- }
- class PositionNormalVertex {
- position: Vector3;
- normal: Vector3;
- constructor(position?: Vector3, normal?: Vector3);
- clone(): PositionNormalVertex;
- }
- class PositionNormalTextureVertex {
- position: Vector3;
- normal: Vector3;
- uv: Vector2;
- constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
- clone(): PositionNormalTextureVertex;
- }
- class Tmp {
- static Color3: Color3[];
- static Vector2: Vector2[];
- static Vector3: Vector3[];
- static Vector4: Vector4[];
- static Quaternion: Quaternion[];
- static Matrix: Matrix[];
- }
- }
- declare module BABYLON {
- class Particle {
- position: Vector3;
- direction: Vector3;
- color: Color4;
- colorStep: Color4;
- lifeTime: number;
- age: number;
- size: number;
- angle: number;
- angularSpeed: number;
- copyTo(other: Particle): void;
- }
- }
- declare module BABYLON {
- class ParticleSystem implements IDisposable, IAnimatable {
- name: string;
- static BLENDMODE_ONEONE: number;
- static BLENDMODE_STANDARD: number;
- animations: Animation[];
- id: string;
- renderingGroupId: number;
- emitter: any;
- emitRate: number;
- manualEmitCount: number;
- updateSpeed: number;
- targetStopDuration: number;
- disposeOnStop: boolean;
- minEmitPower: number;
- maxEmitPower: number;
- minLifeTime: number;
- maxLifeTime: number;
- minSize: number;
- maxSize: number;
- minAngularSpeed: number;
- maxAngularSpeed: number;
- particleTexture: Texture;
- layerMask: number;
- /**
- * An event triggered when the system is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<ParticleSystem>;
- onDispose: () => void;
- updateFunction: (particles: Particle[]) => void;
- blendMode: number;
- forceDepthWrite: boolean;
- gravity: Vector3;
- direction1: Vector3;
- direction2: Vector3;
- minEmitBox: Vector3;
- maxEmitBox: Vector3;
- color1: Color4;
- color2: Color4;
- colorDead: Color4;
- textureMask: Color4;
- startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
- startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
- private particles;
- constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
- recycleParticle(particle: Particle): void;
- getCapacity(): number;
- isAlive(): boolean;
- isStarted(): boolean;
- start(): void;
- stop(): void;
- animate(): void;
- render(): number;
- dispose(): void;
- clone(name: string, newEmitter: any): ParticleSystem;
- serialize(): any;
- static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
- }
- }
- declare module BABYLON {
- class SolidParticle {
- idx: number;
- color: Color4;
- position: Vector3;
- rotation: Vector3;
- rotationQuaternion: Quaternion;
- scaling: Vector3;
- uvs: Vector4;
- velocity: Vector3;
- alive: boolean;
- isVisible: boolean;
- shapeId: number;
- idxInShape: number;
- /**
- * Creates a Solid Particle object.
- * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
- * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
- * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
- * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
- * `shapeId` (integer) is the model shape identifier in the SPS.
- * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
- * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
- */
- constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
- /**
- * legacy support, changed scale to scaling
- */
- scale: Vector3;
- /**
- * legacy support, changed quaternion to rotationQuaternion
- */
- quaternion: Quaternion;
- /**
- * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
- * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
- * `target` is the object (solid particle or mesh) what the intersection is computed against.
- */
- intersectsMesh(target: Mesh | SolidParticle): boolean;
- }
- class ModelShape {
- shapeID: number;
- /**
- * 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.
- * SPS internal tool, don't use it manually.
- */
- constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
- }
- }
- declare module BABYLON {
- /**
- * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
- */
- class SolidParticleSystem implements IDisposable {
- /**
- * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
- * Example : var p = SPS.particles[i];
- */
- particles: SolidParticle[];
- /**
- * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
- */
- nbParticles: number;
- /**
- * If the particles must ever face the camera (default false). Useful for planar particles.
- */
- billboard: boolean;
- /**
- * Recompute normals when adding a shape
- */
- recomputeNormals: boolean;
- /**
- * This a counter ofr your own usage. It's not set by any SPS functions.
- */
- counter: number;
- /**
- * The SPS name. This name is also given to the underlying mesh.
- */
- name: string;
- /**
- * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
- */
- mesh: Mesh;
- /**
- * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
- * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
- */
- vars: any;
- /**
- * This array is populated when the SPS is set as 'pickable'.
- * Each key of this array is a `faceId` value that you can get from a pickResult object.
- * Each element of this array is an object `{idx: int, faceId: int}`.
- * `idx` is the picked particle index in the `SPS.particles` array
- * `faceId` is the picked face index counted within this particle.
- * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
- */
- pickedParticles: {
- idx: number;
- faceId: number;
- }[];
- /**
- * Creates a SPS (Solid Particle System) object.
- * `name` (String) is the SPS name, this will be the underlying mesh name.
- * `scene` (Scene) is the scene in which the SPS is added.
- * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
- * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
- * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
- * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
- * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
- * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
- */
- constructor(name: string, scene: Scene, options?: {
- updatable?: boolean;
- isPickable?: boolean;
- particleIntersection?: boolean;
- boundingSphereOnly?: boolean;
- bSphereRadiusFactor?: number;
- });
- /**
- * Builds the SPS underlying mesh. Returns a standard Mesh.
- * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
- */
- buildMesh(): Mesh;
- /**
- * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
- * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
- * Thus the particles generated from `digest()` have their property `position` set yet.
- * `mesh` ( Mesh ) is the mesh to be digested
- * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
- * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
- * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
- */
- digest(mesh: Mesh, options?: {
- facetNb?: number;
- number?: number;
- delta?: number;
- }): SolidParticleSystem;
- /**
- * Adds some particles to the SPS from the model shape. Returns the shape id.
- * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
- * `mesh` is any Mesh object that will be used as a model for the solid particles.
- * `nb` (positive integer) the number of particles to be created from this model
- * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
- * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
- */
- addShape(mesh: Mesh, nb: number, options?: {
- positionFunction?: any;
- vertexFunction?: any;
- }): number;
- /**
- * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
- */
- rebuildMesh(): void;
- /**
- * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
- * This method calls `updateParticle()` for each particle of the SPS.
- * For an animated SPS, it is usually called within the render loop.
- * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
- * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
- * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
- */
- setParticles(start?: number, end?: number, update?: boolean): void;
- /**
- * Disposes the SPS
- */
- dispose(): void;
- /**
- * Visibilty helper : Recomputes the visible size according to the mesh bounding box
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
- */
- refreshVisibleSize(): void;
- /**
- * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
- * @param size the size (float) of the visibility box
- * note : this doesn't lock the SPS mesh bounding box.
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
- */
- setVisibilityBox(size: number): void;
- /**
- * Sets the SPS as always visible or not
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
- */
- isAlwaysVisible: boolean;
- /**
- * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
- */
- isVisibilityBoxLocked: boolean;
- /**
- * Tells to `setParticles()` to compute the particle rotations or not.
- * Default value : true. The SPS is faster when it's set to false.
- * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
- */
- computeParticleRotation: boolean;
- /**
- * Tells to `setParticles()` to compute the particle colors or not.
- * Default value : true. The SPS is faster when it's set to false.
- * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
- */
- computeParticleColor: boolean;
- /**
- * Tells to `setParticles()` to compute the particle textures or not.
- * Default value : true. The SPS is faster when it's set to false.
- * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
- */
- computeParticleTexture: boolean;
- /**
- * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
- * Default value : false. The SPS is faster when it's set to false.
- * Note : the particle custom vertex positions aren't stored values.
- */
- computeParticleVertex: boolean;
- /**
- * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
- */
- computeBoundingBox: boolean;
- /**
- * This function does nothing. It may be overwritten to set all the particle first values.
- * The SPS doesn't call this function, you may have to call it by your own.
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
- */
- initParticles(): void;
- /**
- * This function does nothing. It may be overwritten to recycle a particle.
- * The SPS doesn't call this function, you may have to call it by your own.
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
- */
- recycleParticle(particle: SolidParticle): SolidParticle;
- /**
- * Updates a particle : this function should be overwritten by the user.
- * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
- * ex : just set a particle position or velocity and recycle conditions
- */
- updateParticle(particle: SolidParticle): SolidParticle;
- /**
- * Updates a vertex of a particle : it can be overwritten by the user.
- * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
- * @param particle the current particle
- * @param vertex the current index of the current particle
- * @param pt the index of the current vertex in the particle shape
- * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
- * ex : just set a vertex particle position
- */
- updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
- /**
- * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
- * This does nothing and may be overwritten by the user.
- * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
- * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
- * @param update the boolean update value actually passed to setParticles()
- */
- beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
- /**
- * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
- * This will be passed three parameters.
- * This does nothing and may be overwritten by the user.
- * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
- * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
- * @param update the boolean update value actually passed to setParticles()
- */
- afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
- }
- }
- declare module BABYLON {
- class AbstractMesh extends Node implements IDisposable, ICullable {
- static BILLBOARDMODE_NONE: number;
- static BILLBOARDMODE_X: number;
- static BILLBOARDMODE_Y: number;
- static BILLBOARDMODE_Z: number;
- static BILLBOARDMODE_ALL: number;
- /**
- * An event triggered when this mesh collides with another one
- * @type {BABYLON.Observable}
- */
- onCollideObservable: Observable<AbstractMesh>;
- onCollide: () => void;
- /**
- * An event triggered when the collision's position changes
- * @type {BABYLON.Observable}
- */
- onCollisionPositionChangeObservable: Observable<Vector3>;
- onCollisionPositionChange: () => void;
- /**
- * An event triggered after the world matrix is updated
- * @type {BABYLON.Observable}
- */
- onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
- definedFacingForward: boolean;
- position: Vector3;
- billboardMode: number;
- visibility: number;
- alphaIndex: number;
- infiniteDistance: boolean;
- isVisible: boolean;
- isPickable: boolean;
- showBoundingBox: boolean;
- showSubMeshesBoundingBox: boolean;
- isBlocker: boolean;
- renderingGroupId: number;
- material: Material;
- receiveShadows: boolean;
- renderOutline: boolean;
- outlineColor: Color3;
- outlineWidth: number;
- renderOverlay: boolean;
- overlayColor: Color3;
- overlayAlpha: number;
- hasVertexAlpha: boolean;
- useVertexColors: boolean;
- applyFog: boolean;
- computeBonesUsingShaders: boolean;
- scalingDeterminant: number;
- numBoneInfluencers: number;
- useOctreeForRenderingSelection: boolean;
- useOctreeForPicking: boolean;
- useOctreeForCollisions: boolean;
- layerMask: number;
- alwaysSelectAsActiveMesh: boolean;
- /**
- * This scene's action manager
- * @type {BABYLON.ActionManager}
- */
- actionManager: ActionManager;
- physicsImpostor: BABYLON.PhysicsImpostor;
- onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void;
- ellipsoid: Vector3;
- ellipsoidOffset: Vector3;
- edgesWidth: number;
- edgesColor: Color4;
- subMeshes: SubMesh[];
- skeleton: Skeleton;
- constructor(name: string, scene: Scene);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- /**
- * Getting the rotation object.
- * If rotation quaternion is set, this vector will (almost always) be the Zero vector!
- */
- rotation: Vector3;
- scaling: Vector3;
- rotationQuaternion: Quaternion;
- updatePoseMatrix(matrix: Matrix): void;
- getPoseMatrix(): Matrix;
- disableEdgesRendering(): void;
- enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
- isBlocked: boolean;
- getLOD(camera: Camera): AbstractMesh;
- getTotalVertices(): number;
- getIndices(): number[] | Int32Array;
- getVerticesData(kind: string): number[] | Float32Array;
- isVerticesDataPresent(kind: string): boolean;
- getBoundingInfo(): BoundingInfo;
- setBoundingInfo(boundingInfo: BoundingInfo): void;
- useBones: boolean;
- getWorldMatrix(): Matrix;
- worldMatrixFromCache: Matrix;
- absolutePosition: Vector3;
- freezeWorldMatrix(): void;
- unfreezeWorldMatrix(): void;
- isWorldMatrixFrozen: boolean;
- rotate(axis: Vector3, amount: number, space?: Space): void;
- translate(axis: Vector3, distance: number, space?: Space): void;
- getAbsolutePosition(): Vector3;
- setAbsolutePosition(absolutePosition: Vector3): void;
- /**
- * Perform relative position change from the point of view of behind the front of the mesh.
- * This is performed taking into account the meshes current rotation, so you do not have to care.
- * Supports definition of mesh facing forward or backward.
- * @param {number} amountRight
- * @param {number} amountUp
- * @param {number} amountForward
- */
- movePOV(amountRight: number, amountUp: number, amountForward: number): void;
- /**
- * Calculate relative position change from the point of view of behind the front of the mesh.
- * This is performed taking into account the meshes current rotation, so you do not have to care.
- * Supports definition of mesh facing forward or backward.
- * @param {number} amountRight
- * @param {number} amountUp
- * @param {number} amountForward
- */
- calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
- /**
- * Perform relative rotation change from the point of view of behind the front of the mesh.
- * Supports definition of mesh facing forward or backward.
- * @param {number} flipBack
- * @param {number} twirlClockwise
- * @param {number} tiltRight
- */
- rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
- /**
- * Calculate relative rotation change from the point of view of behind the front of the mesh.
- * Supports definition of mesh facing forward or backward.
- * @param {number} flipBack
- * @param {number} twirlClockwise
- * @param {number} tiltRight
- */
- calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
- setPivotMatrix(matrix: Matrix): void;
- getPivotMatrix(): Matrix;
- markAsDirty(property: string): void;
- computeWorldMatrix(force?: boolean): Matrix;
- /**
- * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
- * @param func: callback function to add
- */
- registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
- unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
- setPositionWithLocalVector(vector3: Vector3): void;
- getPositionExpressedInLocalSpace(): Vector3;
- locallyTranslate(vector3: Vector3): void;
- lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): void;
- attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
- detachFromBone(): void;
- isInFrustum(frustumPlanes: Plane[]): boolean;
- isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
- intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
- intersectsPoint(point: Vector3): boolean;
- /**
- * @Deprecated. Use new PhysicsImpostor instead.
- * */
- setPhysicsState(impostor?: any, options?: PhysicsImpostorParameters): any;
- getPhysicsImpostor(): PhysicsImpostor;
- /**
- * @Deprecated. Use getPhysicsImpostor().getParam("mass");
- */
- getPhysicsMass(): number;
- /**
- * @Deprecated. Use getPhysicsImpostor().getParam("friction");
- */
- getPhysicsFriction(): number;
- /**
- * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
- */
- getPhysicsRestitution(): number;
- getPositionInCameraSpace(camera?: Camera): Vector3;
- getDistanceToCamera(camera?: Camera): number;
- applyImpulse(force: Vector3, contactPoint: Vector3): void;
- setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
- /**
- * @Deprecated
- */
- updatePhysicsBodyPosition(): void;
- /**
- * @Deprecated
- * Calling this function is not needed anymore.
- * The physics engine takes care of transofmration automatically.
- */
- updatePhysicsBody(): void;
- checkCollisions: boolean;
- moveWithCollisions(velocity: Vector3): void;
- /**
- * This function will create an octree to help select the right submeshes for rendering, picking and collisions
- * Please note that you must have a decent number of submeshes to get performance improvements when using octree
- */
- createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
- intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
- clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
- releaseSubMeshes(): void;
- dispose(doNotRecurse?: boolean): void;
- }
- }
- declare module BABYLON {
- class Buffer {
- constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
- createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
- isUpdatable(): boolean;
- getData(): number[] | Float32Array;
- getBuffer(): WebGLBuffer;
- getStrideSize(): number;
- getIsInstanced(): boolean;
- create(data?: number[] | Float32Array): void;
- update(data: number[] | Float32Array): void;
- updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class CSG {
- private polygons;
- matrix: Matrix;
- position: Vector3;
- rotation: Vector3;
- rotationQuaternion: Quaternion;
- scaling: Vector3;
- static FromMesh(mesh: Mesh): CSG;
- private static FromPolygons(polygons);
- clone(): CSG;
- private toPolygons();
- union(csg: CSG): CSG;
- unionInPlace(csg: CSG): void;
- subtract(csg: CSG): CSG;
- subtractInPlace(csg: CSG): void;
- intersect(csg: CSG): CSG;
- intersectInPlace(csg: CSG): void;
- inverse(): CSG;
- inverseInPlace(): void;
- copyTransformAttributes(csg: CSG): CSG;
- buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
- toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
- }
- }
- declare module BABYLON {
- class Geometry implements IGetSetVerticesData {
- id: string;
- delayLoadState: number;
- delayLoadingFile: string;
- onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
- /**
- * 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
- * @returns The Bias Vector
- */
- boundingBias: Vector2;
- constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
- extend: {
- minimum: Vector3;
- maximum: Vector3;
- };
- getScene(): Scene;
- getEngine(): Engine;
- isReady(): boolean;
- setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
- setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
- setVerticesBuffer(buffer: VertexBuffer): void;
- updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
- updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
- private updateBoundingInfo(updateExtends, data);
- getTotalVertices(): number;
- getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
- getVertexBuffer(kind: string): VertexBuffer;
- getVertexBuffers(): {
- [key: string]: VertexBuffer;
- };
- isVerticesDataPresent(kind: string): boolean;
- getVerticesDataKinds(): string[];
- setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
- getTotalIndices(): number;
- getIndices(copyWhenShared?: boolean): number[] | Int32Array;
- getIndexBuffer(): WebGLBuffer;
- releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
- applyToMesh(mesh: Mesh): void;
- private updateExtend(data?, stride?);
- private notifyUpdate(kind?);
- load(scene: Scene, onLoaded?: () => void): void;
- /**
- * Invert the geometry to move from a right handed system to a left handed one.
- */
- toLeftHanded(): void;
- isDisposed(): boolean;
- dispose(): void;
- copy(id: string): Geometry;
- serialize(): any;
- serializeVerticeData(): any;
- static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
- /**
- * You should now use Tools.RandomId(), this method is still here for legacy reasons.
- * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
- * Be aware Math.random() could cause collisions, but:
- * "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"
- */
- static RandomId(): string;
- static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
- static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
- }
- module Geometry.Primitives {
- class _Primitive extends Geometry {
- constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
- canBeRegenerated(): boolean;
- regenerate(): void;
- asNewGeometry(id: string): Geometry;
- setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
- setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void;
- copy(id: string): Geometry;
- serialize(): any;
- }
- class Ribbon extends _Primitive {
- pathArray: Vector3[][];
- closeArray: boolean;
- closePath: boolean;
- offset: number;
- side: number;
- constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- }
- class Box extends _Primitive {
- size: number;
- side: number;
- constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedBox: any, scene: Scene): Box;
- }
- class Sphere extends _Primitive {
- segments: number;
- diameter: number;
- side: number;
- constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
- }
- class Disc extends _Primitive {
- radius: number;
- tessellation: number;
- side: number;
- constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- }
- class Cylinder extends _Primitive {
- height: number;
- diameterTop: number;
- diameterBottom: number;
- tessellation: number;
- subdivisions: number;
- side: number;
- constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
- }
- class Torus extends _Primitive {
- diameter: number;
- thickness: number;
- tessellation: number;
- side: number;
- constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
- }
- class Ground extends _Primitive {
- width: number;
- height: number;
- subdivisions: number;
- constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
- }
- class TiledGround extends _Primitive {
- xmin: number;
- zmin: number;
- xmax: number;
- zmax: number;
- subdivisions: {
- w: number;
- h: number;
- };
- precision: {
- w: number;
- h: number;
- };
- constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
- w: number;
- h: number;
- }, precision: {
- w: number;
- h: number;
- }, canBeRegenerated?: boolean, mesh?: Mesh);
- copy(id: string): Geometry;
- }
- class Plane extends _Primitive {
- size: number;
- side: number;
- constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
- }
- class TorusKnot extends _Primitive {
- radius: number;
- tube: number;
- radialSegments: number;
- tubularSegments: number;
- p: number;
- q: number;
- side: number;
- constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
- copy(id: string): Geometry;
- serialize(): any;
- static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
- }
- }
- }
- declare module BABYLON {
- class GroundMesh extends Mesh {
- generateOctree: boolean;
- constructor(name: string, scene: Scene);
- subdivisions: number;
- subdivisionsX: number;
- subdivisionsY: number;
- optimize(chunksCount: number, octreeBlocksSize?: number): void;
- /**
- * Returns a height (y) value in the Worl system :
- * the ground altitude at the coordinates (x, z) expressed in the World system.
- * Returns the ground y position if (x, z) are outside the ground surface.
- * Not pertinent if the ground is rotated.
- */
- getHeightAtCoordinates(x: number, z: number): number;
- /**
- * Returns a normalized vector (Vector3) orthogonal to the ground
- * at the ground coordinates (x, z) expressed in the World system.
- * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface.
- * Not pertinent if the ground is rotated.
- */
- getNormalAtCoordinates(x: number, z: number): Vector3;
- /**
- * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
- * at the ground coordinates (x, z) expressed in the World system.
- * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
- * Not pertinent if the ground is rotated.
- */
- getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void;
- /**
- * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
- * if the ground has been updated.
- * This can be used in the render loop
- */
- updateCoordinateHeights(): void;
- }
- }
- declare module BABYLON {
- /**
- * Creates an instance based on a source mesh.
- */
- class InstancedMesh extends AbstractMesh {
- constructor(name: string, source: Mesh);
- receiveShadows: boolean;
- material: Material;
- visibility: number;
- skeleton: Skeleton;
- renderingGroupId: number;
- getTotalVertices(): number;
- sourceMesh: Mesh;
- getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
- isVerticesDataPresent(kind: string): boolean;
- getIndices(): number[] | Int32Array;
- refreshBoundingInfo(): void;
- getLOD(camera: Camera): AbstractMesh;
- clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
- dispose(doNotRecurse?: boolean): void;
- }
- }
- declare module BABYLON {
- class LinesMesh extends Mesh {
- color: Color3;
- alpha: number;
- /**
- * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
- * This margin is expressed in world space coordinates, so its value may vary.
- * Default value is 0.1
- * @returns the intersection Threshold value.
- */
- /**
- * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
- * This margin is expressed in world space coordinates, so its value may vary.
- * @param value the new threshold to apply
- */
- intersectionThreshold: number;
- constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean);
- material: Material;
- checkCollisions: boolean;
- createInstance(name: string): InstancedMesh;
- dispose(doNotRecurse?: boolean): void;
- clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
- }
- }
- declare module BABYLON {
- class _InstancesBatch {
- mustReturn: boolean;
- visibleInstances: InstancedMesh[][];
- renderSelf: boolean[];
- }
- class Mesh extends AbstractMesh implements IGetSetVerticesData {
- /**
- * Mesh side orientation : usually the external or front surface
- */
- static FRONTSIDE: number;
- /**
- * Mesh side orientation : usually the internal or back surface
- */
- static BACKSIDE: number;
- /**
- * Mesh side orientation : both internal and external or front and back surfaces
- */
- static DOUBLESIDE: number;
- /**
- * Mesh side orientation : by default, `FRONTSIDE`
- */
- static DEFAULTSIDE: number;
- /**
- * Mesh cap setting : no cap
- */
- static NO_CAP: number;
- /**
- * Mesh cap setting : one cap at the beginning of the mesh
- */
- static CAP_START: number;
- /**
- * Mesh cap setting : one cap at the end of the mesh
- */
- static CAP_END: number;
- /**
- * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
- */
- static CAP_ALL: number;
- /**
- * An event triggered before rendering the mesh
- * @type {BABYLON.Observable}
- */
- onBeforeRenderObservable: Observable<Mesh>;
- /**
- * An event triggered after rendering the mesh
- * @type {BABYLON.Observable}
- */
- onAfterRenderObservable: Observable<Mesh>;
- /**
- * An event triggered before drawing the mesh
- * @type {BABYLON.Observable}
- */
- onBeforeDrawObservable: Observable<Mesh>;
- onBeforeDraw: () => void;
- delayLoadState: number;
- instances: InstancedMesh[];
- delayLoadingFile: string;
- onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
- /**
- * @constructor
- * @param {string} name The value used by scene.getMeshByName() to do a lookup.
- * @param {Scene} scene The scene to add this mesh to.
- * @param {Node} parent The parent of this mesh, if it has one
- * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
- * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
- * When false, achieved by calling a clone(), also passing False.
- * This will make creation of children, recursive.
- */
- constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
- /**
- * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
- */
- toString(fullDetails?: boolean): string;
- hasLODLevels: boolean;
- /**
- * Add a mesh as LOD level triggered at the given distance.
- * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
- * @param {number} distance The distance from the center of the object to show this level
- * @param {Mesh} mesh The mesh to be added as LOD level
- * @return {Mesh} This mesh (for chaining)
- */
- addLODLevel(distance: number, mesh: Mesh): Mesh;
- /**
- * Returns the LOD level mesh at the passed distance or null if not found.
- * It is related to the method `addLODLevel(distance, mesh)`.
- * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
- */
- getLODLevelAtDistance(distance: number): Mesh;
- /**
- * Remove a mesh from the LOD array
- * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
- * @param {Mesh} mesh The mesh to be removed.
- * @return {Mesh} This mesh (for chaining)
- */
- removeLODLevel(mesh: Mesh): Mesh;
- /**
- * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
- * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
- */
- getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
- /**
- * Returns the mesh internal Geometry object.
- */
- geometry: Geometry;
- /**
- * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
- */
- getTotalVertices(): number;
- /**
- * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
- * 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.
- * Returns null if the mesh has no geometry or no vertex buffer.
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
- /**
- * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
- * Returns `undefined` if the mesh has no geometry.
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- getVertexBuffer(kind: any): VertexBuffer;
- /**
- * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- isVerticesDataPresent(kind: string): boolean;
- /**
- * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- getVerticesDataKinds(): string[];
- /**
- * Returns a positive integer : the total number of indices in this mesh geometry.
- * Returns zero if the mesh has no geometry.
- */
- getTotalIndices(): number;
- /**
- * Returns an array of integers or a Int32Array populated with the mesh indices.
- * 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.
- * Returns an empty array if the mesh has no geometry.
- */
- getIndices(copyWhenShared?: boolean): number[] | Int32Array;
- isBlocked: boolean;
- /**
- * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
- */
- isReady(): boolean;
- /**
- * Boolean : true if the mesh has been disposed.
- */
- isDisposed(): boolean;
- /**
- * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
- * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
- */
- sideOrientation: number;
- /**
- * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
- * This property is pertinent only for updatable parametric shapes.
- */
- areNormalsFrozen: boolean;
- /**
- * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
- * It has no effect at all on other shapes.
- * It prevents the mesh normals from being recomputed on next `positions` array update.
- */
- freezeNormals(): void;
- /**
- * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
- * It has no effect at all on other shapes.
- * It reactivates the mesh normals computation if it was previously frozen.
- */
- unfreezeNormals(): void;
- /**
- * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
- */
- overridenInstanceCount: number;
- /**
- * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
- * This means the mesh underlying bounding box and sphere are recomputed.
- */
- refreshBoundingInfo(): void;
- subdivide(count: number): void;
- /**
- * Sets the vertex data of the mesh geometry for the requested `kind`.
- * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
- * The `data` are either a numeric array either a Float32Array.
- * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
- * 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).
- * Note that a new underlying VertexBuffer object is created each call.
- * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
- *
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
- setVerticesBuffer(buffer: VertexBuffer): void;
- /**
- * Updates the existing vertex data of the mesh geometry for the requested `kind`.
- * If the mesh has no geometry, it is simply returned as it is.
- * The `data` are either a numeric array either a Float32Array.
- * No new underlying VertexBuffer object is created.
- * 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.
- * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
- *
- * Possible `kind` values :
- * - BABYLON.VertexBuffer.PositionKind
- * - BABYLON.VertexBuffer.UVKind
- * - BABYLON.VertexBuffer.UV2Kind
- * - BABYLON.VertexBuffer.UV3Kind
- * - BABYLON.VertexBuffer.UV4Kind
- * - BABYLON.VertexBuffer.UV5Kind
- * - BABYLON.VertexBuffer.UV6Kind
- * - BABYLON.VertexBuffer.ColorKind
- * - BABYLON.VertexBuffer.MatricesIndicesKind
- * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
- * - BABYLON.VertexBuffer.MatricesWeightsKind
- * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
- */
- updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
- /**
- * Deprecated since BabylonJS v2.3
- */
- updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
- /**
- * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
- * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
- * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
- * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
- */
- updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
- makeGeometryUnique(): void;
- /**
- * Sets the mesh indices.
- * Expects an array populated with integers or a Int32Array.
- * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
- * This method creates a new index buffer each call.
- */
- setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
- /**
- * Invert the geometry to move from a right handed system to a left handed one.
- */
- toLeftHanded(): void;
- /**
- * Registers for this mesh a javascript function called just before the rendering process.
- * This function is passed the current mesh and doesn't return anything.
- */
- registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
- /**
- * Disposes a previously registered javascript function called before the rendering.
- * This function is passed the current mesh and doesn't return anything.
- */
- unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
- /**
- * Registers for this mesh a javascript function called just after the rendering is complete.
- * This function is passed the current mesh and doesn't return anything.
- */
- registerAfterRender(func: (mesh: AbstractMesh) => void): void;
- /**
- * Disposes a previously registered javascript function called after the rendering.
- * This function is passed the current mesh and doesn't return anything.
- */
- unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
- /**
- * Triggers the draw call for the mesh.
- * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
- */
- render(subMesh: SubMesh, enableAlphaMode: boolean): void;
- /**
- * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
- */
- getEmittedParticleSystems(): ParticleSystem[];
- /**
- * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
- */
- getHierarchyEmittedParticleSystems(): ParticleSystem[];
- /**
- * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
- */
- isInFrustum(frustumPlanes: Plane[]): boolean;
- /**
- * Sets the mesh material by the material or multiMaterial `id` property.
- * The material `id` is a string identifying the material or the multiMaterial.
- * This method returns nothing.
- */
- setMaterialByID(id: string): void;
- /**
- * Returns as a new array populated with the mesh material and/or skeleton, if any.
- */
- getAnimatables(): IAnimatable[];
- /**
- * Modifies the mesh geometry according to the passed transformation matrix.
- * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
- * The mesh normals are modified accordingly the same transformation.
- * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
- * Note that, under the hood, this method sets a new VertexBuffer each call.
- */
- bakeTransformIntoVertices(transform: Matrix): void;
- /**
- * Modifies the mesh geometry according to its own current World Matrix.
- * The mesh World Matrix is then reset.
- * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
- * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
- * Note that, under the hood, this method sets a new VertexBuffer each call.
- */
- bakeCurrentTransformIntoVertices(): void;
- /**
- * Returns a new Mesh object generated from the current mesh properties.
- * This method must not get confused with createInstance().
- * The parameter `name` is a string, the name given to the new mesh.
- * The optional parameter `newParent` can be any Node object (default `null`).
- * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
- * 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.
- */
- clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
- /**
- * Disposes the mesh.
- * This also frees the memory allocated under the hood to all the buffers used by WebGL.
- */
- dispose(doNotRecurse?: boolean): void;
- /**
- * Modifies the mesh geometry according to a displacement map.
- * 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.
- * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
- * This method returns nothing.
- * The parameter `url` is a string, the URL from the image file is to be downloaded.
- * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
- * 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.
- */
- applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
- /**
- * Modifies the mesh geometry according to a displacementMap buffer.
- * 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.
- * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
- * This method returns nothing.
- * 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.
- * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
- * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
- */
- applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
- /**
- * Modify the mesh to get a flat shading rendering.
- * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
- * This method returns nothing.
- * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
- */
- convertToFlatShadedMesh(): void;
- /**
- * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
- * In other words, more vertices, no more indices and a single bigger VBO.
- * This method returns nothing.
- * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
- *
- */
- convertToUnIndexedMesh(): void;
- /**
- * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
- * This method returns nothing.
- * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
- */
- flipFaces(flipNormals?: boolean): void;
- /**
- * Creates a new InstancedMesh object from the mesh model.
- * An instance shares the same properties and the same material than its model.
- * Only these properties of each instance can then be set individually :
- * - position
- * - rotation
- * - rotationQuaternion
- * - setPivotMatrix
- * - scaling
- * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
- * Warning : this method is not supported for Line mesh and LineSystem
- */
- createInstance(name: string): InstancedMesh;
- /**
- * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
- * After this call, all the mesh instances have the same submeshes than the current mesh.
- * This method returns nothing.
- */
- synchronizeInstances(): void;
- /**
- * Simplify the mesh according to the given array of settings.
- * Function will return immediately and will simplify async. It returns nothing.
- * @param settings a collection of simplification settings.
- * @param parallelProcessing should all levels calculate parallel or one after the other.
- * @param type the type of simplification to run.
- * @param successCallback optional success callback to be called after the simplification finished processing all settings.
- */
- simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
- /**
- * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
- * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
- * This should be used together with the simplification to avoid disappearing triangles.
- * @param successCallback an optional success callback to be called after the optimization finished.
- */
- optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
- /**
- * Returns a new Mesh object what is a deep copy of the passed mesh.
- * The parameter `parsedMesh` is the mesh to be copied.
- * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
- */
- static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
- /**
- * Creates a ribbon mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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.
- *
- * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
- * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
- * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
- * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
- * 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.
- * 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.
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
- /**
- * Creates a plane polygonal mesh. By default, this is a disc.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
- * 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.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a box mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `size` sets the size (float) of each box side (default 1).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a sphere mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
- * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a cylinder or a cone mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
- * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
- * 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.
- * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
- * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
- /**
- * Creates a torus mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
- * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
- * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a torus knot mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
- * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
- * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
- * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a line mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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.
- * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
- * The parameter `points` is an array successive Vector3.
- * 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
- * When updating an instance, remember that only point positions can change, not the number of points.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
- /**
- * Creates a dashed line mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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.
- * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
- * The parameter `points` is an array successive Vector3.
- * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
- * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
- * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
- * 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
- * When updating an instance, remember that only point positions can change, not the number of points.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
- /**
- * Creates an extruded shape mesh.
- * 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.
- * Please consider using the same method from the MeshBuilder class instead.
- *
- * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
- * 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
- * extruded along the Z axis.
- * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
- * 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.
- * The parameter `scale` (float, default 1) is the value to scale the shape.
- * 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
- * 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
- * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
- /**
- * Creates an custom extruded shape mesh.
- * 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.
- * Please consider using the same method from the MeshBuilder class instead.
- *
- * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
- * 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
- * extruded along the Z axis.
- * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
- * 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
- * and the distance of this point from the begining of the path :
- * ```javascript
- * var rotationFunction = function(i, distance) {
- * // do things
- * return rotationValue; }
- * ```
- * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
- * 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
- * and the distance of this point from the begining of the path :
- * ```javascript
- * var scaleFunction = function(i, distance) {
- * // do things
- * return scaleValue;}
- * ```
- * It must returns a float value that will be the scale value applied to the shape on each path point.
- * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
- * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
- * 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
- * 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
- * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- 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;
- /**
- * Creates lathe mesh.
- * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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
- * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
- * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
- * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a plane mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
- /**
- * Creates a ground mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
- * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
- /**
- * Creates a tiled ground mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
- * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
- * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
- * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
- * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
- * numbers of subdivisions on the ground width and height of each tile.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
- w: number;
- h: number;
- }, precision: {
- w: number;
- h: number;
- }, scene: Scene, updatable?: boolean): Mesh;
- /**
- * Creates a ground mesh from a height map.
- * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `url` sets the URL of the height map image resource.
- * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
- * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
- * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
- * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
- * 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).
- * This function is passed the newly built mesh :
- * ```javascript
- * function(mesh) { // do things
- * return; }
- * ```
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- 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;
- /**
- * Creates a tube mesh.
- * 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.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
- * The parameter `radius` (positive float, default 1) sets the tube radius size.
- * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
- * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
- * 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.
- * It must return a radius value (positive float) :
- * ```javascript
- * var radiusFunction = function(i, distance) {
- * // do things
- * return radius; }
- * ```
- * 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
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
- (i: number, distance: number): number;
- }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
- /**
- * Creates a polyhedron mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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
- * to choose the wanted type.
- * The parameter `size` (positive float, default 1) sets the polygon size.
- * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
- * 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`.
- * 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
- * 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)`).
- * 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
- * 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.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreatePolyhedron(name: string, options: {
- type?: number;
- size?: number;
- sizeX?: number;
- sizeY?: number;
- sizeZ?: number;
- custom?: any;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- updatable?: boolean;
- sideOrientation?: number;
- }, scene: Scene): Mesh;
- /**
- * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
- * Please consider using the same method from the MeshBuilder class instead.
- * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
- * 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`).
- * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
- * 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.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateIcoSphere(name: string, options: {
- radius?: number;
- flat?: boolean;
- subdivisions?: number;
- sideOrientation?: number;
- updatable?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a decal mesh.
- * Please consider using the same method from the MeshBuilder class instead.
- * 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.
- * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
- * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
- * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
- * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
- */
- static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
- /**
- * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
- */
- setPositionsForCPUSkinning(): Float32Array;
- /**
- * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
- */
- setNormalsForCPUSkinning(): Float32Array;
- /**
- * Update the vertex buffers by applying transformation from the bones
- * @param {skeleton} skeleton to apply
- */
- applySkeleton(skeleton: Skeleton): Mesh;
- /**
- * Returns an object `{min:` Vector3`, max:` Vector3`}`
- * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
- */
- static MinMax(meshes: AbstractMesh[]): {
- min: Vector3;
- max: Vector3;
- };
- /**
- * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
- */
- static Center(meshesOrMinMaxVector: any): Vector3;
- /**
- * Merge the array of meshes into a single mesh for performance reasons.
- * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
- * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
- * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
- * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
- */
- static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
- }
- }
- declare module BABYLON {
- interface IGetSetVerticesData {
- isVerticesDataPresent(kind: string): boolean;
- getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array;
- getIndices(copyWhenShared?: boolean): number[] | Int32Array;
- setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
- updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
- setIndices(indices: number[] | Int32Array): void;
- }
- class VertexData {
- positions: number[] | Float32Array;
- normals: number[] | Float32Array;
- uvs: number[] | Float32Array;
- uvs2: number[] | Float32Array;
- uvs3: number[] | Float32Array;
- uvs4: number[] | Float32Array;
- uvs5: number[] | Float32Array;
- uvs6: number[] | Float32Array;
- colors: number[] | Float32Array;
- matricesIndices: number[] | Float32Array;
- matricesWeights: number[] | Float32Array;
- matricesIndicesExtra: number[] | Float32Array;
- matricesWeightsExtra: number[] | Float32Array;
- indices: number[] | Int32Array;
- set(data: number[] | Float32Array, kind: string): void;
- applyToMesh(mesh: Mesh, updatable?: boolean): void;
- applyToGeometry(geometry: Geometry, updatable?: boolean): void;
- updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
- updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
- transform(matrix: Matrix): void;
- merge(other: VertexData): void;
- serialize(): any;
- static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
- static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
- static CreateRibbon(options: {
- pathArray: Vector3[][];
- closeArray?: boolean;
- closePath?: boolean;
- offset?: number;
- sideOrientation?: number;
- invertUV?: boolean;
- }): VertexData;
- static CreateBox(options: {
- size?: number;
- width?: number;
- height?: number;
- depth?: number;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- sideOrientation?: number;
- }): VertexData;
- static CreateSphere(options: {
- segments?: number;
- diameter?: number;
- diameterX?: number;
- diameterY?: number;
- diameterZ?: number;
- arc?: number;
- slice?: number;
- sideOrientation?: number;
- }): VertexData;
- static CreateCylinder(options: {
- height?: number;
- diameterTop?: number;
- diameterBottom?: number;
- diameter?: number;
- tessellation?: number;
- subdivisions?: number;
- arc?: number;
- faceColors?: Color4[];
- faceUV?: Vector4[];
- hasRings?: boolean;
- enclose?: boolean;
- sideOrientation?: number;
- }): VertexData;
- static CreateTorus(options: {
- diameter?: number;
- thickness?: number;
- tessellation?: number;
- sideOrientation?: number;
- }): VertexData;
- static CreateLineSystem(options: {
- lines: Vector3[][];
- }): VertexData;
- static CreateDashedLines(options: {
- points: Vector3[];
- dashSize?: number;
- gapSize?: number;
- dashNb?: number;
- }): VertexData;
- static CreateGround(options: {
- width?: number;
- height?: number;
- subdivisions?: number;
- subdivisionsX?: number;
- subdivisionsY?: number;
- }): VertexData;
- static CreateTiledGround(options: {
- xmin: number;
- zmin: number;
- xmax: number;
- zmax: number;
- subdivisions?: {
- w: number;
- h: number;
- };
- precision?: {
- w: number;
- h: number;
- };
- }): VertexData;
- static CreateGroundFromHeightMap(options: {
- width: number;
- height: number;
- subdivisions: number;
- minHeight: number;
- maxHeight: number;
- buffer: Uint8Array;
- bufferWidth: number;
- bufferHeight: number;
- }): VertexData;
- static CreatePlane(options: {
- size?: number;
- width?: number;
- height?: number;
- sideOrientation?: number;
- }): VertexData;
- static CreateDisc(options: {
- radius?: number;
- tessellation?: number;
- arc?: number;
- sideOrientation?: number;
- }): VertexData;
- static CreateIcoSphere(options: {
- radius?: number;
- radiusX?: number;
- radiusY?: number;
- radiusZ?: number;
- flat?: boolean;
- subdivisions?: number;
- sideOrientation?: number;
- }): VertexData;
- static CreatePolyhedron(options: {
- type?: number;
- size?: number;
- sizeX?: number;
- sizeY?: number;
- sizeZ?: number;
- custom?: any;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- flat?: boolean;
- sideOrientation?: number;
- }): VertexData;
- static CreateTorusKnot(options: {
- radius?: number;
- tube?: number;
- radialSegments?: number;
- tubularSegments?: number;
- p?: number;
- q?: number;
- sideOrientation?: number;
- }): VertexData;
- /**
- * @param {any} - positions (number[] or Float32Array)
- * @param {any} - indices (number[] or Uint16Array)
- * @param {any} - normals (number[] or Float32Array)
- */
- static ComputeNormals(positions: any, indices: any, normals: any): void;
- static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
- }
- }
- declare module BABYLON {
- class MeshBuilder {
- private static updateSideOrientation(orientation, scene);
- /**
- * Creates a box mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
- * The parameter `size` sets the size (float) of each box side (default 1).
- * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
- * 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).
- * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateBox(name: string, options: {
- size?: number;
- width?: number;
- height?: number;
- depth?: number;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- sideOrientation?: number;
- updatable?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a sphere mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
- * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
- * 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`).
- * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
- * 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
- * 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).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateSphere(name: string, options: {
- segments?: number;
- diameter?: number;
- diameterX?: number;
- diameterY?: number;
- diameterZ?: number;
- arc?: number;
- slice?: number;
- sideOrientation?: number;
- updatable?: boolean;
- }, scene: any): Mesh;
- /**
- * Creates a plane polygonal mesh. By default, this is a disc.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
- * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
- * 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.
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateDisc(name: string, options: {
- radius?: number;
- tessellation?: number;
- arc?: number;
- updatable?: boolean;
- sideOrientation?: number;
- }, scene: Scene): Mesh;
- /**
- * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
- * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
- * 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`).
- * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
- * 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.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateIcoSphere(name: string, options: {
- radius?: number;
- radiusX?: number;
- radiusY?: number;
- radiusZ?: number;
- flat?: boolean;
- subdivisions?: number;
- sideOrientation?: number;
- updatable?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a ribbon mesh.
- * 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.
- *
- * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
- * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
- * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
- * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
- * 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.
- * 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.
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateRibbon(name: string, options: {
- pathArray: Vector3[][];
- closeArray?: boolean;
- closePath?: boolean;
- offset?: number;
- updatable?: boolean;
- sideOrientation?: number;
- instance?: Mesh;
- invertUV?: boolean;
- }, scene?: Scene): Mesh;
- /**
- * Creates a cylinder or a cone mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
- * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
- * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
- * 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.
- * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
- * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
- * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
- * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
- * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
- * 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).
- * 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
- * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
- * 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
- * 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.
- * If `enclose` is false, a ring surface is one element.
- * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateCylinder(name: string, options: {
- height?: number;
- diameterTop?: number;
- diameterBottom?: number;
- diameter?: number;
- tessellation?: number;
- subdivisions?: number;
- arc?: number;
- faceColors?: Color4[];
- faceUV?: Vector4[];
- updatable?: boolean;
- hasRings?: boolean;
- enclose?: boolean;
- sideOrientation?: number;
- }, scene: any): Mesh;
- /**
- * Creates a torus mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
- * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
- * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
- * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTorus(name: string, options: {
- diameter?: number;
- thickness?: number;
- tessellation?: number;
- updatable?: boolean;
- sideOrientation?: number;
- }, scene: any): Mesh;
- /**
- * Creates a torus knot mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
- * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
- * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
- * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
- * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTorusKnot(name: string, options: {
- radius?: number;
- tube?: number;
- radialSegments?: number;
- tubularSegments?: number;
- p?: number;
- q?: number;
- updatable?: boolean;
- sideOrientation?: number;
- }, scene: any): Mesh;
- /**
- * Creates a line system mesh.
- * A line system is a pool of many lines gathered in a single mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
- * 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.
- * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
- * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
- * 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
- * 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
- * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateLineSystem(name: string, options: {
- lines: Vector3[][];
- updatable: boolean;
- instance?: LinesMesh;
- }, scene: Scene): LinesMesh;
- /**
- * Creates a line mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
- * 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.
- * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
- * The parameter `points` is an array successive Vector3.
- * 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
- * When updating an instance, remember that only point positions can change, not the number of points.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateLines(name: string, options: {
- points: Vector3[];
- updatable?: boolean;
- instance?: LinesMesh;
- }, scene: Scene): LinesMesh;
- /**
- * Creates a dashed line mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
- * 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.
- * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
- * The parameter `points` is an array successive Vector3.
- * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
- * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
- * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
- * 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
- * When updating an instance, remember that only point positions can change, not the number of points.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateDashedLines(name: string, options: {
- points: Vector3[];
- dashSize?: number;
- gapSize?: number;
- dashNb?: number;
- updatable?: boolean;
- instance?: LinesMesh;
- }, scene: Scene): LinesMesh;
- /**
- * Creates an extruded shape mesh.
- * 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.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
- *
- * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
- * 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
- * extruded along the Z axis.
- * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
- * 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.
- * The parameter `scale` (float, default 1) is the value to scale the shape.
- * 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
- * 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
- * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static ExtrudeShape(name: string, options: {
- shape: Vector3[];
- path: Vector3[];
- scale?: number;
- rotation?: number;
- cap?: number;
- updatable?: boolean;
- sideOrientation?: number;
- instance?: Mesh;
- invertUV?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates an custom extruded shape mesh.
- * 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.
- * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
- *
- * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
- * 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
- * extruded along the Z axis.
- * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
- * 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
- * and the distance of this point from the begining of the path :
- * ```javascript
- * var rotationFunction = function(i, distance) {
- * // do things
- * return rotationValue; }
- * ```
- * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
- * 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
- * and the distance of this point from the begining of the path :
- * ```javascript
- * var scaleFunction = function(i, distance) {
- * // do things
- * return scaleValue;}
- * ```
- * It must returns a float value that will be the scale value applied to the shape on each path point.
- * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
- * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
- * 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
- * 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
- * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static ExtrudeShapeCustom(name: string, options: {
- shape: Vector3[];
- path: Vector3[];
- scaleFunction?: any;
- rotationFunction?: any;
- ribbonCloseArray?: boolean;
- ribbonClosePath?: boolean;
- cap?: number;
- updatable?: boolean;
- sideOrientation?: number;
- instance?: Mesh;
- invertUV?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates lathe mesh.
- * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
- *
- * 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
- * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
- * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
- * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
- * 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.
- * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateLathe(name: string, options: {
- shape: Vector3[];
- radius?: number;
- tessellation?: number;
- arc?: number;
- closed?: boolean;
- updatable?: boolean;
- sideOrientation?: number;
- cap?: number;
- invertUV?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a plane mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
- * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
- * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
- * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreatePlane(name: string, options: {
- size?: number;
- width?: number;
- height?: number;
- sideOrientation?: number;
- updatable?: boolean;
- sourcePlane?: Plane;
- }, scene: Scene): Mesh;
- /**
- * Creates a ground mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
- * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
- * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateGround(name: string, options: {
- width?: number;
- height?: number;
- subdivisions?: number;
- subdivisionsX?: number;
- subdivisionsY?: number;
- updatable?: boolean;
- }, scene: any): Mesh;
- /**
- * Creates a tiled ground mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
- * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
- * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
- * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
- * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
- * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
- * numbers of subdivisions on the ground width and height of each tile.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTiledGround(name: string, options: {
- xmin: number;
- zmin: number;
- xmax: number;
- zmax: number;
- subdivisions?: {
- w: number;
- h: number;
- };
- precision?: {
- w: number;
- h: number;
- };
- updatable?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a ground mesh from a height map.
- * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
- * The parameter `url` sets the URL of the height map image resource.
- * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
- * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
- * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
- * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
- * 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).
- * This function is passed the newly built mesh :
- * ```javascript
- * function(mesh) { // do things
- * return; }
- * ```
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateGroundFromHeightMap(name: string, url: string, options: {
- width?: number;
- height?: number;
- subdivisions?: number;
- minHeight?: number;
- maxHeight?: number;
- updatable?: boolean;
- onReady?: (mesh: GroundMesh) => void;
- }, scene: Scene): GroundMesh;
- /**
- * Creates a tube mesh.
- * 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.
- *
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
- * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
- * The parameter `radius` (positive float, default 1) sets the tube radius size.
- * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
- * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
- * 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.
- * It must return a radius value (positive float) :
- * ```javascript
- * var radiusFunction = function(i, distance) {
- * // do things
- * return radius; }
- * ```
- * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
- * 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
- * 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
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreateTube(name: string, options: {
- path: Vector3[];
- radius?: number;
- tessellation?: number;
- radiusFunction?: {
- (i: number, distance: number): number;
- };
- cap?: number;
- arc?: number;
- updatable?: boolean;
- sideOrientation?: number;
- instance?: Mesh;
- invertUV?: boolean;
- }, scene: Scene): Mesh;
- /**
- * Creates a polyhedron mesh.
- *
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
- * 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
- * to choose the wanted type.
- * The parameter `size` (positive float, default 1) sets the polygon size.
- * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
- * 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`.
- * 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
- * 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)`).
- * 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
- * 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.
- * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
- * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
- */
- static CreatePolyhedron(name: string, options: {
- type?: number;
- size?: number;
- sizeX?: number;
- sizeY?: number;
- sizeZ?: number;
- custom?: any;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- flat?: boolean;
- updatable?: boolean;
- sideOrientation?: number;
- }, scene: Scene): Mesh;
- /**
- * Creates a decal mesh.
- * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
- * 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.
- * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
- * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
- * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
- * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
- */
- static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
- position?: Vector3;
- normal?: Vector3;
- size?: Vector3;
- angle?: number;
- }): Mesh;
- }
- }
- declare module BABYLON.Internals {
- class MeshLODLevel {
- distance: number;
- mesh: Mesh;
- constructor(distance: number, mesh: Mesh);
- }
- }
- declare module BABYLON {
- /**
- * A simplifier interface for future simplification implementations.
- */
- interface ISimplifier {
- /**
- * Simplification of a given mesh according to the given settings.
- * Since this requires computation, it is assumed that the function runs async.
- * @param settings The settings of the simplification, including quality and distance
- * @param successCallback A callback that will be called after the mesh was simplified.
- * @param errorCallback in case of an error, this callback will be called. optional.
- */
- simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
- }
- /**
- * Expected simplification settings.
- * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
- */
- interface ISimplificationSettings {
- quality: number;
- distance: number;
- optimizeMesh?: boolean;
- }
- class SimplificationSettings implements ISimplificationSettings {
- quality: number;
- distance: number;
- optimizeMesh: boolean;
- constructor(quality: number, distance: number, optimizeMesh?: boolean);
- }
- interface ISimplificationTask {
- settings: Array<ISimplificationSettings>;
- simplificationType: SimplificationType;
- mesh: Mesh;
- successCallback?: () => void;
- parallelProcessing: boolean;
- }
- class SimplificationQueue {
- running: any;
- constructor();
- addTask(task: ISimplificationTask): void;
- executeNext(): void;
- runSimplification(task: ISimplificationTask): void;
- private getSimplifier(task);
- }
- /**
- * The implemented types of simplification.
- * At the moment only Quadratic Error Decimation is implemented.
- */
- enum SimplificationType {
- QUADRATIC = 0,
- }
- class DecimationTriangle {
- vertices: Array<DecimationVertex>;
- normal: Vector3;
- error: Array<number>;
- deleted: boolean;
- isDirty: boolean;
- borderFactor: number;
- deletePending: boolean;
- originalOffset: number;
- constructor(vertices: Array<DecimationVertex>);
- }
- class DecimationVertex {
- position: Vector3;
- id: any;
- q: QuadraticMatrix;
- isBorder: boolean;
- triangleStart: number;
- triangleCount: number;
- originalOffsets: Array<number>;
- constructor(position: Vector3, id: any);
- updatePosition(newPosition: Vector3): void;
- }
- class QuadraticMatrix {
- data: Array<number>;
- constructor(data?: Array<number>);
- det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
- addInPlace(matrix: QuadraticMatrix): void;
- addArrayInPlace(data: Array<number>): void;
- add(matrix: QuadraticMatrix): QuadraticMatrix;
- static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
- static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
- }
- class Reference {
- vertexId: number;
- triangleId: number;
- constructor(vertexId: number, triangleId: number);
- }
- /**
- * An implementation of the Quadratic Error simplification algorithm.
- * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
- * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
- * @author RaananW
- */
- class QuadraticErrorSimplification implements ISimplifier {
- private triangles;
- private vertices;
- private references;
- private initialized;
- syncIterations: number;
- aggressiveness: number;
- decimationIterations: number;
- boundingBoxEpsilon: number;
- constructor(_mesh: Mesh);
- simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
- private isTriangleOnBoundingBox(triangle);
- private runDecimation(settings, submeshIndex, successCallback);
- private initWithMesh(submeshIndex, callback, optimizeMesh?);
- private init(callback);
- private reconstructMesh(submeshIndex);
- private initDecimatedMesh();
- private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
- private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
- private identifyBorder();
- private updateMesh(identifyBorders?);
- private vertexError(q, point);
- private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
- }
- }
- declare module BABYLON {
- class Polygon {
- static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
- static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
- static Parse(input: string): Vector2[];
- static StartingAt(x: number, y: number): Path2;
- }
- class PolygonMeshBuilder {
- constructor(name: string, contours: Path2, scene: Scene);
- constructor(name: string, contours: Vector2[], scene: Scene);
- addHole(hole: Vector2[]): PolygonMeshBuilder;
- build(updatable?: boolean, depth?: number): Mesh;
- private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
- }
- }
- declare module BABYLON {
- class SubMesh implements ICullable {
- materialIndex: number;
- verticesStart: number;
- verticesCount: number;
- indexStart: any;
- indexCount: number;
- linesIndexCount: number;
- constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
- IsGlobal: boolean;
- getBoundingInfo(): BoundingInfo;
- getMesh(): AbstractMesh;
- getRenderingMesh(): Mesh;
- getMaterial(): Material;
- refreshBoundingInfo(): void;
- updateBoundingInfo(world: Matrix): void;
- isInFrustum(frustumPlanes: Plane[]): boolean;
- isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
- render(enableAlphaMode: boolean): void;
- getLinesIndexBuffer(indices: number[] | Int32Array, engine: Engine): WebGLBuffer;
- canIntersects(ray: Ray): boolean;
- intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo;
- clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
- dispose(): void;
- static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
- }
- }
- declare module BABYLON {
- class VertexBuffer {
- constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
- getKind(): string;
- isUpdatable(): boolean;
- getData(): number[] | Float32Array;
- getBuffer(): WebGLBuffer;
- getStrideSize(): number;
- getOffset(): number;
- getSize(): number;
- getIsInstanced(): boolean;
- create(data?: number[] | Float32Array): void;
- update(data: number[] | Float32Array): void;
- updateDirectly(data: Float32Array, offset: number): void;
- dispose(): void;
- static PositionKind: string;
- static NormalKind: string;
- static UVKind: string;
- static UV2Kind: string;
- static UV3Kind: string;
- static UV4Kind: string;
- static UV5Kind: string;
- static UV6Kind: string;
- static ColorKind: string;
- static MatricesIndicesKind: string;
- static MatricesWeightsKind: string;
- static MatricesIndicesExtraKind: string;
- static MatricesWeightsExtraKind: string;
- }
- }
- declare module BABYLON {
- interface PhysicsImpostorJoint {
- mainImpostor: PhysicsImpostor;
- connectedImpostor: PhysicsImpostor;
- joint: PhysicsJoint;
- }
- class PhysicsEngine {
- gravity: Vector3;
- constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
- setGravity(gravity: Vector3): void;
- /**
- * Set the time step of the physics engine.
- * default is 1/60.
- * To slow it down, enter 1/600 for example.
- * To speed it up, 1/30
- * @param {number} newTimeStep the new timestep to apply to this world.
- */
- setTimeStep(newTimeStep?: number): void;
- dispose(): void;
- getPhysicsPluginName(): string;
- /**
- * @Deprecated
- *
- */
- static NoImpostor: number;
- static SphereImpostor: number;
- static BoxImpostor: number;
- static PlaneImpostor: number;
- static MeshImpostor: number;
- static CylinderImpostor: number;
- static HeightmapImpostor: number;
- static CapsuleImpostor: number;
- static ConeImpostor: number;
- static ConvexHullImpostor: number;
- static Epsilon: number;
- /**
- * Adding a new impostor for the impostor tracking.
- * This will be done by the impostor itself.
- * @param {PhysicsImpostor} impostor the impostor to add
- */
- addImpostor(impostor: PhysicsImpostor): void;
- /**
- * Remove an impostor from the engine.
- * This impostor and its mesh will not longer be updated by the physics engine.
- * @param {PhysicsImpostor} impostor the impostor to remove
- */
- removeImpostor(impostor: PhysicsImpostor): void;
- /**
- * Add a joint to the physics engine
- * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
- * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
- * @param {PhysicsJoint} the joint that will connect both impostors.
- */
- addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
- removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
- /**
- * Called by the scene. no need to call it.
- */
- getPhysicsPlugin(): IPhysicsEnginePlugin;
- getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
- getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
- }
- interface IPhysicsEnginePlugin {
- world: any;
- name: string;
- setGravity(gravity: Vector3): any;
- setTimeStep(timeStep: number): any;
- executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
- applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
- applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
- generatePhysicsBody(impostor: PhysicsImpostor): any;
- removePhysicsBody(impostor: PhysicsImpostor): any;
- generateJoint(joint: PhysicsImpostorJoint): any;
- removeJoint(joint: PhysicsImpostorJoint): any;
- isSupported(): boolean;
- setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
- setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
- setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
- setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
- getLinearVelocity(impostor: PhysicsImpostor): Vector3;
- getAngularVelocity(impostor: PhysicsImpostor): Vector3;
- setBodyMass(impostor: PhysicsImpostor, mass: number): any;
- sleepBody(impostor: PhysicsImpostor): any;
- wakeUpBody(impostor: PhysicsImpostor): any;
- updateDistanceJoint(joint: DistanceJoint, maxDistance: number, minDistance?: number): any;
- setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
- setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
- dispose(): any;
- }
- }
- declare module BABYLON {
- interface PhysicsImpostorParameters {
- mass: number;
- friction?: number;
- restitution?: number;
- nativeOptions?: any;
- }
- interface IPhysicsEnabledObject {
- position: Vector3;
- rotationQuaternion: Quaternion;
- scaling: Vector3;
- rotation?: Vector3;
- parent?: any;
- getBoundingInfo?(): BoundingInfo;
- computeWorldMatrix?(force: boolean): void;
- getChildMeshes?(): Array<AbstractMesh>;
- getVerticesData?(kind: string): Array<number> | Float32Array;
- getIndices?(): Array<number> | Int32Array;
- getScene?(): Scene;
- }
- class PhysicsImpostor {
- object: IPhysicsEnabledObject;
- type: number;
- static DEFAULT_OBJECT_SIZE: Vector3;
- uniqueId: number;
- constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
- /**
- * This function will completly initialize this impostor.
- * It will create a new body - but only if this mesh has no parent.
- * If it has, this impostor will not be used other than to define the impostor
- * of the child mesh.
- */
- /**
- * Should a new body be generated.
- */
- isBodyInitRequired(): boolean;
- setScalingUpdated(updated: boolean): void;
- /**
- * Force a regeneration of this or the parent's impostor's body.
- * Use under cautious - This will remove all joints already implemented.
- */
- forceUpdate(): void;
- /**
- * Gets the body that holds this impostor. Either its own, or its parent.
- */
- /**
- * Set the physics body. Used mainly by the physics engine/plugin
- */
- physicsBody: any;
- parent: PhysicsImpostor;
- resetUpdateFlags(): void;
- getObjectExtendSize(): Vector3;
- getObjectCenter(): Vector3;
- /**
- * Get a specific parametes from the options parameter.
- */
- getParam(paramName: string): any;
- /**
- * Sets a specific parameter in the options given to the physics plugin
- */
- setParam(paramName: string, value: number): void;
- /**
- * Specifically change the body's mass option. Won't recreate the physics body object
- */
- setMass(mass: number): void;
- getLinearVelocity(): Vector3;
- /**
- * Set the body's linear velocity.
- */
- setLinearVelocity(velocity: Vector3): void;
- getAngularVelocity(): Vector3;
- /**
- * Set the body's linear velocity.
- */
- setAngularVelocity(velocity: Vector3): void;
- /**
- * Execute a function with the physics plugin native code.
- * Provide a function the will have two variables - the world object and the physics body object.
- */
- executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
- /**
- * Register a function that will be executed before the physics world is stepping forward.
- */
- registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
- unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
- /**
- * Register a function that will be executed after the physics step
- */
- registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
- unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
- /**
- * register a function that will be executed when this impostor collides against a different body.
- */
- registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
- unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
- /**
- * this function is executed by the physics engine.
- */
- beforeStep: () => void;
- /**
- * this function is executed by the physics engine.
- */
- afterStep: () => void;
- onCollide: (e: {
- body: any;
- }) => void;
- /**
- * Apply a force
- */
- applyForce(force: Vector3, contactPoint: Vector3): void;
- /**
- * Apply an impulse
- */
- applyImpulse(force: Vector3, contactPoint: Vector3): void;
- /**
- * A help function to create a joint.
- */
- createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
- /**
- * Add a joint to this impostor with a different impostor.
- */
- addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
- /**
- * Will keep this body still, in a sleep mode.
- */
- sleep(): void;
- /**
- * Wake the body up.
- */
- wakeUp(): void;
- clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
- dispose(): void;
- setDeltaPosition(position: Vector3): void;
- setDeltaRotation(rotation: Quaternion): void;
- static NoImpostor: number;
- static SphereImpostor: number;
- static BoxImpostor: number;
- static PlaneImpostor: number;
- static MeshImpostor: number;
- static CylinderImpostor: number;
- static ParticleImpostor: number;
- static HeightmapImpostor: number;
- }
- }
- declare module BABYLON {
- interface PhysicsJointData {
- mainPivot?: Vector3;
- connectedPivot?: Vector3;
- mainAxis?: Vector3;
- connectedAxis?: Vector3;
- collision?: boolean;
- nativeParams?: any;
- }
- /**
- * This is a holder class for the physics joint created by the physics plugin.
- * It holds a set of functions to control the underlying joint.
- */
- class PhysicsJoint {
- type: number;
- jointData: PhysicsJointData;
- constructor(type: number, jointData: PhysicsJointData);
- physicsJoint: any;
- physicsPlugin: IPhysicsEnginePlugin;
- /**
- * Execute a function that is physics-plugin specific.
- * @param {Function} func the function that will be executed.
- * It accepts two parameters: the physics world and the physics joint.
- */
- executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
- static DistanceJoint: number;
- static HingeJoint: number;
- static BallAndSocketJoint: number;
- static WheelJoint: number;
- static SliderJoint: number;
- static PrismaticJoint: number;
- static UniversalJoint: number;
- static Hinge2Joint: number;
- static PointToPointJoint: number;
- static SpringJoint: number;
- static LockJoint: number;
- }
- /**
- * A class representing a physics distance joint.
- */
- class DistanceJoint extends PhysicsJoint {
- constructor(jointData: DistanceJointData);
- /**
- * Update the predefined distance.
- */
- updateDistance(maxDistance: number, minDistance?: number): void;
- }
- class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
- constructor(type: number, jointData: PhysicsJointData);
- /**
- * Set the motor values.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- * @param {number} force the force to apply
- * @param {number} maxForce max force for this motor.
- */
- setMotor(force?: number, maxForce?: number): void;
- /**
- * Set the motor's limits.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- */
- setLimit(upperLimit: number, lowerLimit?: number): void;
- }
- /**
- * This class represents a single hinge physics joint
- */
- class HingeJoint extends MotorEnabledJoint {
- constructor(jointData: PhysicsJointData);
- /**
- * Set the motor values.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- * @param {number} force the force to apply
- * @param {number} maxForce max force for this motor.
- */
- setMotor(force?: number, maxForce?: number): void;
- /**
- * Set the motor's limits.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- */
- setLimit(upperLimit: number, lowerLimit?: number): void;
- }
- /**
- * This class represents a dual hinge physics joint (same as wheel joint)
- */
- class Hinge2Joint extends MotorEnabledJoint {
- constructor(jointData: PhysicsJointData);
- /**
- * Set the motor values.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- * @param {number} force the force to apply
- * @param {number} maxForce max force for this motor.
- * @param {motorIndex} the motor's index, 0 or 1.
- */
- setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
- /**
- * Set the motor limits.
- * Attention, this function is plugin specific. Engines won't react 100% the same.
- * @param {number} upperLimit the upper limit
- * @param {number} lowerLimit lower limit
- * @param {motorIndex} the motor's index, 0 or 1.
- */
- setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
- }
- interface IMotorEnabledJoint {
- physicsJoint: any;
- setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
- setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
- }
- interface DistanceJointData extends PhysicsJointData {
- maxDistance: number;
- }
- interface SpringJointData extends PhysicsJointData {
- length: number;
- stiffness: number;
- damping: number;
- }
- }
- declare module BABYLON {
- class ReflectionProbe {
- name: string;
- invertYAxis: boolean;
- position: Vector3;
- constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
- refreshRate: number;
- getScene(): Scene;
- cubeTexture: RenderTargetTexture;
- renderList: AbstractMesh[];
- attachToMesh(mesh: AbstractMesh): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class AnaglyphPostProcess extends PostProcess {
- constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class BlackAndWhitePostProcess extends PostProcess {
- constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class BlurPostProcess extends PostProcess {
- direction: Vector2;
- blurWidth: number;
- constructor(name: string, direction: Vector2, blurWidth: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class ColorCorrectionPostProcess extends PostProcess {
- constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class ConvolutionPostProcess extends PostProcess {
- kernel: number[];
- constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- static EdgeDetect0Kernel: number[];
- static EdgeDetect1Kernel: number[];
- static EdgeDetect2Kernel: number[];
- static SharpenKernel: number[];
- static EmbossKernel: number[];
- static GaussianKernel: number[];
- }
- }
- declare module BABYLON {
- class DisplayPassPostProcess extends PostProcess {
- constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class FilterPostProcess extends PostProcess {
- kernelMatrix: Matrix;
- constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class FxaaPostProcess extends PostProcess {
- texelWidth: number;
- texelHeight: number;
- constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
- /**
- * Public members
- */
- /**
- * Gaussian blur coefficient
- * @type {number}
- */
- gaussCoeff: number;
- /**
- * Gaussian blur mean
- * @type {number}
- */
- gaussMean: number;
- /**
- * Gaussian blur standard deviation
- * @type {number}
- */
- gaussStandDev: number;
- /**
- * Gaussian blur multiplier. Multiplies the blur effect
- * @type {number}
- */
- gaussMultiplier: number;
- /**
- * Exposure, controls the overall intensity of the pipeline
- * @type {number}
- */
- exposure: number;
- /**
- * Minimum luminance that the post-process can output. Luminance is >= 0
- * @type {number}
- */
- minimumLuminance: number;
- /**
- * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
- * @type {number}
- */
- maximumLuminance: number;
- /**
- * Increase rate for luminance: eye adaptation speed to dark
- * @type {number}
- */
- luminanceIncreaserate: number;
- /**
- * Decrease rate for luminance: eye adaptation speed to bright
- * @type {number}
- */
- luminanceDecreaseRate: number;
- /**
- * Minimum luminance needed to compute HDR
- * @type {number}
- */
- brightThreshold: number;
- /**
- * Private members
- */
- static LUM_STEPS: number;
- /**
- * @constructor
- * @param {string} name - The rendering pipeline name
- * @param {BABYLON.Scene} scene - The scene linked to this pipeline
- * @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)
- * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
- * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
- */
- constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
- /**
- * Tells the pipeline to update its post-processes
- */
- update(): void;
- /**
- * Returns the current calculated luminance
- */
- getCurrentLuminance(): number;
- /**
- * Returns the currently drawn luminance
- */
- getOutputLuminance(): number;
- /**
- * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
- */
- dispose(): void;
- /**
- * Creates the HDR post-process and computes the luminance adaptation
- */
- /**
- * Texture Adder post-process
- */
- /**
- * Down sample X4 post-process
- */
- /**
- * Bright pass post-process
- */
- /**
- * Luminance generator. Creates the luminance post-process and down sample post-processes
- */
- /**
- * Gaussian blur post-processes. Horizontal and Vertical
- */
- }
- }
- declare module BABYLON {
- class LensRenderingPipeline extends PostProcessRenderPipeline {
- /**
- * The chromatic aberration PostProcess id in the pipeline
- * @type {string}
- */
- LensChromaticAberrationEffect: string;
- /**
- * The highlights enhancing PostProcess id in the pipeline
- * @type {string}
- */
- HighlightsEnhancingEffect: string;
- /**
- * The depth-of-field PostProcess id in the pipeline
- * @type {string}
- */
- LensDepthOfFieldEffect: string;
- /**
- * @constructor
- *
- * Effect parameters are as follow:
- * {
- * chromatic_aberration: number; // from 0 to x (1 for realism)
- * edge_blur: number; // from 0 to x (1 for realism)
- * distortion: number; // from 0 to x (1 for realism)
- * grain_amount: number; // from 0 to 1
- * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
- * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
- * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
- * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
- * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
- * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
- * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
- * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
- * }
- * Note: if an effect parameter is unset, effect is disabled
- *
- * @param {string} name - The rendering pipeline name
- * @param {object} parameters - An object containing all parameters (see above)
- * @param {BABYLON.Scene} scene - The scene linked to this pipeline
- * @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)
- * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
- */
- constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
- setEdgeBlur(amount: number): void;
- disableEdgeBlur(): void;
- setGrainAmount(amount: number): void;
- disableGrain(): void;
- setChromaticAberration(amount: number): void;
- disableChromaticAberration(): void;
- setEdgeDistortion(amount: number): void;
- disableEdgeDistortion(): void;
- setFocusDistance(amount: number): void;
- disableDepthOfField(): void;
- setAperture(amount: number): void;
- setDarkenOutOfFocus(amount: number): void;
- enablePentagonBokeh(): void;
- disablePentagonBokeh(): void;
- enableNoiseBlur(): void;
- disableNoiseBlur(): void;
- setHighlightsGain(amount: number): void;
- setHighlightsThreshold(amount: number): void;
- disableHighlights(): void;
- /**
- * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
- */
- dispose(disableDepthRender?: boolean): void;
- }
- }
- declare module BABYLON {
- class PassPostProcess extends PostProcess {
- constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- type PostProcessOptions = {
- width: number;
- height: number;
- };
- class PostProcess {
- name: string;
- width: number;
- height: number;
- renderTargetSamplingMode: number;
- clearColor: Color4;
- enablePixelPerfectMode: boolean;
- /**
- * An event triggered when the postprocess is activated.
- * @type {BABYLON.Observable}
- */
- onActivateObservable: Observable<Camera>;
- onActivate: (camera: Camera) => void;
- /**
- * An event triggered when the postprocess changes its size.
- * @type {BABYLON.Observable}
- */
- onSizeChangedObservable: Observable<PostProcess>;
- onSizeChanged: (postProcess: PostProcess) => void;
- /**
- * An event triggered when the postprocess applies its effect.
- * @type {BABYLON.Observable}
- */
- onApplyObservable: Observable<Effect>;
- onApply: (effect: Effect) => void;
- /**
- * An event triggered before rendering the postprocess
- * @type {BABYLON.Observable}
- */
- onBeforeRenderObservable: Observable<Effect>;
- onBeforeRender: (effect: Effect) => void;
- /**
- * An event triggered after rendering the postprocess
- * @type {BABYLON.Observable}
- */
- onAfterRenderObservable: Observable<Effect>;
- onAfterRender: (efect: Effect) => void;
- constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
- updateEffect(defines?: string): void;
- isReusable(): boolean;
- /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
- markTextureDirty(): void;
- activate(camera: Camera, sourceTexture?: WebGLTexture): void;
- isSupported: boolean;
- apply(): Effect;
- dispose(camera?: Camera): void;
- }
- }
- declare module BABYLON {
- class PostProcessManager {
- constructor(scene: Scene);
- directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class RefractionPostProcess extends PostProcess {
- color: Color3;
- depth: number;
- colorLevel: number;
- constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
- dispose(camera: Camera): void;
- }
- }
- declare module BABYLON {
- class SSAORenderingPipeline extends PostProcessRenderPipeline {
- /**
- * The PassPostProcess id in the pipeline that contains the original scene color
- * @type {string}
- */
- SSAOOriginalSceneColorEffect: string;
- /**
- * The SSAO PostProcess id in the pipeline
- * @type {string}
- */
- SSAORenderEffect: string;
- /**
- * The horizontal blur PostProcess id in the pipeline
- * @type {string}
- */
- SSAOBlurHRenderEffect: string;
- /**
- * The vertical blur PostProcess id in the pipeline
- * @type {string}
- */
- SSAOBlurVRenderEffect: string;
- /**
- * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
- * @type {string}
- */
- SSAOCombineRenderEffect: string;
- /**
- * The output strength of the SSAO post-process. Default value is 1.0.
- * @type {number}
- */
- totalStrength: number;
- /**
- * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
- * @type {number}
- */
- radius: number;
- /**
- * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
- * Must not be equal to fallOff and superior to fallOff.
- * Default value is 0.975
- * @type {number}
- */
- area: number;
- /**
- * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
- * Must not be equal to area and inferior to area.
- * Default value is 0.0
- * @type {number}
- */
- fallOff: number;
- /**
- * The base color of the SSAO post-process
- * The final result is "base + ssao" between [0, 1]
- * @type {number}
- */
- base: number;
- /**
- * @constructor
- * @param {string} name - The rendering pipeline name
- * @param {BABYLON.Scene} scene - The scene linked to this pipeline
- * @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 }
- * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
- */
- constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
- /**
- * Returns the horizontal blur PostProcess
- * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
- */
- getBlurHPostProcess(): BlurPostProcess;
- /**
- * Returns the vertical blur PostProcess
- * @return {BABYLON.BlurPostProcess} The vertical blur post-process
- */
- getBlurVPostProcess(): BlurPostProcess;
- /**
- * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
- */
- dispose(disableDepthRender?: boolean): void;
- }
- }
- declare module BABYLON {
- class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
- /**
- * Public members
- */
- originalPostProcess: PostProcess;
- downSampleX4PostProcess: PostProcess;
- brightPassPostProcess: PostProcess;
- gaussianBlurHPostProcesses: PostProcess[];
- gaussianBlurVPostProcesses: PostProcess[];
- textureAdderPostProcess: PostProcess;
- textureAdderFinalPostProcess: PostProcess;
- lensFlarePostProcess: PostProcess;
- lensFlareComposePostProcess: PostProcess;
- depthOfFieldPostProcess: PostProcess;
- brightThreshold: number;
- blurWidth: number;
- gaussianCoefficient: number;
- gaussianMean: number;
- gaussianStandardDeviation: number;
- exposure: number;
- lensTexture: Texture;
- lensColorTexture: Texture;
- lensFlareStrength: number;
- lensFlareGhostDispersal: number;
- lensFlareHaloWidth: number;
- lensFlareDistortionStrength: number;
- lensStarTexture: Texture;
- lensFlareDirtTexture: Texture;
- depthOfFieldDistance: number;
- animations: Animation[];
- /**
- * Private members
- */
- DepthOfFieldEnabled: boolean;
- LensFlareEnabled: boolean;
- /**
- * @constructor
- * @param {string} name - The rendering pipeline name
- * @param {BABYLON.Scene} scene - The scene linked to this pipeline
- * @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)
- * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
- * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
- */
- constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
- dispose(): void;
- }
- }
- declare module BABYLON {
- class StereoscopicInterlacePostProcess extends PostProcess {
- constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
- }
- }
- declare module BABYLON {
- enum TonemappingOperator {
- Hable = 0,
- Reinhard = 1,
- HejiDawson = 2,
- Photographic = 3,
- }
- class TonemapPostProcess extends PostProcess {
- exposureAdjustment: number;
- constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
- }
- }
- declare module BABYLON {
- class VolumetricLightScatteringPostProcess extends PostProcess {
- /**
- * If not undefined, the mesh position is computed from the attached node position
- * @type {{position: Vector3}}
- */
- attachedNode: {
- position: Vector3;
- };
- /**
- * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
- * @type {Vector3}
- */
- customMeshPosition: Vector3;
- /**
- * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
- * @type {boolean}
- */
- useCustomMeshPosition: boolean;
- /**
- * If the post-process should inverse the light scattering direction
- * @type {boolean}
- */
- invert: boolean;
- /**
- * The internal mesh used by the post-process
- * @type {boolean}
- */
- mesh: Mesh;
- useDiffuseColor: boolean;
- /**
- * Array containing the excluded meshes not rendered in the internal pass
- */
- excludedMeshes: AbstractMesh[];
- /**
- * Controls the overall intensity of the post-process
- * @type {number}
- */
- exposure: number;
- /**
- * Dissipates each sample's contribution in range [0, 1]
- * @type {number}
- */
- decay: number;
- /**
- * Controls the overall intensity of each sample
- * @type {number}
- */
- weight: number;
- /**
- * Controls the density of each sample
- * @type {number}
- */
- density: number;
- /**
- * @constructor
- * @param {string} name - The post-process name
- * @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)
- * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
- * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
- * @param {number} samples - The post-process quality, default 100
- * @param {number} samplingMode - The post-process filtering mode
- * @param {BABYLON.Engine} engine - The babylon engine
- * @param {boolean} reusable - If the post-process is reusable
- * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
- */
- constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
- isReady(subMesh: SubMesh, useInstances: boolean): boolean;
- /**
- * Sets the new light position for light scattering effect
- * @param {BABYLON.Vector3} The new custom light position
- */
- setCustomMeshPosition(position: Vector3): void;
- /**
- * Returns the light position for light scattering effect
- * @return {BABYLON.Vector3} The custom light position
- */
- getCustomMeshPosition(): Vector3;
- /**
- * Disposes the internal assets and detaches the post-process from the camera
- */
- dispose(camera: Camera): void;
- /**
- * Returns the render target texture used by the post-process
- * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
- */
- getPass(): RenderTargetTexture;
- /**
- * Creates a default mesh for the Volumeric Light Scattering post-process
- * @param {string} The mesh name
- * @param {BABYLON.Scene} The scene where to create the mesh
- * @return {BABYLON.Mesh} the default mesh
- */
- static CreateDefaultMesh(name: string, scene: Scene): Mesh;
- }
- }
- declare module BABYLON {
- class VRDistortionCorrectionPostProcess extends PostProcess {
- aspectRatio: number;
- constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
- }
- }
- declare module BABYLON {
- class BoundingBoxRenderer {
- frontColor: Color3;
- backColor: Color3;
- showBackLines: boolean;
- renderList: SmartArray<BoundingBox>;
- constructor(scene: Scene);
- reset(): void;
- render(): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class DepthRenderer {
- constructor(scene: Scene, type?: number);
- isReady(subMesh: SubMesh, useInstances: boolean): boolean;
- getDepthMap(): RenderTargetTexture;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class EdgesRenderer {
- edgesWidthScalerForOrthographic: number;
- edgesWidthScalerForPerspective: number;
- constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
- dispose(): void;
- render(): void;
- }
- }
- declare module BABYLON {
- class OutlineRenderer {
- constructor(scene: Scene);
- render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
- isReady(subMesh: SubMesh, useInstances: boolean): boolean;
- }
- }
- declare module BABYLON {
- class RenderingGroup {
- index: number;
- onBeforeTransparentRendering: () => void;
- /**
- * Set the opaque sort comparison function.
- * If null the sub meshes will be render in the order they were created
- */
- opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
- /**
- * Set the alpha test sort comparison function.
- * If null the sub meshes will be render in the order they were created
- */
- alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
- /**
- * Set the transparent sort comparison function.
- * If null the sub meshes will be render in the order they were created
- */
- transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
- /**
- * Creates a new rendering group.
- * @param index The rendering group index
- * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
- * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
- * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
- */
- constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
- /**
- * Render all the sub meshes contained in the group.
- * @param customRenderFunction Used to override the default render behaviour of the group.
- * @returns true if rendered some submeshes.
- */
- render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
- /**
- * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
- * @param subMeshes The submeshes to render
- */
- private renderOpaqueSorted(subMeshes);
- /**
- * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
- * @param subMeshes The submeshes to render
- */
- private renderAlphaTestSorted(subMeshes);
- /**
- * Renders the opaque submeshes in the order from the transparentSortCompareFn.
- * @param subMeshes The submeshes to render
- */
- private renderTransparentSorted(subMeshes);
- /**
- * Renders the submeshes in a specified order.
- * @param subMeshes The submeshes to sort before render
- * @param sortCompareFn The comparison function use to sort
- * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
- * @param transparent Specifies to activate blending if true
- */
- private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
- /**
- * Renders the submeshes in the order they were dispatched (no sort applied).
- * @param subMeshes The submeshes to render
- */
- private static renderUnsorted(subMeshes);
- /**
- * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
- * are rendered back to front if in the same alpha index.
- *
- * @param a The first submesh
- * @param b The second submesh
- * @returns The result of the comparison
- */
- static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
- /**
- * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
- * are rendered back to front.
- *
- * @param a The first submesh
- * @param b The second submesh
- * @returns The result of the comparison
- */
- static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
- /**
- * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
- * are rendered front to back (prevent overdraw).
- *
- * @param a The first submesh
- * @param b The second submesh
- * @returns The result of the comparison
- */
- static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
- /**
- * Resets the different lists of submeshes to prepare a new frame.
- */
- prepare(): void;
- /**
- * Inserts the submesh in its correct queue depending on its material.
- * @param subMesh The submesh to dispatch
- */
- dispatch(subMesh: SubMesh): void;
- }
- }
- declare module BABYLON {
- class RenderingManager {
- /**
- * The max id used for rendering groups (not included)
- */
- static MAX_RENDERINGGROUPS: number;
- /**
- * The min id used for rendering groups (included)
- */
- static MIN_RENDERINGGROUPS: number;
- constructor(scene: Scene);
- render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
- reset(): void;
- dispatch(subMesh: SubMesh): void;
- /**
- * Overrides the default sort function applied in the renderging group to prepare the meshes.
- * This allowed control for front to back rendering or reversly depending of the special needs.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
- * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
- * @param transparentSortCompareFn The transparent queue comparison function use to sort.
- */
- setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
- /**
- * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
- */
- setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
- }
- }
- declare module BABYLON {
- class Sprite {
- name: string;
- position: Vector3;
- color: Color4;
- width: number;
- height: number;
- angle: number;
- cellIndex: number;
- invertU: number;
- invertV: number;
- disposeWhenFinishedAnimating: boolean;
- animations: Animation[];
- isPickable: boolean;
- actionManager: ActionManager;
- size: number;
- constructor(name: string, manager: SpriteManager);
- playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
- stopAnimation(): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class SpriteManager {
- name: string;
- sprites: Sprite[];
- renderingGroupId: number;
- layerMask: number;
- fogEnabled: boolean;
- isPickable: boolean;
- cellWidth: number;
- cellHeight: number;
- /**
- * An event triggered when the manager is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<SpriteManager>;
- onDispose: () => void;
- texture: Texture;
- constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
- intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
- render(): void;
- dispose(): void;
- }
- }
- declare module BABYLON.Internals {
- class _AlphaState {
- /**
- * Initializes the state.
- */
- constructor();
- isDirty: boolean;
- alphaBlend: boolean;
- setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
- reset(): void;
- apply(gl: WebGLRenderingContext): void;
- }
- }
- declare module BABYLON.Internals {
- class _DepthCullingState {
- /**
- * Initializes the state.
- */
- constructor();
- isDirty: boolean;
- zOffset: number;
- cullFace: number;
- cull: boolean;
- depthFunc: number;
- depthMask: boolean;
- depthTest: boolean;
- reset(): void;
- apply(gl: WebGLRenderingContext): void;
- }
- }
- declare module BABYLON.Internals {
- class _StencilState {
- isDirty: boolean;
- stencilFunc: number;
- stencilFuncRef: number;
- stencilFuncMask: number;
- stencilOpStencilFail: number;
- stencilOpDepthFail: number;
- stencilOpStencilDepthPass: number;
- stencilMask: number;
- stencilTest: boolean;
- constructor();
- reset(): void;
- apply(gl: WebGLRenderingContext): void;
- }
- }
- declare module BABYLON.Internals {
- class AndOrNotEvaluator {
- static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
- }
- }
- declare module BABYLON {
- interface IAssetTask {
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- run(scene: Scene, onSuccess: () => void, onError: () => void): any;
- }
- class MeshAssetTask implements IAssetTask {
- name: string;
- meshesNames: any;
- rootUrl: string;
- sceneFilename: string;
- loadedMeshes: Array<AbstractMesh>;
- loadedParticleSystems: Array<ParticleSystem>;
- loadedSkeletons: Array<Skeleton>;
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- class TextFileAssetTask implements IAssetTask {
- name: string;
- url: string;
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- text: string;
- constructor(name: string, url: string);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- class BinaryFileAssetTask implements IAssetTask {
- name: string;
- url: string;
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- data: ArrayBuffer;
- constructor(name: string, url: string);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- class ImageAssetTask implements IAssetTask {
- name: string;
- url: string;
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- image: HTMLImageElement;
- constructor(name: string, url: string);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- interface ITextureAssetTask extends IAssetTask {
- onSuccess: (task: ITextureAssetTask) => void;
- onError: (task: ITextureAssetTask) => void;
- texture: Texture;
- }
- class TextureAssetTask implements ITextureAssetTask {
- name: string;
- url: string;
- noMipmap: boolean;
- invertY: boolean;
- samplingMode: number;
- onSuccess: (task: ITextureAssetTask) => void;
- onError: (task: ITextureAssetTask) => void;
- isCompleted: boolean;
- texture: Texture;
- constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- class CubeTextureAssetTask implements IAssetTask {
- name: string;
- url: string;
- extensions: string[];
- noMipmap: boolean;
- files: string[];
- onSuccess: (task: IAssetTask) => void;
- onError: (task: IAssetTask) => void;
- isCompleted: boolean;
- texture: CubeTexture;
- constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
- run(scene: Scene, onSuccess: () => void, onError: () => void): void;
- }
- class AssetsManager {
- protected tasks: IAssetTask[];
- protected waitingTasksCount: number;
- onFinish: (tasks: IAssetTask[]) => void;
- onTaskSuccess: (task: IAssetTask) => void;
- onTaskError: (task: IAssetTask) => void;
- useDefaultLoadingScreen: boolean;
- constructor(scene: Scene);
- addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
- addTextFileTask(taskName: string, url: string): IAssetTask;
- addBinaryFileTask(taskName: string, url: string): IAssetTask;
- addImageTask(taskName: string, url: string): IAssetTask;
- addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
- reset(): AssetsManager;
- load(): AssetsManager;
- }
- }
- declare module BABYLON {
- class Database {
- private callbackManifestChecked;
- private currentSceneUrl;
- private db;
- private enableSceneOffline;
- private enableTexturesOffline;
- private manifestVersionFound;
- private mustUpdateRessources;
- private hasReachedQuota;
- private isSupported;
- private idbFactory;
- static IsUASupportingBlobStorage: boolean;
- static IDBStorageEnabled: boolean;
- constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
- static parseURL: (url: string) => string;
- static ReturnFullUrlLocation: (url: string) => string;
- checkManifestFile(): void;
- openAsync(successCallback: any, errorCallback: any): void;
- loadImageFromDB(url: string, image: HTMLImageElement): void;
- private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
- }
- }
- declare module BABYLON {
- function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
- class SerializationHelper {
- static Serialize<T>(entity: T, serializationObject?: any): any;
- static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
- static Clone<T>(creationFunction: () => T, source: T): T;
- }
- }
- declare module BABYLON {
- class DynamicFloatArrayElementInfo {
- offset: number;
- }
- /**
- * 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.
- * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
- * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
- * 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.
- * 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.
- * 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".
- */
- class DynamicFloatArray {
- /**
- * Construct an instance of the dynamic float array
- * @param stride size of one element in float (i.e. not bytes!)
- * @param initialElementCount the number of available entries at construction
- */
- constructor(stride: number, initialElementCount: number);
- /**
- * Allocate an element in the array.
- * @return the element info instance that contains the offset into the main buffer of the element's location.
- * Beware, this offset may change when you call pack()
- */
- allocElement(): DynamicFloatArrayElementInfo;
- /**
- * Free the element corresponding to the given element info
- * @param elInfo the element that describe the allocated element
- */
- freeElement(elInfo: DynamicFloatArrayElementInfo): void;
- /**
- * This method will pack all the used elements into a linear sequence and put all the free space at the end.
- * 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().
- * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
- */
- pack(): Float32Array;
- /**
- * 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!
- * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
- */
- buffer: Float32Array;
- /**
- * Get the total count of entries that can fit in the current buffer
- * @returns the elements count
- */
- totalElementCount: number;
- /**
- * Get the count of free entries that can still be allocated without resizing the buffer
- * @returns the free elements count
- */
- freeElementCount: number;
- /**
- * Get the count of allocated elements
- * @returns the allocated elements count
- */
- usedElementCount: number;
- /**
- * Return the size of one element in float
- * @returns the size in float
- */
- stride: number;
- compareValueOffset: number;
- sortingAscending: boolean;
- sort(): boolean;
- }
- }
- declare module Earcut {
- /**
- * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
- * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
- * @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).
- * @param dim is the number of coordinates per vertice in the input array (2 by default).
- */
- function earcut(data: number[], holeIndices: number[], dim: number): any[];
- /**
- * return a percentage difference between the polygon area and its triangulation area;
- * used to verify correctness of triangulation
- */
- function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
- /**
- * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
- */
- function flatten(data: number[][][]): {
- vertices: any[];
- holes: any[];
- dimensions: number;
- };
- }
- declare module BABYLON {
- class FilesInput {
- static FilesTextures: any[];
- static FilesToLoad: any[];
- 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);
- monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
- private renderFunction();
- private drag(e);
- private drop(eventDrop);
- loadFiles(event: any): void;
- reload(): void;
- }
- }
- declare module BABYLON {
- class Gamepads {
- private babylonGamepads;
- private oneGamepadConnected;
- private isMonitoring;
- private gamepadEventSupported;
- private gamepadSupportAvailable;
- private static gamepadDOMInfo;
- constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
- dispose(): void;
- }
- class StickValues {
- x: any;
- y: any;
- constructor(x: any, y: any);
- }
- class Gamepad {
- id: string;
- index: number;
- browserGamepad: any;
- constructor(id: string, index: number, browserGamepad: any);
- onleftstickchanged(callback: (values: StickValues) => void): void;
- onrightstickchanged(callback: (values: StickValues) => void): void;
- leftStick: StickValues;
- rightStick: StickValues;
- update(): void;
- }
- class GenericPad extends Gamepad {
- id: string;
- index: number;
- gamepad: any;
- onbuttondown(callback: (buttonPressed: number) => void): void;
- onbuttonup(callback: (buttonReleased: number) => void): void;
- constructor(id: string, index: number, gamepad: any);
- update(): void;
- }
- enum Xbox360Button {
- A = 0,
- B = 1,
- X = 2,
- Y = 3,
- Start = 4,
- Back = 5,
- LB = 6,
- RB = 7,
- LeftStick = 8,
- RightStick = 9,
- }
- enum Xbox360Dpad {
- Up = 0,
- Down = 1,
- Left = 2,
- Right = 3,
- }
- class Xbox360Pad extends Gamepad {
- onlefttriggerchanged(callback: (value: number) => void): void;
- onrighttriggerchanged(callback: (value: number) => void): void;
- leftTrigger: number;
- rightTrigger: number;
- onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
- onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
- ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
- ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
- buttonA: number;
- buttonB: number;
- buttonX: number;
- buttonY: number;
- buttonStart: number;
- buttonBack: number;
- buttonLB: number;
- buttonRB: number;
- buttonLeftStick: number;
- buttonRightStick: number;
- dPadUp: number;
- dPadDown: number;
- dPadLeft: number;
- dPadRight: number;
- update(): void;
- }
- }
- interface Navigator {
- getGamepads(func?: any): any;
- webkitGetGamepads(func?: any): any;
- msGetGamepads(func?: any): any;
- webkitGamepads(func?: any): any;
- }
- declare module BABYLON {
- interface ILoadingScreen {
- displayLoadingUI: () => void;
- hideLoadingUI: () => void;
- loadingUIBackgroundColor: string;
- loadingUIText: string;
- }
- class DefaultLoadingScreen implements ILoadingScreen {
- constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
- displayLoadingUI(): void;
- hideLoadingUI(): void;
- loadingUIText: string;
- loadingUIBackgroundColor: string;
- }
- }
- declare module BABYLON {
- /**
- * A class serves as a medium between the observable and its observers
- */
- class EventState {
- /**
- * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
- */
- constructor(mask: number, skipNextObservers?: boolean);
- initalize(mask: number, skipNextObservers?: boolean): EventState;
- /**
- * An Observer can set this property to true to prevent subsequent observers of being notified
- */
- skipNextObservers: boolean;
- /**
- * Get the mask value that were used to trigger the event corresponding to this EventState object
- */
- mask: number;
- }
- /**
- * Represent an Observer registered to a given Observable object.
- */
- class Observer<T> {
- callback: (eventData: T, eventState: EventState) => void;
- mask: number;
- constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
- }
- /**
- * The Observable class is a simple implementation of the Observable pattern.
- * 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.
- * This enable a more fine grained execution without having to rely on multiple different Observable objects.
- * 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).
- * 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.
- */
- class Observable<T> {
- constructor();
- /**
- * Create a new Observer with the specified callback
- * @param callback the callback that will be executed for that Observer
- * @param mask the mask used to filter observers
- * @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.
- */
- add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
- /**
- * Remove an Observer from the Observable object
- * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
- */
- remove(observer: Observer<T>): boolean;
- /**
- * Remove a callback from the Observable object
- * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
- */
- removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
- /**
- * Notify all Observers by calling their respective callback with the given data
- * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
- * @param eventData
- * @param mask
- */
- notifyObservers(eventData: T, mask?: number): boolean;
- /**
- * return true is the Observable has at least one Observer registered
- */
- hasObservers(): boolean;
- /**
- * Clear the list of observers
- */
- clear(): void;
- /**
- * Clone the current observable
- */
- clone(): Observable<T>;
- }
- }
- declare module BABYLON {
- /**
- * This class describe a rectangle that were added to the map.
- * You have access to its coordinates either in pixel or normalized (UV)
- */
- class PackedRect {
- constructor(root: PackedRect, parent: PackedRect, pos: Vector2, size: Size);
- /**
- * @returns the position of this node into the map
- */
- pos: Vector2;
- /**
- * @returns the size of the rectangle this node handles
- */
- contentSize: Size;
- /**
- * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
- * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
- */
- UVs: Vector2[];
- /**
- * 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.
- * This method will return the UVs for this part by given the custom size of what you really use
- * @param customSize must be less/equal to the allocated size, UV will be compute from this
- */
- getUVsForCustomSize(customSize: Size): Vector2[];
- /**
- * Free this rectangle from the map.
- * Call this method when you no longer need the rectangle to be in the map.
- */
- freeContent(): void;
- protected isUsed: boolean;
- protected findAndSplitNode(contentSize: Size): PackedRect;
- private findNode(size);
- private splitNode(contentSize);
- private attemptDefrag();
- private clearNode();
- private isRecursiveFree;
- protected evalFreeSize(size: number): number;
- }
- /**
- * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
- * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
- * 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.
- */
- class RectPackingMap extends PackedRect {
- /**
- * Create an instance of the object with a dimension using the given size
- * @param size The dimension of the rectangle that will contain all the sub ones.
- */
- constructor(size: Size);
- /**
- * Add a rectangle, finding the best location to store it into the map
- * @param size the dimension of the rectangle to store
- * @return the Node containing the rectangle information, or null if we couldn't find a free spot
- */
- addRect(size: Size): PackedRect;
- /**
- * Return the current space free normalized between [0;1]
- * @returns {}
- */
- freeSpace: number;
- }
- }
- declare module BABYLON {
- class SceneOptimization {
- priority: number;
- apply: (scene: Scene) => boolean;
- constructor(priority?: number);
- }
- class TextureOptimization extends SceneOptimization {
- priority: number;
- maximumSize: number;
- constructor(priority?: number, maximumSize?: number);
- apply: (scene: Scene) => boolean;
- }
- class HardwareScalingOptimization extends SceneOptimization {
- priority: number;
- maximumScale: number;
- constructor(priority?: number, maximumScale?: number);
- apply: (scene: Scene) => boolean;
- }
- class ShadowsOptimization extends SceneOptimization {
- apply: (scene: Scene) => boolean;
- }
- class PostProcessesOptimization extends SceneOptimization {
- apply: (scene: Scene) => boolean;
- }
- class LensFlaresOptimization extends SceneOptimization {
- apply: (scene: Scene) => boolean;
- }
- class ParticlesOptimization extends SceneOptimization {
- apply: (scene: Scene) => boolean;
- }
- class RenderTargetsOptimization extends SceneOptimization {
- apply: (scene: Scene) => boolean;
- }
- class MergeMeshesOptimization extends SceneOptimization {
- static UpdateSelectionTree: boolean;
- apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
- }
- class SceneOptimizerOptions {
- targetFrameRate: number;
- trackerDuration: number;
- optimizations: SceneOptimization[];
- constructor(targetFrameRate?: number, trackerDuration?: number);
- static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
- static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
- static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
- }
- class SceneOptimizer {
- static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
- }
- }
- declare module BABYLON {
- class SceneSerializer {
- static ClearCache(): void;
- static Serialize(scene: Scene): any;
- static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
- }
- }
- declare module BABYLON {
- class SmartArray<T> {
- data: Array<T>;
- length: number;
- constructor(capacity: number);
- push(value: any): void;
- pushNoDuplicate(value: any): boolean;
- sort(compareFn: any): void;
- reset(): void;
- concat(array: any): void;
- concatWithNoDuplicate(array: any): void;
- indexOf(value: any): number;
- }
- }
- declare module BABYLON {
- /**
- * This class implement a typical dictionary using a string as key and the generic type T as value.
- * The underlying implementation relies on an associative array to ensure the best performances.
- * The value can be anything including 'null' but except 'undefined'
- */
- class StringDictionary<T> {
- /**
- * This will clear this dictionary and copy the content from the 'source' one.
- * If the T value is a custom object, it won't be copied/cloned, the same object will be used
- * @param source the dictionary to take the content from and copy to this dictionary
- */
- copyFrom(source: StringDictionary<T>): void;
- /**
- * Get a value based from its key
- * @param key the given key to get the matching value from
- * @return the value if found, otherwise undefined is returned
- */
- get(key: string): T;
- /**
- * Get a value from its key or add it if it doesn't exist.
- * This method will ensure you that a given key/data will be present in the dictionary.
- * @param key the given key to get the matching value from
- * @param factory the factory that will create the value if the key is not present in the dictionary.
- * The factory will only be invoked if there's no data for the given key.
- * @return the value corresponding to the key.
- */
- getOrAddWithFactory(key: string, factory: (key: string) => T): T;
- /**
- * Get a value from its key if present in the dictionary otherwise add it
- * @param key the key to get the value from
- * @param val if there's no such key/value pair in the dictionary add it with this value
- * @return the value corresponding to the key
- */
- getOrAdd(key: string, val: T): T;
- /**
- * Check if there's a given key in the dictionary
- * @param key the key to check for
- * @return true if the key is present, false otherwise
- */
- contains(key: any): boolean;
- /**
- * Add a new key and its corresponding value
- * @param key the key to add
- * @param value the value corresponding to the key
- * @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
- */
- add(key: string, value: T): boolean;
- set(key: string, value: T): boolean;
- /**
- * Get the element of the given key and remove it from the dictionary
- * @param key
- */
- getAndRemove(key: string): T;
- /**
- * Remove a key/value from the dictionary.
- * @param key the key to remove
- * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
- */
- remove(key: string): boolean;
- /**
- * Clear the whole content of the dictionary
- */
- clear(): void;
- count: number;
- /**
- * Execute a callback on each key/val of the dictionary.
- * Note that you can remove any element in this dictionary in the callback implementation
- * @param callback the callback to execute on a given key/value pair
- */
- forEach(callback: (key: string, val: T) => void): void;
- /**
- * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
- * If the callback returns null or undefined the method will iterate to the next key/value pair
- * Note that you can remove any element in this dictionary in the callback implementation
- * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
- */
- first<TRes>(callback: (key: string, val: T) => TRes): TRes;
- }
- }
- declare module BABYLON {
- class Tags {
- static EnableFor(obj: any): void;
- static DisableFor(obj: any): void;
- static HasTags(obj: any): boolean;
- static GetTags(obj: any, asString?: boolean): any;
- static AddTagsTo(obj: any, tagsString: string): void;
- static RemoveTagsFrom(obj: any, tagsString: string): void;
- static MatchesQuery(obj: any, tagsQuery: string): boolean;
- }
- }
- declare module BABYLON.Internals {
- interface DDSInfo {
- width: number;
- height: number;
- mipmapCount: number;
- isFourCC: boolean;
- isRGB: boolean;
- isLuminance: boolean;
- isCube: boolean;
- }
- class DDSTools {
- static GetDDSInfo(arrayBuffer: any): DDSInfo;
- private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
- private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
- private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
- static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
- }
- }
- declare module BABYLON.Internals {
- class TGATools {
- static GetTGAHeader(data: Uint8Array): any;
- static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
- }
- }
- declare module BABYLON {
- interface IAnimatable {
- animations: Array<Animation>;
- }
- class Tools {
- static BaseUrl: string;
- static CorsBehavior: any;
- static UseFallbackTexture: boolean;
- static Instantiate(className: string): any;
- static SetImmediate(action: () => void): void;
- static IsExponentOfTwo(value: number): boolean;
- static GetExponentOfTwo(value: number, max: number): number;
- static GetFilename(path: string): string;
- static GetDOMTextContent(element: HTMLElement): string;
- static ToDegrees(angle: number): number;
- static ToRadians(angle: number): number;
- static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
- static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number, bias?: Vector2): {
- minimum: Vector3;
- maximum: Vector3;
- };
- static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
- minimum: Vector3;
- maximum: Vector3;
- };
- static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i) => Vector2;
- static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
- minimum: Vector2;
- maximum: Vector2;
- };
- static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
- static GetPointerPrefix(): string;
- /**
- * @param func - the function to be called
- * @param requester - the object that will request the next frame. Falls back to window.
- */
- static QueueNewFrame(func: any, requester?: any): void;
- static RequestFullscreen(element: any): void;
- static ExitFullscreen(): void;
- static SetCorsBehavior(url: string, img: HTMLImageElement): string;
- static CleanUrl(url: string): string;
- static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
- static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
- static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
- static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
- static FileAsURL(content: string): string;
- static Format(value: number, decimals?: number): string;
- static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
- static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
- static IsEmpty(obj: any): boolean;
- static RegisterTopRootEvents(events: {
- name: string;
- handler: EventListener;
- }[]): void;
- static UnregisterTopRootEvents(events: {
- name: string;
- handler: EventListener;
- }[]): void;
- static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
- static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
- static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
- static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
- static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
- /**
- * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
- * Be aware Math.random() could cause collisions, but:
- * "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"
- */
- static RandomId(): string;
- static errorsCount: number;
- static OnNewCacheEntry: (entry: string) => void;
- static NoneLogLevel: number;
- static MessageLogLevel: number;
- static WarningLogLevel: number;
- static ErrorLogLevel: number;
- static AllLogLevel: number;
- static Log: (message: string) => void;
- static Warn: (message: string) => void;
- static Error: (message: string) => void;
- static LogCache: string;
- static ClearLogCache(): void;
- static LogLevels: number;
- static PerformanceNoneLogLevel: number;
- static PerformanceUserMarkLogLevel: number;
- static PerformanceConsoleLogLevel: number;
- static PerformanceLogLevel: number;
- static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
- static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
- static Now: number;
- /**
- * This method will return the name of the class used to create the instance of the given object.
- * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
- * @param object the object to get the class name from
- * @return the name of the class, will be "object" for a custom data type not using the @className decorator
- */
- static getClassName(object: any, isType?: boolean): string;
- static first<T>(array: Array<T>, predicate: (item) => boolean): T;
- /**
- * This method will return the name of the full name of the class, including its owning module (if any).
- * 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).
- * @param object the object to get the class name from
- * @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.
- */
- static getFullClassName(object: any, isType?: boolean): string;
- /**
- * 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.
- * @param array
- */
- static arrayOrStringFeeder(array: any): (i) => number;
- /**
- * Compute the hashCode of a stream of number
- * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
- * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
- * @return the hash code computed
- */
- static hashCodeFromStream(feeder: (index: number) => number): number;
- }
- /**
- * This class is used to track a performance counter which is number based.
- * The user has access to many properties which give statistics of different nature
- *
- * The implementer can track two kinds of Performance Counter: time and count
- * 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.
- * 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.
- */
- class PerfCounter {
- /**
- * Returns the smallest value ever
- */
- min: number;
- /**
- * Returns the biggest value ever
- */
- max: number;
- /**
- * Returns the average value since the performance counter is running
- */
- average: number;
- /**
- * Returns the average value of the last second the counter was monitored
- */
- lastSecAverage: number;
- /**
- * Returns the current value
- */
- current: number;
- total: number;
- constructor();
- /**
- * Call this method to start monitoring a new frame.
- * 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.
- */
- fetchNewFrame(): void;
- /**
- * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
- * @param newCount the count value to add to the monitored count
- * @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.
- */
- addCount(newCount: number, fetchResult: boolean): void;
- /**
- * Start monitoring this performance counter
- */
- beginMonitoring(): void;
- /**
- * Compute the time lapsed since the previous beginMonitoring() call.
- * @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
- */
- endMonitoring(newFrame?: boolean): void;
- }
- /**
- * Use this className as a decorator on a given class definition to add it a name and optionally its module.
- * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
- * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
- * @param name The name of the class, case should be preserved
- * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
- */
- function className(name: string, module?: string): (target: Object) => void;
- /**
- * An implementation of a loop for asynchronous functions.
- */
- class AsyncLoop {
- iterations: number;
- index: number;
- /**
- * Constroctor.
- * @param iterations the number of iterations.
- * @param _fn the function to run each iteration
- * @param _successCallback the callback that will be called upon succesful execution
- * @param offset starting offset.
- */
- constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
- /**
- * Execute the next iteration. Must be called after the last iteration was finished.
- */
- executeNext(): void;
- /**
- * Break the loop and run the success callback.
- */
- breakLoop(): void;
- /**
- * Helper function
- */
- static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
- /**
- * A for-loop that will run a given number of iterations synchronous and the rest async.
- * @param iterations total number of iterations
- * @param syncedIterations number of synchronous iterations in each async iteration.
- * @param fn the function to call each iteration.
- * @param callback a success call back that will be called when iterating stops.
- * @param breakFunction a break condition (optional)
- * @param timeout timeout settings for the setTimeout function. default - 0.
- * @constructor
- */
- static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
- }
- }
- declare module BABYLON {
- enum JoystickAxis {
- X = 0,
- Y = 1,
- Z = 2,
- }
- class VirtualJoystick {
- reverseLeftRight: boolean;
- reverseUpDown: boolean;
- deltaPosition: Vector3;
- pressed: boolean;
- private static vjCanvas;
- private static vjCanvasContext;
- private static vjCanvasWidth;
- private static vjCanvasHeight;
- private static halfWidth;
- private static halfHeight;
- constructor(leftJoystick?: boolean);
- setJoystickSensibility(newJoystickSensibility: number): void;
- /**
- * Change the color of the virtual joystick
- * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
- */
- setJoystickColor(newColor: string): void;
- setActionOnTouch(action: () => any): void;
- setAxisForLeftRight(axis: JoystickAxis): void;
- setAxisForUpDown(axis: JoystickAxis): void;
- releaseCanvas(): void;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
- camera: ArcRotateCamera;
- gamepad: Gamepad;
- gamepadRotationSensibility: number;
- gamepadMoveSensibility: number;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
- camera: ArcRotateCamera;
- keysUp: number[];
- keysDown: number[];
- keysLeft: number[];
- keysRight: number[];
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
- camera: ArcRotateCamera;
- wheelPrecision: number;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
- camera: ArcRotateCamera;
- buttons: number[];
- angularSensibilityX: number;
- angularSensibilityY: number;
- pinchPrecision: number;
- panningSensibility: number;
- pinchInwards: boolean;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
- camera: ArcRotateCamera;
- alphaCorrection: number;
- betaCorrection: number;
- gammaCorrection: number;
- constructor();
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- checkInputs(): void;
- detachControl(element: HTMLElement): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
- constructor();
- camera: FreeCamera;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
- camera: FreeCamera;
- gamepad: Gamepad;
- gamepadAngularSensibility: number;
- gamepadMoveSensibility: number;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
- camera: FreeCamera;
- keysUp: number[];
- keysDown: number[];
- keysLeft: number[];
- keysRight: number[];
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
- touchEnabled: boolean;
- camera: FreeCamera;
- buttons: number[];
- angularSensibility: number;
- private previousPosition;
- constructor(touchEnabled?: boolean);
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
- camera: FreeCamera;
- touchAngularSensibility: number;
- touchMoveSensibility: number;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- checkInputs(): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
- camera: FreeCamera;
- getLeftJoystick(): VirtualJoystick;
- getRightJoystick(): VirtualJoystick;
- checkInputs(): void;
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- getTypeName(): string;
- getSimpleName(): string;
- }
- }
- declare module BABYLON {
- class VRCameraMetrics {
- hResolution: number;
- vResolution: number;
- hScreenSize: number;
- vScreenSize: number;
- vScreenCenter: number;
- eyeToScreenDistance: number;
- lensSeparationDistance: number;
- interpupillaryDistance: number;
- distortionK: number[];
- chromaAbCorrection: number[];
- postProcessScaleFactor: number;
- lensCenterOffset: number;
- compensateDistortion: boolean;
- aspectRatio: number;
- aspectRatioFov: number;
- leftHMatrix: Matrix;
- rightHMatrix: Matrix;
- leftPreViewMatrix: Matrix;
- rightPreViewMatrix: Matrix;
- static GetDefault(): VRCameraMetrics;
- }
- }
- declare module BABYLON {
- class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
- constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
- getTypeName(): string;
- }
- class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
- constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
- getTypeName(): string;
- }
- }
- declare var HMDVRDevice: any;
- declare var VRDisplay: any;
- declare var VRFrameData: any;
- declare module BABYLON {
- interface WebVROptions {
- trackPosition?: boolean;
- positionScale?: number;
- displayName?: string;
- }
- class WebVRFreeCamera extends FreeCamera {
- private webVROptions;
- constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, webVROptions?: WebVROptions);
- attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
- detachControl(element: HTMLElement): void;
- requestVRFullscreen(requestPointerlock: boolean): void;
- getTypeName(): string;
- resetToCurrentRotation(): void;
- /**
- *
- * Set the position offset of the VR camera
- * The offset will be added to the WebVR pose, after scaling it (if set).
- *
- * @param {Vector3} [newPosition] an optional new position. if not provided, the current camera position will be used.
- *
- * @memberOf WebVRFreeCamera
- */
- setPositionOffset(newPosition?: Vector3): void;
- }
- }
- declare module BABYLON {
- interface IOctreeContainer<T> {
- blocks: Array<OctreeBlock<T>>;
- }
- class Octree<T> {
- maxDepth: number;
- blocks: Array<OctreeBlock<T>>;
- dynamicContent: T[];
- constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
- update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
- addMesh(entry: T): void;
- select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
- intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
- intersectsRay(ray: Ray): SmartArray<T>;
- static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
- static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
- }
- }
- declare module BABYLON {
- class OctreeBlock<T> {
- entries: T[];
- blocks: Array<OctreeBlock<T>>;
- constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
- capacity: number;
- minPoint: Vector3;
- maxPoint: Vector3;
- addEntry(entry: T): void;
- addEntries(entries: T[]): void;
- select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
- intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
- intersectsRay(ray: Ray, selection: SmartArray<T>): void;
- createInnerBlocks(): void;
- }
- }
- declare module BABYLON {
- interface IShadowGenerator {
- getShadowMap(): RenderTargetTexture;
- dispose(): void;
- }
- class ShadowGenerator implements IShadowGenerator {
- static FILTER_NONE: number;
- static FILTER_VARIANCESHADOWMAP: number;
- static FILTER_POISSONSAMPLING: number;
- static FILTER_BLURVARIANCESHADOWMAP: number;
- blurScale: number;
- forceBackFacesOnly: boolean;
- bias: number;
- blurBoxOffset: number;
- filter: number;
- useVarianceShadowMap: boolean;
- usePoissonSampling: boolean;
- useBlurVarianceShadowMap: boolean;
- constructor(mapSize: number, light: IShadowLight);
- isReady(subMesh: SubMesh, useInstances: boolean): boolean;
- getShadowMap(): RenderTargetTexture;
- getShadowMapForRendering(): RenderTargetTexture;
- getLight(): IShadowLight;
- getTransformMatrix(): Matrix;
- getDarkness(): number;
- setDarkness(darkness: number): void;
- setTransparencyShadow(hasShadow: boolean): void;
- dispose(): void;
- serialize(): any;
- static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
- }
- }
- declare module BABYLON.Internals {
- }
- declare module BABYLON {
- class BaseTexture {
- name: string;
- hasAlpha: boolean;
- getAlphaFromRGB: boolean;
- level: number;
- coordinatesIndex: number;
- coordinatesMode: number;
- wrapU: number;
- wrapV: number;
- anisotropicFilteringLevel: number;
- isCube: boolean;
- isRenderTarget: boolean;
- uid: string;
- toString(): string;
- animations: Animation[];
- /**
- * An event triggered when the texture is disposed.
- * @type {BABYLON.Observable}
- */
- onDisposeObservable: Observable<BaseTexture>;
- onDispose: () => void;
- delayLoadState: number;
- constructor(scene: Scene);
- getScene(): Scene;
- getTextureMatrix(): Matrix;
- getReflectionTextureMatrix(): Matrix;
- getInternalTexture(): WebGLTexture;
- isReady(): boolean;
- getSize(): ISize;
- getBaseSize(): ISize;
- scale(ratio: number): void;
- canRescale: boolean;
- delayLoad(): void;
- clone(): BaseTexture;
- releaseInternalTexture(): void;
- dispose(): void;
- serialize(): any;
- }
- }
- declare module BABYLON {
- /**
- * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
- * It can help converting any input color in a desired output one. This can then be used to create effects
- * from sepia, black and white to sixties or futuristic rendering...
- *
- * The only supported format is currently 3dl.
- * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
- */
- class ColorGradingTexture extends BaseTexture {
- /**
- * The current internal texture size.
- */
- /**
- * The current texture matrix. (will always be identity in color grading texture)
- */
- /**
- * The texture URL.
- */
- url: string;
- /**
- * Empty line regex stored for GC.
- */
- /**
- * Instantiates a ColorGradingTexture from the following parameters.
- *
- * @param url The location of the color gradind data (currently only supporting 3dl)
- * @param scene The scene the texture will be used in
- */
- constructor(url: string, scene: Scene);
- /**
- * Returns the texture matrix used in most of the material.
- * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
- */
- getTextureMatrix(): Matrix;
- /**
- * Occurs when the file being loaded is a .3dl LUT file.
- */
- private load3dlTexture();
- /**
- * Starts the loading process of the texture.
- */
- private loadTexture();
- /**
- * Clones the color gradind texture.
- */
- clone(): ColorGradingTexture;
- /**
- * Called during delayed load for textures.
- */
- delayLoad(): void;
- /**
- * Binds the color grading to the shader.
- * @param colorGrading The texture to bind
- * @param effect The effect to bind to
- */
- static Bind(colorGrading: BaseTexture, effect: Effect): void;
- /**
- * Prepare the list of uniforms associated with the ColorGrading effects.
- * @param uniformsList The list of uniforms used in the effect
- * @param samplersList The list of samplers used in the effect
- */
- static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
- /**
- * Parses a color grading texture serialized by Babylon.
- * @param parsedTexture The texture information being parsedTexture
- * @param scene The scene to load the texture in
- * @param rootUrl The root url of the data assets to load
- * @return A color gradind texture
- */
- static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
- /**
- * Serializes the LUT texture to json format.
- */
- serialize(): any;
- }
- }
- declare module BABYLON {
- class CubeTexture extends BaseTexture {
- url: string;
- coordinatesMode: number;
- static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
- constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void);
- delayLoad(): void;
- getReflectionTextureMatrix(): Matrix;
- static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
- clone(): CubeTexture;
- }
- }
- declare module BABYLON {
- class DynamicTexture extends Texture {
- constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
- canRescale: boolean;
- scale(ratio: number): void;
- getContext(): CanvasRenderingContext2D;
- clear(): void;
- update(invertY?: boolean): void;
- drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
- clone(): DynamicTexture;
- }
- }
- declare module BABYLON {
- /**
- * This class given information about a given character.
- */
- class CharInfo {
- /**
- * The normalized ([0;1]) top/left position of the character in the texture
- */
- topLeftUV: Vector2;
- /**
- * The normalized ([0;1]) right/bottom position of the character in the texture
- */
- bottomRightUV: Vector2;
- charWidth: number;
- }
- class FontTexture extends Texture {
- isSuperSampled: boolean;
- isSignedDistanceField: boolean;
- spaceWidth: number;
- lineHeight: number;
- static GetCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): FontTexture;
- static ReleaseCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): void;
- /**
- * Create a new instance of the FontTexture class
- * @param name the name of the texture
- * @param font the font to use, use the W3C CSS notation
- * @param scene the scene that owns the texture
- * @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
- * @param samplingMode the texture sampling mode
- * @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.
- */
- constructor(name: string, font: string, scene: Scene, maxCharCount?: number, samplingMode?: number, superSample?: boolean, signedDistanceField?: boolean);
- /**
- * Make sure the given char is present in the font map.
- * @param char the character to get or add
- * @return the CharInfo instance corresponding to the given character
- */
- getChar(char: string): CharInfo;
- measureText(text: string, tabulationSize?: number): Size;
- private getSuperSampleFont(font);
- private getFontHeight(font);
- canRescale: boolean;
- getContext(): CanvasRenderingContext2D;
- /**
- * Call this method when you've call getChar() at least one time, this will update the texture if needed.
- * Don't be afraid to call it, if no new character was added, this method simply does nothing.
- */
- update(): void;
- clone(): FontTexture;
- /**
- * For FontTexture retrieved using GetCachedFontTexture, use this method when you transfer this object's lifetime to another party in order to share this resource.
- * When the other party is done with this object, decCachedFontTextureCounter must be called.
- */
- incCachedFontTextureCounter(): void;
- /**
- * Use this method only in conjunction with incCachedFontTextureCounter, call it when you no longer need to use this shared resource.
- */
- decCachedFontTextureCounter(): void;
- }
- }
- declare module BABYLON {
- /**
- * This represents a texture coming from an HDR input.
- *
- * The only supported format is currently panorama picture stored in RGBE format.
- * Example of such files can be found on HDRLib: http://hdrlib.com/
- */
- class HDRCubeTexture extends BaseTexture {
- /**
- * The texture URL.
- */
- url: string;
- /**
- * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
- */
- coordinatesMode: number;
- /**
- * The spherical polynomial data extracted from the texture.
- */
- sphericalPolynomial: SphericalPolynomial;
- /**
- * Specifies wether the texture has been generated through the PMREMGenerator tool.
- * This is usefull at run time to apply the good shader.
- */
- isPMREM: boolean;
- /**
- * Instantiates an HDRTexture from the following parameters.
- *
- * @param url The location of the HDR raw data (Panorama stored in RGBE format)
- * @param scene The scene the texture will be used in
- * @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.
- * @param noMipmap Forces to not generate the mipmap if true
- * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
- * @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)
- * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
- */
- constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
- /**
- * Occurs when the file is a preprocessed .babylon.hdr file.
- */
- private loadBabylonTexture();
- /**
- * Occurs when the file is raw .hdr file.
- */
- private loadHDRTexture();
- /**
- * Starts the loading process of the texture.
- */
- private loadTexture();
- clone(): HDRCubeTexture;
- delayLoad(): void;
- getReflectionTextureMatrix(): Matrix;
- static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
- serialize(): any;
- /**
- * Saves as a file the data contained in the texture in a binary format.
- * This can be used to prevent the long loading tie associated with creating the seamless texture as well
- * as the spherical used in the lighting.
- * @param url The HDR file url.
- * @param size The size of the texture data to generate (one of the cubemap face desired width).
- * @param onError Method called if any error happens during download.
- * @return The packed binary data.
- */
- static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
- /**
- * Serializes the data contained in the texture in a binary format.
- * This can be used to prevent the long loading tie associated with creating the seamless texture as well
- * as the spherical used in the lighting.
- * @param url The HDR file url.
- * @param size The size of the texture data to generate (one of the cubemap face desired width).
- * @param onError Method called if any error happens during download.
- * @return The packed binary data.
- */
- static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer) => void), onError?: (() => void)): void;
- }
- }
- declare module BABYLON {
- class MapTexture extends Texture {
- constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean);
- /**
- * Allocate a rectangle of a given size in the texture map
- * @param size the size of the rectangle to allocation
- * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
- */
- allocateRect(size: Size): PackedRect;
- /**
- * Free a given rectangle from the texture map
- * @param rectInfo the instance corresponding to the rect to free.
- */
- freeRect(rectInfo: PackedRect): void;
- /**
- * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
- * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
- * @returns {}
- */
- freeSpace: number;
- /**
- * Bind the texture to the rendering engine to render in the zone of a given rectangle.
- * 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.
- * Don't forget to call unbindTexture when you're done rendering
- * @param rect the zone to render to
- * @param clear true to clear the portion's color/depth data
- */
- bindTextureForRect(rect: PackedRect, clear: boolean): void;
- /**
- * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
- * 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.
- * Don't forget to call unbindTexture when you're done rendering
- * @param pos the position into the texture
- * @param size the portion to fit the clip space to
- * @param clear true to clear the portion's color/depth data
- */
- bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
- /**
- * Unbind the texture map from the rendering engine.
- * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
- * @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.
- */
- unbindTexture(dumpForDebug?: boolean): void;
- canRescale: boolean;
- clone(): MapTexture;
- }
- }
- declare module BABYLON {
- class MirrorTexture extends RenderTargetTexture {
- mirrorPlane: Plane;
- constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
- clone(): MirrorTexture;
- serialize(): any;
- }
- }
- declare module BABYLON {
- class RawTexture extends Texture {
- format: number;
- constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
- update(data: ArrayBufferView): void;
- static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
- static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
- static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
- static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
- static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
- }
- }
- declare module BABYLON {
- /**
- * Creates a refraction texture used by refraction channel of the standard material.
- * @param name the texture name
- * @param size size of the underlying texture
- * @param scene root scene
- */
- class RefractionTexture extends RenderTargetTexture {
- refractionPlane: Plane;
- depth: number;
- constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
- clone(): RefractionTexture;
- serialize(): any;
- }
- }
- declare module BABYLON {
- class RenderTargetTexture extends Texture {
- isCube: boolean;
- static REFRESHRATE_RENDER_ONCE: number;
- static REFRESHRATE_RENDER_ONEVERYFRAME: number;
- static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
- /**
- * Use this predicate to dynamically define the list of mesh you want to render.
- * If set, the renderList property will be overwritten.
- */
- renderListPredicate: (AbstractMesh) => boolean;
- /**
- * Use this list to define the list of mesh you want to render.
- */
- renderList: AbstractMesh[];
- renderParticles: boolean;
- renderSprites: boolean;
- coordinatesMode: number;
- activeCamera: Camera;
- customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
- useCameraPostProcesses: boolean;
- /**
- * An event triggered when the texture is unbind.
- * @type {BABYLON.Observable}
- */
- onAfterUnbindObservable: Observable<RenderTargetTexture>;
- onAfterUnbind: () => void;
- /**
- * An event triggered before rendering the texture
- * @type {BABYLON.Observable}
- */
- onBeforeRenderObservable: Observable<number>;
- onBeforeRender: (faceIndex: number) => void;
- /**
- * An event triggered after rendering the texture
- * @type {BABYLON.Observable}
- */
- onAfterRenderObservable: Observable<number>;
- onAfterRender: (faceIndex: number) => void;
- /**
- * An event triggered after the texture clear
- * @type {BABYLON.Observable}
- */
- onClearObservable: Observable<Engine>;
- onClear: (Engine: Engine) => void;
- constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean);
- resetRefreshCounter(): void;
- refreshRate: number;
- isReady(): boolean;
- getRenderSize(): number;
- canRescale: boolean;
- scale(ratio: number): void;
- getReflectionTextureMatrix(): Matrix;
- resize(size: any, generateMipMaps?: boolean): void;
- render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
- renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], currentRenderListLength: number, useCameraPostProcess: boolean, dumpForDebug: boolean): void;
- /**
- * Overrides the default sort function applied in the renderging group to prepare the meshes.
- * This allowed control for front to back rendering or reversly depending of the special needs.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
- * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
- * @param transparentSortCompareFn The transparent queue comparison function use to sort.
- */
- setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
- /**
- * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
- *
- * @param renderingGroupId The rendering group id corresponding to its index
- * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
- */
- setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
- clone(): RenderTargetTexture;
- serialize(): any;
- }
- }
- declare module BABYLON {
- class Texture extends BaseTexture {
- static NEAREST_SAMPLINGMODE: number;
- static BILINEAR_SAMPLINGMODE: number;
- static TRILINEAR_SAMPLINGMODE: number;
- static EXPLICIT_MODE: number;
- static SPHERICAL_MODE: number;
- static PLANAR_MODE: number;
- static CUBIC_MODE: number;
- static PROJECTION_MODE: number;
- static SKYBOX_MODE: number;
- static INVCUBIC_MODE: number;
- static EQUIRECTANGULAR_MODE: number;
- static FIXED_EQUIRECTANGULAR_MODE: number;
- static CLAMP_ADDRESSMODE: number;
- static WRAP_ADDRESSMODE: number;
- static MIRROR_ADDRESSMODE: number;
- url: string;
- uOffset: number;
- vOffset: number;
- uScale: number;
- vScale: number;
- uAng: number;
- vAng: number;
- wAng: number;
- noMipmap: boolean;
- constructor(urlOrList: string | Array<string>, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
- delayLoad(): void;
- updateSamplingMode(samplingMode: number): void;
- getTextureMatrix(): Matrix;
- getReflectionTextureMatrix(): Matrix;
- clone(): Texture;
- onLoadObservable: Observable<boolean>;
- static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
- static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
- static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
- }
- }
- declare module BABYLON {
- class VideoTexture extends Texture {
- video: HTMLVideoElement;
- /**
- * Creates a video texture.
- * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
- * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
- * @param {BABYLON.Scene} scene is obviously the current scene.
- * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
- * @param {boolean} invertY is false by default but can be used to invert video on Y axis
- * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
- */
- constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
- update(): boolean;
- }
- }
- declare module BABYLON {
- class CannonJSPlugin implements IPhysicsEnginePlugin {
- world: any;
- name: string;
- constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
- setGravity(gravity: Vector3): void;
- setTimeStep(timeStep: number): void;
- executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
- applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
- applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
- generatePhysicsBody(impostor: PhysicsImpostor): void;
- removePhysicsBody(impostor: PhysicsImpostor): void;
- generateJoint(impostorJoint: PhysicsImpostorJoint): void;
- removeJoint(impostorJoint: PhysicsImpostorJoint): void;
- setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
- setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
- isSupported(): boolean;
- setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
- setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
- getLinearVelocity(impostor: PhysicsImpostor): Vector3;
- getAngularVelocity(impostor: PhysicsImpostor): Vector3;
- setBodyMass(impostor: PhysicsImpostor, mass: number): void;
- sleepBody(impostor: PhysicsImpostor): void;
- wakeUpBody(impostor: PhysicsImpostor): void;
- updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
- private enableMotor(joint, motorIndex?);
- private disableMotor(joint, motorIndex?);
- setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
- setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class OimoJSPlugin {
- world: any;
- name: string;
- constructor(iterations?: number);
- setGravity(gravity: Vector3): void;
- setTimeStep(timeStep: number): void;
- executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
- applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
- applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
- generatePhysicsBody(impostor: PhysicsImpostor): void;
- removePhysicsBody(impostor: PhysicsImpostor): void;
- generateJoint(impostorJoint: PhysicsImpostorJoint): void;
- removeJoint(impostorJoint: PhysicsImpostorJoint): void;
- isSupported(): boolean;
- setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
- setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
- setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
- setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
- getLinearVelocity(impostor: PhysicsImpostor): Vector3;
- getAngularVelocity(impostor: PhysicsImpostor): Vector3;
- setBodyMass(impostor: PhysicsImpostor, mass: number): void;
- sleepBody(impostor: PhysicsImpostor): void;
- wakeUpBody(impostor: PhysicsImpostor): void;
- updateDistanceJoint(joint: IMotorEnabledJoint, maxDistance: number, minDistance?: number): void;
- setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
- setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class PostProcessRenderEffect {
- applyParameters: (postProcess: PostProcess) => void;
- constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
- isSupported: boolean;
- addPass(renderPass: PostProcessRenderPass): void;
- removePass(renderPass: PostProcessRenderPass): void;
- addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
- getPass(passName: string): void;
- emptyPasses(): void;
- getPostProcess(camera?: Camera): PostProcess;
- }
- }
- declare module BABYLON {
- class PostProcessRenderPass {
- constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
- setRenderList(renderList: Mesh[]): void;
- getRenderTexture(): RenderTargetTexture;
- }
- }
- declare module BABYLON {
- class PostProcessRenderPipeline {
- private static PASS_EFFECT_NAME;
- private static PASS_SAMPLER_NAME;
- constructor(engine: Engine, name: string);
- isSupported: boolean;
- addEffect(renderEffect: PostProcessRenderEffect): void;
- dispose(): void;
- }
- }
- declare module BABYLON {
- class PostProcessRenderPipelineManager {
- constructor();
- addPipeline(renderPipeline: PostProcessRenderPipeline): void;
- attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
- attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
- detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
- detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
- enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
- enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
- disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
- disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
- enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
- enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
- disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
- disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
- update(): void;
- }
- }
- declare module BABYLON.Internals {
- /**
- * Helper class dealing with the extraction of spherical polynomial dataArray
- * from a cube map.
- */
- class CubeMapToSphericalPolynomialTools {
- private static FileFaces;
- /**
- * Converts a cubemap to the according Spherical Polynomial data.
- * This extracts the first 3 orders only as they are the only one used in the lighting.
- *
- * @param cubeInfo The Cube map to extract the information from.
- * @return The Spherical Polynomial data.
- */
- static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
- }
- }
- declare module BABYLON.Internals {
- /**
- * Header information of HDR texture files.
- */
- interface HDRInfo {
- /**
- * The height of the texture in pixels.
- */
- height: number;
- /**
- * The width of the texture in pixels.
- */
- width: number;
- /**
- * The index of the beginning of the data in the binary file.
- */
- dataPosition: number;
- }
- /**
- * This groups tools to convert HDR texture to native colors array.
- */
- class HDRTools {
- private static Ldexp(mantissa, exponent);
- private static Rgbe2float(float32array, red, green, blue, exponent, index);
- private static readStringLine(uint8array, startIndex);
- /**
- * Reads header information from an RGBE texture stored in a native array.
- * More information on this format are available here:
- * https://en.wikipedia.org/wiki/RGBE_image_format
- *
- * @param uint8array The binary file stored in native array.
- * @return The header information.
- */
- static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
- /**
- * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
- * This RGBE texture needs to store the information as a panorama.
- *
- * More information on this format are available here:
- * https://en.wikipedia.org/wiki/RGBE_image_format
- *
- * @param buffer The binary file stored in an array buffer.
- * @param size The expected size of the extracted cubemap.
- * @return The Cube Map information.
- */
- static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
- /**
- * Returns the pixels data extracted from an RGBE texture.
- * This pixels will be stored left to right up to down in the R G B order in one array.
- *
- * More information on this format are available here:
- * https://en.wikipedia.org/wiki/RGBE_image_format
- *
- * @param uint8array The binary file stored in an array buffer.
- * @param hdrInfo The header information of the file.
- * @return The pixels data in RGB right to left up to down order.
- */
- static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
- private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
- }
- }
- declare module BABYLON.Internals {
- /**
- * CubeMap information grouping all the data for each faces as well as the cubemap size.
- */
- interface CubeMapInfo {
- /**
- * The pixel array for the front face.
- * This is stored in RGB, left to right, up to down format.
- */
- front: Float32Array;
- /**
- * The pixel array for the back face.
- * This is stored in RGB, left to right, up to down format.
- */
- back: Float32Array;
- /**
- * The pixel array for the left face.
- * This is stored in RGB, left to right, up to down format.
- */
- left: Float32Array;
- /**
- * The pixel array for the right face.
- * This is stored in RGB, left to right, up to down format.
- */
- right: Float32Array;
- /**
- * The pixel array for the up face.
- * This is stored in RGB, left to right, up to down format.
- */
- up: Float32Array;
- /**
- * The pixel array for the down face.
- * This is stored in RGB, left to right, up to down format.
- */
- down: Float32Array;
- /**
- * The size of the cubemap stored.
- *
- * Each faces will be size * size pixels.
- */
- size: number;
- }
- /**
- * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
- */
- class PanoramaToCubeMapTools {
- private static FACE_FRONT;
- private static FACE_BACK;
- private static FACE_RIGHT;
- private static FACE_LEFT;
- private static FACE_DOWN;
- private static FACE_UP;
- /**
- * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
- *
- * @param float32Array The source data.
- * @param inputWidth The width of the input panorama.
- * @param inputhHeight The height of the input panorama.
- * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
- * @return The cubemap data
- */
- static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
- private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
- private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
- }
- }
- declare namespace BABYLON.Internals {
- /**
- * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
- * required by the glossinees of a material.
- *
- * This only supports the cosine drop power as well as Warp fixup generation method.
- *
- * This is using the process from CubeMapGen described here:
- * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
- */
- class PMREMGenerator {
- input: ArrayBufferView[];
- inputSize: number;
- outputSize: number;
- maxNumMipLevels: number;
- numChannels: number;
- isFloat: boolean;
- specularPower: number;
- cosinePowerDropPerMip: number;
- excludeBase: boolean;
- fixup: boolean;
- private static CP_MAX_MIPLEVELS;
- private static CP_UDIR;
- private static CP_VDIR;
- private static CP_FACEAXIS;
- private static CP_FACE_X_POS;
- private static CP_FACE_X_NEG;
- private static CP_FACE_Y_POS;
- private static CP_FACE_Y_NEG;
- private static CP_FACE_Z_POS;
- private static CP_FACE_Z_NEG;
- private static CP_EDGE_LEFT;
- private static CP_EDGE_RIGHT;
- private static CP_EDGE_TOP;
- private static CP_EDGE_BOTTOM;
- private static CP_CORNER_NNN;
- private static CP_CORNER_NNP;
- private static CP_CORNER_NPN;
- private static CP_CORNER_NPP;
- private static CP_CORNER_PNN;
- private static CP_CORNER_PNP;
- private static CP_CORNER_PPN;
- private static CP_CORNER_PPP;
- /**
- * Constructor of the generator.
- *
- * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
- * @param inputSize The size of the cubemap faces
- * @param outputSize The size of the output cubemap faces
- * @param maxNumMipLevels The max number of mip map to generate (0 means all)
- * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
- * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
- * @param specularPower The max specular level of the desired cubemap
- * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
- * @param excludeBase Specifies wether to process the level 0 (original level) or not
- * @param fixup Specifies wether to apply the edge fixup algorythm or not
- */
- constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
- /**
- * Launches the filter process and return the result.
- *
- * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
- */
- filterCubeMap(): ArrayBufferView[][];
- private init();
- private filterCubeMapMipChain();
- private getBaseFilterAngle(cosinePower);
- private precomputeFilterLookupTables(srcCubeMapWidth);
- private buildNormalizerSolidAngleCubemap(size);
- private texelCoordToVect(faceIdx, u, v, size, fixup);
- private vectToTexelCoord(x, y, z, size);
- private areaElement(x, y);
- private texelCoordSolidAngle(faceIdx, u, v, size);
- private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
- private clearFilterExtents(filterExtents);
- private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
- private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
- private fixupCubeEdges(cubeMap, cubeMapSize);
- }
- }
- declare module BABYLON {
- class CustomProceduralTexture extends ProceduralTexture {
- constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
- private loadJson(jsonUrl);
- isReady(): boolean;
- render(useCameraPostProcess?: boolean): void;
- updateTextures(): void;
- updateShaderUniforms(): void;
- animate: boolean;
- }
- }
- declare module BABYLON {
- class ProceduralTexture extends Texture {
- isCube: boolean;
- isEnabled: boolean;
- onGenerated: () => void;
- constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
- reset(): void;
- isReady(): boolean;
- resetRefreshCounter(): void;
- setFragment(fragment: any): void;
- refreshRate: number;
- getRenderSize(): number;
- resize(size: any, generateMipMaps: any): void;
- setTexture(name: string, texture: Texture): ProceduralTexture;
- setFloat(name: string, value: number): ProceduralTexture;
- setFloats(name: string, value: number[]): ProceduralTexture;
- setColor3(name: string, value: Color3): ProceduralTexture;
- setColor4(name: string, value: Color4): ProceduralTexture;
- setVector2(name: string, value: Vector2): ProceduralTexture;
- setVector3(name: string, value: Vector3): ProceduralTexture;
- setMatrix(name: string, value: Matrix): ProceduralTexture;
- render(useCameraPostProcess?: boolean): void;
- clone(): ProceduralTexture;
- dispose(): void;
- }
- }
- declare module BABYLON {
- /**
- * Stores 2D Bounding Information.
- * This class handles a circle area and a bounding rectangle one.
- */
- class BoundingInfo2D {
- /**
- * The coordinate of the center of the bounding info
- */
- center: Vector2;
- /**
- * The radius of the bounding circle, from the center of the bounded object
- */
- radius: number;
- /**
- * The extent of the bounding rectangle, from the center of the bounded object.
- * 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.
- */
- extent: Vector2;
- constructor();
- /**
- * Create a BoundingInfo2D object from a given size
- * @param size the size that will be used to set the extend, radius will be computed from it.
- */
- static CreateFromSize(size: Size): BoundingInfo2D;
- /**
- * Create a BoundingInfo2D object from a given radius
- * @param radius the radius to use, the extent will be computed from it.
- */
- static CreateFromRadius(radius: number): BoundingInfo2D;
- /**
- * Create a BoundingInfo2D object from a list of points.
- * The resulted object will be the smallest bounding area that includes all the given points.
- * @param points an array of points to compute the bounding object from.
- */
- static CreateFromPoints(points: Vector2[]): BoundingInfo2D;
- /**
- * Update a BoundingInfo2D object using the given Size as input
- * @param size the bounding data will be computed from this size.
- * @param b must be a valid/allocated object, it will contain the result of the operation
- */
- static CreateFromSizeToRef(size: Size, b: BoundingInfo2D): void;
- /**
- * Update a BoundingInfo2D object using the given radius as input
- * @param radius the bounding data will be computed from this radius
- * @param b must be a valid/allocated object, it will contain the result of the operation
- */
- static CreateFromRadiusToRef(radius: number, b: BoundingInfo2D): void;
- /**
- * Update a BoundingInfo2D object using the given points array as input
- * @param points the point array to use to update the bounding data
- * @param b must be a valid/allocated object, it will contain the result of the operation
- */
- static CreateFromPointsToRef(points: Vector2[], b: BoundingInfo2D): void;
- /**
- * Update a BoundingInfo2D object using the given min/max values as input
- * @param xmin the smallest x coordinate
- * @param xmax the biggest x coordinate
- * @param ymin the smallest y coordinate
- * @param ymax the buggest y coordinate
- * @param b must be a valid/allocated object, it will contain the result of the operation
- */
- static CreateFromMinMaxToRef(xmin: number, xmax: number, ymin: number, ymax: number, b: BoundingInfo2D): void;
- /**
- * Duplicate this instance and return a new one
- * @return the duplicated instance
- */
- clone(): BoundingInfo2D;
- clear(): void;
- copyFrom(src: BoundingInfo2D): void;
- /**
- * return the max extend of the bounding info
- */
- max(): Vector2;
- /**
- * Update a vector2 with the max extend of the bounding info
- * @param result must be a valid/allocated vector2 that will contain the result of the operation
- */
- maxToRef(result: Vector2): void;
- /**
- * Apply a transformation matrix to this BoundingInfo2D and return a new instance containing the result
- * @param matrix the transformation matrix to apply
- * @return the new instance containing the result of the transformation applied on this BoundingInfo2D
- */
- transform(matrix: Matrix): BoundingInfo2D;
- /**
- * Compute the union of this BoundingInfo2D with a given one, returns a new BoundingInfo2D as a result
- * @param other the second BoundingInfo2D to compute the union with this one
- * @return a new instance containing the result of the union
- */
- union(other: BoundingInfo2D): BoundingInfo2D;
- /**
- * Transform this BoundingInfo2D with a given matrix and store the result in an existing BoundingInfo2D instance.
- * 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.
- * @param matrix The matrix to use to compute the transformation
- * @param result A VALID (i.e. allocated) BoundingInfo2D object where the result will be stored
- */
- transformToRef(matrix: Matrix, result: BoundingInfo2D): void;
- /**
- * Compute the union of this BoundingInfo2D with another one and store the result in a third valid BoundingInfo2D object
- * 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.
- * @param other the second object used to compute the union
- * @param result a VALID BoundingInfo2D instance (i.e. allocated) where the result will be stored
- */
- unionToRef(other: BoundingInfo2D, result: BoundingInfo2D): void;
- /**
- * Check if the given point is inside the BoundingInfo.
- * The test is first made on the radius, then inside the rectangle described by the extent
- * @param pickPosition the position to test
- * @return true if the point is inside, false otherwise
- */
- doesIntersect(pickPosition: Vector2): boolean;
- }
- }
- declare module BABYLON {
- /**
- * This interface is used to implement a lockable instance pattern.
- * Classes that implements it may be locked at any time, making their content immutable from now on.
- * You also can query if a given instance is locked or not.
- * This allow instances to be shared among several 'consumers'.
- */
- interface ILockable {
- /**
- * Query the lock state
- * @returns returns true if the object is locked and immutable, false if it's not
- */
- isLocked(): boolean;
- /**
- * A call to this method will definitely lock the instance, making its content immutable
- * @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.
- */
- lock(): boolean;
- }
- /**
- * This interface defines the IBrush2D contract.
- * Classes implementing a new type of Brush2D must implement this interface
- */
- interface IBrush2D extends ILockable {
- /**
- * Define if the brush will use transparency / alpha blending
- * @returns true if the brush use transparency
- */
- isTransparent(): boolean;
- /**
- * 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
- * @returns A string identifier that uniquely identify the instance
- */
- toString(): string;
- }
- /**
- * Base class implementing the ILocable interface.
- * The particularity of this class is to call the protected onLock() method when the instance is about to be locked for good.
- */
- class LockableBase implements ILockable {
- isLocked(): boolean;
- lock(): boolean;
- /**
- * Protected handler that will be called when the instance is about to be locked.
- */
- protected onLock(): void;
- }
- class SolidColorBrush2D extends LockableBase implements IBrush2D {
- constructor(color: Color4, lock?: boolean);
- /**
- * Return true if the brush is transparent, false if it's totally opaque
- */
- isTransparent(): boolean;
- /**
- * The color used by this instance to render
- * @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.
- */
- color: Color4;
- /**
- * Return a unique identifier of the instance, which is simply the hexadecimal representation (CSS Style) of the solid color.
- */
- toString(): string;
- }
- class GradientColorBrush2D extends LockableBase implements IBrush2D {
- constructor(color1: Color4, color2: Color4, translation?: Vector2, rotation?: number, scale?: number, lock?: boolean);
- /**
- * Return true if the brush is transparent, false if it's totally opaque
- */
- isTransparent(): boolean;
- /**
- * First color, the blend will start from this color
- */
- color1: Color4;
- /**
- * Second color, the blend will end to this color
- */
- color2: Color4;
- /**
- * Translation vector to apply on the blend
- * Default is [0;0]
- */
- translation: Vector2;
- /**
- * Rotation in radian to apply to the brush
- * Default direction of the brush is vertical, you can change this using this property.
- * Default is 0.
- */
- rotation: number;
- /**
- * Scale factor to apply to the gradient.
- * Default is 1: no scale.
- */
- scale: number;
- /**
- * Return a string describing the brush
- */
- toString(): string;
- /**
- * Build a unique key string for the given parameters
- */
- static BuildKey(color1: Color4, color2: Color4, translation: Vector2, rotation: number, scale: number): string;
- }
- }
- declare module BABYLON {
- class Canvas2DEngineBoundData {
- GetOrAddModelCache<TInstData>(key: string, factory: (key: string) => ModelRenderCache): ModelRenderCache;
- DisposeModelRenderCache(modelRenderCache: ModelRenderCache): boolean;
- }
- abstract class Canvas2D extends Group2D {
- /**
- * 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.
- * This strategy doesn't allow primitives added directly as children of the Canvas.
- * 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.
- */
- static CACHESTRATEGY_TOPLEVELGROUPS: number;
- /**
- * In this strategy each group will have its own cache bitmap (except if a given group explicitly defines the DONTCACHEOVERRIDE or CACHEINPARENTGROUP behaviors).
- * 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.
- * When using this strategy, group instances can rely on the DONTCACHEOVERRIDE or CACHEINPARENTGROUP behaviors to minimize the amount of cached bitmaps.
- * 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.
- */
- static CACHESTRATEGY_ALLGROUPS: number;
- /**
- * 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).
- */
- static CACHESTRATEGY_CANVAS: number;
- /**
- * This strategy is used to recompose/redraw the canvas entirely at each viewport render.
- * 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).
- * Note that you can't use this strategy for WorldSpace Canvas, they need at least a top level group caching.
- */
- static CACHESTRATEGY_DONTCACHE: number;
- /**
- * Observable Mask to be notified before rendering is made
- */
- static RENDEROBSERVABLE_PRE: number;
- /**
- * Observable Mask to be notified after rendering is made
- */
- static RENDEROBSERVABLE_POST: number;
- constructor(scene: Scene, settings?: {
- id?: string;
- children?: Array<Prim2DBase>;
- size?: Size;
- renderingPhase?: {
- camera: Camera;
- renderingGroupID: number;
- };
- designSize?: Size;
- designUseHorizAxis?: boolean;
- isScreenSpace?: boolean;
- cachingStrategy?: number;
- enableInteraction?: boolean;
- origin?: Vector2;
- isVisible?: boolean;
- backgroundRoundRadius?: number;
- backgroundFill?: IBrush2D | string;
- backgroundBorder?: IBrush2D | string;
- backgroundBorderThickNess?: number;
- });
- drawCallsOpaqueCounter: PerfCounter;
- drawCallsAlphaTestCounter: PerfCounter;
- drawCallsTransparentCounter: PerfCounter;
- groupRenderCounter: PerfCounter;
- updateTransparentDataCounter: PerfCounter;
- cachedGroupRenderCounter: PerfCounter;
- updateCachedStateCounter: PerfCounter;
- updateLayoutCounter: PerfCounter;
- updatePositioningCounter: PerfCounter;
- updateLocalTransformCounter: PerfCounter;
- updateGlobalTransformCounter: PerfCounter;
- boundingInfoRecomputeCounter: PerfCounter;
- static instances: Array<Canvas2D>;
- /**
- * 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.
- * Beware that you have to take under consideration the origin in your calculations! Good luck!
- */
- worldSpaceToNodeLocal: (worldPos: Vector3) => Vector2;
- /**
- * 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
- */
- worldSpaceCacheChanged: () => void;
- /**
- * Internal method, you should use the Prim2DBase version instead
- */
- /**
- * Internal method, you should use the Prim2DBase version instead
- */
- /**
- * Determine if the given pointer is captured or not
- * @param pointerId the Id of the pointer
- * @return true if it's captured, false otherwise
- */
- isPointerCaptured(pointerId: number): boolean;
- private getCapturedPrimitive(pointerId);
- /**
- * Don't forget to call the dispose method when you're done with the Canvas instance.
- * But don't worry, if you dispose its scene, the canvas will be automatically disposed too.
- */
- dispose(): boolean;
- /**
- * Accessor to the Scene that owns the Canvas
- * @returns The instance of the Scene object
- */
- scene: Scene;
- /**
- * Accessor to the Engine that drives the Scene used by this Canvas
- * @returns The instance of the Engine object
- */
- engine: Engine;
- /**
- * return a unique identifier for the Canvas2D
- */
- uid: string;
- /**
- * And observable called during the Canvas rendering process.
- * This observable is called twice per render, each time with a different mask:
- * - 1: before render is executed
- * - 2: after render is executed
- */
- renderObservable: Observable<Canvas2D>;
- /**
- * Accessor of the Caching Strategy used by this Canvas.
- * See Canvas2D.CACHESTRATEGY_xxxx static members for more information
- * @returns the value corresponding to the used strategy.
- */
- cachingStrategy: number;
- /**
- * Return true if the Canvas is a Screen Space one, false if it's a World Space one.
- * @returns {}
- */
- isScreenSpace: boolean;
- /**
- * Only valid for World Space Canvas, returns the scene node that displays the canvas
- */
- worldSpaceCanvasNode: Node;
- /**
- * Check if the WebGL Instanced Array extension is supported or not
- */
- supportInstancedArray: boolean;
- /**
- * Property that defines the fill object used to draw the background of the Canvas.
- * Note that Canvas with a Caching Strategy of
- * @returns If the background is not set, null will be returned, otherwise a valid fill object is returned.
- */
- backgroundFill: IBrush2D;
- /**
- * Property that defines the border object used to draw the background of the Canvas.
- * @returns If the background is not set, null will be returned, otherwise a valid border object is returned.
- */
- backgroundBorder: IBrush2D;
- /**
- * Property that defines the thickness of the border object used to draw the background of the Canvas.
- * @returns If the background is not set, null will be returned, otherwise a valid number matching the thickness is returned.
- */
- backgroundBorderThickness: number;
- /**
- * You can set the roundRadius of the background
- * @returns The current roundRadius
- */
- backgroundRoundRadius: number;
- /**
- * Enable/Disable interaction for this Canvas
- * When enabled the Prim2DBase.pointerEventObservable property will notified when appropriate events occur
- */
- interactionEnabled: boolean;
- fitRenderingDevice: boolean;
- designSize: Size;
- designSizeUseHorizAxis: boolean;
- /**
- * Return
- */
- overPrim: Prim2DBase;
- /**
- * Access the babylon.js' engine bound data, do not invoke this method, it's for internal purpose only
- * @returns {}
- */
- createCanvasProfileInfoCanvas(): Canvas2D;
- /**
- * Instanced Array will be create if there's at least this number of parts/prim that can fit into it
- */
- minPartCountToUseInstancedArray: number;
- private checkBackgroundAvailability();
- addCachedGroupRenderCounter(count: number): void;
- addUpdateCachedStateCounter(count: number): void;
- addUpdateLayoutCounter(count: number): void;
- addUpdatePositioningCounter(count: number): void;
- addupdateLocalTransformCounter(count: number): void;
- addUpdateGlobalTransformCounter(count: number): void;
- /**
- * Call this method change you want to have layout related data computed and up to date (layout area, primitive area, local/global transformation matrices)
- */
- updateCanvasLayout(forceRecompute: boolean): void;
- /**
- * Method that renders the Canvas, you should not invoke
- */
- /**
- * Internal method that allocate a cache for the given group.
- * Caching is made using a collection of MapTexture where many groups have their bitmap cache stored inside.
- * @param group The group to allocate the cache of.
- * @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.
- */
- node: PackedRect;
- texture: MapTexture;
- sprite: Sprite2D;
- };
- /**
- * Define the default size used for both the width and height of a MapTexture to allocate.
- * Note that some MapTexture might be bigger than this size if the first node to allocate is bigger in width or height
- */
- /**
- * Internal method used to register a Scene Node to track position for the given group
- * Do not invoke this method, for internal purpose only.
- * @param group the group to track its associated Scene Node
- */
- /**
- * Internal method used to unregister a tracked Scene Node
- * Do not invoke this method, it's for internal purpose only.
- * @param group the group to unregister its tracked Scene Node from.
- */
- /**
- * Get a Solid Color Brush instance matching the given color.
- * @param color The color to retrieve
- * @return A shared instance of the SolidColorBrush2D class that use the given color
- */
- static GetSolidColorBrush(color: Color4): IBrush2D;
- /**
- * Get a Solid Color Brush instance matching the given color expressed as a CSS formatted hexadecimal value.
- * @param color The color to retrieve
- * @return A shared instance of the SolidColorBrush2D class that uses the given color
- */
- static GetSolidColorBrushFromHex(hexValue: string): IBrush2D;
- /**
- * Get a Gradient Color Brush
- * @param color1 starting color
- * @param color2 engine color
- * @param translation translation vector to apply. default is [0;0]
- * @param rotation rotation in radian to apply to the brush, initial direction is top to bottom. rotation is counter clockwise. default is 0.
- * @param scale scaling factor to apply. default is 1.
- */
- static GetGradientColorBrush(color1: Color4, color2: Color4, translation?: Vector2, rotation?: number, scale?: number): IBrush2D;
- /**
- * Create a solid or gradient brush from a string value.
- * @param brushString should be either
- * - "solid: #RRGGBBAA" or "#RRGGBBAA"
- * - "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.
- */
- static GetBrushFromString(brushString: string): IBrush2D;
- }
- class WorldSpaceCanvas2D extends Canvas2D {
- /**
- * 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.
- * 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.
- * @param scene the Scene that owns the Canvas
- * @param size the dimension of the Canvas in World Space
- * @param settings a combination of settings, possible ones are
- * - children: an array of direct children primitives
- * - id: a text identifier, for information purpose only, default is null.
- * - worldPosition the position of the Canvas in World Space, default is [0,0,0]
- * - worldRotation the rotation of the Canvas in World Space, default is Quaternion.Identity()
- * - sideOrientation: Unexpected behavior occur if the value is different from Mesh.DEFAULTSIDE right now, so please use this one, which is the default.
- * - cachingStrategy Must be CACHESTRATEGY_CANVAS for now, which is the default.
- * - 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).
- * - isVisible: true if the canvas must be visible, false for hidden. Default is true.
- * - backgroundRoundRadius: the round radius of the background, either backgroundFill or backgroundBorder must be specified.
- * - 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.
- * - 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.
- * - backgroundBorderThickness: if a backgroundBorder is specified, its thickness can be set using this property
- * - 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.
- * - 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.
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(scene: Scene, size: Size, settings?: {
- children?: Array<Prim2DBase>;
- id?: string;
- worldPosition?: Vector3;
- worldRotation?: Quaternion;
- sideOrientation?: number;
- cachingStrategy?: number;
- enableInteraction?: boolean;
- isVisible?: boolean;
- backgroundRoundRadius?: number;
- backgroundFill?: IBrush2D | string;
- backgroundBorder?: IBrush2D | string;
- backgroundBorderThickNess?: number;
- customWorldSpaceNode?: Node;
- maxAdaptiveCanvasSize?: number;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- dispose(): boolean;
- }
- class ScreenSpaceCanvas2D extends Canvas2D {
- /**
- * 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.
- * 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.
- * All caching strategies will be available.
- * 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]
- * @param scene the Scene that owns the Canvas
- * @param settings a combination of settings, possible ones are
- * - children: an array of direct children primitives
- * - id: a text identifier, for information purpose only
- * - x: the position along the x axis (horizontal), relative to the left edge of the viewport. you can alternatively use the position setting.
- * - y: the position along the y axis (vertically), relative to the bottom edge of the viewport. you can alternatively use the position setting.
- * - 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]
- * - width: the width of the Canvas. you can alternatively use the size setting.
- * - height: the height of the Canvas. you can alternatively use the size setting.
- * - 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
- * - 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.
- * - 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.
- * - 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.
- * - cachingStrategy: either CACHESTRATEGY_TOPLEVELGROUPS, CACHESTRATEGY_ALLGROUPS, CACHESTRATEGY_CANVAS, CACHESTRATEGY_DONTCACHE. Please refer to their respective documentation for more information. Default is Canvas2D.CACHESTRATEGY_DONTCACHE
- * - 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.
- * - isVisible: true if the canvas must be visible, false for hidden. Default is true.
- * - backgroundRoundRadius: the round radius of the background, either backgroundFill or backgroundBorder must be specified.
- * - 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.
- * - 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.
- * - backgroundBorderThickness: if a backgroundBorder is specified, its thickness can be set using this property
- * - 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.
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see BABYLON.PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see BABYLON.PrimitiveThickness.fromString)
- */
- constructor(scene: Scene, settings?: {
- children?: Array<Prim2DBase>;
- id?: string;
- x?: number;
- y?: number;
- position?: Vector2;
- origin?: Vector2;
- width?: number;
- height?: number;
- size?: Size;
- renderingPhase?: {
- camera: Camera;
- renderingGroupID: number;
- };
- designSize?: Size;
- designUseHorizAxis?: boolean;
- cachingStrategy?: number;
- cacheBehavior?: number;
- enableInteraction?: boolean;
- isVisible?: boolean;
- backgroundRoundRadius?: number;
- backgroundFill?: IBrush2D | string;
- backgroundBorder?: IBrush2D | string;
- backgroundBorderThickNess?: number;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- }
- }
- declare module BABYLON {
- class LayoutEngineBase implements ILockable {
- constructor();
- updateLayout(prim: Prim2DBase): void;
- isChildPositionAllowed: boolean;
- isLocked(): boolean;
- lock(): boolean;
- layoutDirtyOnPropertyChangedMask: any;
- }
- class CanvasLayoutEngine extends LayoutEngineBase {
- static Singleton: CanvasLayoutEngine;
- updateLayout(prim: Prim2DBase): void;
- isChildPositionAllowed: boolean;
- }
- class StackPanelLayoutEngine extends LayoutEngineBase {
- constructor();
- static Horizontal: StackPanelLayoutEngine;
- static Vertical: StackPanelLayoutEngine;
- isHorizontal: boolean;
- private static dstOffset;
- private static dstArea;
- updateLayout(prim: Prim2DBase): void;
- isChildPositionAllowed: boolean;
- }
- }
- declare module BABYLON {
- class Ellipse2DRenderCache extends ModelRenderCache {
- effectsReady: boolean;
- fillVB: WebGLBuffer;
- fillIB: WebGLBuffer;
- fillIndicesCount: number;
- instancingFillAttributes: InstancingAttributeInfo[];
- effectFillInstanced: Effect;
- effectFill: Effect;
- borderVB: WebGLBuffer;
- borderIB: WebGLBuffer;
- borderIndicesCount: number;
- instancingBorderAttributes: InstancingAttributeInfo[];
- effectBorderInstanced: Effect;
- effectBorder: Effect;
- constructor(engine: Engine, modelKey: string);
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- dispose(): boolean;
- }
- class Ellipse2DInstanceData extends Shape2DInstanceData {
- constructor(partId: number);
- properties: Vector3;
- }
- class Ellipse2D extends Shape2D {
- static acutalSizeProperty: Prim2DPropInfo;
- static subdivisionsProperty: Prim2DPropInfo;
- actualSize: Size;
- subdivisions: number;
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- protected updateLevelBoundingInfo(): void;
- /**
- * Create an Ellipse 2D Shape primitive
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id: a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - size: the size of the group. Alternatively the width and height properties can be set. Default will be [10;10].
- * - subdivision: the number of subdivision to create the ellipse perimeter, default is 64.
- * - 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)
- * - 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)
- * - borderThickness: the thickness of the drawn border, default is 1.
- * - isVisible: true if the group must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- size?: Size;
- width?: number;
- height?: number;
- subdivisions?: number;
- fill?: IBrush2D | string;
- border?: IBrush2D | string;
- borderThickness?: number;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Ellipse2DRenderCache;
- protected createInstanceDataParts(): InstanceDataBase[];
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- }
- declare module BABYLON {
- class Group2D extends Prim2DBase {
- static GROUP2D_PROPCOUNT: number;
- static sizeProperty: Prim2DPropInfo;
- static actualSizeProperty: Prim2DPropInfo;
- /**
- * Default behavior, the group will use the caching strategy defined at the Canvas Level
- */
- static GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY: number;
- /**
- * When used, this group's content won't be cached, no matter which strategy used.
- * If the group is part of a WorldSpace Canvas, its content will be drawn in the Canvas cache bitmap.
- */
- static GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE: number;
- /**
- * When used, the group's content will be cached in the nearest cached parent group/canvas
- */
- static GROUPCACHEBEHAVIOR_CACHEINPARENTGROUP: number;
- /**
- * 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
- */
- static GROUPCACHEBEHAVIOR_NORESIZEONSCALE: number;
- private static GROUPCACHEBEHAVIOR_OPTIONMASK;
- /**
- * Create an Logical or Renderable Group.
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - 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.
- * - cacheBehavior: Define how the group should behave regarding the Canvas's cache strategy, default is Group2D.GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY
- * - 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).
- * - isVisible: true if the group must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- trackNode?: Node;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- size?: Size;
- width?: number;
- height?: number;
- cacheBehavior?: number;
- layoutEngine?: LayoutEngineBase | string;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected applyCachedTexture(vertexData: VertexData, material: StandardMaterial): void;
- /**
- * Allow you to access the information regarding the cached rectangle of the Group2D into the MapTexture.
- * 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.
- */
- cachedRect: PackedRect;
- /**
- * The UVs into the MapTexture that map the cached group
- */
- cachedUVs: Vector2[];
- cachedUVsChanged: Observable<Vector2[]>;
- /**
- * Access the texture that maintains a cached version of the Group2D.
- * This is useful only if you're not using a WorldSpaceNode for your WorldSpace Canvas and therefore need to perform the rendering yourself.
- */
- cacheTexture: MapTexture;
- /**
- * Call this method to remove this Group and its children from the Canvas
- */
- dispose(): boolean;
- /**
- * @returns Returns true if the Group render content, false if it's a logical group only
- */
- isRenderableGroup: boolean;
- /**
- * @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
- */
- isCachedGroup: boolean;
- /**
- * Get/Set the size of the group. If null the size of the group will be determine from its content.
- * 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.
- */
- size: Size;
- viewportSize: ISize;
- actualSize: Size;
- /**
- * 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.
- * GROUPCACHEBEHAVIOR_NORESIZEONSCALE can also be set if you set it at creation time.
- * 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.
- */
- cacheBehavior: number;
- /**
- * Get/set the Scene's Node that should be tracked, the group's position will follow the projected position of the Node.
- */
- trackedNode: Node;
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- protected updateLevelBoundingInfo(): void;
- protected static _unS: Vector2;
- protected handleGroupChanged(prop: Prim2DPropInfo): void;
- private detectGroupStates();
- }
- class RenderableGroupData {
- constructor();
- dispose(owner: Canvas2D): void;
- addNewTransparentPrimitiveInfo(prim: RenderablePrim2D, gii: GroupInstanceInfo): TransparentPrimitiveInfo;
- removeTransparentPrimitiveInfo(tpi: TransparentPrimitiveInfo): void;
- transparentPrimitiveZChanged(tpi: TransparentPrimitiveInfo): void;
- }
- class TransparentPrimitiveInfo {
- }
- }
- declare module BABYLON {
- class Lines2DRenderCache extends ModelRenderCache {
- effectsReady: boolean;
- fillVB: WebGLBuffer;
- fillIB: WebGLBuffer;
- fillIndicesCount: number;
- instancingFillAttributes: InstancingAttributeInfo[];
- effectFill: Effect;
- effectFillInstanced: Effect;
- borderVB: WebGLBuffer;
- borderIB: WebGLBuffer;
- borderIndicesCount: number;
- instancingBorderAttributes: InstancingAttributeInfo[];
- effectBorder: Effect;
- effectBorderInstanced: Effect;
- constructor(engine: Engine, modelKey: string);
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- dispose(): boolean;
- }
- class Lines2DInstanceData extends Shape2DInstanceData {
- constructor(partId: number);
- boundingMin: Vector2;
- boundingMax: Vector2;
- }
- class Lines2D extends Shape2D {
- /**
- * No Cap to apply on the extremity
- */
- static NoCap: number;
- /**
- * A round cap, will use the line thickness as diameter
- */
- static RoundCap: number;
- /**
- * Creates a triangle at the extremity.
- */
- static TriangleCap: number;
- /**
- * Creates a Square anchor at the extremity, the square size is twice the thickness of the line
- */
- static SquareAnchorCap: number;
- /**
- * Creates a round anchor at the extremity, the diameter is twice the thickness of the line
- */
- static RoundAnchorCap: number;
- /**
- * Creates a diamond anchor at the extremity.
- */
- static DiamondAnchorCap: number;
- /**
- * Creates an arrow anchor at the extremity. the arrow base size is twice the thickness of the line
- */
- static ArrowCap: number;
- static pointsProperty: Prim2DPropInfo;
- static fillThicknessProperty: Prim2DPropInfo;
- static closedProperty: Prim2DPropInfo;
- static startCapProperty: Prim2DPropInfo;
- static endCapProperty: Prim2DPropInfo;
- points: Vector2[];
- fillThickness: number;
- closed: boolean;
- startCap: number;
- endCap: number;
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- protected boundingMin: Vector2;
- protected boundingMax: Vector2;
- protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
- protected updateLevelBoundingInfo(): void;
- /**
- * Create an 2D Lines Shape primitive. The defined lines may be opened or closed (see below)
- * @param points an array that describe the points to use to draw the line, must contain at least two entries.
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - 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.
- * - 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.
- * - 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.
- * - 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.
- * - 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)
- * - 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)
- * - borderThickness: the thickness of the drawn border, default is 1.
- * - isVisible: true if the primitive must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(points: Vector2[], settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- fillThickness?: number;
- closed?: boolean;
- startCap?: number;
- endCap?: number;
- fill?: IBrush2D | string;
- border?: IBrush2D | string;
- borderThickness?: number;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Lines2DRenderCache;
- size: Size;
- protected createInstanceDataParts(): InstanceDataBase[];
- protected applyActualScaleOnTransform(): boolean;
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- }
- declare module BABYLON {
- const enum ShaderDataType {
- Vector2 = 0,
- Vector3 = 1,
- Vector4 = 2,
- Matrix = 3,
- float = 4,
- Color3 = 5,
- Color4 = 6,
- Size = 7,
- }
- class GroupInstanceInfo {
- constructor(owner: Group2D, mrc: ModelRenderCache, partCount: number);
- dispose(): boolean;
- owner: Group2D;
- modelRenderCache: ModelRenderCache;
- partIndexFromId: StringDictionary<number>;
- hasOpaqueData: boolean;
- hasAlphaTestData: boolean;
- hasTransparentData: boolean;
- opaqueDirty: boolean;
- opaqueData: GroupInfoPartData[];
- alphaTestDirty: boolean;
- alphaTestData: GroupInfoPartData[];
- transparentOrderDirty: boolean;
- transparentDirty: boolean;
- transparentData: TransparentGroupInfoPartData[];
- sortTransparentData(): void;
- usedShaderCategories: string[];
- strides: number[];
- }
- class TransparentSegment {
- constructor();
- dispose(engine: Engine): void;
- groupInsanceInfo: GroupInstanceInfo;
- startZ: number;
- endZ: number;
- startDataIndex: number;
- endDataIndex: number;
- partBuffers: WebGLBuffer[];
- }
- class GroupInfoPartData {
- constructor(stride: number);
- dispose(engine: Engine): boolean;
- }
- class TransparentGroupInfoPartData extends GroupInfoPartData {
- constructor(stride: number, zoff: number);
- }
- class ModelRenderCache {
- constructor(engine: Engine, modelKey: string);
- dispose(): boolean;
- isDisposed: boolean;
- addRef(): number;
- modelKey: string;
- /**
- * Render the model instances
- * @param instanceInfo
- * @param context
- * @return must return true is the rendering succeed, false if the rendering couldn't be done (asset's not yet ready, like Effect)
- */
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- protected getPartIndexFromId(partId: number): number;
- protected loadInstancingAttributes(partId: number, effect: Effect): InstancingAttributeInfo[];
- private static v2;
- private static v3;
- private static v4;
- protected setupUniforms(effect: Effect, partIndex: number, data: DynamicFloatArray, elementCount: number): void;
- }
- class ModelRenderCachePartData {
- }
- }
- declare module BABYLON {
- class PrepareRender2DContext {
- constructor();
- /**
- * True if the primitive must be refreshed no matter what
- * This mode is needed because sometimes the primitive doesn't change by itself, but external changes make a refresh of its InstanceData necessary
- */
- forceRefreshPrimitive: boolean;
- }
- class Render2DContext {
- constructor(renderMode: number);
- /**
- * Define which render Mode should be used to render the primitive: one of Render2DContext.RenderModeXxxx property
- */
- renderMode: number;
- /**
- * If true hardware instancing is supported and must be used for the rendering. The groupInfoPartData._partBuffer must be used.
- * If false rendering on a per primitive basis must be made. The following properties must be used
- * - groupInfoPartData._partData: contains the primitive instances data to render
- * - partDataStartIndex: the index into instanceArrayData of the first instance to render.
- * - partDataCount: the number of primitive to render
- */
- useInstancing: boolean;
- /**
- * If specified, must take precedence from the groupInfoPartData. partIndex is the same as groupInfoPardData
- */
- instancedBuffers: WebGLBuffer[];
- /**
- * To use when instancedBuffers is specified, gives the count of instances to draw
- */
- instancesCount: number;
- /**
- * Contains the data related to the primitives instances to render
- */
- groupInfoPartData: GroupInfoPartData[];
- /**
- * 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.
- */
- partDataStartIndex: number;
- /**
- * The exclusive end index, you have to render the primitive instances until you reach this one, but don't render this one!
- */
- partDataEndIndex: number;
- /**
- * The set of primitives to render is opaque.
- * This is the first rendering pass. All Opaque primitives are rendered. Depth Compare and Write are both enabled.
- */
- static RenderModeOpaque: number;
- /**
- * The set of primitives to render is using Alpha Test (aka masking).
- * 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.
- */
- static RenderModeAlphaTest: number;
- /**
- * The set of primitives to render is transparent.
- * 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.
- */
- static RenderModeTransparent: number;
- }
- /**
- * This class store information for the pointerEventObservable Observable.
- * 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.
- */
- class PrimitivePointerInfo {
- /**
- * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive.
- * Bubbles: yes
- */
- static PointerOver: number;
- /**
- * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive or one of its descendants.
- * Bubbles: no
- */
- static PointerEnter: number;
- /**
- * 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.
- * Bubbles: yes
- */
- static PointerDown: number;
- /**
- * This event type is raised when the pointer is a mouse and it's wheel is rolling
- * Bubbles: yes
- */
- static PointerMouseWheel: number;
- /**
- * 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.
- * Bubbles: yes
- */
- static PointerMove: number;
- /**
- * 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.
- * Bubbles: yes
- */
- static PointerUp: number;
- /**
- * This event type is raised when a pointing device is moved out of the hit test the boundaries of a primitive.
- * Bubbles: yes
- */
- static PointerOut: number;
- /**
- * This event type is raised when a pointing device is moved out of the hit test boundaries of a primitive and all its descendants.
- * Bubbles: no
- */
- static PointerLeave: number;
- /**
- * 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.
- * Bubbles: yes
- */
- static PointerGotCapture: number;
- /**
- * This event type is raised after pointer capture is released for a pointer.
- * Bubbles: yes
- */
- static PointerLostCapture: number;
- static MouseWheelPrecision: number;
- /**
- * Event Type, one of the static PointerXXXX property defined above (PrimitivePointerInfo.PointerOver to PrimitivePointerInfo.PointerLostCapture)
- */
- eventType: number;
- /**
- * Position of the pointer relative to the bottom/left of the Canvas
- */
- canvasPointerPos: Vector2;
- /**
- * Position of the pointer relative to the bottom/left of the primitive that registered the Observer
- */
- primitivePointerPos: Vector2;
- /**
- * The primitive where the event was initiated first (in case of bubbling)
- */
- relatedTarget: Prim2DBase;
- /**
- * Position of the pointer relative to the bottom/left of the relatedTarget
- */
- relatedTargetPointerPos: Vector2;
- /**
- * An observable can set this property to true to stop bubbling on the upper levels
- */
- cancelBubble: boolean;
- /**
- * True if the Control keyboard key is down
- */
- ctrlKey: boolean;
- /**
- * true if the Shift keyboard key is down
- */
- shiftKey: boolean;
- /**
- * true if the Alt keyboard key is down
- */
- altKey: boolean;
- /**
- * true if the Meta keyboard key is down
- */
- metaKey: boolean;
- /**
- * For button, buttons, refer to https://www.w3.org/TR/pointerevents/#button-states
- */
- button: number;
- /**
- * For button, buttons, refer to https://www.w3.org/TR/pointerevents/#button-states
- */
- buttons: number;
- /**
- * The amount of mouse wheel rolled
- */
- mouseWheelDelta: number;
- /**
- * Id of the Pointer involved in the event
- */
- pointerId: number;
- width: number;
- height: number;
- presssure: number;
- tilt: Vector2;
- /**
- * true if the involved pointer is captured for a particular primitive, false otherwise.
- */
- isCaptured: boolean;
- constructor();
- updateRelatedTarget(prim: Prim2DBase, primPointerPos: Vector2): void;
- static getEventTypeName(mask: number): string;
- }
- /**
- * Defines the horizontal and vertical alignment information for a Primitive.
- */
- class PrimitiveAlignment {
- constructor(changeCallback?: () => void);
- /**
- * Alignment is made relative to the left edge of the Primitive. Valid for horizontal alignment only.
- */
- static AlignLeft: number;
- /**
- * Alignment is made relative to the top edge of the Primitive. Valid for vertical alignment only.
- */
- static AlignTop: number;
- /**
- * Alignment is made relative to the right edge of the Primitive. Valid for horizontal alignment only.
- */
- static AlignRight: number;
- /**
- * Alignment is made relative to the bottom edge of the Primitive. Valid for vertical alignment only.
- */
- static AlignBottom: number;
- /**
- * Alignment is made to center the content from equal distance to the opposite edges of the Primitive
- */
- static AlignCenter: number;
- /**
- * The content is stretched toward the opposite edges of the Primitive
- */
- static AlignStretch: number;
- /**
- * Get/set the horizontal alignment. Use one of the AlignXXX static properties of this class
- */
- horizontal: number;
- /**
- * Get/set the vertical alignment. Use one of the AlignXXX static properties of this class
- */
- vertical: number;
- private onChangeCallback();
- /**
- * Set the horizontal alignment from a string value.
- * @param text can be either: 'left','right','center','stretch'
- */
- setHorizontal(text: string): void;
- /**
- * Set the vertical alignment from a string value.
- * @param text can be either: 'top','bottom','center','stretch'
- */
- setVertical(text: string): void;
- /**
- * Set the horizontal and or vertical alignments from a string value.
- * @param text can be: [<h:|horizontal:><left|right|center|stretch>], [<v:|vertical:><top|bottom|center|stretch>]
- */
- fromString(value: string): void;
- copyFrom(pa: PrimitiveAlignment): void;
- isDefault: boolean;
- }
- /**
- * Stores information about a Primitive that was intersected
- */
- class PrimitiveIntersectedInfo {
- prim: Prim2DBase;
- intersectionLocation: Vector2;
- constructor(prim: Prim2DBase, intersectionLocation: Vector2);
- }
- /**
- * Define a thickness toward every edges of a Primitive to allow margin and padding.
- * The thickness can be expressed as pixels, percentages, inherit the value of the parent primitive or be auto.
- */
- class PrimitiveThickness {
- constructor(parentAccess: () => PrimitiveThickness, changedCallback?: () => void);
- /**
- * Set the thickness from a string value
- * @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.
- * Values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- */
- fromString(thickness: string): void;
- /**
- * Set the thickness from multiple string
- * Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- * @param top the top thickness to set
- * @param left the left thickness to set
- * @param right the right thickness to set
- * @param bottom the bottom thickness to set
- */
- fromStrings(top: string, left: string, right: string, bottom: string): PrimitiveThickness;
- /**
- * Set the thickness from pixel values
- * @param top the top thickness in pixels to set
- * @param left the left thickness in pixels to set
- * @param right the right thickness in pixels to set
- * @param bottom the bottom thickness in pixels to set
- */
- fromPixels(top: number, left: number, right: number, bottom: number): PrimitiveThickness;
- /**
- * Apply the same pixel value to all edges
- * @param margin the value to set, in pixels.
- */
- fromUniformPixels(margin: number): PrimitiveThickness;
- copyFrom(pt: PrimitiveThickness): void;
- /**
- * Set all edges in auto
- */
- auto(): PrimitiveThickness;
- setTop(value: number | string): void;
- setLeft(value: number | string): void;
- setRight(value: number | string): void;
- setBottom(value: number | string): void;
- /**
- * Get/set the top thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- */
- top: string;
- /**
- * Get/set the left thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- */
- left: string;
- /**
- * Get/set the right thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- */
- right: string;
- /**
- * Get/set the bottom thickness. Possible values are: 'auto', 'inherit', 'XX%' for percentage, 'XXpx' or 'XX' for pixels.
- */
- bottom: string;
- /**
- * Get/set the top thickness in pixel.
- */
- topPixels: number;
- /**
- * Get/set the left thickness in pixel.
- */
- leftPixels: number;
- /**
- * Get/set the right thickness in pixel.
- */
- rightPixels: number;
- /**
- * Get/set the bottom thickness in pixel.
- */
- bottomPixels: number;
- /**
- * Get/set the top thickness in percentage.
- * The get will return a valid value only if the edge type is percentage.
- * The Set will change the edge mode if needed
- */
- topPercentage: number;
- /**
- * Get/set the left thickness in percentage.
- * The get will return a valid value only if the edge mode is percentage.
- * The Set will change the edge mode if needed
- */
- leftPercentage: number;
- /**
- * Get/set the right thickness in percentage.
- * The get will return a valid value only if the edge mode is percentage.
- * The Set will change the edge mode if needed
- */
- rightPercentage: number;
- /**
- * Get/set the bottom thickness in percentage.
- * The get will return a valid value only if the edge mode is percentage.
- * The Set will change the edge mode if needed
- */
- bottomPercentage: number;
- /**
- * Get/set the top mode. The setter shouldn't be used, other setters with value should be preferred
- */
- topMode: number;
- /**
- * Get/set the left mode. The setter shouldn't be used, other setters with value should be preferred
- */
- leftMode: number;
- /**
- * Get/set the right mode. The setter shouldn't be used, other setters with value should be preferred
- */
- rightMode: number;
- /**
- * Get/set the bottom mode. The setter shouldn't be used, other setters with value should be preferred
- */
- bottomMode: number;
- isDefault: boolean;
- static Auto: number;
- static Inherit: number;
- static Percentage: number;
- static Pixel: number;
- private onChangeCallback();
- /**
- * Compute the positioning/size of an area considering the thickness of this object and a given alignment
- * @param sourceArea the source area where the content must be sized/positioned
- * @param contentSize the content size to position/resize
- * @param alignment the alignment setting
- * @param dstOffset the position of the content, x, y, z, w are left, bottom, right, top
- * @param dstArea the new size of the content
- */
- computeWithAlignment(sourceArea: Size, contentSize: Size, alignment: PrimitiveAlignment, dstOffset: Vector4, dstArea: Size, computeLayoutArea?: boolean): void;
- /**
- * Compute an area and its position considering this thickness properties based on a given source area
- * @param sourceArea the source area
- * @param dstOffset the position of the resulting area
- * @param dstArea the size of the resulting area
- */
- compute(sourceArea: Size, dstOffset: Vector4, dstArea: Size): void;
- /**
- * Compute an area considering this thickness properties based on a given source area
- * @param sourceArea the source area
- * @param result the resulting area
- */
- computeArea(sourceArea: Size, result: Size): void;
- enlarge(sourceArea: Size, dstOffset: Vector4, enlargedArea: Size): void;
- }
- /**
- * Main class used for the Primitive Intersection API
- */
- class IntersectInfo2D {
- constructor();
- /**
- * Set the pick position, relative to the primitive where the intersection test is made
- */
- pickPosition: Vector2;
- /**
- * 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)
- */
- findFirstOnly: boolean;
- /**
- * If true the intersection test will also be made on hidden primitive (false default)
- */
- intersectHidden: boolean;
- /**
- * The topmost intersected primitive
- */
- topMostIntersectedPrimitive: PrimitiveIntersectedInfo;
- /**
- * The array containing all intersected primitive, in no particular order.
- */
- intersectedPrimitives: Array<PrimitiveIntersectedInfo>;
- /**
- * true if at least one primitive intersected during the test
- */
- isIntersected: boolean;
- isPrimIntersected(prim: Prim2DBase): Vector2;
- }
- class Prim2DBase extends SmartPropertyPrim {
- static PRIM2DBASE_PROPCOUNT: number;
- constructor(settings: {
- parent?: Prim2DBase;
- id?: string;
- children?: Array<Prim2DBase>;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- layoutEngine?: LayoutEngineBase | string;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- actionManager: ActionManager;
- /**
- * From 'this' primitive, traverse up (from parent to parent) until the given predicate is true
- * @param predicate the predicate to test on each parent
- * @return the first primitive where the predicate was successful
- */
- traverseUp(predicate: (p: Prim2DBase) => boolean): Prim2DBase;
- /**
- * Retrieve the owner Canvas2D
- */
- owner: Canvas2D;
- /**
- * Get the parent primitive (can be the Canvas, only the Canvas has no parent)
- */
- parent: Prim2DBase;
- /**
- * The array of direct children primitives
- */
- children: Prim2DBase[];
- /**
- * The identifier of this primitive, may not be unique, it's for information purpose only
- */
- id: string;
- /**
- * Metadata of the position property
- */
- static positionProperty: Prim2DPropInfo;
- /**
- * Metadata of the left property
- */
- static xProperty: Prim2DPropInfo;
- /**
- * Metadata of the bottom property
- */
- static yProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualPosition property
- */
- static actualPositionProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualX (Left) property
- */
- static actualXProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualY (Bottom) property
- */
- static actualYProperty: Prim2DPropInfo;
- /**
- * Metadata of the size property
- */
- static sizeProperty: Prim2DPropInfo;
- /**
- * Metadata of the width property
- */
- static widthProperty: Prim2DPropInfo;
- /**
- * Metadata of the height property
- */
- static heightProperty: Prim2DPropInfo;
- /**
- * Metadata of the rotation property
- */
- static rotationProperty: Prim2DPropInfo;
- /**
- * Metadata of the scale property
- */
- static scaleProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualSize property
- */
- static actualSizeProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualWidth property
- */
- static actualWidthProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualHeight property
- */
- static actualHeightProperty: Prim2DPropInfo;
- /**
- * Metadata of the origin property
- */
- static originProperty: Prim2DPropInfo;
- /**
- * Metadata of the levelVisible property
- */
- static levelVisibleProperty: Prim2DPropInfo;
- /**
- * Metadata of the isVisible property
- */
- static isVisibleProperty: Prim2DPropInfo;
- /**
- * Metadata of the zOrder property
- */
- static zOrderProperty: Prim2DPropInfo;
- /**
- * Metadata of the margin property
- */
- static marginProperty: Prim2DPropInfo;
- /**
- * Metadata of the margin property
- */
- static paddingProperty: Prim2DPropInfo;
- /**
- * Metadata of the marginAlignment property
- */
- static marginAlignmentProperty: Prim2DPropInfo;
- /**
- * Metadata of the opacity property
- */
- static opacityProperty: Prim2DPropInfo;
- /**
- * Metadata of the scaleX property
- */
- static scaleXProperty: Prim2DPropInfo;
- /**
- * Metadata of the scaleY property
- */
- static scaleYProperty: Prim2DPropInfo;
- /**
- * Metadata of the actualScale property
- */
- static actualScaleProperty: Prim2DPropInfo;
- /**
- * DO NOT INVOKE for internal purpose only
- */
- actualPosition: Vector2;
- /**
- * Shortcut to actualPosition.x
- */
- actualX: number;
- /**
- * Shortcut to actualPosition.y
- */
- actualY: number;
- /**
- * Position of the primitive, relative to its parent.
- * BEWARE: if you change only position.x or y it won't trigger a property change and you won't have the expected behavior.
- * Use this property to set a new Vector2 object, otherwise to change only the x/y use Prim2DBase.x or y properties.
- * Setting this property may have no effect is specific alignment are in effect.
- */
- position: Vector2;
- /**
- * Direct access to the position.x value of the primitive
- * Use this property when you only want to change one component of the position property
- */
- x: number;
- /**
- * Direct access to the position.y value of the primitive
- * Use this property when you only want to change one component of the position property
- */
- y: number;
- private static boundinbBoxReentrency;
- protected static nullSize: Size;
- /**
- * Size of the primitive or its bounding area
- * BEWARE: if you change only size.width or height it won't trigger a property change and you won't have the expected behavior.
- * Use this property to set a new Size object, otherwise to change only the width/height use Prim2DBase.width or height properties.
- */
- size: Size;
- /**
- * Direct access to the size.width value of the primitive
- * Use this property when you only want to change one component of the size property
- */
- width: number;
- /**
- * Direct access to the size.height value of the primitive
- * Use this property when you only want to change one component of the size property
- */
- height: number;
- rotation: number;
- scale: number;
- /**
- * Return the size of the primitive as it's being rendered into the target.
- * 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.
- * BEWARE: don't use the setter, it's for internal purpose only
- * Note to implementers: you have to override this property and declare if necessary a @xxxxInstanceLevel decorator
- */
- actualSize: Size;
- /**
- * Shortcut to actualSize.width
- */
- actualWidth: number;
- /**
- * Shortcut to actualPosition.height
- */
- actualHeight: number;
- actualZOffset: number;
- /**
- * Get or set the minimal size the Layout Engine should respect when computing the primitive's actualSize.
- * The Primitive's size won't be less than specified.
- * The default value depends of the Primitive type
- */
- minSize: Size;
- /**
- * Get or set the maximal size the Layout Engine should respect when computing the primitive's actualSize.
- * The Primitive's size won't be more than specified.
- * The default value depends of the Primitive type
- */
- maxSize: Size;
- /**
- * The origin defines the normalized coordinate of the center of the primitive, from the bottom/left corner.
- * The origin is used only to compute transformation of the primitive, it has no meaning in the primitive local frame of reference
- * For instance:
- * 0,0 means the center is bottom/left. Which is the default for Canvas2D instances
- * 0.5,0.5 means the center is at the center of the primitive, which is default of all types of Primitives
- * 0,1 means the center is top/left
- * @returns The normalized center.
- */
- origin: Vector2;
- levelVisible: boolean;
- isVisible: boolean;
- zOrder: number;
- isManualZOrder: boolean;
- margin: PrimitiveThickness;
- /**
- * Check for both margin and marginAlignment, return true if at least one of them is specified with a non default value
- */
- padding: PrimitiveThickness;
- marginAlignment: PrimitiveAlignment;
- /**
- * Check if there a marginAlignment specified (non null and not default)
- */
- opacity: number;
- scaleX: number;
- scaleY: number;
- /**
- * 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
- */
- actualScale: Vector2;
- /**
- * Get the actual Scale of the X axis, shortcut for this.actualScale.x
- */
- actualScaleX: number;
- /**
- * Get the actual Scale of the Y axis, shortcut for this.actualScale.y
- */
- actualScaleY: number;
- /**
- * Get the actual opacity level, this property is computed from the opacity property, multiplied by the actualOpacity of its parent (if any)
- */
- actualOpacity: number;
- /**
- * Get/set the layout engine to use for this primitive.
- * The default layout engine is the CanvasLayoutEngine.
- */
- layoutEngine: LayoutEngineBase;
- /**
- * Get/set the layout are of this primitive.
- * The Layout area is the zone allocated by the Layout Engine for this particular primitive. Margins/Alignment will be computed based on this area.
- * The setter should only be called by a Layout Engine class.
- */
- layoutArea: Size;
- /**
- * Get/set the layout area position (relative to the parent primitive).
- * The setter should only be called by a Layout Engine class.
- */
- layoutAreaPos: Vector2;
- /**
- * Define if the Primitive can be subject to intersection test or not (default is true)
- */
- isPickable: boolean;
- /**
- * Define if the Primitive acts as a container or not
- * A container will encapsulate its children for interaction event.
- * If it's not a container events will be process down to children if the primitive is not pickable.
- * Default value is true
- */
- isContainer: boolean;
- /**
- * Return the depth level of the Primitive into the Canvas' Graph. A Canvas will be 0, its direct children 1, and so on.
- */
- hierarchyDepth: number;
- /**
- * Retrieve the Group that is responsible to render this primitive
- */
- renderGroup: Group2D;
- /**
- * Get the global transformation matrix of the primitive
- */
- globalTransform: Matrix;
- /**
- * return the global position of the primitive, relative to its canvas
- */
- getGlobalPosition(): Vector2;
- /**
- * return the global position of the primitive, relative to its canvas
- * @param v the valid Vector2 object where the global position will be stored
- */
- getGlobalPositionByRef(v: Vector2): void;
- /**
- * Get invert of the global transformation matrix of the primitive
- */
- invGlobalTransform: Matrix;
- /**
- * Get the local transformation of the primitive
- */
- localTransform: Matrix;
- /**
- * Get the boundingInfo associated to the primitive and its children.
- * The value is supposed to be always up to date
- */
- boundingInfo: BoundingInfo2D;
- /**
- * Get the boundingInfo of the primitive's content arranged by a layout Engine
- * If a particular child is not arranged by layout, it's boundingInfo is used instead to produce something as accurate as possible
- */
- layoutBoundingInfo: BoundingInfo2D;
- /**
- * Determine if the size is automatically computed or fixed because manually specified.
- * Use the actualSize property to get the final/real size of the primitive
- * @returns true if the size is automatically computed, false if it were manually specified.
- */
- isSizeAuto: boolean;
- /**
- * Return true if this prim has an auto size which is set by the children's global bounding box
- */
- isSizedByContent: boolean;
- /**
- * Determine if the position is automatically computed or fixed because manually specified.
- * Use the actualPosition property to get the final/real position of the primitive
- * @returns true if the position is automatically computed, false if it were manually specified.
- */
- isPositionAuto: boolean;
- /**
- * Interaction with the primitive can be create using this Observable. See the PrimitivePointerInfo class for more information
- */
- pointerEventObservable: Observable<PrimitivePointerInfo>;
- zActualOrderChangedObservable: Observable<number>;
- displayDebugAreas: boolean;
- findById(id: string): Prim2DBase;
- protected onZOrderChanged(): void;
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- /**
- * Capture all the Events of the given PointerId for this primitive.
- * Don't forget to call releasePointerEventsCapture when done.
- * @param pointerId the Id of the pointer to capture the events from.
- */
- setPointerEventCapture(pointerId: number): boolean;
- /**
- * Release a captured pointer made with setPointerEventCapture.
- * @param pointerId the Id of the pointer to release the capture from.
- */
- releasePointerEventsCapture(pointerId: number): boolean;
- /**
- * Make an intersection test with the primitive, all inputs/outputs are stored in the IntersectInfo2D class, see its documentation for more information.
- * @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.
- */
- intersect(intersectInfo: IntersectInfo2D): boolean;
- /**
- * Move a child object into a new position regarding its siblings to change its rendering order.
- * You can also use the shortcut methods to move top/bottom: moveChildToTop, moveChildToBottom, moveToTop, moveToBottom.
- * @param child the object to move
- * @param previous the object which will be before "child", if child has to be the first among sibling, set "previous" to null.
- */
- moveChild(child: Prim2DBase, previous: Prim2DBase): boolean;
- /**
- * Move the given child so it's displayed on the top of all its siblings
- * @param child the primitive to move to the top
- */
- moveChildToTop(child: Prim2DBase): boolean;
- /**
- * Move the given child so it's displayed on the bottom of all its siblings
- * @param child the primitive to move to the top
- */
- moveChildToBottom(child: Prim2DBase): boolean;
- /**
- * Move this primitive to be at the top among all its sibling
- */
- moveToTop(): boolean;
- /**
- * Move this primitive to be at the bottom among all its sibling
- */
- moveToBottom(): boolean;
- private addChild(child);
- /**
- * Dispose the primitive, remove it from its parent.
- */
- dispose(): boolean;
- protected onPrimBecomesDirty(): void;
- protected static _isCanvasInit: boolean;
- protected static CheckParent(parent: Prim2DBase): void;
- protected updateCachedStatesOf(list: Prim2DBase[], recurse: boolean): void;
- protected updateCachedStates(recurse: boolean): void;
- /**
- * Get the content are of this primitive, this area is computed using the padding property and also possibly the primitive type itself.
- * Children of this primitive will be positioned relative to the bottom/left corner of this area.
- */
- contentArea: Size;
- /**
- * This method is used to alter the contentArea of the Primitive before margin is applied.
- * 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.
- * @param primSize the current size of the primitive
- * @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
- * @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!
- */
- /**
- * This method is used to calculate the new size of the primitive based on the content which must stay the same
- * Check the Rectangle2D implementation for a concrete application.
- * @param primSize the current size of the primitive
- * @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!
- */
- }
- }
- declare module BABYLON {
- class Rectangle2DRenderCache extends ModelRenderCache {
- effectsReady: boolean;
- fillVB: WebGLBuffer;
- fillIB: WebGLBuffer;
- fillIndicesCount: number;
- instancingFillAttributes: InstancingAttributeInfo[];
- effectFill: Effect;
- effectFillInstanced: Effect;
- borderVB: WebGLBuffer;
- borderIB: WebGLBuffer;
- borderIndicesCount: number;
- instancingBorderAttributes: InstancingAttributeInfo[];
- effectBorder: Effect;
- effectBorderInstanced: Effect;
- constructor(engine: Engine, modelKey: string);
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- dispose(): boolean;
- }
- class Rectangle2DInstanceData extends Shape2DInstanceData {
- constructor(partId: number);
- properties: Vector3;
- }
- class Rectangle2D extends Shape2D {
- static actualSizeProperty: Prim2DPropInfo;
- static notRoundedProperty: Prim2DPropInfo;
- static roundRadiusProperty: Prim2DPropInfo;
- actualSize: Size;
- notRounded: boolean;
- roundRadius: number;
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- protected updateLevelBoundingInfo(): void;
- /**
- * Create an Rectangle 2D Shape primitive. May be a sharp rectangle (with sharp corners), or a rounded one.
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y settings can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - size: the size of the group. Alternatively the width and height settings can be set. Default will be [10;10].
- * - roundRadius: if the rectangle has rounded corner, set their radius, default is 0 (to get a sharp edges rectangle).
- * - 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)
- * - 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)
- * - borderThickness: the thickness of the drawn border, default is 1.
- * - isVisible: true if the primitive must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- size?: Size;
- width?: number;
- height?: number;
- roundRadius?: number;
- fill?: IBrush2D | string;
- border?: IBrush2D | string;
- borderThickness?: number;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- static roundSubdivisions: number;
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Rectangle2DRenderCache;
- protected createInstanceDataParts(): InstanceDataBase[];
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- }
- declare module BABYLON {
- class InstanceClassInfo {
- constructor(base: InstanceClassInfo);
- mapProperty(propInfo: InstancePropInfo, push: boolean): void;
- getInstancingAttributeInfos(effect: Effect, categories: string[]): InstancingAttributeInfo[];
- getShaderAttributes(categories: string[]): string[];
- }
- class InstancePropInfo {
- attributeName: string;
- category: string;
- size: number;
- shaderOffset: number;
- instanceOffset: StringDictionary<number>;
- dataType: ShaderDataType;
- delimitedCategory: string;
- constructor();
- setSize(val: any): void;
- writeData(array: Float32Array, offset: number, val: any): void;
- }
- function instanceData<T>(category?: string, shaderAttributeName?: string): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- class InstanceDataBase {
- constructor(partId: number, dataElementCount: number);
- id: number;
- isVisible: boolean;
- zBias: Vector2;
- transformX: Vector4;
- transformY: Vector4;
- opacity: number;
- getClassTreeInfo(): ClassTreeInfo<InstanceClassInfo, InstancePropInfo>;
- allocElements(): void;
- freeElements(): void;
- dataElementCount: number;
- groupInstanceInfo: GroupInstanceInfo;
- arrayLengthChanged: boolean;
- curElement: number;
- renderMode: number;
- dataElements: DynamicFloatArrayElementInfo[];
- dataBuffer: DynamicFloatArray;
- typeInfo: ClassTreeInfo<InstanceClassInfo, InstancePropInfo>;
- }
- abstract class RenderablePrim2D extends Prim2DBase {
- static RENDERABLEPRIM2D_PROPCOUNT: number;
- static isAlphaTestProperty: Prim2DPropInfo;
- static isTransparentProperty: Prim2DPropInfo;
- isAlphaTest: boolean;
- isTransparent: boolean;
- renderMode: number;
- constructor(settings?: {
- parent?: Prim2DBase;
- id?: string;
- origin?: Vector2;
- isVisible?: boolean;
- });
- /**
- * Dispose the primitive and its resources, remove it from its parent
- */
- dispose(): boolean;
- protected onZOrderChanged(): void;
- /**
- * Transform a given point using the Primitive's origin setting.
- * This method requires the Primitive's actualSize to be accurate
- * @param p the point to transform
- * @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.
- * @param res an allocated Vector2 that will receive the transformed content
- */
- protected transformPointWithOriginByRef(p: Vector2, originOffset: Vector2, res: Vector2): void;
- protected transformPointWithOriginToRef(p: Vector2, originOffset: Vector2, res: Vector2): Vector2;
- /**
- * Get the info for a given effect based on the dataPart metadata
- * @param dataPartId partId in part list to get the info
- * @param vertexBufferAttributes vertex buffer attributes to manually add
- * @param uniforms uniforms to manually add
- * @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
- */
- protected getDataPartEffectInfo(dataPartId: number, vertexBufferAttributes: string[], uniforms?: string[], useInstanced?: boolean): {
- attributes: string[];
- uniforms: string[];
- defines: string;
- };
- protected modelRenderCache: ModelRenderCache;
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): void;
- protected createInstanceDataParts(): InstanceDataBase[];
- protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
- protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
- protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
- protected applyActualScaleOnTransform(): boolean;
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- /**
- * Update the instanceDataBase level properties of a part
- * @param part the part to update
- * @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).
- */
- protected updateInstanceDataPart(part: InstanceDataBase, positionOffset?: Vector2): void;
- }
- }
- declare module BABYLON {
- abstract class Shape2D extends RenderablePrim2D {
- static SHAPE2D_BORDERPARTID: number;
- static SHAPE2D_FILLPARTID: number;
- static SHAPE2D_CATEGORY_BORDER: string;
- static SHAPE2D_CATEGORY_BORDERSOLID: string;
- static SHAPE2D_CATEGORY_BORDERGRADIENT: string;
- static SHAPE2D_CATEGORY_FILLSOLID: string;
- static SHAPE2D_CATEGORY_FILLGRADIENT: string;
- static SHAPE2D_PROPCOUNT: number;
- static borderProperty: Prim2DPropInfo;
- static fillProperty: Prim2DPropInfo;
- static borderThicknessProperty: Prim2DPropInfo;
- border: IBrush2D;
- /**
- * Get/set the brush to render the Fill part of the Primitive
- */
- fill: IBrush2D;
- borderThickness: number;
- constructor(settings?: {
- fill?: IBrush2D | string;
- border?: IBrush2D | string;
- borderThickness?: number;
- });
- protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
- protected applyActualScaleOnTransform(): boolean;
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- class Shape2DInstanceData extends InstanceDataBase {
- fillSolidColor: Color4;
- fillGradientColor1: Color4;
- fillGradientColor2: Color4;
- fillGradientTY: Vector4;
- borderThickness: number;
- borderSolidColor: Color4;
- borderGradientColor1: Color4;
- borderGradientColor2: Color4;
- borderGradientTY: Vector4;
- }
- }
- declare module BABYLON {
- class Prim2DClassInfo {
- }
- class Prim2DPropInfo {
- static PROPKIND_MODEL: number;
- static PROPKIND_INSTANCE: number;
- static PROPKIND_DYNAMIC: number;
- id: number;
- flagId: number;
- kind: number;
- name: string;
- dirtyBoundingInfo: boolean;
- dirtyParentBoundingInfo: boolean;
- typeLevelCompare: boolean;
- bindingMode: number;
- bindingUpdateSourceTrigger: number;
- }
- class ClassTreeInfo<TClass, TProp> {
- constructor(baseClass: ClassTreeInfo<TClass, TProp>, type: Object, classContentFactory: (base: TClass) => TClass);
- classContent: TClass;
- type: Object;
- levelContent: StringDictionary<TProp>;
- fullContent: StringDictionary<TProp>;
- getLevelOf(type: Object): ClassTreeInfo<TClass, TProp>;
- getOrAddType(baseType: Object, type: Object): ClassTreeInfo<TClass, TProp>;
- static get<TClass, TProp>(type: Object): ClassTreeInfo<TClass, TProp>;
- static getOrRegister<TClass, TProp>(type: Object, classContentFactory: (base: TClass) => TClass): ClassTreeInfo<TClass, TProp>;
- }
- class DataBinding {
- /**
- * Use the mode specified in the SmartProperty declaration
- */
- static MODE_DEFAULT: number;
- /**
- * Update the binding target only once when the Smart Property's value is first accessed
- */
- static MODE_ONETIME: number;
- /**
- * Update the smart property when the source changes.
- * The source won't be updated if the smart property value is set.
- */
- static MODE_ONEWAY: number;
- /**
- * Only update the source when the target's data is changing.
- */
- static MODE_ONEWAYTOSOURCE: number;
- /**
- * Update the bind target when the source changes and update the source when the Smart Property value is set.
- */
- static MODE_TWOWAY: number;
- /**
- * Use the Update Source Trigger defined in the SmartProperty declaration
- */
- static UPDATESOURCETRIGGER_DEFAULT: number;
- /**
- * Update the source as soon as the Smart Property has a value change
- */
- static UPDATESOURCETRIGGER_PROPERTYCHANGED: number;
- /**
- * Update the source when the binding target loses focus
- */
- static UPDATESOURCETRIGGER_LOSTFOCUS: number;
- /**
- * Update the source will be made by explicitly calling the UpdateFromDataSource method
- */
- static UPDATESOURCETRIGGER_EXPLICIT: number;
- constructor();
- /**
- * Provide a callback that will convert the value obtained by the Data Binding to the type of the SmartProperty it's bound to.
- * If no value are set, then it's assumed that the sourceValue is of the same type as the SmartProperty's one.
- * 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.
- * @param sourceValue the source object retrieve by the Data Binding mechanism
- * @returns the object of a compatible type with the SmartProperty it's bound to
- */
- converter: (sourceValue: any) => any;
- /**
- * 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
- */
- mode: number;
- /**
- * You can override the Data Source object with this member which is the Id of a uiElement existing in the UI Logical tree.
- * If not set and source no set too, then the dataSource property will be used.
- */
- uiElementId: string;
- /**
- * You can override the Data Source object with this member which is the source object to use directly.
- * If not set and uiElement no set too, then the dataSource property of the SmartPropertyBase object will be used.
- */
- dataSource: IPropertyChanged;
- /**
- * The path & name of the property to get from the source object.
- * 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.
- * If nothing is set then the source object will be used.
- * 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.
- * 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.
- */
- propertyPathName: string;
- /**
- * 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}`
- */
- stringFormat: (value: any) => string;
- /**
- * 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.
- */
- updateSourceTrigger: number;
- canUpdateTarget(resetUpdateCounter: boolean): boolean;
- updateTarget(): void;
- /**
- * The PropInfo of the property the binding is bound to
- */
- }
- abstract class SmartPropertyBase extends PropertyChangedBase {
- constructor();
- disposeObservable: Observable<SmartPropertyBase>;
- /**
- * Check if the object is disposed or not.
- * @returns true if the object is dispose, false otherwise.
- */
- isDisposed: boolean;
- /**
- * Disposable pattern, this method must be overloaded by derived types in order to clean up hardware related resources.
- * @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.
- */
- dispose(): boolean;
- /**
- * Check if a given set of properties are dirty or not.
- * @param flags a ORed combination of Prim2DPropInfo.flagId values
- * @return true if at least one property is dirty, false if none of them are.
- */
- checkPropertiesDirty(flags: number): boolean;
- /**
- * Clear a given set of properties.
- * @param flags a ORed combination of Prim2DPropInfo.flagId values
- * @return the new set of property still marked as dirty
- */
- protected clearPropertiesDirty(flags: number): number;
- /**
- * Add an externally attached data from its key.
- * This method call will fail and return false, if such key already exists.
- * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
- * @param key the unique key that identifies the data
- * @param data the data object to associate to the key for this Engine instance
- * @return true if no such key were already present and the data was added successfully, false otherwise
- */
- addExternalData<T>(key: string, data: T): boolean;
- /**
- * Get an externally attached data from its key
- * @param key the unique key that identifies the data
- * @return the associated data, if present (can be null), or undefined if not present
- */
- getExternalData<T>(key: string): T;
- /**
- * Get an externally attached data from its key, create it using a factory if it's not already present
- * @param key the unique key that identifies the data
- * @param factory the factory that will be called to create the instance if and only if it doesn't exists
- * @return the associated data, can be null if the factory returned null.
- */
- getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
- /**
- * Remove an externally attached data from the Engine instance
- * @param key the unique key that identifies the data
- * @return true if the data was successfully removed, false if it doesn't exist
- */
- removeExternalData(key: any): boolean;
- bindingMode?: number;
- bindingUpdateSourceTrigger?: number;
- typeLevelCompare?: boolean;
- dirtyBoundingInfo?: boolean;
- dirtyParentBoundingBox?: boolean;
- }): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- /**
- * Access the dictionary of properties metadata. Only properties decorated with XXXXLevelProperty are concerned
- * @returns the dictionary, the key is the property name as declared in Javascript, the value is the metadata object
- */
- protected propDic: StringDictionary<Prim2DPropInfo>;
- private static propChangedInfo;
- private static propChangeGuarding;
- /**
- * Set the object from which Smart Properties using Binding will take/update their data from/to.
- * 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.
- */
- dataSource: IPropertyChanged;
- createSimpleDataBinding(propInfo: Prim2DPropInfo, propertyPathName: string, mode?: number): DataBinding;
- createDataBinding(propInfo: Prim2DPropInfo, binding: DataBinding): DataBinding;
- removeDataBinding(propInfo: Prim2DPropInfo): boolean;
- updateFromDataSource(): void;
- }
- abstract class SmartPropertyPrim extends SmartPropertyBase {
- static SMARTPROPERTYPRIM_PROPCOUNT: number;
- constructor();
- /**
- * Disposable pattern, this method must be overloaded by derived types in order to clean up hardware related resources.
- * @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.
- */
- dispose(): boolean;
- /**
- * Animation array, more info: http://doc.babylonjs.com/tutorials/Animations
- */
- animations: Animation[];
- /**
- * Returns as a new array populated with the Animatable used by the primitive. Must be overloaded by derived primitives.
- * Look at Sprite2D for more information
- */
- getAnimatables(): IAnimatable[];
- /**
- * Property giving the Model Key associated to the property.
- * This value is constructed from the type of the primitive and all the name/value of its properties declared with the modelLevelProperty decorator
- * @returns the model key string.
- */
- modelKey: string;
- /**
- * States if the Primitive is dirty and should be rendered again next time.
- * @returns true is dirty, false otherwise
- */
- isDirty: boolean;
- protected onPrimitivePropertyDirty(propFlagId: number): void;
- protected handleGroupChanged(prop: Prim2DPropInfo): void;
- /**
- * Retrieve the boundingInfo for this Primitive, computed based on the primitive itself and NOT its children
- */
- levelBoundingInfo: BoundingInfo2D;
- /**
- * This method must be overridden by a given Primitive implementation to compute its boundingInfo
- */
- protected updateLevelBoundingInfo(): void;
- /**
- * Property method called when the Primitive becomes dirty
- */
- protected onPrimBecomesDirty(): void;
- /**
- * Check if a given flag is set
- * @param flag the flag value
- * @return true if set, false otherwise
- */
- /**
- * Check if all given flags are set
- * @param flags the flags ORed
- * @return true if all the flags are set, false otherwise
- */
- /**
- * Check if at least one flag of the given flags is set
- * @param flags the flags ORed
- * @return true if at least one flag is set, false otherwise
- */
- /**
- * Clear the given flags
- * @param flags the flags to clear
- */
- /**
- * Set the given flags to true state
- * @param flags the flags ORed to set
- * @return the flags state before this call
- */
- /**
- * Change the state of the given flags
- * @param flags the flags ORed to change
- * @param state true to set them, false to clear them
- */
- static flagNoPartOfLayout: number;
- static flagLevelBoundingInfoDirty: number;
- static flagModelDirty: number;
- static flagLayoutDirty: number;
- static flagLevelVisible: number;
- static flagBoundingInfoDirty: number;
- static flagIsPickable: number;
- static flagIsVisible: number;
- static flagVisibilityChanged: number;
- static flagPositioningDirty: number;
- static flagTrackedGroup: number;
- static flagWorldCacheChanged: number;
- static flagChildrenFlatZOrder: number;
- static flagZOrderDirty: number;
- static flagActualOpacityDirty: number;
- static flagPrimInDirtyList: number;
- static flagIsContainer: number;
- static flagNeedRefresh: number;
- static flagActualScaleDirty: number;
- static flagDontInheritParentScale: number;
- static flagGlobalTransformDirty: number;
- static flagLayoutBoundingInfoDirty: number;
- }
- function dependencyProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, mode?: number, updateSourceTrigger?: number): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- function modelLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- function instanceLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- function dynamicLevelProperty<T>(propId: number, piStore: (pi: Prim2DPropInfo) => void, typeLevelCompare?: boolean, dirtyBoundingInfo?: boolean, dirtyParentBoundingBox?: boolean): (target: Object, propName: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void;
- }
- declare module BABYLON {
- class Sprite2DRenderCache extends ModelRenderCache {
- effectsReady: boolean;
- vb: WebGLBuffer;
- ib: WebGLBuffer;
- instancingAttributes: InstancingAttributeInfo[];
- texture: Texture;
- effect: Effect;
- effectInstanced: Effect;
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- dispose(): boolean;
- }
- class Sprite2DInstanceData extends InstanceDataBase {
- constructor(partId: number);
- topLeftUV: Vector2;
- sizeUV: Vector2;
- scaleFactor: Vector2;
- textureSize: Vector2;
- properties: Vector3;
- }
- class Sprite2D extends RenderablePrim2D {
- static SPRITE2D_MAINPARTID: number;
- static textureProperty: Prim2DPropInfo;
- static useAlphaFromTextureProperty: Prim2DPropInfo;
- static actualSizeProperty: Prim2DPropInfo;
- static spriteLocationProperty: Prim2DPropInfo;
- static spriteFrameProperty: Prim2DPropInfo;
- static invertYProperty: Prim2DPropInfo;
- static spriteScaleFactorProperty: Prim2DPropInfo;
- texture: Texture;
- useAlphaFromTexture: boolean;
- actualSize: Size;
- spriteLocation: Vector2;
- spriteFrame: number;
- invertY: boolean;
- spriteScaleFactor: Vector2;
- /**
- * Sets the scale of the sprite using a BABYLON.Size(w,h).
- * Keeps proportion by taking the maximum of the two scale for x and y.
- * @param {Size} size Size(width,height)
- */
- scaleToSize(size: Size): void;
- /**
- * Get/set if the sprite rendering should be aligned to the target rendering device pixel or not
- */
- alignToPixel: boolean;
- protected updateLevelBoundingInfo(): void;
- /**
- * Get the animatable array (see http://doc.babylonjs.com/tutorials/Animations)
- */
- getAnimatables(): IAnimatable[];
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- /**
- * Create an 2D Sprite primitive
- * @param texture the texture that stores the sprite to render
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - spriteSize: the size of the sprite (in pixels), if null the size of the given texture will be used, default is null.
- * - spriteLocation: the location (in pixels) in the texture of the top/left corner of the Sprite to display, default is null (0,0)
- * - 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.
- * - invertY: if true the texture Y will be inverted, default is false.
- * - 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.
- * - isVisible: true if the sprite must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(texture: Texture, settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- spriteSize?: Size;
- spriteLocation?: Vector2;
- spriteScaleFactor?: Vector2;
- invertY?: boolean;
- alignToPixel?: boolean;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Sprite2DRenderCache;
- protected createInstanceDataParts(): InstanceDataBase[];
- private static layoutConstructMode;
- protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
- protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- }
- declare module BABYLON {
- class Text2DRenderCache extends ModelRenderCache {
- effectsReady: boolean;
- vb: WebGLBuffer;
- ib: WebGLBuffer;
- instancingAttributes: InstancingAttributeInfo[];
- fontTexture: FontTexture;
- effect: Effect;
- effectInstanced: Effect;
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
- dispose(): boolean;
- }
- class Text2DInstanceData extends InstanceDataBase {
- constructor(partId: number, dataElementCount: number);
- topLeftUV: Vector2;
- sizeUV: Vector2;
- textureSize: Vector2;
- color: Color4;
- superSampleFactor: number;
- }
- class Text2D extends RenderablePrim2D {
- static TEXT2D_MAINPARTID: number;
- static TEXT2D_CATEGORY_SDF: string;
- static fontProperty: Prim2DPropInfo;
- static defaultFontColorProperty: Prim2DPropInfo;
- static textProperty: Prim2DPropInfo;
- static sizeProperty: Prim2DPropInfo;
- static fontSuperSampleProperty: Prim2DPropInfo;
- static fontSignedDistanceFieldProperty: Prim2DPropInfo;
- fontName: string;
- defaultFontColor: Color4;
- text: string;
- size: Size;
- fontSuperSample: boolean;
- fontSignedDistanceField: boolean;
- isSizeAuto: boolean;
- /**
- * Get the actual size of the Text2D primitive
- */
- actualSize: Size;
- /**
- * Get the area that bounds the text associated to the primitive
- */
- textSize: Size;
- protected fontTexture: FontTexture;
- /**
- * Dispose the primitive, remove it from its parent
- */
- dispose(): boolean;
- protected updateLevelBoundingInfo(): void;
- /**
- * Create a Text primitive
- * @param text the text to display
- * @param settings a combination of settings, possible ones are
- * - 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)
- * - children: an array of direct children
- * - id a text identifier, for information purpose
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
- * - scale: the initial scale of the primitive. default is 1. You can alternatively use scaleX &| scaleY to apply non uniform scale
- * - dontInheritParentScale: if set the parent's scale won't be taken into consideration to compute the actualScale property
- * - opacity: set the overall opacity of the primitive, 1 to be opaque (default), less than 1 to be transparent.
- * - zOrder: override the zOrder with the specified value
- * - origin: define the normalized origin point location, default [0.5;0.5]
- * - fontName: the name/size/style of the font to use, following the CSS notation. Default is "12pt Arial".
- * - 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.
- * - 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.
- * - defaultFontColor: the color by default to apply on each letter of the text to display, default is plain white.
- * - areaSize: the size of the area in which to display the text, default is auto-fit from text content.
- * - tabulationSize: number of space character to insert when a tabulation is encountered, default is 4
- * - isVisible: true if the text must be visible, false for hidden. Default is true.
- * - 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.
- * - 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.
- * - 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!
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
- */
- constructor(text: string, settings?: {
- parent?: Prim2DBase;
- children?: Array<Prim2DBase>;
- id?: string;
- position?: Vector2;
- x?: number;
- y?: number;
- rotation?: number;
- scale?: number;
- scaleX?: number;
- scaleY?: number;
- dontInheritParentScale?: boolean;
- opacity?: number;
- zOrder?: number;
- origin?: Vector2;
- fontName?: string;
- fontSuperSample?: boolean;
- fontSignedDistanceField?: boolean;
- defaultFontColor?: Color4;
- size?: Size;
- tabulationSize?: number;
- isVisible?: boolean;
- isPickable?: boolean;
- isContainer?: boolean;
- childrenFlatZOrder?: boolean;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Text2DRenderCache;
- protected createInstanceDataParts(): InstanceDataBase[];
- protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
- protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
- protected getUsedShaderCategories(dataPart: InstanceDataBase): string[];
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
- }
- }
- declare module BABYLON {
- /**
- * This is the class that is used to display a World Space Canvas into a 3D scene
- */
- class WorldSpaceCanvas2DNode extends Mesh {
- constructor(name: string, scene: Scene, canvas: Canvas2D);
- dispose(): void;
- }
- }
- declare module BABYLON {
- class Button extends ContentControl {
- static pushedState: string;
- static BUTTON_PROPCOUNT: number;
- static isPushedProperty: Prim2DPropInfo;
- static isDefaultProperty: Prim2DPropInfo;
- static isOutlineProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- templateName?: string;
- styleName?: string;
- content?: any;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- isPushed: boolean;
- isDefault: boolean;
- isOutline: boolean;
- clickObservable: Observable<Button>;
- protected createVisualTree(): void;
- normalStateBackground: ObservableStringDictionary<IBrush2D>;
- defaultStateBackground: ObservableStringDictionary<IBrush2D>;
- normalStateBorder: ObservableStringDictionary<IBrush2D>;
- defaultStateBorder: ObservableStringDictionary<IBrush2D>;
- }
- class DefaultButtonRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- attach(owner: UIElement): void;
- stateChange(): void;
- }
- }
- declare module BABYLON {
- abstract class ContentControl extends Control {
- static CONTENTCONTROL_PROPCOUNT: number;
- static contentProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- templateName?: string;
- styleName?: string;
- content?: any;
- });
- dispose(): boolean;
- content: any;
- }
- }
- declare module BABYLON {
- abstract class Control extends UIElement {
- static CONTROL_PROPCOUNT: number;
- static backgroundProperty: Prim2DPropInfo;
- static borderProperty: Prim2DPropInfo;
- static borderThicknessProperty: Prim2DPropInfo;
- static fontNameProperty: Prim2DPropInfo;
- static foregroundProperty: Prim2DPropInfo;
- constructor(settings: {
- id?: string;
- templateName?: string;
- styleName?: string;
- });
- background: StringDictionary<IBrush2D>;
- border: IBrush2D;
- borderThickness: number;
- fontName: string;
- foreground: IBrush2D;
- }
- }
- declare module BABYLON {
- class Label extends Control {
- static textProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- templateName?: string;
- styleName?: string;
- text?: string;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- });
- protected createVisualTree(): void;
- text: string;
- }
- class DefaultLabelRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- }
- }
- declare module BABYLON {
- interface ICommand {
- canExecute(parameter: any): boolean;
- execute(parameter: any): void;
- canExecuteChanged: Observable<void>;
- }
- class Command implements ICommand {
- constructor(execute: (p) => void, canExecute: (p) => boolean);
- canExecute(parameter: any): boolean;
- execute(parameter: any): void;
- canExecuteChanged: Observable<void>;
- }
- abstract class UIElement extends SmartPropertyBase {
- static enabledState: string;
- static disabledState: string;
- static mouseOverState: string;
- static UIELEMENT_PROPCOUNT: number;
- static parentProperty: Prim2DPropInfo;
- static widthProperty: Prim2DPropInfo;
- static heightProperty: Prim2DPropInfo;
- static minWidthProperty: Prim2DPropInfo;
- static minHeightProperty: Prim2DPropInfo;
- static maxWidthProperty: Prim2DPropInfo;
- static maxHeightProperty: Prim2DPropInfo;
- static actualWidthProperty: Prim2DPropInfo;
- static actualHeightProperty: Prim2DPropInfo;
- static marginProperty: Prim2DPropInfo;
- static paddingProperty: Prim2DPropInfo;
- static marginAlignmentProperty: Prim2DPropInfo;
- static paddingAlignmentProperty: Prim2DPropInfo;
- static isEnabledProperty: Prim2DPropInfo;
- static isFocusedProperty: Prim2DPropInfo;
- static isMouseOverProperty: Prim2DPropInfo;
- constructor(settings: {
- id?: string;
- parent?: UIElement;
- templateName?: string;
- styleName?: string;
- minWidth?: number;
- minHeight?: number;
- maxWidth?: number;
- maxHeight?: number;
- width?: number;
- height?: number;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- dispose(): boolean;
- /**
- * Animation array, more info: http://doc.babylonjs.com/tutorials/Animations
- */
- animations: Animation[];
- /**
- * Returns as a new array populated with the Animatable used by the primitive. Must be overloaded by derived primitives.
- * Look at Sprite2D for more information
- */
- getAnimatables(): IAnimatable[];
- findById(id: string): UIElement;
- ownerWindow: Window;
- style: string;
- /**
- * A string that identifies the UIElement.
- * The id is optional and there's possible collision with other UIElement's id as the uniqueness is not supported.
- */
- id: string;
- /**
- * Return a unique id automatically generated.
- * This property is mainly used for serialization to ensure a perfect way of identifying a UIElement
- */
- uid: string;
- hierarchyDepth: number;
- parent: UIElement;
- width: number;
- height: number;
- minWidth: number;
- minHheight: number;
- minHeight: number;
- maxWidth: number;
- maxHeight: number;
- actualWidth: number;
- actualHeight: number;
- margin: PrimitiveThickness;
- padding: PrimitiveThickness;
- marginAlignment: PrimitiveAlignment;
- /**
- * Check if there a marginAlignment specified (non null and not default)
- */
- paddingAlignment: PrimitiveAlignment;
- /**
- * Check if there a marginAlignment specified (non null and not default)
- */
- isVisible: boolean;
- isEnabled: boolean;
- isFocused: boolean;
- isMouseOver: boolean;
- isFocusScope: boolean;
- isFocusable: boolean;
- protected getFocusScope(): UIElement;
- /**
- * Check if a given flag is set
- * @param flag the flag value
- * @return true if set, false otherwise
- */
- /**
- * Check if all given flags are set
- * @param flags the flags ORed
- * @return true if all the flags are set, false otherwise
- */
- /**
- * Check if at least one flag of the given flags is set
- * @param flags the flags ORed
- * @return true if at least one flag is set, false otherwise
- */
- /**
- * Clear the given flags
- * @param flags the flags to clear
- */
- /**
- * Set the given flags to true state
- * @param flags the flags ORed to set
- * @return the flags state before this call
- */
- /**
- * Change the state of the given flags
- * @param flags the flags ORed to change
- * @param state true to set them, false to clear them
- */
- protected createVisualTree(): void;
- protected visualPlaceholder: Prim2DBase;
- protected visualTemplateRoot: Prim2DBase;
- protected visualChildrenPlaceholder: Prim2DBase;
- protected abstract _getChildren(): Array<UIElement>;
- static flagVisualToBuild: number;
- static flagIsVisible: number;
- static flagIsFocus: number;
- static flagIsFocusScope: number;
- static flagIsFocusable: number;
- static flagIsEnabled: number;
- static flagIsMouseOver: number;
- }
- abstract class UIElementStyle {
- abstract removeStyle(uiel: UIElement): any;
- abstract applyStyle(uiel: UIElement): any;
- name: string;
- }
- class GUIManager {
- static registerDataTemplate(className: string, factory: (parent: UIElement, dataObject: any) => UIElement): void;
- static getStyle(uiElType: string, styleName: string): UIElementStyle;
- static registerStyle(uiElType: string, templateName: string, style: UIElementStyle): void;
- static stylesByUIElement: StringDictionary<StringDictionary<UIElementStyle>>;
- static DefaultStyleName: string;
- static getRenderingTemplate(uiElType: string, templateName: string): () => UIElementRenderingTemplateBase;
- static registerRenderingTemplate(uiElType: string, templateName: string, factory: () => UIElementRenderingTemplateBase): void;
- static renderingTemplatesByUIElement: StringDictionary<StringDictionary<() => UIElementRenderingTemplateBase>>;
- static DefaultTemplateName: string;
- }
- abstract class UIElementRenderingTemplateBase {
- attach(owner: UIElement): void;
- detach(): void;
- owner: UIElement;
- abstract createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- }
- function registerWindowRenderingTemplate(uiElType: string, templateName: string, factory: () => UIElementRenderingTemplateBase): (target: Object) => void;
- }
- declare module BABYLON {
- class FocusManager {
- constructor();
- setFocusOn(el: UIElement, focusScope: UIElement): void;
- }
- class Window extends ContentControl {
- static WINDOW_PROPCOUNT: number;
- static leftProperty: Prim2DPropInfo;
- static bottomProperty: Prim2DPropInfo;
- static positionProperty: Prim2DPropInfo;
- static isActiveProperty: Prim2DPropInfo;
- constructor(scene: Scene, settings?: {
- id?: string;
- templateName?: string;
- styleName?: string;
- content?: any;
- left?: number;
- bottom?: number;
- minWidth?: number;
- minHeight?: number;
- maxWidth?: number;
- maxHeight?: number;
- width?: number;
- height?: number;
- worldPosition?: Vector3;
- worldRotation?: Quaternion;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- canvas: Canvas2D;
- left: number;
- bottom: number;
- position: Vector2;
- isActive: boolean;
- focusManager: FocusManager;
- protected createVisualTree(): void;
- private static getSceneData(scene);
- }
- class DefaultWindowRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- }
- }
- declare module BABYLON {
- class PropertyChangedInfo {
- /**
- * Previous value of the property
- */
- oldValue: any;
- /**
- * New value of the property
- */
- newValue: any;
- /**
- * Name of the property that changed its value
- */
- propertyName: string;
- }
- /**
- * Custom type of the propertyChanged observable
- */
- /**
- * Property Changed interface
- */
- interface IPropertyChanged {
- /**
- * PropertyChanged observable
- */
- propertyChanged: Observable<PropertyChangedInfo>;
- }
- /**
- * The purpose of this class is to provide a base implementation of the IPropertyChanged interface for the user to avoid rewriting a code needlessly.
- * 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.
- * 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)
- */
- abstract class PropertyChangedBase implements IPropertyChanged {
- /**
- * Protected method to call when there's a change of value in a property set
- * @param propName the name of the concerned property
- * @param oldValue its old value
- * @param newValue its new value
- * @param mask an optional observable mask
- */
- protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
- /**
- * An observable that is triggered when a property (using of the XXXXLevelProperty decorator) has its value changing.
- * 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)
- */
- propertyChanged: Observable<PropertyChangedInfo>;
- private static pci;
- private static calling;
- }
- }
- declare module BABYLON {
- /**
- * Class for the ObservableArray.onArrayChanged observable
- */
- class ArrayChanged<T> {
- constructor();
- /**
- * Contain the action that were made on the ObservableArray, it's one of the ArrayChanged.xxxAction members.
- * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
- */
- action: number;
- /**
- * Only valid if the action is newItemsAction
- */
- newItems: {
- index: number;
- value: T;
- }[];
- /**
- * Only valid if the action is removedItemsAction
- */
- removedItems: {
- index: number;
- value: T;
- }[];
- /**
- * Only valid if the action is changedItemAction
- */
- changedItems: {
- index: number;
- value: T;
- }[];
- /**
- * Get the index of the first item inserted
- */
- newStartingIndex: number;
- /**
- * Get the index of the first item removed
- */
- removedStartingIndex: number;
- /**
- * Get the index of the first changed item
- */
- changedStartingIndex: number;
- /**
- * The content of the array was totally cleared
- */
- static clearAction: number;
- /**
- * A new item was added, the newItems field contains the key/value pairs
- */
- static newItemsAction: number;
- /**
- * An existing item was removed, the removedKey field contains its key
- */
- static removedItemsAction: number;
- /**
- * One or many items in the array were changed, the
- */
- static changedItemAction: number;
- /**
- * The array's content was totally changed
- * Depending on the method that used this mode the ChangedArray object may contains more information
- */
- static replacedArrayAction: number;
- /**
- * The length of the array changed
- */
- static lengthChangedAction: number;
- clear(): void;
- }
- class OAWatchedObjectChangedInfo<T> {
- object: T;
- propertyChanged: PropertyChangedInfo;
- }
- /**
- * This class mimics the Javascript Array and TypeScript Array<T> classes, adding new features concerning the Observable pattern.
- *
- */
- class ObservableArray<T> extends PropertyChangedBase {
- /**
- * Create an Observable Array.
- * @param watchObjectsPropertyChange
- * @param array and optional array that will be encapsulated by this ObservableArray instance. That's right, it's NOT a copy!
- */
- constructor(watchObjectsPropertyChange: boolean, array?: Array<T>);
- /**
- * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
- */
- length: number;
- getAt(index: number): T;
- setAt(index: number, value: T): boolean;
- /**
- * Returns a string representation of an array.
- */
- toString(): string;
- toLocaleString(): string;
- /**
- * Appends new elements to an array, and returns the new length of the array.
- * @param items New elements of the Array.
- */
- push(...items: T[]): number;
- /**
- * Removes the last element from an array and returns it.
- */
- pop(): T;
- /**
- * Combines two or more arrays.
- * @param items Additional items to add to the end of array1.
- */
- concat(...items: T[]): ObservableArray<T>;
- /**
- * Adds all the elements of an array separated by the specified separator string.
- * @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.
- */
- join(separator?: string): string;
- /**
- * Reverses the elements in an Array.
- * The arrayChanged action is
- */
- reverse(): T[];
- /**
- * Removes the first element from an array and returns it, shift all subsequents element one element before.
- * The ArrayChange action is replacedArrayAction, the whole array changes and must be reevaluate as such, the removed element is in removedItems.
- *
- */
- shift(): T;
- /**
- * Returns a section of an array.
- * @param start The beginning of the specified portion of the array.
- * @param end The end of the specified portion of the array.
- */
- slice(start?: number, end?: number): ObservableArray<T>;
- /**
- * Sorts an array.
- * @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.
- * On the contrary of the Javascript Array's implementation, this method returns nothing
- */
- sort(compareFn?: (a: T, b: T) => number): void;
- /**
- * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
- * @param start The zero-based location in the array from which to start removing elements.
- * @param deleteCount The number of elements to remove.
- * @param items Elements to insert into the array in place of the deleted elements.
- */
- splice(start: number, deleteCount: number, ...items: T[]): T[];
- /**
- * Inserts new elements at the start of an array.
- * @param items Elements to insert at the start of the Array.
- * The ChangedArray action is replacedArrayAction, newItems contains the list of the added items
- */
- unshift(...items: T[]): number;
- /**
- * Returns the index of the first occurrence of a value in an array.
- * @param searchElement The value to locate in the array.
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
- */
- indexOf(searchElement: T, fromIndex?: number): number;
- /**
- * Returns the index of the last occurrence of a specified value in an array.
- * @param searchElement The value to locate in the array.
- * @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.
- */
- lastIndexOf(searchElement: T, fromIndex?: number): number;
- /**
- * Determines whether all the members of an array satisfy the specified test.
- * @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.
- * @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.
- */
- every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
- /**
- * Determines whether the specified callback function returns true for any element of an array.
- * @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.
- * @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.
- */
- some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
- /**
- * Performs the specified action for each element in an array.
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
- * @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.
- */
- forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
- /**
- * Calls a defined callback function on each element of an array, and returns an array that contains the results.
- * @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.
- * @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.
- */
- map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
- /**
- * Returns the elements of an array that meet the condition specified in a callback function.
- * @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.
- * @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.
- */
- filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
- /**
- * 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.
- * @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.
- * @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.
- */
- reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
- /**
- * 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.
- * @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.
- * @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.
- */
- reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
- arrayChanged: Observable<ArrayChanged<T>>;
- protected getArrayChangedObject(): ArrayChanged<T>;
- protected feedNotifArray(array: {
- index: number;
- value: T;
- }[], startindIndex: number, ...items: T[]): void;
- protected callArrayChanged(ac: ArrayChanged<T>): void;
- watchedObjectChanged: Observable<OAWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private dci;
- }
- }
- declare module BABYLON {
- /**
- * Class for the ObservableStringDictionary.onDictionaryChanged observable
- */
- class DictionaryChanged<T> {
- /**
- * Contain the action that were made on the dictionary, it's one of the DictionaryChanged.xxxAction members.
- * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
- */
- action: number;
- /**
- * Only valid if the action is newItemAction
- */
- newItem: {
- key: string;
- value: T;
- };
- /**
- * Only valid if the action is removedItemAction
- */
- removedKey: string;
- /**
- * Only valid if the action is itemValueChangedAction
- */
- changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- };
- /**
- * The content of the dictionary was totally cleared
- */
- static clearAction: number;
- /**
- * A new item was added, the newItem field contains the key/value pair
- */
- static newItemAction: number;
- /**
- * An existing item was removed, the removedKey field contains its key
- */
- static removedItemAction: number;
- /**
- * An existing item had a value change, the changedItem field contains the key/value
- */
- static itemValueChangedAction: number;
- /**
- * The dictionary's content was reset and replaced by the content of another dictionary.
- * DictionaryChanged<T> contains no further information about this action
- */
- static replacedAction: number;
- }
- class OSDWatchedObjectChangedInfo<T> {
- key: string;
- object: T;
- propertyChanged: PropertyChangedInfo;
- }
- class ObservableStringDictionary<T> extends StringDictionary<T> implements IPropertyChanged {
- constructor(watchObjectsPropertyChange: boolean);
- /**
- * This will clear this dictionary and copy the content from the 'source' one.
- * If the T value is a custom object, it won't be copied/cloned, the same object will be used
- * @param source the dictionary to take the content from and copy to this dictionary
- */
- copyFrom(source: StringDictionary<T>): void;
- /**
- * Get a value from its key or add it if it doesn't exist.
- * This method will ensure you that a given key/data will be present in the dictionary.
- * @param key the given key to get the matching value from
- * @param factory the factory that will create the value if the key is not present in the dictionary.
- * The factory will only be invoked if there's no data for the given key.
- * @return the value corresponding to the key.
- */
- getOrAddWithFactory(key: string, factory: (key: string) => T): T;
- /**
- * Add a new key and its corresponding value
- * @param key the key to add
- * @param value the value corresponding to the key
- * @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
- */
- add(key: string, value: T): boolean;
- getAndRemove(key: string): T;
- set(key: string, value: T): boolean;
- /**
- * Remove a key/value from the dictionary.
- * @param key the key to remove
- * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
- */
- remove(key: string): boolean;
- /**
- * Clear the whole content of the dictionary
- */
- clear(): void;
- propertyChanged: Observable<PropertyChangedInfo>;
- protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
- dictionaryChanged: Observable<DictionaryChanged<T>>;
- protected onDictionaryChanged(action: number, newItem: {
- key: string;
- value: T;
- }, removedKey: string, changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- }): void;
- watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private static pci;
- private static callingPropChanged;
- private dci;
- }
- }
- declare module BABYLON {
- class StackPanel extends UIElement {
- static STACKPANEL_PROPCOUNT: number;
- static orientationHorizontalProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- children?: Array<UIElement>;
- templateName?: string;
- styleName?: string;
- isOrientationHorizontal?: any;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- isOrientationHorizontal: boolean;
- protected createVisualTree(): void;
- children: Array<UIElement>;
- }
- class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- attach(owner: UIElement): void;
- }
- }
- implements IPropertyChanged {
- constructor(watchObjectsPropertyChange: boolean);
- /**
- * This will clear this dictionary and copy the content from the 'source' one.
- * If the T value is a custom object, it won't be copied/cloned, the same object will be used
- * @param source the dictionary to take the content from and copy to this dictionary
- */
- copyFrom(source: StringDictionary<T>): void;
- /**
- * Get a value from its key or add it if it doesn't exist.
- * This method will ensure you that a given key/data will be present in the dictionary.
- * @param key the given key to get the matching value from
- * @param factory the factory that will create the value if the key is not present in the dictionary.
- * The factory will only be invoked if there's no data for the given key.
- * @return the value corresponding to the key.
- */
- getOrAddWithFactory(key: string, factory: (key: string) => T): T;
- /**
- * Add a new key and its corresponding value
- * @param key the key to add
- * @param value the value corresponding to the key
- * @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
- */
- add(key: string, value: T): boolean;
- getAndRemove(key: string): T;
- set(key: string, value: T): boolean;
- /**
- * Remove a key/value from the dictionary.
- * @param key the key to remove
- * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
- */
- remove(key: string): boolean;
- /**
- * Clear the whole content of the dictionary
- */
- clear(): void;
- propertyChanged: Observable<PropertyChangedInfo>;
- protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
- dictionaryChanged: Observable<DictionaryChanged<T>>;
- protected onDictionaryChanged(action: number, newItem: {
- key: string;
- value: T;
- }, removedKey: string, changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- }): void;
- watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private static pci;
- private static callingPropChanged;
- private dci;
- }
- }
- declare module BABYLON {
- class StackPanel extends UIElement {
- static STACKPANEL_PROPCOUNT: number;
- static orientationHorizontalProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- children?: Array<UIElement>;
- templateName?: string;
- styleName?: string;
- isOrientationHorizontal?: any;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- isOrientationHorizontal: boolean;
- protected createVisualTree(): void;
- children: Array<UIElement>;
- protected _getChildren(): Array<UIElement>;
- }
- class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- attach(owner: UIElement): void;
- }
- }
- he given key to get the matching value from
- * @param factory the factory that will create the value if the key is not present in the dictionary.
- * The factory will only be invoked if there's no data for the given key.
- * @return the value corresponding to the key.
- */
- getOrAddWithFactory(key: string, factory: (key: string) => T): T;
- /**
- * Add a new key and its corresponding value
- * @param key the key to add
- * @param value the value corresponding to the key
- * @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
- */
- add(key: string, value: T): boolean;
- getAndRemove(key: string): T;
- set(key: string, value: T): boolean;
- /**
- * Remove a key/value from the dictionary.
- * @param key the key to remove
- * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
- */
- remove(key: string): boolean;
- /**
- * Clear the whole content of the dictionary
- */
- clear(): void;
- propertyChanged: Observable<PropertyChangedInfo>;
- protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
- dictionaryChanged: Observable<DictionaryChanged<T>>;
- protected onDictionaryChanged(action: number, newItem: {
- key: string;
- value: T;
- }, removedKey: string, changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- }): void;
- watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private static pci;
- private static callingPropChanged;
- private dci;
- }
- }
- declare module BABYLON {
- class StackPanel extends UIElement {
- static STACKPANEL_PROPCOUNT: number;
- static orientationHorizontalProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- children?: Array<UIElement>;
- templateName?: string;
- styleName?: string;
- isOrientationHorizontal?: any;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- isOrientationHorizontal: boolean;
- protected createVisualTree(): void;
- children: Array<UIElement>;
- protected _getChildren(): Array<UIElement>;
- }
- class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- attach(owner: UIElement): void;
- }
- }
- an array satisfy the specified test.
- * @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.
- * @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.
- */
- every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
- /**
- * Determines whether the specified callback function returns true for any element of an array.
- * @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.
- * @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.
- */
- some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
- /**
- * Performs the specified action for each element in an array.
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
- * @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.
- */
- forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
- /**
- * Calls a defined callback function on each element of an array, and returns an array that contains the results.
- * @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.
- * @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.
- */
- map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
- /**
- * Returns the elements of an array that meet the condition specified in a callback function.
- * @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.
- * @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.
- */
- filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
- /**
- * 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.
- * @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.
- * @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.
- */
- reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
- /**
- * 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.
- * @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.
- * @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.
- */
- reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
- arrayChanged: Observable<ArrayChanged<T>>;
- protected getArrayChangedObject(): ArrayChanged<T>;
- protected feedNotifArray(array: {
- index: number;
- value: T;
- }[], startindIndex: number, ...items: T[]): void;
- protected callArrayChanged(ac: ArrayChanged<T>): void;
- watchedObjectChanged: Observable<OAWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private dci;
- }
- }
- declare module BABYLON {
- /**
- * Class for the ObservableStringDictionary.onDictionaryChanged observable
- */
- class DictionaryChanged<T> {
- /**
- * Contain the action that were made on the dictionary, it's one of the DictionaryChanged.xxxAction members.
- * Note the action's value can be used in the "mask" field of the Observable to only be notified about given action(s)
- */
- action: number;
- /**
- * Only valid if the action is newItemAction
- */
- newItem: {
- key: string;
- value: T;
- };
- /**
- * Only valid if the action is removedItemAction
- */
- removedKey: string;
- /**
- * Only valid if the action is itemValueChangedAction
- */
- changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- };
- /**
- * The content of the dictionary was totally cleared
- */
- static clearAction: number;
- /**
- * A new item was added, the newItem field contains the key/value pair
- */
- static newItemAction: number;
- /**
- * An existing item was removed, the removedKey field contains its key
- */
- static removedItemAction: number;
- /**
- * An existing item had a value change, the changedItem field contains the key/value
- */
- static itemValueChangedAction: number;
- /**
- * The dictionary's content was reset and replaced by the content of another dictionary.
- * DictionaryChanged<T> contains no further information about this action
- */
- static replacedAction: number;
- private static _clearAction;
- private static _newItemAction;
- private static _removedItemAction;
- private static _itemValueChangedAction;
- private static _replacedAction;
- }
- class OSDWatchedObjectChangedInfo<T> {
- key: string;
- object: T;
- propertyChanged: PropertyChangedInfo;
- }
- class ObservableStringDictionary<T> extends StringDictionary<T> implements IPropertyChanged {
- constructor(watchObjectsPropertyChange: boolean);
- /**
- * This will clear this dictionary and copy the content from the 'source' one.
- * If the T value is a custom object, it won't be copied/cloned, the same object will be used
- * @param source the dictionary to take the content from and copy to this dictionary
- */
- copyFrom(source: StringDictionary<T>): void;
- /**
- * Get a value from its key or add it if it doesn't exist.
- * This method will ensure you that a given key/data will be present in the dictionary.
- * @param key the given key to get the matching value from
- * @param factory the factory that will create the value if the key is not present in the dictionary.
- * The factory will only be invoked if there's no data for the given key.
- * @return the value corresponding to the key.
- */
- getOrAddWithFactory(key: string, factory: (key: string) => T): T;
- /**
- * Add a new key and its corresponding value
- * @param key the key to add
- * @param value the value corresponding to the key
- * @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
- */
- add(key: string, value: T): boolean;
- getAndRemove(key: string): T;
- set(key: string, value: T): boolean;
- /**
- * Remove a key/value from the dictionary.
- * @param key the key to remove
- * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
- */
- remove(key: string): boolean;
- /**
- * Clear the whole content of the dictionary
- */
- clear(): void;
- propertyChanged: Observable<PropertyChangedInfo>;
- protected onPropertyChanged<T>(propName: string, oldValue: T, newValue: T, mask?: number): void;
- dictionaryChanged: Observable<DictionaryChanged<T>>;
- protected onDictionaryChanged(action: number, newItem: {
- key: string;
- value: T;
- }, removedKey: string, changedItem: {
- key: string;
- oldValue: T;
- newValue: T;
- }): void;
- watchedObjectChanged: Observable<OSDWatchedObjectChangedInfo<T>>;
- protected onWatchedObjectChanged(key: string, object: T, propChanged: PropertyChangedInfo): void;
- private static pci;
- private static callingPropChanged;
- private dci;
- }
- }
- declare module BABYLON {
- class StackPanel extends UIElement {
- static STACKPANEL_PROPCOUNT: number;
- static orientationHorizontalProperty: Prim2DPropInfo;
- constructor(settings?: {
- id?: string;
- parent?: UIElement;
- children?: Array<UIElement>;
- templateName?: string;
- styleName?: string;
- isOrientationHorizontal?: any;
- marginTop?: number | string;
- marginLeft?: number | string;
- marginRight?: number | string;
- marginBottom?: number | string;
- margin?: number | string;
- marginHAlignment?: number;
- marginVAlignment?: number;
- marginAlignment?: string;
- paddingTop?: number | string;
- paddingLeft?: number | string;
- paddingRight?: number | string;
- paddingBottom?: number | string;
- padding?: string;
- paddingHAlignment?: number;
- paddingVAlignment?: number;
- paddingAlignment?: string;
- });
- isOrientationHorizontal: boolean;
- protected createVisualTree(): void;
- children: Array<UIElement>;
- protected _getChildren(): Array<UIElement>;
- }
- class DefaultStackPanelRenderingTemplate extends UIElementRenderingTemplateBase {
- createVisualTree(owner: UIElement, visualPlaceholder: Group2D): {
- root: Prim2DBase;
- contentPlaceholder: Prim2DBase;
- };
- attach(owner: UIElement): void;
- }
- }
|