babylon.d.ts 274 KB

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