babylon.d.ts 316 KB

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