babylon.d.ts 301 KB

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