babylon.2.0.d.ts 209 KB

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