babylon.2.1.d.ts 215 KB

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