babylon.d.ts 255 KB

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