babylon.2.1.d.ts 228 KB

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