babylon.d.ts 454 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181
  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 CollisionsEpsilon: number;
  62. static CodeRepository: string;
  63. static ShadersRepository: string;
  64. isFullscreen: boolean;
  65. isPointerLock: boolean;
  66. cullBackFaces: boolean;
  67. renderEvenInBackground: boolean;
  68. enableOfflineSupport: boolean;
  69. scenes: Scene[];
  70. _gl: WebGLRenderingContext;
  71. private _renderingCanvas;
  72. private _windowIsBackground;
  73. private _webGLVersion;
  74. static audioEngine: AudioEngine;
  75. private _onBlur;
  76. private _onFocus;
  77. private _onFullscreenChange;
  78. private _onPointerLockChange;
  79. private _hardwareScalingLevel;
  80. private _caps;
  81. private _pointerLockRequested;
  82. private _alphaTest;
  83. private _loadingScreen;
  84. private _drawCalls;
  85. private _glVersion;
  86. private _glRenderer;
  87. private _glVendor;
  88. private _videoTextureSupported;
  89. private _renderingQueueLaunched;
  90. private _activeRenderLoops;
  91. private fpsRange;
  92. private previousFramesDuration;
  93. private fps;
  94. private deltaTime;
  95. private _depthCullingState;
  96. private _alphaState;
  97. private _alphaMode;
  98. private _loadedTexturesCache;
  99. private _maxTextureChannels;
  100. private _activeTexturesCache;
  101. private _currentEffect;
  102. private _compiledEffects;
  103. private _vertexAttribArrays;
  104. private _cachedViewport;
  105. private _cachedVertexBuffers;
  106. private _cachedIndexBuffer;
  107. private _cachedEffectForVertexBuffers;
  108. private _currentRenderTarget;
  109. private _uintIndicesCurrentlySet;
  110. private _workingCanvas;
  111. private _workingContext;
  112. private _bindedRenderFunction;
  113. /**
  114. * @constructor
  115. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  116. * @param {boolean} [antialias] - enable antialias
  117. * @param options - further options to be sent to the getContext function
  118. */
  119. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: {
  120. antialias?: boolean;
  121. preserveDrawingBuffer?: boolean;
  122. limitDeviceRatio?: number;
  123. }, adaptToDeviceRatio?: boolean);
  124. webGLVersion: string;
  125. private _prepareWorkingCanvas();
  126. resetTextureCache(): void;
  127. getGlInfo(): {
  128. vendor: string;
  129. renderer: string;
  130. version: string;
  131. };
  132. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  133. getRenderWidth(useScreen?: boolean): number;
  134. getRenderHeight(useScreen?: boolean): number;
  135. getRenderingCanvas(): HTMLCanvasElement;
  136. getRenderingCanvasClientRect(): ClientRect;
  137. setHardwareScalingLevel(level: number): void;
  138. getHardwareScalingLevel(): number;
  139. getLoadedTexturesCache(): WebGLTexture[];
  140. getCaps(): EngineCapabilities;
  141. drawCalls: number;
  142. resetDrawCalls(): void;
  143. setDepthFunctionToGreater(): void;
  144. setDepthFunctionToGreaterOrEqual(): void;
  145. setDepthFunctionToLess(): void;
  146. setDepthFunctionToLessOrEqual(): void;
  147. /**
  148. * stop executing a render loop function and remove it from the execution array
  149. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  150. */
  151. stopRenderLoop(renderFunction?: () => void): void;
  152. _renderLoop(): void;
  153. /**
  154. * Register and execute a render loop. The engine can have more than one render function.
  155. * @param {Function} renderFunction - the function to continuesly execute starting the next render loop.
  156. * @example
  157. * engine.runRenderLoop(function () {
  158. * scene.render()
  159. * })
  160. */
  161. runRenderLoop(renderFunction: () => void): void;
  162. /**
  163. * Toggle full screen mode.
  164. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  165. */
  166. switchFullscreen(requestPointerLock: boolean): void;
  167. clear(color: any, backBuffer: boolean, depthStencil: boolean): void;
  168. /**
  169. * Set the WebGL's viewport
  170. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  171. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  172. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  173. */
  174. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  175. setDirectViewport(x: number, y: number, width: number, height: number): void;
  176. beginFrame(): void;
  177. endFrame(): void;
  178. /**
  179. * resize the view according to the canvas' size.
  180. * @example
  181. * window.addEventListener("resize", function () {
  182. * engine.resize();
  183. * });
  184. */
  185. resize(): void;
  186. /**
  187. * force a specific size of the canvas
  188. * @param {number} width - the new canvas' width
  189. * @param {number} height - the new canvas' height
  190. */
  191. setSize(width: number, height: number): void;
  192. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  193. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
  194. generateMipMapsForCubemap(texture: WebGLTexture): void;
  195. flushFramebuffer(): void;
  196. restoreDefaultFramebuffer(): void;
  197. private _resetVertexBufferBinding();
  198. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  199. createDynamicVertexBuffer(capacity: number): WebGLBuffer;
  200. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number): void;
  201. private _resetIndexBufferBinding();
  202. createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer;
  203. bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  204. bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void;
  205. _releaseBuffer(buffer: WebGLBuffer): boolean;
  206. createInstancesBuffer(capacity: number): WebGLBuffer;
  207. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  208. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void;
  209. unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void;
  210. applyStates(): void;
  211. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  212. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  213. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  214. _releaseEffect(effect: Effect): void;
  215. createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
  216. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  217. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram;
  218. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  219. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  220. enableEffect(effect: Effect): void;
  221. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  222. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  223. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  224. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  225. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  226. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  227. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  228. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  229. setFloat(uniform: WebGLUniformLocation, value: number): void;
  230. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  231. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  232. setBool(uniform: WebGLUniformLocation, bool: number): void;
  233. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  234. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  235. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  236. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  237. setDepthBuffer(enable: boolean): void;
  238. getDepthWrite(): boolean;
  239. setDepthWrite(enable: boolean): void;
  240. setColorWrite(enable: boolean): void;
  241. setAlphaMode(mode: number): void;
  242. getAlphaMode(): number;
  243. setAlphaTesting(enable: boolean): void;
  244. getAlphaTesting(): boolean;
  245. wipeCaches(): void;
  246. setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  247. createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
  248. private _getInternalFormat(format);
  249. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  250. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  251. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture;
  252. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  253. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void;
  254. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  255. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  256. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  257. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean): WebGLTexture;
  258. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  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. name: string;
  386. id: string;
  387. uniqueId: number;
  388. state: string;
  389. animations: Animation[];
  390. private _ranges;
  391. onReady: (node: Node) => void;
  392. private _childrenFlag;
  393. private _isEnabled;
  394. private _isReady;
  395. _currentRenderId: number;
  396. private _parentRenderId;
  397. _waitingParentId: string;
  398. private _scene;
  399. _cache: any;
  400. private _parentNode;
  401. private _children;
  402. parent: Node;
  403. /**
  404. * @constructor
  405. * @param {string} name - the name and id to be given to this node
  406. * @param {BABYLON.Scene} the scene this node will be added to
  407. */
  408. constructor(name: string, scene: Scene);
  409. getScene(): Scene;
  410. getEngine(): Engine;
  411. getWorldMatrix(): Matrix;
  412. _initCache(): void;
  413. updateCache(force?: boolean): void;
  414. _updateCache(ignoreParentClass?: boolean): void;
  415. _isSynchronized(): boolean;
  416. _markSyncedWithParent(): void;
  417. isSynchronizedWithParent(): boolean;
  418. isSynchronized(updateCache?: boolean): boolean;
  419. hasNewParent(update?: boolean): boolean;
  420. /**
  421. * Is this node ready to be used/rendered
  422. * @return {boolean} is it ready
  423. */
  424. isReady(): boolean;
  425. /**
  426. * Is this node enabled.
  427. * If the node has a parent and is enabled, the parent will be inspected as well.
  428. * @return {boolean} whether this node (and its parent) is enabled.
  429. * @see setEnabled
  430. */
  431. isEnabled(): boolean;
  432. /**
  433. * Set the enabled state of this node.
  434. * @param {boolean} value - the new enabled state
  435. * @see isEnabled
  436. */
  437. setEnabled(value: boolean): void;
  438. /**
  439. * Is this node a descendant of the given node.
  440. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  441. * @param {BABYLON.Node} ancestor - The parent node to inspect
  442. * @see parent
  443. */
  444. isDescendantOf(ancestor: Node): boolean;
  445. /**
  446. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  447. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  448. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  449. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  450. */
  451. _getDescendants(results: Node[], directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): void;
  452. /**
  453. * Will return all nodes that have this node as ascendant.
  454. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  455. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  456. * @return {BABYLON.Node[]} all children nodes of all types.
  457. */
  458. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  459. /**
  460. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  461. * @Deprecated, legacy support.
  462. * use getDecendants instead.
  463. */
  464. getChildren(predicate?: (node: Node) => boolean): Node[];
  465. /**
  466. * Get all child-meshes of this node.
  467. */
  468. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  469. _setReady(state: boolean): void;
  470. getAnimationByName(name: string): Animation;
  471. createAnimationRange(name: string, from: number, to: number): void;
  472. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  473. getAnimationRange(name: string): AnimationRange;
  474. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  475. serializeAnimationRanges(): any;
  476. dispose(): void;
  477. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  478. }
  479. }
  480. declare module BABYLON {
  481. interface IDisposable {
  482. dispose(): void;
  483. }
  484. class PointerEventTypes {
  485. static _POINTERDOWN: number;
  486. static _POINTERUP: number;
  487. static _POINTERMOVE: number;
  488. static _POINTERWHEEL: number;
  489. static _POINTERPICK: number;
  490. static POINTERDOWN: number;
  491. static POINTERUP: number;
  492. static POINTERMOVE: number;
  493. static POINTERWHEEL: number;
  494. static POINTERPICK: number;
  495. }
  496. /**
  497. * This type contains all the data related to a pointer event in Babylon.js.
  498. * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The differents event types can be found in the PointerEventTypes class.
  499. */
  500. class PointerInfo {
  501. type: number;
  502. event: PointerEvent | MouseWheelEvent;
  503. pickInfo: PickingInfo;
  504. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  505. }
  506. /**
  507. * Represents a scene to be rendered by the engine.
  508. * @see http://doc.babylonjs.com/page.php?p=21911
  509. */
  510. class Scene implements IAnimatable {
  511. private static _FOGMODE_NONE;
  512. private static _FOGMODE_EXP;
  513. private static _FOGMODE_EXP2;
  514. private static _FOGMODE_LINEAR;
  515. static MinDeltaTime: number;
  516. static MaxDeltaTime: number;
  517. static FOGMODE_NONE: number;
  518. static FOGMODE_EXP: number;
  519. static FOGMODE_EXP2: number;
  520. static FOGMODE_LINEAR: number;
  521. autoClear: boolean;
  522. clearColor: any;
  523. ambientColor: Color3;
  524. forceWireframe: boolean;
  525. forcePointsCloud: boolean;
  526. forceShowBoundingBoxes: boolean;
  527. clipPlane: Plane;
  528. animationsEnabled: boolean;
  529. constantlyUpdateMeshUnderPointer: boolean;
  530. /**
  531. * An event triggered when the scene is disposed.
  532. * @type {BABYLON.Observable}
  533. */
  534. onDisposeObservable: Observable<Scene>;
  535. private _onDisposeObserver;
  536. onDispose: () => void;
  537. /**
  538. * An event triggered before rendering the scene
  539. * @type {BABYLON.Observable}
  540. */
  541. onBeforeRenderObservable: Observable<Scene>;
  542. private _onBeforeRenderObserver;
  543. beforeRender: () => void;
  544. /**
  545. * An event triggered after rendering the scene
  546. * @type {BABYLON.Observable}
  547. */
  548. onAfterRenderObservable: Observable<Scene>;
  549. private _onAfterRenderObserver;
  550. afterRender: () => void;
  551. /**
  552. * An event triggered when the scene is ready
  553. * @type {BABYLON.Observable}
  554. */
  555. onReadyObservable: Observable<Scene>;
  556. /**
  557. * An event triggered before rendering a camera
  558. * @type {BABYLON.Observable}
  559. */
  560. onBeforeCameraRenderObservable: Observable<Camera>;
  561. private _onBeforeCameraRenderObserver;
  562. beforeCameraRender: () => void;
  563. /**
  564. * An event triggered after rendering a camera
  565. * @type {BABYLON.Observable}
  566. */
  567. onAfterCameraRenderObservable: Observable<Camera>;
  568. private _onAfterCameraRenderObserver;
  569. afterCameraRender: () => void;
  570. /**
  571. * An event triggered when a camera is created
  572. * @type {BABYLON.Observable}
  573. */
  574. onNewCameraAddedObservable: Observable<Camera>;
  575. /**
  576. * An event triggered when a camera is removed
  577. * @type {BABYLON.Observable}
  578. */
  579. onCameraRemovedObservable: Observable<Camera>;
  580. /**
  581. * An event triggered when a light is created
  582. * @type {BABYLON.Observable}
  583. */
  584. onNewLightAddedObservable: Observable<Light>;
  585. /**
  586. * An event triggered when a light is removed
  587. * @type {BABYLON.Observable}
  588. */
  589. onLightRemovedObservable: Observable<Light>;
  590. /**
  591. * An event triggered when a geometry is created
  592. * @type {BABYLON.Observable}
  593. */
  594. onNewGeometryAddedObservable: Observable<Geometry>;
  595. /**
  596. * An event triggered when a geometry is removed
  597. * @type {BABYLON.Observable}
  598. */
  599. onGeometryRemovedObservable: Observable<Geometry>;
  600. /**
  601. * An event triggered when a mesh is created
  602. * @type {BABYLON.Observable}
  603. */
  604. onNewMeshAddedObservable: Observable<AbstractMesh>;
  605. /**
  606. * An event triggered when a mesh is removed
  607. * @type {BABYLON.Observable}
  608. */
  609. onMeshRemovedObservable: Observable<AbstractMesh>;
  610. animations: Animation[];
  611. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  612. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  613. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  614. private _onPointerMove;
  615. private _onPointerDown;
  616. private _onPointerUp;
  617. /**
  618. * @deprecated Use onPointerObservable instead
  619. */
  620. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  621. /**
  622. * @deprecated Use onPointerObservable instead
  623. */
  624. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  625. /**
  626. * @deprecated Use onPointerObservable instead
  627. */
  628. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  629. /**
  630. * @deprecated Use onPointerObservable instead
  631. */
  632. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  633. /**
  634. * Observable event triggered each time an input event is received from the rendering canvas
  635. */
  636. onPointerObservable: Observable<PointerInfo>;
  637. cameraToUseForPointers: Camera;
  638. private _pointerX;
  639. private _pointerY;
  640. private _unTranslatedPointerX;
  641. private _unTranslatedPointerY;
  642. private _startingPointerPosition;
  643. private _startingPointerTime;
  644. _mirroredCameraPosition: Vector3;
  645. private _onKeyDown;
  646. private _onKeyUp;
  647. /**
  648. * is fog enabled on this scene.
  649. * @type {boolean}
  650. */
  651. fogEnabled: boolean;
  652. fogMode: number;
  653. fogColor: Color3;
  654. fogDensity: number;
  655. fogStart: number;
  656. fogEnd: number;
  657. /**
  658. * is shadow enabled on this scene.
  659. * @type {boolean}
  660. */
  661. shadowsEnabled: boolean;
  662. /**
  663. * is light enabled on this scene.
  664. * @type {boolean}
  665. */
  666. lightsEnabled: boolean;
  667. /**
  668. * All of the lights added to this scene.
  669. * @see BABYLON.Light
  670. * @type {BABYLON.Light[]}
  671. */
  672. lights: Light[];
  673. /**
  674. * All of the cameras added to this scene.
  675. * @see BABYLON.Camera
  676. * @type {BABYLON.Camera[]}
  677. */
  678. cameras: Camera[];
  679. activeCameras: Camera[];
  680. activeCamera: Camera;
  681. /**
  682. * All of the (abstract) meshes added to this scene.
  683. * @see BABYLON.AbstractMesh
  684. * @type {BABYLON.AbstractMesh[]}
  685. */
  686. meshes: AbstractMesh[];
  687. private _geometries;
  688. materials: Material[];
  689. multiMaterials: MultiMaterial[];
  690. defaultMaterial: StandardMaterial;
  691. texturesEnabled: boolean;
  692. textures: BaseTexture[];
  693. particlesEnabled: boolean;
  694. particleSystems: ParticleSystem[];
  695. spritesEnabled: boolean;
  696. spriteManagers: SpriteManager[];
  697. layers: Layer[];
  698. skeletonsEnabled: boolean;
  699. skeletons: Skeleton[];
  700. lensFlaresEnabled: boolean;
  701. lensFlareSystems: LensFlareSystem[];
  702. collisionsEnabled: boolean;
  703. private _workerCollisions;
  704. collisionCoordinator: ICollisionCoordinator;
  705. gravity: Vector3;
  706. postProcessesEnabled: boolean;
  707. postProcessManager: PostProcessManager;
  708. postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  709. renderTargetsEnabled: boolean;
  710. dumpNextRenderTargets: boolean;
  711. customRenderTargets: RenderTargetTexture[];
  712. useDelayedTextureLoading: boolean;
  713. importedMeshesFiles: String[];
  714. probesEnabled: boolean;
  715. reflectionProbes: ReflectionProbe[];
  716. database: any;
  717. /**
  718. * This scene's action manager
  719. * @type {BABYLON.ActionManager}
  720. */
  721. actionManager: ActionManager;
  722. _actionManagers: ActionManager[];
  723. private _meshesForIntersections;
  724. proceduralTexturesEnabled: boolean;
  725. _proceduralTextures: ProceduralTexture[];
  726. mainSoundTrack: SoundTrack;
  727. soundTracks: SoundTrack[];
  728. private _audioEnabled;
  729. private _headphone;
  730. simplificationQueue: SimplificationQueue;
  731. private _engine;
  732. private _totalVertices;
  733. _activeIndices: number;
  734. _activeParticles: number;
  735. private _lastFrameDuration;
  736. private _evaluateActiveMeshesDuration;
  737. private _renderTargetsDuration;
  738. _particlesDuration: number;
  739. private _renderDuration;
  740. _spritesDuration: number;
  741. private _animationRatio;
  742. private _animationStartDate;
  743. _cachedMaterial: Material;
  744. private _renderId;
  745. private _executeWhenReadyTimeoutId;
  746. private _intermediateRendering;
  747. _toBeDisposed: SmartArray<IDisposable>;
  748. private _pendingData;
  749. private _activeMeshes;
  750. private _processedMaterials;
  751. private _renderTargets;
  752. _activeParticleSystems: SmartArray<ParticleSystem>;
  753. private _activeSkeletons;
  754. private _softwareSkinnedMeshes;
  755. _activeBones: number;
  756. private _renderingManager;
  757. private _physicsEngine;
  758. _activeAnimatables: Animatable[];
  759. private _transformMatrix;
  760. private _pickWithRayInverseMatrix;
  761. private _edgesRenderers;
  762. private _boundingBoxRenderer;
  763. private _outlineRenderer;
  764. private _viewMatrix;
  765. private _projectionMatrix;
  766. private _frustumPlanes;
  767. private _selectionOctree;
  768. private _pointerOverMesh;
  769. private _pointerOverSprite;
  770. private _debugLayer;
  771. private _depthRenderer;
  772. private _uniqueIdCounter;
  773. private _pickedDownMesh;
  774. private _pickedDownSprite;
  775. /**
  776. * @constructor
  777. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  778. */
  779. constructor(engine: Engine);
  780. debugLayer: DebugLayer;
  781. workerCollisions: boolean;
  782. SelectionOctree: Octree<AbstractMesh>;
  783. /**
  784. * The mesh that is currently under the pointer.
  785. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  786. */
  787. meshUnderPointer: AbstractMesh;
  788. /**
  789. * Current on-screen X position of the pointer
  790. * @return {number} X position of the pointer
  791. */
  792. pointerX: number;
  793. /**
  794. * Current on-screen Y position of the pointer
  795. * @return {number} Y position of the pointer
  796. */
  797. pointerY: number;
  798. getCachedMaterial(): Material;
  799. getBoundingBoxRenderer(): BoundingBoxRenderer;
  800. getOutlineRenderer(): OutlineRenderer;
  801. getEngine(): Engine;
  802. getTotalVertices(): number;
  803. getActiveIndices(): number;
  804. getActiveParticles(): number;
  805. getActiveBones(): number;
  806. getLastFrameDuration(): number;
  807. getEvaluateActiveMeshesDuration(): number;
  808. getActiveMeshes(): SmartArray<Mesh>;
  809. getRenderTargetsDuration(): number;
  810. getRenderDuration(): number;
  811. getParticlesDuration(): number;
  812. getSpritesDuration(): number;
  813. getAnimationRatio(): number;
  814. getRenderId(): number;
  815. incrementRenderId(): void;
  816. private _updatePointerPosition(evt);
  817. /**
  818. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  819. * @param attachUp defines if you want to attach events to pointerup
  820. * @param attachDown defines if you want to attach events to pointerdown
  821. * @param attachMove defines if you want to attach events to pointermove
  822. */
  823. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  824. detachControl(): void;
  825. isReady(): boolean;
  826. resetCachedMaterial(): void;
  827. registerBeforeRender(func: () => void): void;
  828. unregisterBeforeRender(func: () => void): void;
  829. registerAfterRender(func: () => void): void;
  830. unregisterAfterRender(func: () => void): void;
  831. _addPendingData(data: any): void;
  832. _removePendingData(data: any): void;
  833. getWaitingItemsCount(): number;
  834. /**
  835. * Registers a function to be executed when the scene is ready.
  836. * @param {Function} func - the function to be executed.
  837. */
  838. executeWhenReady(func: () => void): void;
  839. _checkIsReady(): void;
  840. /**
  841. * Will start the animation sequence of a given target
  842. * @param target - the target
  843. * @param {number} from - from which frame should animation start
  844. * @param {number} to - till which frame should animation run.
  845. * @param {boolean} [loop] - should the animation loop
  846. * @param {number} [speedRatio] - the speed in which to run the animation
  847. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  848. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  849. * @return {BABYLON.Animatable} the animatable object created for this animation
  850. * @see BABYLON.Animatable
  851. * @see http://doc.babylonjs.com/page.php?p=22081
  852. */
  853. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  854. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  855. getAnimatableByTarget(target: any): Animatable;
  856. Animatables: Animatable[];
  857. /**
  858. * Will stop the animation of the given target
  859. * @param target - the target
  860. * @see beginAnimation
  861. */
  862. stopAnimation(target: any): void;
  863. private _animate();
  864. getViewMatrix(): Matrix;
  865. getProjectionMatrix(): Matrix;
  866. getTransformMatrix(): Matrix;
  867. setTransformMatrix(view: Matrix, projection: Matrix): void;
  868. addMesh(newMesh: AbstractMesh): void;
  869. removeMesh(toRemove: AbstractMesh): number;
  870. removeSkeleton(toRemove: Skeleton): number;
  871. removeLight(toRemove: Light): number;
  872. removeCamera(toRemove: Camera): number;
  873. addLight(newLight: Light): void;
  874. addCamera(newCamera: Camera): void;
  875. /**
  876. * Switch active camera
  877. * @param {Camera} newCamera - new active camera
  878. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  879. */
  880. swithActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  881. /**
  882. * sets the active camera of the scene using its ID
  883. * @param {string} id - the camera's ID
  884. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  885. * @see activeCamera
  886. */
  887. setActiveCameraByID(id: string): Camera;
  888. /**
  889. * sets the active camera of the scene using its name
  890. * @param {string} name - the camera's name
  891. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  892. * @see activeCamera
  893. */
  894. setActiveCameraByName(name: string): Camera;
  895. /**
  896. * get a material using its id
  897. * @param {string} the material's ID
  898. * @return {BABYLON.Material|null} the material or null if none found.
  899. */
  900. getMaterialByID(id: string): Material;
  901. /**
  902. * get a material using its name
  903. * @param {string} the material's name
  904. * @return {BABYLON.Material|null} the material or null if none found.
  905. */
  906. getMaterialByName(name: string): Material;
  907. getLensFlareSystemByName(name: string): LensFlareSystem;
  908. getLensFlareSystemByID(id: string): LensFlareSystem;
  909. getCameraByID(id: string): Camera;
  910. getCameraByUniqueID(uniqueId: number): Camera;
  911. /**
  912. * get a camera using its name
  913. * @param {string} the camera's name
  914. * @return {BABYLON.Camera|null} the camera or null if none found.
  915. */
  916. getCameraByName(name: string): Camera;
  917. /**
  918. * get a bone using its id
  919. * @param {string} the bone's id
  920. * @return {BABYLON.Bone|null} the bone or null if not found
  921. */
  922. getBoneByID(id: string): Bone;
  923. /**
  924. * get a bone using its id
  925. * @param {string} the bone's name
  926. * @return {BABYLON.Bone|null} the bone or null if not found
  927. */
  928. getBoneByName(name: string): Bone;
  929. /**
  930. * get a light node using its name
  931. * @param {string} the light's name
  932. * @return {BABYLON.Light|null} the light or null if none found.
  933. */
  934. getLightByName(name: string): Light;
  935. /**
  936. * get a light node using its ID
  937. * @param {string} the light's id
  938. * @return {BABYLON.Light|null} the light or null if none found.
  939. */
  940. getLightByID(id: string): Light;
  941. /**
  942. * get a light node using its scene-generated unique ID
  943. * @param {number} the light's unique id
  944. * @return {BABYLON.Light|null} the light or null if none found.
  945. */
  946. getLightByUniqueID(uniqueId: number): Light;
  947. /**
  948. * get a particle system by id
  949. * @param id {number} the particle system id
  950. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  951. */
  952. getParticleSystemByID(id: string): ParticleSystem;
  953. /**
  954. * get a geometry using its ID
  955. * @param {string} the geometry's id
  956. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  957. */
  958. getGeometryByID(id: string): Geometry;
  959. /**
  960. * add a new geometry to this scene.
  961. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  962. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  963. * @return {boolean} was the geometry added or not
  964. */
  965. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  966. /**
  967. * Removes an existing geometry
  968. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  969. * @return {boolean} was the geometry removed or not
  970. */
  971. removeGeometry(geometry: Geometry): boolean;
  972. getGeometries(): Geometry[];
  973. /**
  974. * Get the first added mesh found of a given ID
  975. * @param {string} id - the id to search for
  976. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  977. */
  978. getMeshByID(id: string): AbstractMesh;
  979. getMeshesByID(id: string): Array<AbstractMesh>;
  980. /**
  981. * Get a mesh with its auto-generated unique id
  982. * @param {number} uniqueId - the unique id to search for
  983. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  984. */
  985. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  986. /**
  987. * Get a the last added mesh found of a given ID
  988. * @param {string} id - the id to search for
  989. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  990. */
  991. getLastMeshByID(id: string): AbstractMesh;
  992. /**
  993. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  994. * @param {string} id - the id to search for
  995. * @return {BABYLON.Node|null} the node found or null if not found at all.
  996. */
  997. getLastEntryByID(id: string): Node;
  998. getNodeByID(id: string): Node;
  999. getNodeByName(name: string): Node;
  1000. getMeshByName(name: string): AbstractMesh;
  1001. getSoundByName(name: string): Sound;
  1002. getLastSkeletonByID(id: string): Skeleton;
  1003. getSkeletonById(id: string): Skeleton;
  1004. getSkeletonByName(name: string): Skeleton;
  1005. isActiveMesh(mesh: Mesh): boolean;
  1006. private _evaluateSubMesh(subMesh, mesh);
  1007. _isInIntermediateRendering(): boolean;
  1008. private _evaluateActiveMeshes();
  1009. private _activeMesh(mesh);
  1010. updateTransformMatrix(force?: boolean): void;
  1011. private _renderForCamera(camera);
  1012. private _processSubCameras(camera);
  1013. private _checkIntersections();
  1014. render(): void;
  1015. private _updateAudioParameters();
  1016. audioEnabled: boolean;
  1017. private _disableAudio();
  1018. private _enableAudio();
  1019. headphone: boolean;
  1020. private _switchAudioModeForHeadphones();
  1021. private _switchAudioModeForNormalSpeakers();
  1022. enableDepthRenderer(): DepthRenderer;
  1023. disableDepthRenderer(): void;
  1024. freezeMaterials(): void;
  1025. unfreezeMaterials(): void;
  1026. dispose(): void;
  1027. disposeSounds(): void;
  1028. getWorldExtends(): {
  1029. min: Vector3;
  1030. max: Vector3;
  1031. };
  1032. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1033. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1034. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1035. private _internalPick(rayFunction, predicate, fastCheck?);
  1036. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  1037. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1038. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1039. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1040. setPointerOverMesh(mesh: AbstractMesh): void;
  1041. getPointerOverMesh(): AbstractMesh;
  1042. setPointerOverSprite(sprite: Sprite): void;
  1043. getPointerOverSprite(): Sprite;
  1044. getPhysicsEngine(): PhysicsEngine;
  1045. /**
  1046. * Enables physics to the current scene
  1047. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1048. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1049. * @return {boolean} was the physics engine initialized
  1050. */
  1051. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1052. disablePhysicsEngine(): void;
  1053. isPhysicsEnabled(): boolean;
  1054. /**
  1055. *
  1056. * Sets the gravity of the physics engine (and NOT of the scene)
  1057. * @param {BABYLON.Vector3} [gravity] - the new gravity to be used
  1058. */
  1059. setGravity(gravity: Vector3): void;
  1060. /**
  1061. * Legacy support, using the new API
  1062. * @Deprecated
  1063. */
  1064. createCompoundImpostor(parts: any, options: PhysicsImpostorParameters): any;
  1065. deleteCompoundImpostor(compound: any): void;
  1066. createDefaultCameraOrLight(): void;
  1067. private _getByTags(list, tagsQuery, forEach?);
  1068. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1069. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1070. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1071. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1072. }
  1073. }
  1074. declare module BABYLON {
  1075. class Action {
  1076. triggerOptions: any;
  1077. trigger: number;
  1078. _actionManager: ActionManager;
  1079. private _nextActiveAction;
  1080. private _child;
  1081. private _condition;
  1082. private _triggerParameter;
  1083. constructor(triggerOptions: any, condition?: Condition);
  1084. _prepare(): void;
  1085. getTriggerParameter(): any;
  1086. _executeCurrent(evt: ActionEvent): void;
  1087. execute(evt: ActionEvent): void;
  1088. skipToNextActiveAction(): void;
  1089. then(action: Action): Action;
  1090. _getProperty(propertyPath: string): string;
  1091. _getEffectiveTarget(target: any, propertyPath: string): any;
  1092. serialize(parent: any): any;
  1093. protected _serialize(serializedAction: any, parent?: any): any;
  1094. static _SerializeValueAsString: (value: any) => string;
  1095. static _GetTargetProperty: (target: Scene | Node) => {
  1096. name: string;
  1097. targetType: string;
  1098. value: string;
  1099. };
  1100. }
  1101. }
  1102. declare module BABYLON {
  1103. /**
  1104. * ActionEvent is the event beint sent when an action is triggered.
  1105. */
  1106. class ActionEvent {
  1107. source: any;
  1108. pointerX: number;
  1109. pointerY: number;
  1110. meshUnderPointer: AbstractMesh;
  1111. sourceEvent: any;
  1112. additionalData: any;
  1113. /**
  1114. * @constructor
  1115. * @param source The mesh or sprite that triggered the action.
  1116. * @param pointerX The X mouse cursor position at the time of the event
  1117. * @param pointerY The Y mouse cursor position at the time of the event
  1118. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1119. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1120. */
  1121. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  1122. /**
  1123. * Helper function to auto-create an ActionEvent from a source mesh.
  1124. * @param source The source mesh that triggered the event
  1125. * @param evt {Event} The original (browser) event
  1126. */
  1127. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1128. /**
  1129. * Helper function to auto-create an ActionEvent from a source mesh.
  1130. * @param source The source sprite that triggered the event
  1131. * @param scene Scene associated with the sprite
  1132. * @param evt {Event} The original (browser) event
  1133. */
  1134. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1135. /**
  1136. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1137. * @param scene the scene where the event occurred
  1138. * @param evt {Event} The original (browser) event
  1139. */
  1140. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1141. }
  1142. /**
  1143. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1144. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1145. */
  1146. class ActionManager {
  1147. private static _NothingTrigger;
  1148. private static _OnPickTrigger;
  1149. private static _OnLeftPickTrigger;
  1150. private static _OnRightPickTrigger;
  1151. private static _OnCenterPickTrigger;
  1152. private static _OnPickDownTrigger;
  1153. private static _OnPickUpTrigger;
  1154. private static _OnLongPressTrigger;
  1155. private static _OnPointerOverTrigger;
  1156. private static _OnPointerOutTrigger;
  1157. private static _OnEveryFrameTrigger;
  1158. private static _OnIntersectionEnterTrigger;
  1159. private static _OnIntersectionExitTrigger;
  1160. private static _OnKeyDownTrigger;
  1161. private static _OnKeyUpTrigger;
  1162. private static _OnPickOutTrigger;
  1163. static NothingTrigger: number;
  1164. static OnPickTrigger: number;
  1165. static OnLeftPickTrigger: number;
  1166. static OnRightPickTrigger: number;
  1167. static OnCenterPickTrigger: number;
  1168. static OnPickDownTrigger: number;
  1169. static OnPickUpTrigger: number;
  1170. static OnPickOutTrigger: number;
  1171. static OnLongPressTrigger: number;
  1172. static OnPointerOverTrigger: number;
  1173. static OnPointerOutTrigger: number;
  1174. static OnEveryFrameTrigger: number;
  1175. static OnIntersectionEnterTrigger: number;
  1176. static OnIntersectionExitTrigger: number;
  1177. static OnKeyDownTrigger: number;
  1178. static OnKeyUpTrigger: number;
  1179. static DragMovementThreshold: number;
  1180. static LongPressDelay: number;
  1181. actions: Action[];
  1182. private _scene;
  1183. constructor(scene: Scene);
  1184. dispose(): void;
  1185. getScene(): Scene;
  1186. /**
  1187. * Does this action manager handles actions of any of the given triggers
  1188. * @param {number[]} triggers - the triggers to be tested
  1189. * @return {boolean} whether one (or more) of the triggers is handeled
  1190. */
  1191. hasSpecificTriggers(triggers: number[]): boolean;
  1192. /**
  1193. * Does this action manager handles actions of a given trigger
  1194. * @param {number} trigger - the trigger to be tested
  1195. * @return {boolean} whether the trigger is handeled
  1196. */
  1197. hasSpecificTrigger(trigger: number): boolean;
  1198. /**
  1199. * Does this action manager has pointer triggers
  1200. * @return {boolean} whether or not it has pointer triggers
  1201. */
  1202. hasPointerTriggers: boolean;
  1203. /**
  1204. * Does this action manager has pick triggers
  1205. * @return {boolean} whether or not it has pick triggers
  1206. */
  1207. hasPickTriggers: boolean;
  1208. /**
  1209. * Registers an action to this action manager
  1210. * @param {BABYLON.Action} action - the action to be registered
  1211. * @return {BABYLON.Action} the action amended (prepared) after registration
  1212. */
  1213. registerAction(action: Action): Action;
  1214. /**
  1215. * Process a specific trigger
  1216. * @param {number} trigger - the trigger to process
  1217. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1218. */
  1219. processTrigger(trigger: number, evt: ActionEvent): void;
  1220. _getEffectiveTarget(target: any, propertyPath: string): any;
  1221. _getProperty(propertyPath: string): string;
  1222. serialize(name: string): any;
  1223. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  1224. static GetTriggerName(trigger: number): string;
  1225. }
  1226. }
  1227. declare module BABYLON {
  1228. class Condition {
  1229. _actionManager: ActionManager;
  1230. _evaluationId: number;
  1231. _currentResult: boolean;
  1232. constructor(actionManager: ActionManager);
  1233. isValid(): boolean;
  1234. _getProperty(propertyPath: string): string;
  1235. _getEffectiveTarget(target: any, propertyPath: string): any;
  1236. serialize(): any;
  1237. protected _serialize(serializedCondition: any): any;
  1238. }
  1239. class ValueCondition extends Condition {
  1240. propertyPath: string;
  1241. value: any;
  1242. operator: number;
  1243. private static _IsEqual;
  1244. private static _IsDifferent;
  1245. private static _IsGreater;
  1246. private static _IsLesser;
  1247. static IsEqual: number;
  1248. static IsDifferent: number;
  1249. static IsGreater: number;
  1250. static IsLesser: number;
  1251. _actionManager: ActionManager;
  1252. private _target;
  1253. private _effectiveTarget;
  1254. private _property;
  1255. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1256. isValid(): boolean;
  1257. serialize(): any;
  1258. static GetOperatorName(operator: number): string;
  1259. }
  1260. class PredicateCondition extends Condition {
  1261. predicate: () => boolean;
  1262. _actionManager: ActionManager;
  1263. constructor(actionManager: ActionManager, predicate: () => boolean);
  1264. isValid(): boolean;
  1265. }
  1266. class StateCondition extends Condition {
  1267. value: string;
  1268. _actionManager: ActionManager;
  1269. private _target;
  1270. constructor(actionManager: ActionManager, target: any, value: string);
  1271. isValid(): boolean;
  1272. serialize(): any;
  1273. }
  1274. }
  1275. declare module BABYLON {
  1276. class SwitchBooleanAction extends Action {
  1277. propertyPath: string;
  1278. private _target;
  1279. private _effectiveTarget;
  1280. private _property;
  1281. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  1282. _prepare(): void;
  1283. execute(): void;
  1284. serialize(parent: any): any;
  1285. }
  1286. class SetStateAction extends Action {
  1287. value: string;
  1288. private _target;
  1289. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  1290. execute(): void;
  1291. serialize(parent: any): any;
  1292. }
  1293. class SetValueAction extends Action {
  1294. propertyPath: string;
  1295. value: any;
  1296. private _target;
  1297. private _effectiveTarget;
  1298. private _property;
  1299. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1300. _prepare(): void;
  1301. execute(): void;
  1302. serialize(parent: any): any;
  1303. }
  1304. class IncrementValueAction extends Action {
  1305. propertyPath: string;
  1306. value: any;
  1307. private _target;
  1308. private _effectiveTarget;
  1309. private _property;
  1310. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  1311. _prepare(): void;
  1312. execute(): void;
  1313. serialize(parent: any): any;
  1314. }
  1315. class PlayAnimationAction extends Action {
  1316. from: number;
  1317. to: number;
  1318. loop: boolean;
  1319. private _target;
  1320. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  1321. _prepare(): void;
  1322. execute(): void;
  1323. serialize(parent: any): any;
  1324. }
  1325. class StopAnimationAction extends Action {
  1326. private _target;
  1327. constructor(triggerOptions: any, target: any, condition?: Condition);
  1328. _prepare(): void;
  1329. execute(): void;
  1330. serialize(parent: any): any;
  1331. }
  1332. class DoNothingAction extends Action {
  1333. constructor(triggerOptions?: any, condition?: Condition);
  1334. execute(): void;
  1335. serialize(parent: any): any;
  1336. }
  1337. class CombineAction extends Action {
  1338. children: Action[];
  1339. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  1340. _prepare(): void;
  1341. execute(evt: ActionEvent): void;
  1342. serialize(parent: any): any;
  1343. }
  1344. class ExecuteCodeAction extends Action {
  1345. func: (evt: ActionEvent) => void;
  1346. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  1347. execute(evt: ActionEvent): void;
  1348. }
  1349. class SetParentAction extends Action {
  1350. private _parent;
  1351. private _target;
  1352. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  1353. _prepare(): void;
  1354. execute(): void;
  1355. serialize(parent: any): any;
  1356. }
  1357. class PlaySoundAction extends Action {
  1358. private _sound;
  1359. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1360. _prepare(): void;
  1361. execute(): void;
  1362. serialize(parent: any): any;
  1363. }
  1364. class StopSoundAction extends Action {
  1365. private _sound;
  1366. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  1367. _prepare(): void;
  1368. execute(): void;
  1369. serialize(parent: any): any;
  1370. }
  1371. }
  1372. declare module BABYLON {
  1373. class InterpolateValueAction extends Action {
  1374. propertyPath: string;
  1375. value: any;
  1376. duration: number;
  1377. stopOtherAnimations: boolean;
  1378. onInterpolationDone: () => void;
  1379. private _target;
  1380. private _effectiveTarget;
  1381. private _property;
  1382. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  1383. _prepare(): void;
  1384. execute(): void;
  1385. serialize(parent: any): any;
  1386. }
  1387. }
  1388. declare module BABYLON {
  1389. class Animatable {
  1390. target: any;
  1391. fromFrame: number;
  1392. toFrame: number;
  1393. loopAnimation: boolean;
  1394. speedRatio: number;
  1395. onAnimationEnd: any;
  1396. private _localDelayOffset;
  1397. private _pausedDelay;
  1398. private _animations;
  1399. private _paused;
  1400. private _scene;
  1401. animationStarted: boolean;
  1402. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  1403. getAnimations(): Animation[];
  1404. appendAnimations(target: any, animations: Animation[]): void;
  1405. getAnimationByTargetProperty(property: string): Animation;
  1406. reset(): void;
  1407. enableBlending(blendingSpeed: number): void;
  1408. disableBlending(): void;
  1409. goToFrame(frame: number): void;
  1410. pause(): void;
  1411. restart(): void;
  1412. stop(): void;
  1413. _animate(delay: number): boolean;
  1414. }
  1415. }
  1416. declare module BABYLON {
  1417. class AnimationRange {
  1418. name: string;
  1419. from: number;
  1420. to: number;
  1421. constructor(name: string, from: number, to: number);
  1422. clone(): AnimationRange;
  1423. }
  1424. /**
  1425. * Composed of a frame, and an action function
  1426. */
  1427. class AnimationEvent {
  1428. frame: number;
  1429. action: () => void;
  1430. onlyOnce: boolean;
  1431. isDone: boolean;
  1432. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  1433. }
  1434. class PathCursor {
  1435. private path;
  1436. private _onchange;
  1437. value: number;
  1438. animations: Animation[];
  1439. constructor(path: Path2);
  1440. getPoint(): Vector3;
  1441. moveAhead(step?: number): PathCursor;
  1442. moveBack(step?: number): PathCursor;
  1443. move(step: number): PathCursor;
  1444. private ensureLimits();
  1445. private markAsDirty(propertyName);
  1446. private raiseOnChange();
  1447. onchange(f: (cursor: PathCursor) => void): PathCursor;
  1448. }
  1449. class Animation {
  1450. name: string;
  1451. targetProperty: string;
  1452. framePerSecond: number;
  1453. dataType: number;
  1454. loopMode: number;
  1455. enableBlending: boolean;
  1456. private _keys;
  1457. private _offsetsCache;
  1458. private _highLimitsCache;
  1459. private _stopped;
  1460. _target: any;
  1461. private _blendingFactor;
  1462. private _easingFunction;
  1463. private _events;
  1464. targetPropertyPath: string[];
  1465. currentFrame: number;
  1466. allowMatricesInterpolation: boolean;
  1467. blendingSpeed: number;
  1468. private _originalBlendValue;
  1469. private _ranges;
  1470. static _PrepareAnimation(name: string, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animation;
  1471. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  1472. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  1473. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  1474. /**
  1475. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  1476. */
  1477. toString(fullDetails?: boolean): string;
  1478. /**
  1479. * Add an event to this animation.
  1480. */
  1481. addEvent(event: AnimationEvent): void;
  1482. /**
  1483. * Remove all events found at the given frame
  1484. * @param frame
  1485. */
  1486. removeEvents(frame: number): void;
  1487. createRange(name: string, from: number, to: number): void;
  1488. deleteRange(name: string, deleteFrames?: boolean): void;
  1489. getRange(name: string): AnimationRange;
  1490. reset(): void;
  1491. isStopped(): boolean;
  1492. getKeys(): any[];
  1493. getHighestFrame(): number;
  1494. getEasingFunction(): IEasingFunction;
  1495. setEasingFunction(easingFunction: EasingFunction): void;
  1496. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  1497. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  1498. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  1499. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  1500. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  1501. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1502. clone(): Animation;
  1503. setKeys(values: Array<any>): void;
  1504. private _getKeyValue(value);
  1505. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  1506. setValue(currentValue: any, blend?: boolean): void;
  1507. goToFrame(frame: number): void;
  1508. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  1509. serialize(): any;
  1510. private static _ANIMATIONTYPE_FLOAT;
  1511. private static _ANIMATIONTYPE_VECTOR3;
  1512. private static _ANIMATIONTYPE_QUATERNION;
  1513. private static _ANIMATIONTYPE_MATRIX;
  1514. private static _ANIMATIONTYPE_COLOR3;
  1515. private static _ANIMATIONTYPE_VECTOR2;
  1516. private static _ANIMATIONLOOPMODE_RELATIVE;
  1517. private static _ANIMATIONLOOPMODE_CYCLE;
  1518. private static _ANIMATIONLOOPMODE_CONSTANT;
  1519. static ANIMATIONTYPE_FLOAT: number;
  1520. static ANIMATIONTYPE_VECTOR3: number;
  1521. static ANIMATIONTYPE_VECTOR2: number;
  1522. static ANIMATIONTYPE_QUATERNION: number;
  1523. static ANIMATIONTYPE_MATRIX: number;
  1524. static ANIMATIONTYPE_COLOR3: number;
  1525. static ANIMATIONLOOPMODE_RELATIVE: number;
  1526. static ANIMATIONLOOPMODE_CYCLE: number;
  1527. static ANIMATIONLOOPMODE_CONSTANT: number;
  1528. static Parse(parsedAnimation: any): Animation;
  1529. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  1530. }
  1531. }
  1532. declare module BABYLON {
  1533. interface IEasingFunction {
  1534. ease(gradient: number): number;
  1535. }
  1536. class EasingFunction implements IEasingFunction {
  1537. private static _EASINGMODE_EASEIN;
  1538. private static _EASINGMODE_EASEOUT;
  1539. private static _EASINGMODE_EASEINOUT;
  1540. static EASINGMODE_EASEIN: number;
  1541. static EASINGMODE_EASEOUT: number;
  1542. static EASINGMODE_EASEINOUT: number;
  1543. private _easingMode;
  1544. setEasingMode(easingMode: number): void;
  1545. getEasingMode(): number;
  1546. easeInCore(gradient: number): number;
  1547. ease(gradient: number): number;
  1548. }
  1549. class CircleEase extends EasingFunction implements IEasingFunction {
  1550. easeInCore(gradient: number): number;
  1551. }
  1552. class BackEase extends EasingFunction implements IEasingFunction {
  1553. amplitude: number;
  1554. constructor(amplitude?: number);
  1555. easeInCore(gradient: number): number;
  1556. }
  1557. class BounceEase extends EasingFunction implements IEasingFunction {
  1558. bounces: number;
  1559. bounciness: number;
  1560. constructor(bounces?: number, bounciness?: number);
  1561. easeInCore(gradient: number): number;
  1562. }
  1563. class CubicEase extends EasingFunction implements IEasingFunction {
  1564. easeInCore(gradient: number): number;
  1565. }
  1566. class ElasticEase extends EasingFunction implements IEasingFunction {
  1567. oscillations: number;
  1568. springiness: number;
  1569. constructor(oscillations?: number, springiness?: number);
  1570. easeInCore(gradient: number): number;
  1571. }
  1572. class ExponentialEase extends EasingFunction implements IEasingFunction {
  1573. exponent: number;
  1574. constructor(exponent?: number);
  1575. easeInCore(gradient: number): number;
  1576. }
  1577. class PowerEase extends EasingFunction implements IEasingFunction {
  1578. power: number;
  1579. constructor(power?: number);
  1580. easeInCore(gradient: number): number;
  1581. }
  1582. class QuadraticEase extends EasingFunction implements IEasingFunction {
  1583. easeInCore(gradient: number): number;
  1584. }
  1585. class QuarticEase extends EasingFunction implements IEasingFunction {
  1586. easeInCore(gradient: number): number;
  1587. }
  1588. class QuinticEase extends EasingFunction implements IEasingFunction {
  1589. easeInCore(gradient: number): number;
  1590. }
  1591. class SineEase extends EasingFunction implements IEasingFunction {
  1592. easeInCore(gradient: number): number;
  1593. }
  1594. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  1595. x1: number;
  1596. y1: number;
  1597. x2: number;
  1598. y2: number;
  1599. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  1600. easeInCore(gradient: number): number;
  1601. }
  1602. }
  1603. declare module BABYLON {
  1604. class Analyser {
  1605. SMOOTHING: number;
  1606. FFT_SIZE: number;
  1607. BARGRAPHAMPLITUDE: number;
  1608. DEBUGCANVASPOS: {
  1609. x: number;
  1610. y: number;
  1611. };
  1612. DEBUGCANVASSIZE: {
  1613. width: number;
  1614. height: number;
  1615. };
  1616. private _byteFreqs;
  1617. private _byteTime;
  1618. private _floatFreqs;
  1619. private _webAudioAnalyser;
  1620. private _debugCanvas;
  1621. private _debugCanvasContext;
  1622. private _scene;
  1623. private _registerFunc;
  1624. private _audioEngine;
  1625. constructor(scene: Scene);
  1626. getFrequencyBinCount(): number;
  1627. getByteFrequencyData(): Uint8Array;
  1628. getByteTimeDomainData(): Uint8Array;
  1629. getFloatFrequencyData(): Uint8Array;
  1630. drawDebugCanvas(): void;
  1631. stopDebugCanvas(): void;
  1632. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  1633. dispose(): void;
  1634. }
  1635. }
  1636. declare module BABYLON {
  1637. class AudioEngine {
  1638. private _audioContext;
  1639. private _audioContextInitialized;
  1640. canUseWebAudio: boolean;
  1641. masterGain: GainNode;
  1642. private _connectedAnalyser;
  1643. WarnedWebAudioUnsupported: boolean;
  1644. unlocked: boolean;
  1645. onAudioUnlocked: () => any;
  1646. audioContext: AudioContext;
  1647. constructor();
  1648. private _unlockiOSaudio();
  1649. private _initializeAudioContext();
  1650. dispose(): void;
  1651. getGlobalVolume(): number;
  1652. setGlobalVolume(newVolume: number): void;
  1653. connectToAnalyser(analyser: Analyser): void;
  1654. }
  1655. }
  1656. declare module BABYLON {
  1657. class Sound {
  1658. name: string;
  1659. autoplay: boolean;
  1660. loop: boolean;
  1661. useCustomAttenuation: boolean;
  1662. soundTrackId: number;
  1663. spatialSound: boolean;
  1664. refDistance: number;
  1665. rolloffFactor: number;
  1666. maxDistance: number;
  1667. distanceModel: string;
  1668. private _panningModel;
  1669. onended: () => any;
  1670. private _playbackRate;
  1671. private _streaming;
  1672. private _startTime;
  1673. private _startOffset;
  1674. private _position;
  1675. private _localDirection;
  1676. private _volume;
  1677. private _isLoaded;
  1678. private _isReadyToPlay;
  1679. isPlaying: boolean;
  1680. isPaused: boolean;
  1681. private _isDirectional;
  1682. private _readyToPlayCallback;
  1683. private _audioBuffer;
  1684. private _soundSource;
  1685. private _streamingSource;
  1686. private _soundPanner;
  1687. private _soundGain;
  1688. private _inputAudioNode;
  1689. private _ouputAudioNode;
  1690. private _coneInnerAngle;
  1691. private _coneOuterAngle;
  1692. private _coneOuterGain;
  1693. private _scene;
  1694. private _connectedMesh;
  1695. private _customAttenuationFunction;
  1696. private _registerFunc;
  1697. private _isOutputConnected;
  1698. private _htmlAudioElement;
  1699. /**
  1700. * Create a sound and attach it to a scene
  1701. * @param name Name of your sound
  1702. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  1703. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  1704. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  1705. */
  1706. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  1707. dispose(): void;
  1708. private _soundLoaded(audioData);
  1709. setAudioBuffer(audioBuffer: AudioBuffer): void;
  1710. updateOptions(options: any): void;
  1711. private _createSpatialParameters();
  1712. private _updateSpatialParameters();
  1713. switchPanningModelToHRTF(): void;
  1714. switchPanningModelToEqualPower(): void;
  1715. private _switchPanningModel();
  1716. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  1717. /**
  1718. * Transform this sound into a directional source
  1719. * @param coneInnerAngle Size of the inner cone in degree
  1720. * @param coneOuterAngle Size of the outer cone in degree
  1721. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  1722. */
  1723. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  1724. setPosition(newPosition: Vector3): void;
  1725. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  1726. private _updateDirection();
  1727. updateDistanceFromListener(): void;
  1728. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  1729. /**
  1730. * Play the sound
  1731. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  1732. */
  1733. play(time?: number): void;
  1734. private _onended();
  1735. /**
  1736. * Stop the sound
  1737. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  1738. */
  1739. stop(time?: number): void;
  1740. pause(): void;
  1741. setVolume(newVolume: number, time?: number): void;
  1742. setPlaybackRate(newPlaybackRate: number): void;
  1743. getVolume(): number;
  1744. attachToMesh(meshToConnectTo: AbstractMesh): void;
  1745. private _onRegisterAfterWorldMatrixUpdate(connectedMesh);
  1746. clone(): Sound;
  1747. getAudioBuffer(): AudioBuffer;
  1748. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  1749. }
  1750. }
  1751. declare module BABYLON {
  1752. class SoundTrack {
  1753. private _outputAudioNode;
  1754. private _inputAudioNode;
  1755. private _trackConvolver;
  1756. private _scene;
  1757. id: number;
  1758. soundCollection: Array<Sound>;
  1759. private _isMainTrack;
  1760. private _connectedAnalyser;
  1761. private _options;
  1762. private _isInitialized;
  1763. constructor(scene: Scene, options?: any);
  1764. private _initializeSoundTrackAudioGraph();
  1765. dispose(): void;
  1766. AddSound(sound: Sound): void;
  1767. RemoveSound(sound: Sound): void;
  1768. setVolume(newVolume: number): void;
  1769. switchPanningModelToHRTF(): void;
  1770. switchPanningModelToEqualPower(): void;
  1771. connectToAnalyser(analyser: Analyser): void;
  1772. }
  1773. }
  1774. declare module BABYLON {
  1775. class Bone extends Node {
  1776. name: string;
  1777. children: Bone[];
  1778. animations: Animation[];
  1779. length: number;
  1780. private _skeleton;
  1781. _matrix: Matrix;
  1782. private _restPose;
  1783. private _baseMatrix;
  1784. private _worldTransform;
  1785. private _absoluteTransform;
  1786. private _invertedAbsoluteTransform;
  1787. private _parent;
  1788. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
  1789. getParent(): Bone;
  1790. getLocalMatrix(): Matrix;
  1791. getBaseMatrix(): Matrix;
  1792. getRestPose(): Matrix;
  1793. returnToRest(): void;
  1794. getWorldMatrix(): Matrix;
  1795. getInvertedAbsoluteTransform(): Matrix;
  1796. getAbsoluteTransform(): Matrix;
  1797. updateMatrix(matrix: Matrix): void;
  1798. _updateDifferenceMatrix(rootMatrix?: Matrix): void;
  1799. markAsDirty(): void;
  1800. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean): boolean;
  1801. }
  1802. }
  1803. declare module BABYLON {
  1804. class Skeleton {
  1805. name: string;
  1806. id: string;
  1807. bones: Bone[];
  1808. needInitialSkinMatrix: boolean;
  1809. private _scene;
  1810. private _isDirty;
  1811. private _transformMatrices;
  1812. private _meshesWithPoseMatrix;
  1813. private _animatables;
  1814. private _identity;
  1815. private _ranges;
  1816. constructor(name: string, id: string, scene: Scene);
  1817. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  1818. getScene(): Scene;
  1819. /**
  1820. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  1821. */
  1822. toString(fullDetails?: boolean): string;
  1823. /**
  1824. * Get bone's index searching by name
  1825. * @param {string} name is bone's name to search for
  1826. * @return {number} Indice of the bone. Returns -1 if not found
  1827. */
  1828. getBoneIndexByName(name: string): number;
  1829. createAnimationRange(name: string, from: number, to: number): void;
  1830. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  1831. getAnimationRange(name: string): AnimationRange;
  1832. /**
  1833. * Returns as an Array, all AnimationRanges defined on this skeleton
  1834. */
  1835. getAnimationRanges(): AnimationRange[];
  1836. /**
  1837. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  1838. */
  1839. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  1840. returnToRest(): void;
  1841. private _getHighestAnimationFrame();
  1842. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  1843. _markAsDirty(): void;
  1844. _registerMeshWithPoseMatrix(mesh: AbstractMesh): void;
  1845. _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void;
  1846. _computeTransformMatrices(targetMatrix: Float32Array, initialSkinMatrix: Matrix): void;
  1847. prepare(): void;
  1848. getAnimatables(): IAnimatable[];
  1849. clone(name: string, id: string): Skeleton;
  1850. dispose(): void;
  1851. serialize(): any;
  1852. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  1853. }
  1854. }
  1855. declare module BABYLON {
  1856. class ArcRotateCamera extends TargetCamera {
  1857. alpha: number;
  1858. beta: number;
  1859. radius: number;
  1860. target: Vector3;
  1861. inertialAlphaOffset: number;
  1862. inertialBetaOffset: number;
  1863. inertialRadiusOffset: number;
  1864. lowerAlphaLimit: any;
  1865. upperAlphaLimit: any;
  1866. lowerBetaLimit: number;
  1867. upperBetaLimit: number;
  1868. lowerRadiusLimit: any;
  1869. upperRadiusLimit: any;
  1870. inertialPanningX: number;
  1871. inertialPanningY: number;
  1872. angularSensibilityX: number;
  1873. angularSensibilityY: number;
  1874. pinchPrecision: number;
  1875. panningSensibility: number;
  1876. keysUp: number[];
  1877. keysDown: number[];
  1878. keysLeft: number[];
  1879. keysRight: number[];
  1880. wheelPrecision: number;
  1881. zoomOnFactor: number;
  1882. targetScreenOffset: Vector2;
  1883. allowUpsideDown: boolean;
  1884. _viewMatrix: Matrix;
  1885. _useCtrlForPanning: boolean;
  1886. inputs: ArcRotateCameraInputsManager;
  1887. _reset: () => void;
  1888. panningAxis: Vector3;
  1889. private _localDirection;
  1890. private _transformedDirection;
  1891. onCollide: (collidedMesh: AbstractMesh) => void;
  1892. checkCollisions: boolean;
  1893. collisionRadius: Vector3;
  1894. private _collider;
  1895. private _previousPosition;
  1896. private _collisionVelocity;
  1897. private _newPosition;
  1898. private _previousAlpha;
  1899. private _previousBeta;
  1900. private _previousRadius;
  1901. private _collisionTriggered;
  1902. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  1903. _initCache(): void;
  1904. _updateCache(ignoreParentClass?: boolean): void;
  1905. private _getTargetPosition();
  1906. _isSynchronizedViewMatrix(): boolean;
  1907. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void;
  1908. detachControl(element: HTMLElement): void;
  1909. _checkInputs(): void;
  1910. private _checkLimits();
  1911. rebuildAnglesAndRadius(): void;
  1912. setPosition(position: Vector3): void;
  1913. setTarget(target: Vector3): void;
  1914. _getViewMatrix(): Matrix;
  1915. private _onCollisionPositionChange;
  1916. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  1917. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  1918. /**
  1919. * @override
  1920. * Override Camera.createRigCamera
  1921. */
  1922. createRigCamera(name: string, cameraIndex: number): Camera;
  1923. /**
  1924. * @override
  1925. * Override Camera._updateRigCameras
  1926. */
  1927. _updateRigCameras(): void;
  1928. dispose(): void;
  1929. getTypeName(): string;
  1930. }
  1931. }
  1932. declare module BABYLON {
  1933. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  1934. constructor(camera: ArcRotateCamera);
  1935. addMouseWheel(): ArcRotateCameraInputsManager;
  1936. addPointers(): ArcRotateCameraInputsManager;
  1937. addKeyboard(): ArcRotateCameraInputsManager;
  1938. addGamepad(): ArcRotateCameraInputsManager;
  1939. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  1940. }
  1941. }
  1942. declare module BABYLON {
  1943. class Camera extends Node {
  1944. inputs: CameraInputsManager<Camera>;
  1945. private static _PERSPECTIVE_CAMERA;
  1946. private static _ORTHOGRAPHIC_CAMERA;
  1947. private static _FOVMODE_VERTICAL_FIXED;
  1948. private static _FOVMODE_HORIZONTAL_FIXED;
  1949. private static _RIG_MODE_NONE;
  1950. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  1951. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  1952. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  1953. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  1954. private static _RIG_MODE_VR;
  1955. static PERSPECTIVE_CAMERA: number;
  1956. static ORTHOGRAPHIC_CAMERA: number;
  1957. static FOVMODE_VERTICAL_FIXED: number;
  1958. static FOVMODE_HORIZONTAL_FIXED: number;
  1959. static RIG_MODE_NONE: number;
  1960. static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  1961. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  1962. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  1963. static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  1964. static RIG_MODE_VR: number;
  1965. static ForceAttachControlToAlwaysPreventDefault: boolean;
  1966. position: Vector3;
  1967. upVector: Vector3;
  1968. orthoLeft: any;
  1969. orthoRight: any;
  1970. orthoBottom: any;
  1971. orthoTop: any;
  1972. fov: number;
  1973. minZ: number;
  1974. maxZ: number;
  1975. inertia: number;
  1976. mode: number;
  1977. isIntermediate: boolean;
  1978. viewport: Viewport;
  1979. layerMask: number;
  1980. fovMode: number;
  1981. cameraRigMode: number;
  1982. interaxialDistance: number;
  1983. isStereoscopicSideBySide: boolean;
  1984. _cameraRigParams: any;
  1985. _rigCameras: Camera[];
  1986. private _computedViewMatrix;
  1987. _projectionMatrix: Matrix;
  1988. private _worldMatrix;
  1989. _postProcesses: PostProcess[];
  1990. _postProcessesTakenIndices: any[];
  1991. _activeMeshes: SmartArray<Mesh>;
  1992. private _globalPosition;
  1993. constructor(name: string, position: Vector3, scene: Scene);
  1994. /**
  1995. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  1996. */
  1997. toString(fullDetails?: boolean): string;
  1998. globalPosition: Vector3;
  1999. getActiveMeshes(): SmartArray<Mesh>;
  2000. isActiveMesh(mesh: Mesh): boolean;
  2001. _initCache(): void;
  2002. _updateCache(ignoreParentClass?: boolean): void;
  2003. _updateFromScene(): void;
  2004. _isSynchronized(): boolean;
  2005. _isSynchronizedViewMatrix(): boolean;
  2006. _isSynchronizedProjectionMatrix(): boolean;
  2007. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2008. detachControl(element: HTMLElement): void;
  2009. _update(): void;
  2010. _checkInputs(): void;
  2011. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  2012. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  2013. getWorldMatrix(): Matrix;
  2014. _getViewMatrix(): Matrix;
  2015. getViewMatrix(force?: boolean): Matrix;
  2016. _computeViewMatrix(force?: boolean): Matrix;
  2017. getProjectionMatrix(force?: boolean): Matrix;
  2018. dispose(): void;
  2019. setCameraRigMode(mode: number, rigParams: any): void;
  2020. private _getVRProjectionMatrix();
  2021. setCameraRigParameter(name: string, value: any): void;
  2022. /**
  2023. * May needs to be overridden by children so sub has required properties to be copied
  2024. */
  2025. createRigCamera(name: string, cameraIndex: number): Camera;
  2026. /**
  2027. * May needs to be overridden by children
  2028. */
  2029. _updateRigCameras(): void;
  2030. _setupInputs(): void;
  2031. serialize(): any;
  2032. getTypeName(): string;
  2033. clone(name: string): Camera;
  2034. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  2035. static Parse(parsedCamera: any, scene: Scene): Camera;
  2036. }
  2037. }
  2038. declare module BABYLON {
  2039. var CameraInputTypes: {};
  2040. interface ICameraInput<TCamera extends BABYLON.Camera> {
  2041. camera: TCamera;
  2042. getTypeName(): string;
  2043. getSimpleName(): string;
  2044. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  2045. detachControl: (element: HTMLElement) => void;
  2046. checkInputs?: () => void;
  2047. }
  2048. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  2049. [name: string]: ICameraInput<TCamera>;
  2050. [idx: number]: ICameraInput<TCamera>;
  2051. }
  2052. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  2053. attached: CameraInputsMap<TCamera>;
  2054. attachedElement: HTMLElement;
  2055. noPreventDefault: boolean;
  2056. camera: TCamera;
  2057. checkInputs: () => void;
  2058. constructor(camera: TCamera);
  2059. add(input: ICameraInput<TCamera>): void;
  2060. remove(inputToRemove: ICameraInput<TCamera>): void;
  2061. removeByType(inputType: string): void;
  2062. private _addCheckInputs(fn);
  2063. attachInput(input: ICameraInput<TCamera>): void;
  2064. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  2065. detachElement(element: HTMLElement): void;
  2066. rebuildInputCheck(): void;
  2067. clear(): void;
  2068. serialize(serializedCamera: any): void;
  2069. parse(parsedCamera: any): void;
  2070. }
  2071. }
  2072. declare module BABYLON {
  2073. class DeviceOrientationCamera extends FreeCamera {
  2074. angularSensibility: number;
  2075. moveSensibility: number;
  2076. constructor(name: string, position: Vector3, scene: Scene);
  2077. getTypeName(): string;
  2078. }
  2079. }
  2080. declare module BABYLON {
  2081. class FollowCamera extends TargetCamera {
  2082. radius: number;
  2083. rotationOffset: number;
  2084. heightOffset: number;
  2085. cameraAcceleration: number;
  2086. maxCameraSpeed: number;
  2087. target: AbstractMesh;
  2088. constructor(name: string, position: Vector3, scene: Scene, target?: AbstractMesh);
  2089. private getRadians(degrees);
  2090. private follow(cameraTarget);
  2091. _checkInputs(): void;
  2092. getTypeName(): string;
  2093. }
  2094. class ArcFollowCamera extends TargetCamera {
  2095. alpha: number;
  2096. beta: number;
  2097. radius: number;
  2098. target: AbstractMesh;
  2099. private _cartesianCoordinates;
  2100. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  2101. private follow();
  2102. _checkInputs(): void;
  2103. getTypeName(): string;
  2104. }
  2105. }
  2106. declare module BABYLON {
  2107. class FreeCamera extends TargetCamera {
  2108. ellipsoid: Vector3;
  2109. checkCollisions: boolean;
  2110. applyGravity: boolean;
  2111. inputs: FreeCameraInputsManager;
  2112. angularSensibility: number;
  2113. keysUp: number[];
  2114. keysDown: number[];
  2115. keysLeft: number[];
  2116. keysRight: number[];
  2117. onCollide: (collidedMesh: AbstractMesh) => void;
  2118. private _collider;
  2119. private _needMoveForGravity;
  2120. private _oldPosition;
  2121. private _diffPosition;
  2122. private _newPosition;
  2123. _localDirection: Vector3;
  2124. _transformedDirection: Vector3;
  2125. constructor(name: string, position: Vector3, scene: Scene);
  2126. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2127. detachControl(element: HTMLElement): void;
  2128. _collideWithWorld(velocity: Vector3): void;
  2129. private _onCollisionPositionChange;
  2130. _checkInputs(): void;
  2131. _decideIfNeedsToMove(): boolean;
  2132. _updatePosition(): void;
  2133. dispose(): void;
  2134. getTypeName(): string;
  2135. }
  2136. }
  2137. declare module BABYLON {
  2138. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  2139. constructor(camera: FreeCamera);
  2140. addKeyboard(): FreeCameraInputsManager;
  2141. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  2142. addGamepad(): FreeCameraInputsManager;
  2143. addDeviceOrientation(): FreeCameraInputsManager;
  2144. addVRDeviceOrientation(): FreeCameraInputsManager;
  2145. addTouch(): FreeCameraInputsManager;
  2146. addVirtualJoystick(): FreeCameraInputsManager;
  2147. }
  2148. }
  2149. declare module BABYLON {
  2150. class GamepadCamera extends UniversalCamera {
  2151. gamepadAngularSensibility: number;
  2152. gamepadMoveSensibility: number;
  2153. constructor(name: string, position: Vector3, scene: Scene);
  2154. getTypeName(): string;
  2155. }
  2156. }
  2157. declare module BABYLON {
  2158. class AnaglyphFreeCamera extends FreeCamera {
  2159. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2160. getTypeName(): string;
  2161. }
  2162. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  2163. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  2164. getTypeName(): string;
  2165. }
  2166. class AnaglyphGamepadCamera extends GamepadCamera {
  2167. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2168. getTypeName(): string;
  2169. }
  2170. class AnaglyphUniversalCamera extends UniversalCamera {
  2171. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2172. getTypeName(): string;
  2173. }
  2174. class StereoscopicFreeCamera extends FreeCamera {
  2175. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2176. getTypeName(): string;
  2177. }
  2178. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  2179. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2180. getTypeName(): string;
  2181. }
  2182. class StereoscopicGamepadCamera extends GamepadCamera {
  2183. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2184. getTypeName(): string;
  2185. }
  2186. class StereoscopicUniversalCamera extends UniversalCamera {
  2187. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  2188. getTypeName(): string;
  2189. }
  2190. }
  2191. declare module BABYLON {
  2192. class TargetCamera extends Camera {
  2193. cameraDirection: Vector3;
  2194. cameraRotation: Vector2;
  2195. rotation: Vector3;
  2196. speed: number;
  2197. noRotationConstraint: boolean;
  2198. lockedTarget: any;
  2199. _currentTarget: Vector3;
  2200. _viewMatrix: Matrix;
  2201. _camMatrix: Matrix;
  2202. _cameraTransformMatrix: Matrix;
  2203. _cameraRotationMatrix: Matrix;
  2204. private _rigCamTransformMatrix;
  2205. _referencePoint: Vector3;
  2206. _transformedReferencePoint: Vector3;
  2207. _lookAtTemp: Matrix;
  2208. _tempMatrix: Matrix;
  2209. _reset: () => void;
  2210. constructor(name: string, position: Vector3, scene: Scene);
  2211. getFrontPosition(distance: number): Vector3;
  2212. _getLockedTargetPosition(): Vector3;
  2213. _initCache(): void;
  2214. _updateCache(ignoreParentClass?: boolean): void;
  2215. _isSynchronizedViewMatrix(): boolean;
  2216. _computeLocalCameraSpeed(): number;
  2217. setTarget(target: Vector3): void;
  2218. getTarget(): Vector3;
  2219. _decideIfNeedsToMove(): boolean;
  2220. _updatePosition(): void;
  2221. _checkInputs(): void;
  2222. _getViewMatrix(): Matrix;
  2223. _getVRViewMatrix(): Matrix;
  2224. /**
  2225. * @override
  2226. * Override Camera.createRigCamera
  2227. */
  2228. createRigCamera(name: string, cameraIndex: number): Camera;
  2229. /**
  2230. * @override
  2231. * Override Camera._updateRigCameras
  2232. */
  2233. _updateRigCameras(): void;
  2234. private _getRigCamPosition(halfSpace, result);
  2235. getTypeName(): string;
  2236. }
  2237. }
  2238. declare module BABYLON {
  2239. class TouchCamera extends FreeCamera {
  2240. touchAngularSensibility: number;
  2241. touchMoveSensibility: number;
  2242. constructor(name: string, position: Vector3, scene: Scene);
  2243. getTypeName(): string;
  2244. _setupInputs(): void;
  2245. }
  2246. }
  2247. declare module BABYLON {
  2248. class UniversalCamera extends TouchCamera {
  2249. gamepadAngularSensibility: number;
  2250. gamepadMoveSensibility: number;
  2251. constructor(name: string, position: Vector3, scene: Scene);
  2252. getTypeName(): string;
  2253. }
  2254. }
  2255. declare module BABYLON {
  2256. class VirtualJoysticksCamera extends FreeCamera {
  2257. constructor(name: string, position: Vector3, scene: Scene);
  2258. }
  2259. }
  2260. declare module BABYLON {
  2261. class Collider {
  2262. radius: Vector3;
  2263. retry: number;
  2264. velocity: Vector3;
  2265. basePoint: Vector3;
  2266. epsilon: number;
  2267. collisionFound: boolean;
  2268. velocityWorldLength: number;
  2269. basePointWorld: Vector3;
  2270. velocityWorld: Vector3;
  2271. normalizedVelocity: Vector3;
  2272. initialVelocity: Vector3;
  2273. initialPosition: Vector3;
  2274. nearestDistance: number;
  2275. intersectionPoint: Vector3;
  2276. collidedMesh: AbstractMesh;
  2277. private _collisionPoint;
  2278. private _planeIntersectionPoint;
  2279. private _tempVector;
  2280. private _tempVector2;
  2281. private _tempVector3;
  2282. private _tempVector4;
  2283. private _edge;
  2284. private _baseToVertex;
  2285. private _destinationPoint;
  2286. private _slidePlaneNormal;
  2287. private _displacementVector;
  2288. _initialize(source: Vector3, dir: Vector3, e: number): void;
  2289. _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  2290. _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  2291. _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
  2292. _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: number[] | Int32Array, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
  2293. _getResponse(pos: Vector3, vel: Vector3): void;
  2294. }
  2295. }
  2296. declare module BABYLON {
  2297. var CollisionWorker: string;
  2298. interface ICollisionCoordinator {
  2299. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2300. init(scene: Scene): void;
  2301. destroy(): void;
  2302. onMeshAdded(mesh: AbstractMesh): any;
  2303. onMeshUpdated(mesh: AbstractMesh): any;
  2304. onMeshRemoved(mesh: AbstractMesh): any;
  2305. onGeometryAdded(geometry: Geometry): any;
  2306. onGeometryUpdated(geometry: Geometry): any;
  2307. onGeometryDeleted(geometry: Geometry): any;
  2308. }
  2309. interface SerializedMesh {
  2310. id: string;
  2311. name: string;
  2312. uniqueId: number;
  2313. geometryId: string;
  2314. sphereCenter: Array<number>;
  2315. sphereRadius: number;
  2316. boxMinimum: Array<number>;
  2317. boxMaximum: Array<number>;
  2318. worldMatrixFromCache: any;
  2319. subMeshes: Array<SerializedSubMesh>;
  2320. checkCollisions: boolean;
  2321. }
  2322. interface SerializedSubMesh {
  2323. position: number;
  2324. verticesStart: number;
  2325. verticesCount: number;
  2326. indexStart: number;
  2327. indexCount: number;
  2328. hasMaterial: boolean;
  2329. sphereCenter: Array<number>;
  2330. sphereRadius: number;
  2331. boxMinimum: Array<number>;
  2332. boxMaximum: Array<number>;
  2333. }
  2334. interface SerializedGeometry {
  2335. id: string;
  2336. positions: Float32Array;
  2337. indices: Int32Array;
  2338. normals: Float32Array;
  2339. }
  2340. interface BabylonMessage {
  2341. taskType: WorkerTaskType;
  2342. payload: InitPayload | CollidePayload | UpdatePayload;
  2343. }
  2344. interface SerializedColliderToWorker {
  2345. position: Array<number>;
  2346. velocity: Array<number>;
  2347. radius: Array<number>;
  2348. }
  2349. enum WorkerTaskType {
  2350. INIT = 0,
  2351. UPDATE = 1,
  2352. COLLIDE = 2,
  2353. }
  2354. interface WorkerReply {
  2355. error: WorkerReplyType;
  2356. taskType: WorkerTaskType;
  2357. payload?: any;
  2358. }
  2359. interface CollisionReplyPayload {
  2360. newPosition: Array<number>;
  2361. collisionId: number;
  2362. collidedMeshUniqueId: number;
  2363. }
  2364. interface InitPayload {
  2365. }
  2366. interface CollidePayload {
  2367. collisionId: number;
  2368. collider: SerializedColliderToWorker;
  2369. maximumRetry: number;
  2370. excludedMeshUniqueId?: number;
  2371. }
  2372. interface UpdatePayload {
  2373. updatedMeshes: {
  2374. [n: number]: SerializedMesh;
  2375. };
  2376. updatedGeometries: {
  2377. [s: string]: SerializedGeometry;
  2378. };
  2379. removedMeshes: Array<number>;
  2380. removedGeometries: Array<string>;
  2381. }
  2382. enum WorkerReplyType {
  2383. SUCCESS = 0,
  2384. UNKNOWN_ERROR = 1,
  2385. }
  2386. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  2387. private _scene;
  2388. private _scaledPosition;
  2389. private _scaledVelocity;
  2390. private _collisionsCallbackArray;
  2391. private _init;
  2392. private _runningUpdated;
  2393. private _runningCollisionTask;
  2394. private _worker;
  2395. private _addUpdateMeshesList;
  2396. private _addUpdateGeometriesList;
  2397. private _toRemoveMeshesArray;
  2398. private _toRemoveGeometryArray;
  2399. constructor();
  2400. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  2401. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  2402. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2403. init(scene: Scene): void;
  2404. destroy(): void;
  2405. onMeshAdded(mesh: AbstractMesh): void;
  2406. onMeshUpdated: (mesh: AbstractMesh) => void;
  2407. onMeshRemoved(mesh: AbstractMesh): void;
  2408. onGeometryAdded(geometry: Geometry): void;
  2409. onGeometryUpdated: (geometry: Geometry) => void;
  2410. onGeometryDeleted(geometry: Geometry): void;
  2411. private _afterRender;
  2412. private _onMessageFromWorker;
  2413. }
  2414. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  2415. private _scene;
  2416. private _scaledPosition;
  2417. private _scaledVelocity;
  2418. private _finalPosition;
  2419. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  2420. init(scene: Scene): void;
  2421. destroy(): void;
  2422. onMeshAdded(mesh: AbstractMesh): void;
  2423. onMeshUpdated(mesh: AbstractMesh): void;
  2424. onMeshRemoved(mesh: AbstractMesh): void;
  2425. onGeometryAdded(geometry: Geometry): void;
  2426. onGeometryUpdated(geometry: Geometry): void;
  2427. onGeometryDeleted(geometry: Geometry): void;
  2428. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  2429. }
  2430. }
  2431. declare module BABYLON {
  2432. var WorkerIncluded: boolean;
  2433. class CollisionCache {
  2434. private _meshes;
  2435. private _geometries;
  2436. getMeshes(): {
  2437. [n: number]: SerializedMesh;
  2438. };
  2439. getGeometries(): {
  2440. [s: number]: SerializedGeometry;
  2441. };
  2442. getMesh(id: any): SerializedMesh;
  2443. addMesh(mesh: SerializedMesh): void;
  2444. removeMesh(uniqueId: number): void;
  2445. getGeometry(id: string): SerializedGeometry;
  2446. addGeometry(geometry: SerializedGeometry): void;
  2447. removeGeometry(id: string): void;
  2448. }
  2449. class CollideWorker {
  2450. collider: Collider;
  2451. private _collisionCache;
  2452. private finalPosition;
  2453. private collisionsScalingMatrix;
  2454. private collisionTranformationMatrix;
  2455. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  2456. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  2457. private checkCollision(mesh);
  2458. private processCollisionsForSubMeshes(transformMatrix, mesh);
  2459. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  2460. private checkSubmeshCollision(subMesh);
  2461. }
  2462. interface ICollisionDetector {
  2463. onInit(payload: InitPayload): void;
  2464. onUpdate(payload: UpdatePayload): void;
  2465. onCollision(payload: CollidePayload): void;
  2466. }
  2467. class CollisionDetectorTransferable implements ICollisionDetector {
  2468. private _collisionCache;
  2469. onInit(payload: InitPayload): void;
  2470. onUpdate(payload: UpdatePayload): void;
  2471. onCollision(payload: CollidePayload): void;
  2472. }
  2473. }
  2474. declare module BABYLON {
  2475. class IntersectionInfo {
  2476. bu: number;
  2477. bv: number;
  2478. distance: number;
  2479. faceId: number;
  2480. subMeshId: number;
  2481. constructor(bu: number, bv: number, distance: number);
  2482. }
  2483. class PickingInfo {
  2484. hit: boolean;
  2485. distance: number;
  2486. pickedPoint: Vector3;
  2487. pickedMesh: AbstractMesh;
  2488. bu: number;
  2489. bv: number;
  2490. faceId: number;
  2491. subMeshId: number;
  2492. pickedSprite: Sprite;
  2493. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  2494. getTextureCoordinates(): Vector2;
  2495. }
  2496. }
  2497. declare module BABYLON {
  2498. class BoundingBox {
  2499. minimum: Vector3;
  2500. maximum: Vector3;
  2501. vectors: Vector3[];
  2502. center: Vector3;
  2503. extendSize: Vector3;
  2504. directions: Vector3[];
  2505. vectorsWorld: Vector3[];
  2506. minimumWorld: Vector3;
  2507. maximumWorld: Vector3;
  2508. private _worldMatrix;
  2509. constructor(minimum: Vector3, maximum: Vector3);
  2510. getWorldMatrix(): Matrix;
  2511. setWorldMatrix(matrix: Matrix): BoundingBox;
  2512. _update(world: Matrix): void;
  2513. isInFrustum(frustumPlanes: Plane[]): boolean;
  2514. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2515. intersectsPoint(point: Vector3): boolean;
  2516. intersectsSphere(sphere: BoundingSphere): boolean;
  2517. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  2518. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  2519. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  2520. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2521. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2522. }
  2523. }
  2524. declare module BABYLON {
  2525. class BoundingInfo {
  2526. minimum: Vector3;
  2527. maximum: Vector3;
  2528. boundingBox: BoundingBox;
  2529. boundingSphere: BoundingSphere;
  2530. private _isLocked;
  2531. constructor(minimum: Vector3, maximum: Vector3);
  2532. isLocked: boolean;
  2533. update(world: Matrix): void;
  2534. isInFrustum(frustumPlanes: Plane[]): boolean;
  2535. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2536. _checkCollision(collider: Collider): boolean;
  2537. intersectsPoint(point: Vector3): boolean;
  2538. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  2539. }
  2540. }
  2541. declare module BABYLON {
  2542. class BoundingSphere {
  2543. minimum: Vector3;
  2544. maximum: Vector3;
  2545. center: Vector3;
  2546. radius: number;
  2547. centerWorld: Vector3;
  2548. radiusWorld: number;
  2549. private _tempRadiusVector;
  2550. constructor(minimum: Vector3, maximum: Vector3);
  2551. _update(world: Matrix): void;
  2552. isInFrustum(frustumPlanes: Plane[]): boolean;
  2553. intersectsPoint(point: Vector3): boolean;
  2554. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  2555. }
  2556. }
  2557. declare module BABYLON {
  2558. class Ray {
  2559. origin: Vector3;
  2560. direction: Vector3;
  2561. length: number;
  2562. private _edge1;
  2563. private _edge2;
  2564. private _pvec;
  2565. private _tvec;
  2566. private _qvec;
  2567. constructor(origin: Vector3, direction: Vector3, length?: number);
  2568. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  2569. intersectsBox(box: BoundingBox): boolean;
  2570. intersectsSphere(sphere: BoundingSphere): boolean;
  2571. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  2572. intersectsPlane(plane: Plane): number;
  2573. private static smallnum;
  2574. private static rayl;
  2575. /**
  2576. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  2577. * @param sega the first point of the segment to test the intersection against
  2578. * @param segb the second point of the segment to test the intersection against
  2579. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  2580. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  2581. */
  2582. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  2583. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  2584. /**
  2585. * 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
  2586. * transformed to the given world matrix.
  2587. * @param origin The origin point
  2588. * @param end The end point
  2589. * @param world a matrix to transform the ray to. Default is the identity matrix.
  2590. */
  2591. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  2592. static Transform(ray: Ray, matrix: Matrix): Ray;
  2593. }
  2594. }
  2595. declare module BABYLON {
  2596. class DebugLayer {
  2597. private _scene;
  2598. private _camera;
  2599. private _transformationMatrix;
  2600. private _enabled;
  2601. private _labelsEnabled;
  2602. private _displayStatistics;
  2603. private _displayTree;
  2604. private _displayLogs;
  2605. private _globalDiv;
  2606. private _statsDiv;
  2607. private _statsSubsetDiv;
  2608. private _optionsDiv;
  2609. private _optionsSubsetDiv;
  2610. private _logDiv;
  2611. private _logSubsetDiv;
  2612. private _treeDiv;
  2613. private _treeSubsetDiv;
  2614. private _drawingCanvas;
  2615. private _drawingContext;
  2616. private _rootElement;
  2617. private _skeletonViewers;
  2618. _syncPositions: () => void;
  2619. private _syncData;
  2620. private _syncUI;
  2621. private _onCanvasClick;
  2622. private _clickPosition;
  2623. private _ratio;
  2624. private _identityMatrix;
  2625. private _showUI;
  2626. private _needToRefreshMeshesTree;
  2627. shouldDisplayLabel: (node: Node) => boolean;
  2628. shouldDisplayAxis: (mesh: Mesh) => boolean;
  2629. axisRatio: number;
  2630. accentColor: string;
  2631. customStatsFunction: () => string;
  2632. constructor(scene: Scene);
  2633. private _refreshMeshesTreeContent();
  2634. private _renderSingleAxis(zero, unit, unitText, label, color);
  2635. private _renderAxis(projectedPosition, mesh, globalViewport);
  2636. private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle);
  2637. private _isClickInsideRect(x, y, width, height);
  2638. isVisible(): boolean;
  2639. hide(): void;
  2640. private _clearSkeletonViewers();
  2641. show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void;
  2642. private _clearLabels();
  2643. private _generateheader(root, text);
  2644. private _generateTexBox(root, title, color);
  2645. private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?);
  2646. private _generateCheckBox(root, title, initialState, task, tag?);
  2647. private _generateButton(root, title, task, tag?);
  2648. private _generateRadio(root, title, name, initialState, task, tag?);
  2649. private _generateDOMelements();
  2650. private _displayStats();
  2651. }
  2652. }
  2653. declare module BABYLON.Debug {
  2654. /**
  2655. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  2656. */
  2657. class SkeletonViewer {
  2658. skeleton: Skeleton;
  2659. mesh: AbstractMesh;
  2660. autoUpdateBonesMatrices: boolean;
  2661. renderingGroupId: number;
  2662. color: Color3;
  2663. private _scene;
  2664. private _debugLines;
  2665. private _debugMesh;
  2666. private _isEnabled;
  2667. private _renderFunction;
  2668. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  2669. isEnabled: boolean;
  2670. private _getBonePosition(position, bone, meshMat, x?, y?, z?);
  2671. private _getLinesForBonesWithLength(bones, meshMat);
  2672. private _getLinesForBonesNoLength(bones, meshMat);
  2673. update(): void;
  2674. private _updateBoneMatrix(bone);
  2675. dispose(): void;
  2676. }
  2677. }
  2678. declare module BABYLON {
  2679. class Layer {
  2680. name: string;
  2681. texture: Texture;
  2682. isBackground: boolean;
  2683. color: Color4;
  2684. scale: Vector2;
  2685. offset: Vector2;
  2686. onDispose: () => void;
  2687. onBeforeRender: () => void;
  2688. onAfterRender: () => void;
  2689. alphaBlendingMode: number;
  2690. alphaTest: boolean;
  2691. private _scene;
  2692. private _vertexDeclaration;
  2693. private _vertexStrideSize;
  2694. private _vertexBuffer;
  2695. private _indexBuffer;
  2696. private _effect;
  2697. private _alphaTestEffect;
  2698. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  2699. render(): void;
  2700. dispose(): void;
  2701. }
  2702. }
  2703. declare module BABYLON {
  2704. class LensFlare {
  2705. size: number;
  2706. position: number;
  2707. color: Color3;
  2708. texture: Texture;
  2709. private _system;
  2710. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  2711. dispose: () => void;
  2712. }
  2713. }
  2714. declare module BABYLON {
  2715. class LensFlareSystem {
  2716. name: string;
  2717. lensFlares: LensFlare[];
  2718. borderLimit: number;
  2719. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  2720. layerMask: number;
  2721. id: string;
  2722. private _scene;
  2723. private _emitter;
  2724. private _vertexDeclaration;
  2725. private _vertexStrideSize;
  2726. private _vertexBuffer;
  2727. private _indexBuffer;
  2728. private _effect;
  2729. private _positionX;
  2730. private _positionY;
  2731. private _isEnabled;
  2732. constructor(name: string, emitter: any, scene: Scene);
  2733. isEnabled: boolean;
  2734. getScene(): Scene;
  2735. getEmitter(): any;
  2736. setEmitter(newEmitter: any): void;
  2737. getEmitterPosition(): Vector3;
  2738. computeEffectivePosition(globalViewport: Viewport): boolean;
  2739. _isVisible(): boolean;
  2740. render(): boolean;
  2741. dispose(): void;
  2742. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  2743. serialize(): any;
  2744. }
  2745. }
  2746. declare module BABYLON {
  2747. class DirectionalLight extends Light implements IShadowLight {
  2748. position: Vector3;
  2749. direction: Vector3;
  2750. private _transformedDirection;
  2751. transformedPosition: Vector3;
  2752. private _worldMatrix;
  2753. shadowOrthoScale: number;
  2754. autoUpdateExtends: boolean;
  2755. private _orthoLeft;
  2756. private _orthoRight;
  2757. private _orthoTop;
  2758. private _orthoBottom;
  2759. constructor(name: string, direction: Vector3, scene: Scene);
  2760. getAbsolutePosition(): Vector3;
  2761. setDirectionToTarget(target: Vector3): Vector3;
  2762. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2763. supportsVSM(): boolean;
  2764. needRefreshPerFrame(): boolean;
  2765. needCube(): boolean;
  2766. getShadowDirection(faceIndex?: number): Vector3;
  2767. computeTransformedPosition(): boolean;
  2768. transferToEffect(effect: Effect, directionUniformName: string): void;
  2769. _getWorldMatrix(): Matrix;
  2770. getTypeID(): number;
  2771. }
  2772. }
  2773. declare module BABYLON {
  2774. class HemisphericLight extends Light {
  2775. groundColor: Color3;
  2776. direction: Vector3;
  2777. private _worldMatrix;
  2778. constructor(name: string, direction: Vector3, scene: Scene);
  2779. setDirectionToTarget(target: Vector3): Vector3;
  2780. getShadowGenerator(): ShadowGenerator;
  2781. transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  2782. _getWorldMatrix(): Matrix;
  2783. getTypeID(): number;
  2784. }
  2785. }
  2786. declare module BABYLON {
  2787. interface IShadowLight {
  2788. id: string;
  2789. position: Vector3;
  2790. transformedPosition: Vector3;
  2791. name: string;
  2792. computeTransformedPosition(): boolean;
  2793. getScene(): Scene;
  2794. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2795. supportsVSM(): boolean;
  2796. needRefreshPerFrame(): boolean;
  2797. needCube(): boolean;
  2798. getShadowDirection(faceIndex?: number): Vector3;
  2799. _shadowGenerator: ShadowGenerator;
  2800. }
  2801. class Light extends Node {
  2802. diffuse: Color3;
  2803. specular: Color3;
  2804. intensity: number;
  2805. range: number;
  2806. includeOnlyWithLayerMask: number;
  2807. includedOnlyMeshes: AbstractMesh[];
  2808. excludedMeshes: AbstractMesh[];
  2809. excludeWithLayerMask: number;
  2810. radius: number;
  2811. _shadowGenerator: ShadowGenerator;
  2812. private _parentedWorldMatrix;
  2813. _excludedMeshesIds: string[];
  2814. _includedOnlyMeshesIds: string[];
  2815. constructor(name: string, scene: Scene);
  2816. /**
  2817. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2818. */
  2819. toString(fullDetails?: boolean): string;
  2820. getShadowGenerator(): ShadowGenerator;
  2821. getAbsolutePosition(): Vector3;
  2822. transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  2823. _getWorldMatrix(): Matrix;
  2824. canAffectMesh(mesh: AbstractMesh): boolean;
  2825. getWorldMatrix(): Matrix;
  2826. dispose(): void;
  2827. getTypeID(): number;
  2828. clone(name: string): Light;
  2829. serialize(): any;
  2830. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  2831. static Parse(parsedLight: any, scene: Scene): Light;
  2832. }
  2833. }
  2834. declare module BABYLON {
  2835. class PointLight extends Light implements IShadowLight {
  2836. private _worldMatrix;
  2837. transformedPosition: Vector3;
  2838. position: Vector3;
  2839. constructor(name: string, position: Vector3, scene: Scene);
  2840. getAbsolutePosition(): Vector3;
  2841. computeTransformedPosition(): boolean;
  2842. transferToEffect(effect: Effect, positionUniformName: string): void;
  2843. needCube(): boolean;
  2844. supportsVSM(): boolean;
  2845. needRefreshPerFrame(): boolean;
  2846. getShadowDirection(faceIndex?: number): Vector3;
  2847. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2848. _getWorldMatrix(): Matrix;
  2849. getTypeID(): number;
  2850. }
  2851. }
  2852. declare module BABYLON {
  2853. class SpotLight extends Light implements IShadowLight {
  2854. position: Vector3;
  2855. direction: Vector3;
  2856. angle: number;
  2857. exponent: number;
  2858. transformedPosition: Vector3;
  2859. private _transformedDirection;
  2860. private _worldMatrix;
  2861. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  2862. getAbsolutePosition(): Vector3;
  2863. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  2864. needCube(): boolean;
  2865. supportsVSM(): boolean;
  2866. needRefreshPerFrame(): boolean;
  2867. getShadowDirection(faceIndex?: number): Vector3;
  2868. setDirectionToTarget(target: Vector3): Vector3;
  2869. computeTransformedPosition(): boolean;
  2870. transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  2871. _getWorldMatrix(): Matrix;
  2872. getTypeID(): number;
  2873. }
  2874. }
  2875. declare module BABYLON {
  2876. interface ISceneLoaderPlugin {
  2877. extensions: string;
  2878. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  2879. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  2880. }
  2881. interface ISceneLoaderPluginAsync {
  2882. extensions: string;
  2883. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror?: () => void) => void;
  2884. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => boolean;
  2885. }
  2886. class SceneLoader {
  2887. private static _ForceFullSceneLoadingForIncremental;
  2888. private static _ShowLoadingScreen;
  2889. static NO_LOGGING: number;
  2890. static MINIMAL_LOGGING: number;
  2891. static SUMMARY_LOGGING: number;
  2892. static DETAILED_LOGGING: number;
  2893. private static _loggingLevel;
  2894. static ForceFullSceneLoadingForIncremental: boolean;
  2895. static ShowLoadingScreen: boolean;
  2896. static loggingLevel: number;
  2897. private static _registeredPlugins;
  2898. private static _getPluginForFilename(sceneFilename);
  2899. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  2900. static RegisterPlugin(plugin: ISceneLoaderPlugin): void;
  2901. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void;
  2902. /**
  2903. * Load a scene
  2904. * @param rootUrl a string that defines the root url for scene and resources
  2905. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  2906. * @param engine is the instance of BABYLON.Engine to use to create the scene
  2907. */
  2908. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  2909. /**
  2910. * Append a scene
  2911. * @param rootUrl a string that defines the root url for scene and resources
  2912. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  2913. * @param scene is the instance of BABYLON.Scene to append to
  2914. */
  2915. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  2916. }
  2917. }
  2918. declare module BABYLON {
  2919. class EffectFallbacks {
  2920. private _defines;
  2921. private _currentRank;
  2922. private _maxRank;
  2923. private _mesh;
  2924. private _meshRank;
  2925. addFallback(rank: number, define: string): void;
  2926. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  2927. isMoreFallbacks: boolean;
  2928. reduce(currentDefines: string): string;
  2929. }
  2930. class Effect {
  2931. name: any;
  2932. defines: string;
  2933. onCompiled: (effect: Effect) => void;
  2934. onError: (effect: Effect, errors: string) => void;
  2935. onBind: (effect: Effect) => void;
  2936. private _engine;
  2937. private _uniformsNames;
  2938. private _samplers;
  2939. private _isReady;
  2940. private _compilationError;
  2941. private _attributesNames;
  2942. private _attributes;
  2943. private _uniforms;
  2944. _key: string;
  2945. private _indexParameters;
  2946. private _program;
  2947. private _valueCache;
  2948. 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, indexParameters?: any);
  2949. isReady(): boolean;
  2950. getProgram(): WebGLProgram;
  2951. getAttributesNames(): string[];
  2952. getAttributeLocation(index: number): number;
  2953. getAttributeLocationByName(name: string): number;
  2954. getAttributesCount(): number;
  2955. getUniformIndex(uniformName: string): number;
  2956. getUniform(uniformName: string): WebGLUniformLocation;
  2957. getSamplers(): string[];
  2958. getCompilationError(): string;
  2959. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  2960. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  2961. private _dumpShadersName();
  2962. private _processIncludes(sourceCode, callback);
  2963. private _processPrecision(source);
  2964. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  2965. isSupported: boolean;
  2966. _bindTexture(channel: string, texture: WebGLTexture): void;
  2967. setTexture(channel: string, texture: BaseTexture): void;
  2968. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  2969. _cacheMatrix(uniformName: any, matrix: any): void;
  2970. _cacheFloat2(uniformName: string, x: number, y: number): void;
  2971. _cacheFloat3(uniformName: string, x: number, y: number, z: number): void;
  2972. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void;
  2973. setArray(uniformName: string, array: number[]): Effect;
  2974. setArray2(uniformName: string, array: number[]): Effect;
  2975. setArray3(uniformName: string, array: number[]): Effect;
  2976. setArray4(uniformName: string, array: number[]): Effect;
  2977. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  2978. setMatrix(uniformName: string, matrix: Matrix): Effect;
  2979. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  2980. setMatrix2x2(uniformname: string, matrix: Float32Array): Effect;
  2981. setFloat(uniformName: string, value: number): Effect;
  2982. setBool(uniformName: string, bool: boolean): Effect;
  2983. setVector2(uniformName: string, vector2: Vector2): Effect;
  2984. setFloat2(uniformName: string, x: number, y: number): Effect;
  2985. setVector3(uniformName: string, vector3: Vector3): Effect;
  2986. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  2987. setVector4(uniformName: string, vector4: Vector4): Effect;
  2988. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  2989. setColor3(uniformName: string, color3: Color3): Effect;
  2990. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  2991. static ShadersStore: {};
  2992. static IncludesShadersStore: {};
  2993. }
  2994. }
  2995. declare module BABYLON {
  2996. class FresnelParameters {
  2997. isEnabled: boolean;
  2998. leftColor: Color3;
  2999. rightColor: Color3;
  3000. bias: number;
  3001. power: number;
  3002. clone(): FresnelParameters;
  3003. serialize(): any;
  3004. static Parse(parsedFresnelParameters: any): FresnelParameters;
  3005. }
  3006. }
  3007. declare module BABYLON {
  3008. class MaterialDefines {
  3009. _keys: string[];
  3010. rebuild(): void;
  3011. isEqual(other: MaterialDefines): boolean;
  3012. cloneTo(other: MaterialDefines): void;
  3013. reset(): void;
  3014. toString(): string;
  3015. }
  3016. class Material {
  3017. name: string;
  3018. private static _TriangleFillMode;
  3019. private static _WireFrameFillMode;
  3020. private static _PointFillMode;
  3021. static TriangleFillMode: number;
  3022. static WireFrameFillMode: number;
  3023. static PointFillMode: number;
  3024. private static _ClockWiseSideOrientation;
  3025. private static _CounterClockWiseSideOrientation;
  3026. static ClockWiseSideOrientation: number;
  3027. static CounterClockWiseSideOrientation: number;
  3028. id: string;
  3029. checkReadyOnEveryCall: boolean;
  3030. checkReadyOnlyOnce: boolean;
  3031. state: string;
  3032. alpha: number;
  3033. backFaceCulling: boolean;
  3034. sideOrientation: number;
  3035. onCompiled: (effect: Effect) => void;
  3036. onError: (effect: Effect, errors: string) => void;
  3037. onDispose: () => void;
  3038. onBind: (material: Material, mesh: Mesh) => void;
  3039. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  3040. alphaMode: number;
  3041. disableDepthWrite: boolean;
  3042. fogEnabled: boolean;
  3043. pointSize: number;
  3044. zOffset: number;
  3045. wireframe: boolean;
  3046. pointsCloud: boolean;
  3047. fillMode: number;
  3048. _effect: Effect;
  3049. _wasPreviouslyReady: boolean;
  3050. private _scene;
  3051. private _fillMode;
  3052. private _cachedDepthWriteState;
  3053. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  3054. /**
  3055. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3056. * subclasses should override adding information pertainent to themselves
  3057. */
  3058. toString(fullDetails?: boolean): string;
  3059. isFrozen: boolean;
  3060. freeze(): void;
  3061. unfreeze(): void;
  3062. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3063. getEffect(): Effect;
  3064. getScene(): Scene;
  3065. needAlphaBlending(): boolean;
  3066. needAlphaTesting(): boolean;
  3067. getAlphaTestTexture(): BaseTexture;
  3068. trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void;
  3069. markDirty(): void;
  3070. _preBind(): void;
  3071. bind(world: Matrix, mesh?: Mesh): void;
  3072. bindOnlyWorldMatrix(world: Matrix): void;
  3073. unbind(): void;
  3074. clone(name: string): Material;
  3075. getBindedMeshes(): AbstractMesh[];
  3076. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3077. serialize(): any;
  3078. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  3079. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  3080. }
  3081. }
  3082. declare module BABYLON {
  3083. class MaterialHelper {
  3084. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, maxSimultaneousLights?: number): boolean;
  3085. static PrepareUniformsListForList(uniformsList: string[], defines: MaterialDefines, maxSimultaneousLights?: number): void;
  3086. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  3087. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  3088. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  3089. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: number, effect: Effect, depthValuesAlreadySet: boolean): boolean;
  3090. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  3091. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  3092. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  3093. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  3094. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  3095. static BindClipPlane(effect: Effect, scene: Scene): void;
  3096. }
  3097. }
  3098. declare module BABYLON {
  3099. class MultiMaterial extends Material {
  3100. subMaterials: Material[];
  3101. constructor(name: string, scene: Scene);
  3102. getSubMaterial(index: any): Material;
  3103. isReady(mesh?: AbstractMesh): boolean;
  3104. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  3105. serialize(): any;
  3106. }
  3107. }
  3108. declare module BABYLON {
  3109. /**
  3110. * The Physically based material of BJS.
  3111. *
  3112. * This offers the main features of a standard PBR material.
  3113. * For more information, please refer to the documentation :
  3114. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  3115. */
  3116. class PBRMaterial extends BABYLON.Material {
  3117. /**
  3118. * Intensity of the direct lights e.g. the four lights available in your scene.
  3119. * This impacts both the direct diffuse and specular highlights.
  3120. */
  3121. directIntensity: number;
  3122. /**
  3123. * Intensity of the emissive part of the material.
  3124. * This helps controlling the emissive effect without modifying the emissive color.
  3125. */
  3126. emissiveIntensity: number;
  3127. /**
  3128. * Intensity of the environment e.g. how much the environment will light the object
  3129. * either through harmonics for rough material or through the refelction for shiny ones.
  3130. */
  3131. environmentIntensity: number;
  3132. /**
  3133. * This is a special control allowing the reduction of the specular highlights coming from the
  3134. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  3135. */
  3136. specularIntensity: number;
  3137. private _lightingInfos;
  3138. /**
  3139. * Debug Control allowing disabling the bump map on this material.
  3140. */
  3141. disableBumpMap: boolean;
  3142. /**
  3143. * Debug Control helping enforcing or dropping the darkness of shadows.
  3144. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  3145. */
  3146. overloadedShadowIntensity: number;
  3147. /**
  3148. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  3149. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  3150. */
  3151. overloadedShadeIntensity: number;
  3152. private _overloadedShadowInfos;
  3153. /**
  3154. * The camera exposure used on this material.
  3155. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  3156. * This corresponds to a photographic exposure.
  3157. */
  3158. cameraExposure: number;
  3159. /**
  3160. * The camera contrast used on this material.
  3161. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  3162. */
  3163. cameraContrast: number;
  3164. private _cameraInfos;
  3165. private _microsurfaceTextureLods;
  3166. /**
  3167. * Debug Control allowing to overload the ambient color.
  3168. * This as to be use with the overloadedAmbientIntensity parameter.
  3169. */
  3170. overloadedAmbient: Color3;
  3171. /**
  3172. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  3173. */
  3174. overloadedAmbientIntensity: number;
  3175. /**
  3176. * Debug Control allowing to overload the albedo color.
  3177. * This as to be use with the overloadedAlbedoIntensity parameter.
  3178. */
  3179. overloadedAlbedo: Color3;
  3180. /**
  3181. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  3182. */
  3183. overloadedAlbedoIntensity: number;
  3184. /**
  3185. * Debug Control allowing to overload the reflectivity color.
  3186. * This as to be use with the overloadedReflectivityIntensity parameter.
  3187. */
  3188. overloadedReflectivity: Color3;
  3189. /**
  3190. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  3191. */
  3192. overloadedReflectivityIntensity: number;
  3193. /**
  3194. * Debug Control allowing to overload the emissive color.
  3195. * This as to be use with the overloadedEmissiveIntensity parameter.
  3196. */
  3197. overloadedEmissive: Color3;
  3198. /**
  3199. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  3200. */
  3201. overloadedEmissiveIntensity: number;
  3202. private _overloadedIntensity;
  3203. /**
  3204. * Debug Control allowing to overload the reflection color.
  3205. * This as to be use with the overloadedReflectionIntensity parameter.
  3206. */
  3207. overloadedReflection: Color3;
  3208. /**
  3209. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  3210. */
  3211. overloadedReflectionIntensity: number;
  3212. /**
  3213. * Debug Control allowing to overload the microsurface.
  3214. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  3215. */
  3216. overloadedMicroSurface: number;
  3217. /**
  3218. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  3219. */
  3220. overloadedMicroSurfaceIntensity: number;
  3221. private _overloadedMicroSurface;
  3222. /**
  3223. * AKA Diffuse Texture in standard nomenclature.
  3224. */
  3225. albedoTexture: BaseTexture;
  3226. /**
  3227. * AKA Occlusion Texture in other nomenclature.
  3228. */
  3229. ambientTexture: BaseTexture;
  3230. opacityTexture: BaseTexture;
  3231. reflectionTexture: BaseTexture;
  3232. emissiveTexture: BaseTexture;
  3233. /**
  3234. * AKA Specular texture in other nomenclature.
  3235. */
  3236. reflectivityTexture: BaseTexture;
  3237. bumpTexture: BaseTexture;
  3238. lightmapTexture: BaseTexture;
  3239. refractionTexture: BaseTexture;
  3240. ambientColor: Color3;
  3241. /**
  3242. * AKA Diffuse Color in other nomenclature.
  3243. */
  3244. albedoColor: Color3;
  3245. /**
  3246. * AKA Specular Color in other nomenclature.
  3247. */
  3248. reflectivityColor: Color3;
  3249. reflectionColor: Color3;
  3250. emissiveColor: Color3;
  3251. /**
  3252. * AKA Glossiness in other nomenclature.
  3253. */
  3254. microSurface: number;
  3255. /**
  3256. * source material index of refraction (IOR)' / 'destination material IOR.
  3257. */
  3258. indexOfRefraction: number;
  3259. /**
  3260. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  3261. */
  3262. invertRefractionY: boolean;
  3263. opacityFresnelParameters: FresnelParameters;
  3264. emissiveFresnelParameters: FresnelParameters;
  3265. /**
  3266. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  3267. * Materials half opaque for instance using refraction could benefit from this control.
  3268. */
  3269. linkRefractionWithTransparency: boolean;
  3270. /**
  3271. * The emissive and albedo are linked to never be more than one (Energy conservation).
  3272. */
  3273. linkEmissiveWithAlbedo: boolean;
  3274. useLightmapAsShadowmap: boolean;
  3275. /**
  3276. * In this mode, the emissive informtaion will always be added to the lighting once.
  3277. * A light for instance can be thought as emissive.
  3278. */
  3279. useEmissiveAsIllumination: boolean;
  3280. /**
  3281. * Secifies that the alpha is coming form the albedo channel alpha channel.
  3282. */
  3283. useAlphaFromAlbedoTexture: boolean;
  3284. /**
  3285. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  3286. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  3287. */
  3288. useSpecularOverAlpha: boolean;
  3289. /**
  3290. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  3291. */
  3292. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  3293. /**
  3294. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  3295. * The material will try to infer what glossiness each pixel should be.
  3296. */
  3297. useAutoMicroSurfaceFromReflectivityMap: boolean;
  3298. /**
  3299. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  3300. * the creation of the material.
  3301. */
  3302. useScalarInLinearSpace: boolean;
  3303. /**
  3304. * BJS is using an harcoded light falloff based on a manually sets up range.
  3305. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  3306. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  3307. */
  3308. usePhysicalLightFalloff: boolean;
  3309. /**
  3310. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  3311. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  3312. */
  3313. useRadianceOverAlpha: boolean;
  3314. /**
  3315. * Allows using the bump map in parallax mode.
  3316. */
  3317. useParallax: boolean;
  3318. /**
  3319. * Allows using the bump map in parallax occlusion mode.
  3320. */
  3321. useParallaxOcclusion: boolean;
  3322. /**
  3323. * Controls the scale bias of the parallax mode.
  3324. */
  3325. parallaxScaleBias: number;
  3326. disableLighting: boolean;
  3327. private _renderTargets;
  3328. private _worldViewProjectionMatrix;
  3329. private _globalAmbientColor;
  3330. private _tempColor;
  3331. private _renderId;
  3332. private _defines;
  3333. private _cachedDefines;
  3334. private _useLogarithmicDepth;
  3335. /**
  3336. * Instantiates a new PBRMaterial instance.
  3337. *
  3338. * @param name The material name
  3339. * @param scene The scene the material will be use in.
  3340. */
  3341. constructor(name: string, scene: Scene);
  3342. useLogarithmicDepth: boolean;
  3343. needAlphaBlending(): boolean;
  3344. needAlphaTesting(): boolean;
  3345. private _shouldUseAlphaFromAlbedoTexture();
  3346. getAlphaTestTexture(): BaseTexture;
  3347. private _checkCache(scene, mesh?, useInstances?);
  3348. private convertColorToLinearSpaceToRef(color, ref);
  3349. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  3350. private static _scaledAlbedo;
  3351. private static _scaledReflectivity;
  3352. private static _scaledEmissive;
  3353. private static _scaledReflection;
  3354. private static _lightRadiuses;
  3355. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean): void;
  3356. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3357. unbind(): void;
  3358. bindOnlyWorldMatrix(world: Matrix): void;
  3359. private _myScene;
  3360. private _myShadowGenerator;
  3361. bind(world: Matrix, mesh?: Mesh): void;
  3362. getAnimatables(): IAnimatable[];
  3363. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3364. clone(name: string): PBRMaterial;
  3365. serialize(): any;
  3366. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  3367. }
  3368. }
  3369. declare module BABYLON {
  3370. class ShaderMaterial extends Material {
  3371. private _shaderPath;
  3372. private _options;
  3373. private _textures;
  3374. private _floats;
  3375. private _floatsArrays;
  3376. private _colors3;
  3377. private _colors4;
  3378. private _vectors2;
  3379. private _vectors3;
  3380. private _vectors4;
  3381. private _matrices;
  3382. private _matrices3x3;
  3383. private _matrices2x2;
  3384. private _cachedWorldViewMatrix;
  3385. private _renderId;
  3386. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  3387. needAlphaBlending(): boolean;
  3388. needAlphaTesting(): boolean;
  3389. private _checkUniform(uniformName);
  3390. setTexture(name: string, texture: Texture): ShaderMaterial;
  3391. setFloat(name: string, value: number): ShaderMaterial;
  3392. setFloats(name: string, value: number[]): ShaderMaterial;
  3393. setColor3(name: string, value: Color3): ShaderMaterial;
  3394. setColor4(name: string, value: Color4): ShaderMaterial;
  3395. setVector2(name: string, value: Vector2): ShaderMaterial;
  3396. setVector3(name: string, value: Vector3): ShaderMaterial;
  3397. setVector4(name: string, value: Vector4): ShaderMaterial;
  3398. setMatrix(name: string, value: Matrix): ShaderMaterial;
  3399. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  3400. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  3401. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3402. bindOnlyWorldMatrix(world: Matrix): void;
  3403. bind(world: Matrix, mesh?: Mesh): void;
  3404. clone(name: string): ShaderMaterial;
  3405. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3406. serialize(): any;
  3407. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  3408. }
  3409. }
  3410. declare module BABYLON {
  3411. class StandardMaterial extends Material {
  3412. diffuseTexture: BaseTexture;
  3413. ambientTexture: BaseTexture;
  3414. opacityTexture: BaseTexture;
  3415. reflectionTexture: BaseTexture;
  3416. emissiveTexture: BaseTexture;
  3417. specularTexture: BaseTexture;
  3418. bumpTexture: BaseTexture;
  3419. lightmapTexture: BaseTexture;
  3420. refractionTexture: BaseTexture;
  3421. ambientColor: Color3;
  3422. diffuseColor: Color3;
  3423. specularColor: Color3;
  3424. emissiveColor: Color3;
  3425. specularPower: number;
  3426. useAlphaFromDiffuseTexture: boolean;
  3427. useEmissiveAsIllumination: boolean;
  3428. linkEmissiveWithDiffuse: boolean;
  3429. useReflectionFresnelFromSpecular: boolean;
  3430. useSpecularOverAlpha: boolean;
  3431. useReflectionOverAlpha: boolean;
  3432. disableLighting: boolean;
  3433. useParallax: boolean;
  3434. useParallaxOcclusion: boolean;
  3435. parallaxScaleBias: number;
  3436. roughness: number;
  3437. indexOfRefraction: number;
  3438. invertRefractionY: boolean;
  3439. useLightmapAsShadowmap: boolean;
  3440. diffuseFresnelParameters: FresnelParameters;
  3441. opacityFresnelParameters: FresnelParameters;
  3442. reflectionFresnelParameters: FresnelParameters;
  3443. refractionFresnelParameters: FresnelParameters;
  3444. emissiveFresnelParameters: FresnelParameters;
  3445. useGlossinessFromSpecularMapAlpha: boolean;
  3446. maxSimultaneousLights: number;
  3447. private _renderTargets;
  3448. private _worldViewProjectionMatrix;
  3449. private _globalAmbientColor;
  3450. private _renderId;
  3451. private _defines;
  3452. private _cachedDefines;
  3453. private _useLogarithmicDepth;
  3454. constructor(name: string, scene: Scene);
  3455. useLogarithmicDepth: boolean;
  3456. needAlphaBlending(): boolean;
  3457. needAlphaTesting(): boolean;
  3458. private _shouldUseAlphaFromDiffuseTexture();
  3459. getAlphaTestTexture(): BaseTexture;
  3460. private _checkCache(scene, mesh?, useInstances?);
  3461. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  3462. unbind(): void;
  3463. bindOnlyWorldMatrix(world: Matrix): void;
  3464. bind(world: Matrix, mesh?: Mesh): void;
  3465. getAnimatables(): IAnimatable[];
  3466. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  3467. clone(name: string): StandardMaterial;
  3468. serialize(): any;
  3469. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  3470. static DiffuseTextureEnabled: boolean;
  3471. static AmbientTextureEnabled: boolean;
  3472. static OpacityTextureEnabled: boolean;
  3473. static ReflectionTextureEnabled: boolean;
  3474. static EmissiveTextureEnabled: boolean;
  3475. static SpecularTextureEnabled: boolean;
  3476. static BumpTextureEnabled: boolean;
  3477. static FresnelEnabled: boolean;
  3478. static LightmapTextureEnabled: boolean;
  3479. static RefractionTextureEnabled: boolean;
  3480. }
  3481. }
  3482. declare module BABYLON {
  3483. class SIMDVector3 {
  3484. static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void;
  3485. static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  3486. }
  3487. class SIMDMatrix {
  3488. multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void;
  3489. invertToRefSIMD(other: Matrix): Matrix;
  3490. static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void;
  3491. }
  3492. class SIMDHelper {
  3493. private static _isEnabled;
  3494. static IsEnabled: boolean;
  3495. static DisableSIMD(): void;
  3496. static EnableSIMD(): void;
  3497. }
  3498. }
  3499. declare module BABYLON {
  3500. const ToGammaSpace: number;
  3501. const ToLinearSpace: number;
  3502. const Epsilon: number;
  3503. class MathTools {
  3504. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  3505. static ToHex(i: number): string;
  3506. static Sign(value: number): number;
  3507. static Clamp(value: number, min?: number, max?: number): number;
  3508. }
  3509. class Color3 {
  3510. r: number;
  3511. g: number;
  3512. b: number;
  3513. constructor(r?: number, g?: number, b?: number);
  3514. toString(): string;
  3515. toArray(array: number[], index?: number): Color3;
  3516. toColor4(alpha?: number): Color4;
  3517. asArray(): number[];
  3518. toLuminance(): number;
  3519. multiply(otherColor: Color3): Color3;
  3520. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  3521. equals(otherColor: Color3): boolean;
  3522. equalsFloats(r: number, g: number, b: number): boolean;
  3523. scale(scale: number): Color3;
  3524. scaleToRef(scale: number, result: Color3): Color3;
  3525. add(otherColor: Color3): Color3;
  3526. addToRef(otherColor: Color3, result: Color3): Color3;
  3527. subtract(otherColor: Color3): Color3;
  3528. subtractToRef(otherColor: Color3, result: Color3): Color3;
  3529. clone(): Color3;
  3530. copyFrom(source: Color3): Color3;
  3531. copyFromFloats(r: number, g: number, b: number): Color3;
  3532. toHexString(): string;
  3533. toLinearSpace(): Color3;
  3534. toLinearSpaceToRef(convertedColor: Color3): Color3;
  3535. toGammaSpace(): Color3;
  3536. toGammaSpaceToRef(convertedColor: Color3): Color3;
  3537. static FromHexString(hex: string): Color3;
  3538. static FromArray(array: number[], offset?: number): Color3;
  3539. static FromInts(r: number, g: number, b: number): Color3;
  3540. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  3541. static Red(): Color3;
  3542. static Green(): Color3;
  3543. static Blue(): Color3;
  3544. static Black(): Color3;
  3545. static White(): Color3;
  3546. static Purple(): Color3;
  3547. static Magenta(): Color3;
  3548. static Yellow(): Color3;
  3549. static Gray(): Color3;
  3550. }
  3551. class Color4 {
  3552. r: number;
  3553. g: number;
  3554. b: number;
  3555. a: number;
  3556. constructor(r: number, g: number, b: number, a: number);
  3557. addInPlace(right: any): Color4;
  3558. asArray(): number[];
  3559. toArray(array: number[], index?: number): Color4;
  3560. add(right: Color4): Color4;
  3561. subtract(right: Color4): Color4;
  3562. subtractToRef(right: Color4, result: Color4): Color4;
  3563. scale(scale: number): Color4;
  3564. scaleToRef(scale: number, result: Color4): Color4;
  3565. toString(): string;
  3566. clone(): Color4;
  3567. copyFrom(source: Color4): Color4;
  3568. toHexString(): string;
  3569. static FromHexString(hex: string): Color4;
  3570. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  3571. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  3572. static FromArray(array: number[], offset?: number): Color4;
  3573. static FromInts(r: number, g: number, b: number, a: number): Color4;
  3574. static CheckColors4(colors: number[], count: number): number[];
  3575. }
  3576. class Vector2 {
  3577. x: number;
  3578. y: number;
  3579. constructor(x: number, y: number);
  3580. toString(): string;
  3581. toArray(array: number[], index?: number): Vector2;
  3582. asArray(): number[];
  3583. copyFrom(source: Vector2): Vector2;
  3584. copyFromFloats(x: number, y: number): Vector2;
  3585. add(otherVector: Vector2): Vector2;
  3586. addVector3(otherVector: Vector3): Vector2;
  3587. subtract(otherVector: Vector2): Vector2;
  3588. subtractInPlace(otherVector: Vector2): Vector2;
  3589. multiplyInPlace(otherVector: Vector2): Vector2;
  3590. multiply(otherVector: Vector2): Vector2;
  3591. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  3592. multiplyByFloats(x: number, y: number): Vector2;
  3593. divide(otherVector: Vector2): Vector2;
  3594. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  3595. negate(): Vector2;
  3596. scaleInPlace(scale: number): Vector2;
  3597. scale(scale: number): Vector2;
  3598. equals(otherVector: Vector2): boolean;
  3599. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  3600. length(): number;
  3601. lengthSquared(): number;
  3602. normalize(): Vector2;
  3603. clone(): Vector2;
  3604. static Zero(): Vector2;
  3605. static FromArray(array: number[] | Float32Array, offset?: number): Vector2;
  3606. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void;
  3607. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  3608. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  3609. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  3610. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  3611. static Dot(left: Vector2, right: Vector2): number;
  3612. static Normalize(vector: Vector2): Vector2;
  3613. static Minimize(left: Vector2, right: Vector2): Vector2;
  3614. static Maximize(left: Vector2, right: Vector2): Vector2;
  3615. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  3616. static Distance(value1: Vector2, value2: Vector2): number;
  3617. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  3618. }
  3619. class Vector3 {
  3620. x: number;
  3621. y: number;
  3622. z: number;
  3623. constructor(x: number, y: number, z: number);
  3624. toString(): string;
  3625. asArray(): number[];
  3626. toArray(array: number[] | Float32Array, index?: number): Vector3;
  3627. toQuaternion(): Quaternion;
  3628. addInPlace(otherVector: Vector3): Vector3;
  3629. add(otherVector: Vector3): Vector3;
  3630. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  3631. subtractInPlace(otherVector: Vector3): Vector3;
  3632. subtract(otherVector: Vector3): Vector3;
  3633. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  3634. subtractFromFloats(x: number, y: number, z: number): Vector3;
  3635. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  3636. negate(): Vector3;
  3637. scaleInPlace(scale: number): Vector3;
  3638. scale(scale: number): Vector3;
  3639. scaleToRef(scale: number, result: Vector3): void;
  3640. equals(otherVector: Vector3): boolean;
  3641. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  3642. equalsToFloats(x: number, y: number, z: number): boolean;
  3643. multiplyInPlace(otherVector: Vector3): Vector3;
  3644. multiply(otherVector: Vector3): Vector3;
  3645. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  3646. multiplyByFloats(x: number, y: number, z: number): Vector3;
  3647. divide(otherVector: Vector3): Vector3;
  3648. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  3649. MinimizeInPlace(other: Vector3): Vector3;
  3650. MaximizeInPlace(other: Vector3): Vector3;
  3651. length(): number;
  3652. lengthSquared(): number;
  3653. normalize(): Vector3;
  3654. clone(): Vector3;
  3655. copyFrom(source: Vector3): Vector3;
  3656. copyFromFloats(x: number, y: number, z: number): Vector3;
  3657. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  3658. static FromArray(array: number[] | Float32Array, offset?: number): Vector3;
  3659. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  3660. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void;
  3661. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  3662. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  3663. static Zero(): Vector3;
  3664. static Up(): Vector3;
  3665. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  3666. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  3667. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  3668. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  3669. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  3670. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  3671. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  3672. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  3673. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  3674. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  3675. static Dot(left: Vector3, right: Vector3): number;
  3676. static Cross(left: Vector3, right: Vector3): Vector3;
  3677. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  3678. static Normalize(vector: Vector3): Vector3;
  3679. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  3680. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  3681. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  3682. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  3683. static Minimize(left: Vector3, right: Vector3): Vector3;
  3684. static Maximize(left: Vector3, right: Vector3): Vector3;
  3685. static Distance(value1: Vector3, value2: Vector3): number;
  3686. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  3687. static Center(value1: Vector3, value2: Vector3): Vector3;
  3688. /**
  3689. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  3690. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  3691. * to something in order to rotate it from its local system to the given target system.
  3692. */
  3693. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  3694. /**
  3695. * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
  3696. */
  3697. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  3698. }
  3699. class Vector4 {
  3700. x: number;
  3701. y: number;
  3702. z: number;
  3703. w: number;
  3704. constructor(x: number, y: number, z: number, w: number);
  3705. toString(): string;
  3706. asArray(): number[];
  3707. toArray(array: number[], index?: number): Vector4;
  3708. addInPlace(otherVector: Vector4): Vector4;
  3709. add(otherVector: Vector4): Vector4;
  3710. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  3711. subtractInPlace(otherVector: Vector4): Vector4;
  3712. subtract(otherVector: Vector4): Vector4;
  3713. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  3714. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  3715. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  3716. negate(): Vector4;
  3717. scaleInPlace(scale: number): Vector4;
  3718. scale(scale: number): Vector4;
  3719. scaleToRef(scale: number, result: Vector4): void;
  3720. equals(otherVector: Vector4): boolean;
  3721. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  3722. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  3723. multiplyInPlace(otherVector: Vector4): Vector4;
  3724. multiply(otherVector: Vector4): Vector4;
  3725. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  3726. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  3727. divide(otherVector: Vector4): Vector4;
  3728. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  3729. MinimizeInPlace(other: Vector4): Vector4;
  3730. MaximizeInPlace(other: Vector4): Vector4;
  3731. length(): number;
  3732. lengthSquared(): number;
  3733. normalize(): Vector4;
  3734. toVector3(): Vector3;
  3735. clone(): Vector4;
  3736. copyFrom(source: Vector4): Vector4;
  3737. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  3738. static FromArray(array: number[], offset?: number): Vector4;
  3739. static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
  3740. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  3741. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  3742. static Zero(): Vector4;
  3743. static Normalize(vector: Vector4): Vector4;
  3744. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  3745. static Minimize(left: Vector4, right: Vector4): Vector4;
  3746. static Maximize(left: Vector4, right: Vector4): Vector4;
  3747. static Distance(value1: Vector4, value2: Vector4): number;
  3748. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  3749. static Center(value1: Vector4, value2: Vector4): Vector4;
  3750. }
  3751. interface ISize {
  3752. width: number;
  3753. height: number;
  3754. }
  3755. class Size implements ISize {
  3756. width: number;
  3757. height: number;
  3758. constructor(width: number, height: number);
  3759. clone(): Size;
  3760. equals(other: Size): boolean;
  3761. surface: number;
  3762. static Zero(): Size;
  3763. }
  3764. class Quaternion {
  3765. x: number;
  3766. y: number;
  3767. z: number;
  3768. w: number;
  3769. constructor(x?: number, y?: number, z?: number, w?: number);
  3770. toString(): string;
  3771. asArray(): number[];
  3772. equals(otherQuaternion: Quaternion): boolean;
  3773. clone(): Quaternion;
  3774. copyFrom(other: Quaternion): Quaternion;
  3775. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  3776. add(other: Quaternion): Quaternion;
  3777. subtract(other: Quaternion): Quaternion;
  3778. scale(value: number): Quaternion;
  3779. multiply(q1: Quaternion): Quaternion;
  3780. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  3781. multiplyInPlace(q1: Quaternion): Quaternion;
  3782. conjugateToRef(ref: Quaternion): Quaternion;
  3783. conjugateInPlace(): Quaternion;
  3784. conjugate(): Quaternion;
  3785. length(): number;
  3786. normalize(): Quaternion;
  3787. toEulerAngles(order?: string): Vector3;
  3788. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  3789. toRotationMatrix(result: Matrix): Quaternion;
  3790. fromRotationMatrix(matrix: Matrix): Quaternion;
  3791. static FromRotationMatrix(matrix: Matrix): Quaternion;
  3792. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  3793. static Inverse(q: Quaternion): Quaternion;
  3794. static Identity(): Quaternion;
  3795. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  3796. static FromArray(array: number[], offset?: number): Quaternion;
  3797. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  3798. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  3799. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  3800. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  3801. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  3802. }
  3803. class Matrix {
  3804. private static _tempQuaternion;
  3805. private static _xAxis;
  3806. private static _yAxis;
  3807. private static _zAxis;
  3808. m: Float32Array;
  3809. isIdentity(): boolean;
  3810. determinant(): number;
  3811. toArray(): Float32Array;
  3812. asArray(): Float32Array;
  3813. invert(): Matrix;
  3814. reset(): Matrix;
  3815. add(other: Matrix): Matrix;
  3816. addToRef(other: Matrix, result: Matrix): Matrix;
  3817. addToSelf(other: Matrix): Matrix;
  3818. invertToRef(other: Matrix): Matrix;
  3819. setTranslation(vector3: Vector3): Matrix;
  3820. getTranslation(): Vector3;
  3821. multiply(other: Matrix): Matrix;
  3822. copyFrom(other: Matrix): Matrix;
  3823. copyToArray(array: Float32Array, offset?: number): Matrix;
  3824. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  3825. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  3826. equals(value: Matrix): boolean;
  3827. clone(): Matrix;
  3828. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  3829. static FromArray(array: number[], offset?: number): Matrix;
  3830. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  3831. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  3832. 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;
  3833. getRow(index: number): Vector4;
  3834. setRow(index: number, row: Vector4): Matrix;
  3835. 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;
  3836. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  3837. static Identity(): Matrix;
  3838. static IdentityToRef(result: Matrix): void;
  3839. static Zero(): Matrix;
  3840. static RotationX(angle: number): Matrix;
  3841. static Invert(source: Matrix): Matrix;
  3842. static RotationXToRef(angle: number, result: Matrix): void;
  3843. static RotationY(angle: number): Matrix;
  3844. static RotationYToRef(angle: number, result: Matrix): void;
  3845. static RotationZ(angle: number): Matrix;
  3846. static RotationZToRef(angle: number, result: Matrix): void;
  3847. static RotationAxis(axis: Vector3, angle: number): Matrix;
  3848. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  3849. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  3850. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  3851. static Scaling(x: number, y: number, z: number): Matrix;
  3852. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  3853. static Translation(x: number, y: number, z: number): Matrix;
  3854. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  3855. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  3856. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  3857. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  3858. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  3859. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  3860. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  3861. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  3862. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  3863. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  3864. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  3865. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  3866. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  3867. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  3868. static Transpose(matrix: Matrix): Matrix;
  3869. static Reflection(plane: Plane): Matrix;
  3870. static ReflectionToRef(plane: Plane, result: Matrix): void;
  3871. }
  3872. class Plane {
  3873. normal: Vector3;
  3874. d: number;
  3875. constructor(a: number, b: number, c: number, d: number);
  3876. asArray(): number[];
  3877. clone(): Plane;
  3878. normalize(): Plane;
  3879. transform(transformation: Matrix): Plane;
  3880. dotCoordinate(point: any): number;
  3881. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  3882. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  3883. signedDistanceTo(point: Vector3): number;
  3884. static FromArray(array: number[]): Plane;
  3885. static FromPoints(point1: any, point2: any, point3: any): Plane;
  3886. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  3887. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  3888. }
  3889. class Viewport {
  3890. x: number;
  3891. y: number;
  3892. width: number;
  3893. height: number;
  3894. constructor(x: number, y: number, width: number, height: number);
  3895. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  3896. }
  3897. class Frustum {
  3898. static GetPlanes(transform: Matrix): Plane[];
  3899. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  3900. }
  3901. enum Space {
  3902. LOCAL = 0,
  3903. WORLD = 1,
  3904. }
  3905. class Axis {
  3906. static X: Vector3;
  3907. static Y: Vector3;
  3908. static Z: Vector3;
  3909. }
  3910. class BezierCurve {
  3911. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  3912. }
  3913. enum Orientation {
  3914. CW = 0,
  3915. CCW = 1,
  3916. }
  3917. class Angle {
  3918. private _radians;
  3919. constructor(radians: number);
  3920. degrees: () => number;
  3921. radians: () => number;
  3922. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  3923. static FromRadians(radians: number): Angle;
  3924. static FromDegrees(degrees: number): Angle;
  3925. }
  3926. class Arc2 {
  3927. startPoint: Vector2;
  3928. midPoint: Vector2;
  3929. endPoint: Vector2;
  3930. centerPoint: Vector2;
  3931. radius: number;
  3932. angle: Angle;
  3933. startAngle: Angle;
  3934. orientation: Orientation;
  3935. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  3936. }
  3937. class Path2 {
  3938. private _points;
  3939. private _length;
  3940. closed: boolean;
  3941. constructor(x: number, y: number);
  3942. addLineTo(x: number, y: number): Path2;
  3943. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  3944. close(): Path2;
  3945. length(): number;
  3946. getPoints(): Vector2[];
  3947. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  3948. static StartingAt(x: number, y: number): Path2;
  3949. }
  3950. class Path3D {
  3951. path: Vector3[];
  3952. private _curve;
  3953. private _distances;
  3954. private _tangents;
  3955. private _normals;
  3956. private _binormals;
  3957. private _raw;
  3958. /**
  3959. * new Path3D(path, normal, raw)
  3960. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  3961. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  3962. * path : an array of Vector3, the curve axis of the Path3D
  3963. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  3964. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  3965. */
  3966. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  3967. /**
  3968. * Returns the Path3D array of successive Vector3 designing its curve.
  3969. */
  3970. getCurve(): Vector3[];
  3971. /**
  3972. * Returns an array populated with tangent vectors on each Path3D curve point.
  3973. */
  3974. getTangents(): Vector3[];
  3975. /**
  3976. * Returns an array populated with normal vectors on each Path3D curve point.
  3977. */
  3978. getNormals(): Vector3[];
  3979. /**
  3980. * Returns an array populated with binormal vectors on each Path3D curve point.
  3981. */
  3982. getBinormals(): Vector3[];
  3983. /**
  3984. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  3985. */
  3986. getDistances(): number[];
  3987. /**
  3988. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  3989. * Returns the same object updated.
  3990. */
  3991. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  3992. private _compute(firstNormal);
  3993. private _getFirstNonNullVector(index);
  3994. private _getLastNonNullVector(index);
  3995. private _normalVector(v0, vt, va);
  3996. }
  3997. class Curve3 {
  3998. private _points;
  3999. private _length;
  4000. /**
  4001. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  4002. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  4003. * @param v1 (Vector3) the control point
  4004. * @param v2 (Vector3) the end point of the Quadratic Bezier
  4005. * @param nbPoints (integer) the wanted number of points in the curve
  4006. */
  4007. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  4008. /**
  4009. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  4010. * @param v0 (Vector3) the origin point of the Cubic Bezier
  4011. * @param v1 (Vector3) the first control point
  4012. * @param v2 (Vector3) the second control point
  4013. * @param v3 (Vector3) the end point of the Cubic Bezier
  4014. * @param nbPoints (integer) the wanted number of points in the curve
  4015. */
  4016. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  4017. /**
  4018. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  4019. * @param p1 (Vector3) the origin point of the Hermite Spline
  4020. * @param t1 (Vector3) the tangent vector at the origin point
  4021. * @param p2 (Vector3) the end point of the Hermite Spline
  4022. * @param t2 (Vector3) the tangent vector at the end point
  4023. * @param nbPoints (integer) the wanted number of points in the curve
  4024. */
  4025. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  4026. /**
  4027. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  4028. * A Curve3 is designed from a series of successive Vector3.
  4029. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  4030. */
  4031. constructor(points: Vector3[]);
  4032. /**
  4033. * Returns the Curve3 stored array of successive Vector3
  4034. */
  4035. getPoints(): Vector3[];
  4036. /**
  4037. * Returns the computed length (float) of the curve.
  4038. */
  4039. length(): number;
  4040. /**
  4041. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  4042. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  4043. * curveA and curveB keep unchanged.
  4044. */
  4045. continue(curve: Curve3): Curve3;
  4046. private _computeLength(path);
  4047. }
  4048. class SphericalHarmonics {
  4049. L00: Vector3;
  4050. L1_1: Vector3;
  4051. L10: Vector3;
  4052. L11: Vector3;
  4053. L2_2: Vector3;
  4054. L2_1: Vector3;
  4055. L20: Vector3;
  4056. L21: Vector3;
  4057. L22: Vector3;
  4058. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  4059. scale(scale: number): void;
  4060. }
  4061. class SphericalPolynomial {
  4062. x: Vector3;
  4063. y: Vector3;
  4064. z: Vector3;
  4065. xx: Vector3;
  4066. yy: Vector3;
  4067. zz: Vector3;
  4068. xy: Vector3;
  4069. yz: Vector3;
  4070. zx: Vector3;
  4071. addAmbient(color: Color3): void;
  4072. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  4073. }
  4074. class PositionNormalVertex {
  4075. position: Vector3;
  4076. normal: Vector3;
  4077. constructor(position?: Vector3, normal?: Vector3);
  4078. clone(): PositionNormalVertex;
  4079. }
  4080. class PositionNormalTextureVertex {
  4081. position: Vector3;
  4082. normal: Vector3;
  4083. uv: Vector2;
  4084. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  4085. clone(): PositionNormalTextureVertex;
  4086. }
  4087. class Tmp {
  4088. static Color3: Color3[];
  4089. static Vector2: Vector2[];
  4090. static Vector3: Vector3[];
  4091. static Vector4: Vector4[];
  4092. static Quaternion: Quaternion[];
  4093. static Matrix: Matrix[];
  4094. }
  4095. }
  4096. declare module BABYLON {
  4097. class AbstractMesh extends Node implements IDisposable {
  4098. private static _BILLBOARDMODE_NONE;
  4099. private static _BILLBOARDMODE_X;
  4100. private static _BILLBOARDMODE_Y;
  4101. private static _BILLBOARDMODE_Z;
  4102. private static _BILLBOARDMODE_ALL;
  4103. static BILLBOARDMODE_NONE: number;
  4104. static BILLBOARDMODE_X: number;
  4105. static BILLBOARDMODE_Y: number;
  4106. static BILLBOARDMODE_Z: number;
  4107. static BILLBOARDMODE_ALL: number;
  4108. /**
  4109. * An event triggered when this mesh collides with another one
  4110. * @type {BABYLON.Observable}
  4111. */
  4112. onCollideObservable: Observable<AbstractMesh>;
  4113. private _onCollideObserver;
  4114. onCollide: () => void;
  4115. /**
  4116. * An event triggered when the collision's position changes
  4117. * @type {BABYLON.Observable}
  4118. */
  4119. onCollisionPositionChangeObservable: Observable<Vector3>;
  4120. private _onCollisionPositionChangeObserver;
  4121. onCollisionPositionChange: () => void;
  4122. /**
  4123. * An event triggered after the world matrix is updated
  4124. * @type {BABYLON.Observable}
  4125. */
  4126. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  4127. definedFacingForward: boolean;
  4128. position: Vector3;
  4129. private _rotation;
  4130. _rotationQuaternion: Quaternion;
  4131. private _scaling;
  4132. billboardMode: number;
  4133. visibility: number;
  4134. alphaIndex: number;
  4135. infiniteDistance: boolean;
  4136. isVisible: boolean;
  4137. isPickable: boolean;
  4138. showBoundingBox: boolean;
  4139. showSubMeshesBoundingBox: boolean;
  4140. onDispose: any;
  4141. isBlocker: boolean;
  4142. renderingGroupId: number;
  4143. material: Material;
  4144. receiveShadows: boolean;
  4145. actionManager: ActionManager;
  4146. renderOutline: boolean;
  4147. outlineColor: Color3;
  4148. outlineWidth: number;
  4149. renderOverlay: boolean;
  4150. overlayColor: Color3;
  4151. overlayAlpha: number;
  4152. hasVertexAlpha: boolean;
  4153. useVertexColors: boolean;
  4154. applyFog: boolean;
  4155. computeBonesUsingShaders: boolean;
  4156. scalingDeterminant: number;
  4157. numBoneInfluencers: number;
  4158. useOctreeForRenderingSelection: boolean;
  4159. useOctreeForPicking: boolean;
  4160. useOctreeForCollisions: boolean;
  4161. layerMask: number;
  4162. alwaysSelectAsActiveMesh: boolean;
  4163. physicsImpostor: BABYLON.PhysicsImpostor;
  4164. onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void;
  4165. private _checkCollisions;
  4166. ellipsoid: Vector3;
  4167. ellipsoidOffset: Vector3;
  4168. private _collider;
  4169. private _oldPositionForCollisions;
  4170. private _diffPositionForCollisions;
  4171. private _newPositionForCollisions;
  4172. private _meshToBoneReferal;
  4173. edgesWidth: number;
  4174. edgesColor: Color4;
  4175. _edgesRenderer: EdgesRenderer;
  4176. private _localWorld;
  4177. _worldMatrix: Matrix;
  4178. private _rotateYByPI;
  4179. private _absolutePosition;
  4180. private _collisionsTransformMatrix;
  4181. private _collisionsScalingMatrix;
  4182. _positions: Vector3[];
  4183. private _isDirty;
  4184. _masterMesh: AbstractMesh;
  4185. _materialDefines: MaterialDefines;
  4186. _boundingInfo: BoundingInfo;
  4187. private _pivotMatrix;
  4188. _isDisposed: boolean;
  4189. _renderId: number;
  4190. subMeshes: SubMesh[];
  4191. _submeshesOctree: Octree<SubMesh>;
  4192. _intersectionsInProgress: AbstractMesh[];
  4193. private _isWorldMatrixFrozen;
  4194. _unIndexed: boolean;
  4195. _poseMatrix: Matrix;
  4196. _waitingActions: any;
  4197. _waitingFreezeWorldMatrix: boolean;
  4198. private _skeleton;
  4199. _bonesTransformMatrices: Float32Array;
  4200. skeleton: Skeleton;
  4201. constructor(name: string, scene: Scene);
  4202. /**
  4203. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4204. */
  4205. toString(fullDetails?: boolean): string;
  4206. /**
  4207. * Getting the rotation object.
  4208. * If rotation quaternion is set, this vector will (almost always) be the Zero vector!
  4209. */
  4210. rotation: Vector3;
  4211. scaling: Vector3;
  4212. rotationQuaternion: Quaternion;
  4213. updatePoseMatrix(matrix: Matrix): void;
  4214. getPoseMatrix(): Matrix;
  4215. disableEdgesRendering(): void;
  4216. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
  4217. isBlocked: boolean;
  4218. getLOD(camera: Camera): AbstractMesh;
  4219. getTotalVertices(): number;
  4220. getIndices(): number[] | Int32Array;
  4221. getVerticesData(kind: string): number[] | Float32Array;
  4222. isVerticesDataPresent(kind: string): boolean;
  4223. getBoundingInfo(): BoundingInfo;
  4224. useBones: boolean;
  4225. _preActivate(): void;
  4226. _preActivateForIntermediateRendering(renderId: number): void;
  4227. _activate(renderId: number): void;
  4228. getWorldMatrix(): Matrix;
  4229. worldMatrixFromCache: Matrix;
  4230. absolutePosition: Vector3;
  4231. freezeWorldMatrix(): void;
  4232. unfreezeWorldMatrix(): void;
  4233. isWorldMatrixFrozen: boolean;
  4234. rotate(axis: Vector3, amount: number, space?: Space): void;
  4235. translate(axis: Vector3, distance: number, space?: Space): void;
  4236. getAbsolutePosition(): Vector3;
  4237. setAbsolutePosition(absolutePosition: Vector3): void;
  4238. /**
  4239. * Perform relative position change from the point of view of behind the front of the mesh.
  4240. * This is performed taking into account the meshes current rotation, so you do not have to care.
  4241. * Supports definition of mesh facing forward or backward.
  4242. * @param {number} amountRight
  4243. * @param {number} amountUp
  4244. * @param {number} amountForward
  4245. */
  4246. movePOV(amountRight: number, amountUp: number, amountForward: number): void;
  4247. /**
  4248. * Calculate relative position change from the point of view of behind the front of the mesh.
  4249. * This is performed taking into account the meshes current rotation, so you do not have to care.
  4250. * Supports definition of mesh facing forward or backward.
  4251. * @param {number} amountRight
  4252. * @param {number} amountUp
  4253. * @param {number} amountForward
  4254. */
  4255. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  4256. /**
  4257. * Perform relative rotation change from the point of view of behind the front of the mesh.
  4258. * Supports definition of mesh facing forward or backward.
  4259. * @param {number} flipBack
  4260. * @param {number} twirlClockwise
  4261. * @param {number} tiltRight
  4262. */
  4263. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
  4264. /**
  4265. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  4266. * Supports definition of mesh facing forward or backward.
  4267. * @param {number} flipBack
  4268. * @param {number} twirlClockwise
  4269. * @param {number} tiltRight
  4270. */
  4271. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  4272. setPivotMatrix(matrix: Matrix): void;
  4273. getPivotMatrix(): Matrix;
  4274. _isSynchronized(): boolean;
  4275. _initCache(): void;
  4276. markAsDirty(property: string): void;
  4277. _updateBoundingInfo(): void;
  4278. _updateSubMeshesBoundingInfo(matrix: Matrix): void;
  4279. computeWorldMatrix(force?: boolean): Matrix;
  4280. /**
  4281. * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
  4282. * @param func: callback function to add
  4283. */
  4284. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  4285. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  4286. setPositionWithLocalVector(vector3: Vector3): void;
  4287. getPositionExpressedInLocalSpace(): Vector3;
  4288. locallyTranslate(vector3: Vector3): void;
  4289. lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void;
  4290. attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
  4291. detachFromBone(): void;
  4292. isInFrustum(frustumPlanes: Plane[]): boolean;
  4293. isCompletelyInFrustum(camera?: Camera): boolean;
  4294. intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean;
  4295. intersectsPoint(point: Vector3): boolean;
  4296. /**
  4297. * @Deprecated. Use new PhysicsImpostor instead.
  4298. * */
  4299. setPhysicsState(impostor?: any, options?: PhysicsImpostorParameters): any;
  4300. getPhysicsImpostor(): PhysicsImpostor;
  4301. /**
  4302. * @Deprecated. Use getPhysicsImpostor().getParam("mass");
  4303. */
  4304. getPhysicsMass(): number;
  4305. /**
  4306. * @Deprecated. Use getPhysicsImpostor().getParam("friction");
  4307. */
  4308. getPhysicsFriction(): number;
  4309. /**
  4310. * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
  4311. */
  4312. getPhysicsRestitution(): number;
  4313. getPositionInCameraSpace(camera?: Camera): Vector3;
  4314. getDistanceToCamera(camera?: Camera): number;
  4315. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  4316. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  4317. /**
  4318. * @Deprecated
  4319. */
  4320. updatePhysicsBodyPosition(): void;
  4321. /**
  4322. * @Deprecated
  4323. * Calling this function is not needed anymore.
  4324. * The physics engine takes care of transofmration automatically.
  4325. */
  4326. updatePhysicsBody(): void;
  4327. checkCollisions: boolean;
  4328. moveWithCollisions(velocity: Vector3): void;
  4329. private _onCollisionPositionChange;
  4330. /**
  4331. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  4332. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  4333. */
  4334. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  4335. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void;
  4336. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void;
  4337. _checkCollision(collider: Collider): void;
  4338. _generatePointsArray(): boolean;
  4339. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  4340. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  4341. releaseSubMeshes(): void;
  4342. dispose(doNotRecurse?: boolean): void;
  4343. }
  4344. }
  4345. declare module BABYLON {
  4346. class CSG {
  4347. private polygons;
  4348. matrix: Matrix;
  4349. position: Vector3;
  4350. rotation: Vector3;
  4351. rotationQuaternion: Quaternion;
  4352. scaling: Vector3;
  4353. static FromMesh(mesh: Mesh): CSG;
  4354. private static FromPolygons(polygons);
  4355. clone(): CSG;
  4356. private toPolygons();
  4357. union(csg: CSG): CSG;
  4358. unionInPlace(csg: CSG): void;
  4359. subtract(csg: CSG): CSG;
  4360. subtractInPlace(csg: CSG): void;
  4361. intersect(csg: CSG): CSG;
  4362. intersectInPlace(csg: CSG): void;
  4363. inverse(): CSG;
  4364. inverseInPlace(): void;
  4365. copyTransformAttributes(csg: CSG): CSG;
  4366. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  4367. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  4368. }
  4369. }
  4370. declare module BABYLON {
  4371. class Geometry implements IGetSetVerticesData {
  4372. id: string;
  4373. delayLoadState: number;
  4374. delayLoadingFile: string;
  4375. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  4376. private _scene;
  4377. private _engine;
  4378. private _meshes;
  4379. private _totalVertices;
  4380. private _indices;
  4381. private _vertexBuffers;
  4382. private _isDisposed;
  4383. private _extend;
  4384. private _boundingBias;
  4385. _delayInfo: any;
  4386. private _indexBuffer;
  4387. _boundingInfo: BoundingInfo;
  4388. _delayLoadingFunction: (any: any, geometry: Geometry) => void;
  4389. _softwareSkinningRenderId: number;
  4390. /**
  4391. * The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
  4392. * @returns The Bias Vector
  4393. */
  4394. boundingBias: Vector2;
  4395. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  4396. extend: {
  4397. minimum: Vector3;
  4398. maximum: Vector3;
  4399. };
  4400. getScene(): Scene;
  4401. getEngine(): Engine;
  4402. isReady(): boolean;
  4403. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  4404. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  4405. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  4406. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  4407. private updateBoundingInfo(updateExtends, data);
  4408. getTotalVertices(): number;
  4409. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  4410. getVertexBuffer(kind: string): VertexBuffer;
  4411. getVertexBuffers(): VertexBuffer[];
  4412. isVerticesDataPresent(kind: string): boolean;
  4413. getVerticesDataKinds(): string[];
  4414. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  4415. getTotalIndices(): number;
  4416. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  4417. getIndexBuffer(): any;
  4418. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  4419. applyToMesh(mesh: Mesh): void;
  4420. private updateExtend(data?);
  4421. private _applyToMesh(mesh);
  4422. private notifyUpdate(kind?);
  4423. load(scene: Scene, onLoaded?: () => void): void;
  4424. isDisposed(): boolean;
  4425. dispose(): void;
  4426. copy(id: string): Geometry;
  4427. serialize(): any;
  4428. serializeVerticeData(): any;
  4429. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  4430. static RandomId(): string;
  4431. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  4432. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  4433. }
  4434. module Geometry.Primitives {
  4435. class _Primitive extends Geometry {
  4436. private _canBeRegenerated;
  4437. private _beingRegenerated;
  4438. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  4439. canBeRegenerated(): boolean;
  4440. regenerate(): void;
  4441. asNewGeometry(id: string): Geometry;
  4442. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  4443. setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void;
  4444. _regenerateVertexData(): VertexData;
  4445. copy(id: string): Geometry;
  4446. serialize(): any;
  4447. }
  4448. class Ribbon extends _Primitive {
  4449. pathArray: Vector3[][];
  4450. closeArray: boolean;
  4451. closePath: boolean;
  4452. offset: number;
  4453. side: number;
  4454. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4455. _regenerateVertexData(): VertexData;
  4456. copy(id: string): Geometry;
  4457. }
  4458. class Box extends _Primitive {
  4459. size: number;
  4460. side: number;
  4461. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4462. _regenerateVertexData(): VertexData;
  4463. copy(id: string): Geometry;
  4464. serialize(): any;
  4465. static Parse(parsedBox: any, scene: Scene): Box;
  4466. }
  4467. class Sphere extends _Primitive {
  4468. segments: number;
  4469. diameter: number;
  4470. side: number;
  4471. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4472. _regenerateVertexData(): VertexData;
  4473. copy(id: string): Geometry;
  4474. serialize(): any;
  4475. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  4476. }
  4477. class Disc extends _Primitive {
  4478. radius: number;
  4479. tessellation: number;
  4480. side: number;
  4481. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4482. _regenerateVertexData(): VertexData;
  4483. copy(id: string): Geometry;
  4484. }
  4485. class Cylinder extends _Primitive {
  4486. height: number;
  4487. diameterTop: number;
  4488. diameterBottom: number;
  4489. tessellation: number;
  4490. subdivisions: number;
  4491. side: number;
  4492. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4493. _regenerateVertexData(): VertexData;
  4494. copy(id: string): Geometry;
  4495. serialize(): any;
  4496. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  4497. }
  4498. class Torus extends _Primitive {
  4499. diameter: number;
  4500. thickness: number;
  4501. tessellation: number;
  4502. side: number;
  4503. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4504. _regenerateVertexData(): VertexData;
  4505. copy(id: string): Geometry;
  4506. serialize(): any;
  4507. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  4508. }
  4509. class Ground extends _Primitive {
  4510. width: number;
  4511. height: number;
  4512. subdivisions: number;
  4513. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  4514. _regenerateVertexData(): VertexData;
  4515. copy(id: string): Geometry;
  4516. serialize(): any;
  4517. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  4518. }
  4519. class TiledGround extends _Primitive {
  4520. xmin: number;
  4521. zmin: number;
  4522. xmax: number;
  4523. zmax: number;
  4524. subdivisions: {
  4525. w: number;
  4526. h: number;
  4527. };
  4528. precision: {
  4529. w: number;
  4530. h: number;
  4531. };
  4532. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  4533. w: number;
  4534. h: number;
  4535. }, precision: {
  4536. w: number;
  4537. h: number;
  4538. }, canBeRegenerated?: boolean, mesh?: Mesh);
  4539. _regenerateVertexData(): VertexData;
  4540. copy(id: string): Geometry;
  4541. }
  4542. class Plane extends _Primitive {
  4543. size: number;
  4544. side: number;
  4545. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4546. _regenerateVertexData(): VertexData;
  4547. copy(id: string): Geometry;
  4548. serialize(): any;
  4549. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  4550. }
  4551. class TorusKnot extends _Primitive {
  4552. radius: number;
  4553. tube: number;
  4554. radialSegments: number;
  4555. tubularSegments: number;
  4556. p: number;
  4557. q: number;
  4558. side: number;
  4559. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  4560. _regenerateVertexData(): VertexData;
  4561. copy(id: string): Geometry;
  4562. serialize(): any;
  4563. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  4564. }
  4565. }
  4566. }
  4567. declare module BABYLON {
  4568. class GroundMesh extends Mesh {
  4569. generateOctree: boolean;
  4570. private _worldInverse;
  4571. private _heightQuads;
  4572. _subdivisions: number;
  4573. _width: number;
  4574. _height: number;
  4575. _minX: number;
  4576. _maxX: number;
  4577. _minZ: number;
  4578. _maxZ: number;
  4579. constructor(name: string, scene: Scene);
  4580. subdivisions: number;
  4581. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  4582. /**
  4583. * Returns a height (y) value in the Worl system :
  4584. * the ground altitude at the coordinates (x, z) expressed in the World system.
  4585. * Returns the ground y position if (x, z) are outside the ground surface.
  4586. * Not pertinent if the ground is rotated.
  4587. */
  4588. getHeightAtCoordinates(x: number, z: number): number;
  4589. /**
  4590. * Returns a normalized vector (Vector3) orthogonal to the ground
  4591. * at the ground coordinates (x, z) expressed in the World system.
  4592. * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface.
  4593. * Not pertinent if the ground is rotated.
  4594. */
  4595. getNormalAtCoordinates(x: number, z: number): Vector3;
  4596. /**
  4597. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  4598. * at the ground coordinates (x, z) expressed in the World system.
  4599. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  4600. * Not pertinent if the ground is rotated.
  4601. */
  4602. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void;
  4603. /**
  4604. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  4605. * if the ground has been updated.
  4606. * This can be used in the render loop
  4607. */
  4608. updateCoordinateHeights(): void;
  4609. private _getFacetAt(x, z);
  4610. private _initHeightQuads();
  4611. private _computeHeightQuads();
  4612. }
  4613. }
  4614. declare module BABYLON {
  4615. /**
  4616. * Creates an instance based on a source mesh.
  4617. */
  4618. class InstancedMesh extends AbstractMesh {
  4619. private _sourceMesh;
  4620. private _currentLOD;
  4621. constructor(name: string, source: Mesh);
  4622. receiveShadows: boolean;
  4623. material: Material;
  4624. visibility: number;
  4625. skeleton: Skeleton;
  4626. renderingGroupId: number;
  4627. getTotalVertices(): number;
  4628. sourceMesh: Mesh;
  4629. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  4630. isVerticesDataPresent(kind: string): boolean;
  4631. getIndices(): number[] | Int32Array;
  4632. _positions: Vector3[];
  4633. refreshBoundingInfo(): void;
  4634. _preActivate(): void;
  4635. _activate(renderId: number): void;
  4636. getLOD(camera: Camera): AbstractMesh;
  4637. _syncSubMeshes(): void;
  4638. _generatePointsArray(): boolean;
  4639. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  4640. dispose(doNotRecurse?: boolean): void;
  4641. }
  4642. }
  4643. declare module BABYLON {
  4644. class LinesMesh extends Mesh {
  4645. color: Color3;
  4646. alpha: number;
  4647. /**
  4648. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  4649. * This margin is expressed in world space coordinates, so its value may vary.
  4650. * Default value is 0.1
  4651. * @returns the intersection Threshold value.
  4652. */
  4653. /**
  4654. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  4655. * This margin is expressed in world space coordinates, so its value may vary.
  4656. * @param value the new threshold to apply
  4657. */
  4658. intersectionThreshold: number;
  4659. private _intersectionThreshold;
  4660. private _colorShader;
  4661. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean);
  4662. material: Material;
  4663. checkCollisions: boolean;
  4664. createInstance(name: string): InstancedMesh;
  4665. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  4666. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  4667. dispose(doNotRecurse?: boolean): void;
  4668. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  4669. }
  4670. }
  4671. declare module BABYLON {
  4672. class _InstancesBatch {
  4673. mustReturn: boolean;
  4674. visibleInstances: InstancedMesh[][];
  4675. renderSelf: boolean[];
  4676. }
  4677. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  4678. static _FRONTSIDE: number;
  4679. static _BACKSIDE: number;
  4680. static _DOUBLESIDE: number;
  4681. static _DEFAULTSIDE: number;
  4682. static _NO_CAP: number;
  4683. static _CAP_START: number;
  4684. static _CAP_END: number;
  4685. static _CAP_ALL: number;
  4686. /**
  4687. * Mesh side orientation : usually the external or front surface
  4688. */
  4689. static FRONTSIDE: number;
  4690. /**
  4691. * Mesh side orientation : usually the internal or back surface
  4692. */
  4693. static BACKSIDE: number;
  4694. /**
  4695. * Mesh side orientation : both internal and external or front and back surfaces
  4696. */
  4697. static DOUBLESIDE: number;
  4698. /**
  4699. * Mesh side orientation : by default, `FRONTSIDE`
  4700. */
  4701. static DEFAULTSIDE: number;
  4702. /**
  4703. * Mesh cap setting : no cap
  4704. */
  4705. static NO_CAP: number;
  4706. /**
  4707. * Mesh cap setting : one cap at the beginning of the mesh
  4708. */
  4709. static CAP_START: number;
  4710. /**
  4711. * Mesh cap setting : one cap at the end of the mesh
  4712. */
  4713. static CAP_END: number;
  4714. /**
  4715. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  4716. */
  4717. static CAP_ALL: number;
  4718. /**
  4719. * An event triggered before rendering the mesh
  4720. * @type {BABYLON.Observable}
  4721. */
  4722. onBeforeRenderObservable: Observable<Mesh>;
  4723. /**
  4724. * An event triggered after rendering the mesh
  4725. * @type {BABYLON.Observable}
  4726. */
  4727. onAfterRenderObservable: Observable<Mesh>;
  4728. /**
  4729. * An event triggered before drawing the mesh
  4730. * @type {BABYLON.Observable}
  4731. */
  4732. onBeforeDrawObservable: Observable<Mesh>;
  4733. private _onBeforeDrawObserver;
  4734. onBeforeDraw: () => void;
  4735. delayLoadState: number;
  4736. instances: InstancedMesh[];
  4737. delayLoadingFile: string;
  4738. _binaryInfo: any;
  4739. private _LODLevels;
  4740. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  4741. _geometry: Geometry;
  4742. _delayInfo: any;
  4743. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  4744. _visibleInstances: any;
  4745. private _renderIdForInstances;
  4746. private _batchCache;
  4747. private _worldMatricesInstancesBuffer;
  4748. private _worldMatricesInstancesArray;
  4749. private _instancesBufferSize;
  4750. _shouldGenerateFlatShading: boolean;
  4751. private _preActivateId;
  4752. private _sideOrientation;
  4753. private _areNormalsFrozen;
  4754. private _sourcePositions;
  4755. private _sourceNormals;
  4756. /**
  4757. * @constructor
  4758. * @param {string} name - The value used by scene.getMeshByName() to do a lookup.
  4759. * @param {Scene} scene - The scene to add this mesh to.
  4760. * @param {Node} parent - The parent of this mesh, if it has one
  4761. * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned.
  4762. * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False.
  4763. * When false, achieved by calling a clone(), also passing False.
  4764. * This will make creation of children, recursive.
  4765. */
  4766. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  4767. /**
  4768. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4769. */
  4770. toString(fullDetails?: boolean): string;
  4771. hasLODLevels: boolean;
  4772. private _sortLODLevels();
  4773. /**
  4774. * Add a mesh as LOD level triggered at the given distance.
  4775. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  4776. * @param {number} distance - the distance from the center of the object to show this level
  4777. * @param {Mesh} mesh - the mesh to be added as LOD level
  4778. * @return {Mesh} this mesh (for chaining)
  4779. */
  4780. addLODLevel(distance: number, mesh: Mesh): Mesh;
  4781. /**
  4782. * Returns the LOD level mesh at the passed distance or null if not found.
  4783. * It is related to the method `addLODLevel(distance, mesh)`.
  4784. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  4785. */
  4786. getLODLevelAtDistance(distance: number): Mesh;
  4787. /**
  4788. * Remove a mesh from the LOD array
  4789. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  4790. * @param {Mesh} mesh - the mesh to be removed.
  4791. * @return {Mesh} this mesh (for chaining)
  4792. */
  4793. removeLODLevel(mesh: Mesh): Mesh;
  4794. /**
  4795. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  4796. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  4797. */
  4798. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  4799. /**
  4800. * Returns the mesh internal `Geometry` object.
  4801. */
  4802. geometry: Geometry;
  4803. /**
  4804. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  4805. */
  4806. getTotalVertices(): number;
  4807. /**
  4808. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  4809. * If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  4810. * Returns null if the mesh has no geometry or no vertex buffer.
  4811. * Possible `kind` values :
  4812. * - BABYLON.VertexBuffer.PositionKind
  4813. * - BABYLON.VertexBuffer.UVKind
  4814. * - BABYLON.VertexBuffer.UV2Kind
  4815. * - BABYLON.VertexBuffer.UV3Kind
  4816. * - BABYLON.VertexBuffer.UV4Kind
  4817. * - BABYLON.VertexBuffer.UV5Kind
  4818. * - BABYLON.VertexBuffer.UV6Kind
  4819. * - BABYLON.VertexBuffer.ColorKind
  4820. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4821. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4822. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4823. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4824. */
  4825. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  4826. /**
  4827. * Returns the mesh `VertexBuffer` object from the requested `kind` : positions, indices, normals, etc.
  4828. * Returns `undefined` if the mesh has no geometry.
  4829. * Possible `kind` values :
  4830. * - BABYLON.VertexBuffer.PositionKind
  4831. * - BABYLON.VertexBuffer.UVKind
  4832. * - BABYLON.VertexBuffer.UV2Kind
  4833. * - BABYLON.VertexBuffer.UV3Kind
  4834. * - BABYLON.VertexBuffer.UV4Kind
  4835. * - BABYLON.VertexBuffer.UV5Kind
  4836. * - BABYLON.VertexBuffer.UV6Kind
  4837. * - BABYLON.VertexBuffer.ColorKind
  4838. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4839. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4840. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4841. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4842. */
  4843. getVertexBuffer(kind: any): VertexBuffer;
  4844. /**
  4845. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  4846. * Possible `kind` values :
  4847. * - BABYLON.VertexBuffer.PositionKind
  4848. * - BABYLON.VertexBuffer.UVKind
  4849. * - BABYLON.VertexBuffer.UV2Kind
  4850. * - BABYLON.VertexBuffer.UV3Kind
  4851. * - BABYLON.VertexBuffer.UV4Kind
  4852. * - BABYLON.VertexBuffer.UV5Kind
  4853. * - BABYLON.VertexBuffer.UV6Kind
  4854. * - BABYLON.VertexBuffer.ColorKind
  4855. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4856. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4857. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4858. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4859. */
  4860. isVerticesDataPresent(kind: string): boolean;
  4861. /**
  4862. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  4863. * Possible `kind` values :
  4864. * - BABYLON.VertexBuffer.PositionKind
  4865. * - BABYLON.VertexBuffer.UVKind
  4866. * - BABYLON.VertexBuffer.UV2Kind
  4867. * - BABYLON.VertexBuffer.UV3Kind
  4868. * - BABYLON.VertexBuffer.UV4Kind
  4869. * - BABYLON.VertexBuffer.UV5Kind
  4870. * - BABYLON.VertexBuffer.UV6Kind
  4871. * - BABYLON.VertexBuffer.ColorKind
  4872. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4873. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4874. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4875. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4876. */
  4877. getVerticesDataKinds(): string[];
  4878. /**
  4879. * Returns a positive integer : the total number of indices in this mesh geometry.
  4880. * Returns zero if the mesh has no geometry.
  4881. */
  4882. getTotalIndices(): number;
  4883. /**
  4884. * Returns an array of integers or a Int32Array populated with the mesh indices.
  4885. * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  4886. * Returns an empty array if the mesh has no geometry.
  4887. */
  4888. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  4889. isBlocked: boolean;
  4890. /**
  4891. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  4892. */
  4893. isReady(): boolean;
  4894. /**
  4895. * Boolean : true if the mesh has been disposed.
  4896. */
  4897. isDisposed(): boolean;
  4898. /**
  4899. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  4900. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  4901. */
  4902. sideOrientation: number;
  4903. /**
  4904. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  4905. * This property is pertinent only for updatable parametric shapes.
  4906. */
  4907. areNormalsFrozen: boolean;
  4908. /**
  4909. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  4910. * It has no effect at all on other shapes.
  4911. * It prevents the mesh normals from being recomputed on next `positions` array update.
  4912. */
  4913. freezeNormals(): void;
  4914. /**
  4915. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  4916. * It has no effect at all on other shapes.
  4917. * It reactivates the mesh normals computation if it was previously frozen.
  4918. */
  4919. unfreezeNormals(): void;
  4920. _preActivate(): void;
  4921. _preActivateForIntermediateRendering(renderId: number): void;
  4922. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void;
  4923. /**
  4924. * This method recomputes and sets a new `BoundingInfo` to the mesh unless it is locked.
  4925. * This means the mesh underlying bounding box and sphere are recomputed.
  4926. */
  4927. refreshBoundingInfo(): void;
  4928. _createGlobalSubMesh(): SubMesh;
  4929. subdivide(count: number): void;
  4930. /**
  4931. * Sets the vertex data of the mesh geometry for the requested `kind`.
  4932. * If the mesh has no geometry, a new `Geometry` object is set to the mesh and then passed this vertex data.
  4933. * The `data` are either a numeric array either a Float32Array.
  4934. * The parameter `updatable` is passed as is to the underlying `Geometry` object constructor (if initianilly none) or updater.
  4935. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  4936. * Note that a new underlying `VertexBuffer` object is created each call.
  4937. * If the `kind` is the `PositionKind`, the mesh `BoundingInfo` is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  4938. *
  4939. * Possible `kind` values :
  4940. * - BABYLON.VertexBuffer.PositionKind
  4941. * - BABYLON.VertexBuffer.UVKind
  4942. * - BABYLON.VertexBuffer.UV2Kind
  4943. * - BABYLON.VertexBuffer.UV3Kind
  4944. * - BABYLON.VertexBuffer.UV4Kind
  4945. * - BABYLON.VertexBuffer.UV5Kind
  4946. * - BABYLON.VertexBuffer.UV6Kind
  4947. * - BABYLON.VertexBuffer.ColorKind
  4948. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4949. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4950. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4951. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4952. */
  4953. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  4954. /**
  4955. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  4956. * If the mesh has no geometry, it is simply returned as it is.
  4957. * The `data` are either a numeric array either a Float32Array.
  4958. * No new underlying `VertexBuffer` object is created.
  4959. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh `BoundingInfo` is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  4960. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  4961. *
  4962. * Possible `kind` values :
  4963. * - BABYLON.VertexBuffer.PositionKind
  4964. * - BABYLON.VertexBuffer.UVKind
  4965. * - BABYLON.VertexBuffer.UV2Kind
  4966. * - BABYLON.VertexBuffer.UV3Kind
  4967. * - BABYLON.VertexBuffer.UV4Kind
  4968. * - BABYLON.VertexBuffer.UV5Kind
  4969. * - BABYLON.VertexBuffer.UV6Kind
  4970. * - BABYLON.VertexBuffer.ColorKind
  4971. * - BABYLON.VertexBuffer.MatricesIndicesKind
  4972. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  4973. * - BABYLON.VertexBuffer.MatricesWeightsKind
  4974. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  4975. */
  4976. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  4977. /**
  4978. * Deprecated since BabylonJS v2.3
  4979. */
  4980. updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
  4981. /**
  4982. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  4983. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  4984. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  4985. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  4986. */
  4987. updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
  4988. makeGeometryUnique(): void;
  4989. /**
  4990. * Sets the mesh indices.
  4991. * Expects an array populated with integers or a Int32Array.
  4992. * If the mesh has no geometry, a new `Geometry` object is created and set to the mesh.
  4993. * This method creates a new index buffer each call.
  4994. */
  4995. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  4996. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  4997. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  4998. /**
  4999. * Registers for this mesh a javascript function called just before the rendering process.
  5000. * This function is passed the current mesh and doesn't return anything.
  5001. */
  5002. registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
  5003. /**
  5004. * Disposes a previously registered javascript function called before the rendering.
  5005. * This function is passed the current mesh and doesn't return anything.
  5006. */
  5007. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
  5008. /**
  5009. * Registers for this mesh a javascript function called just after the rendering is complete.
  5010. * This function is passed the current mesh and doesn't return anything.
  5011. */
  5012. registerAfterRender(func: (mesh: AbstractMesh) => void): void;
  5013. /**
  5014. * Disposes a previously registered javascript function called after the rendering.
  5015. * This function is passed the current mesh and doesn't return anything.
  5016. */
  5017. unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
  5018. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  5019. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void;
  5020. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void;
  5021. /**
  5022. * Triggers the draw call for the mesh.
  5023. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  5024. */
  5025. render(subMesh: SubMesh, enableAlphaMode: boolean): void;
  5026. /**
  5027. * Returns an array populated with `ParticleSystem` objects whose the mesh is the emitter.
  5028. */
  5029. getEmittedParticleSystems(): ParticleSystem[];
  5030. /**
  5031. * Returns an array populated with `ParticleSystem` objects whose the mesh or its children are the emitter.
  5032. */
  5033. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  5034. _checkDelayState(): void;
  5035. /**
  5036. * Boolean, true is the mesh in the frustum defined by the `Plane` objects from the `frustumPlanes` array parameter.
  5037. */
  5038. isInFrustum(frustumPlanes: Plane[]): boolean;
  5039. /**
  5040. * Sets the mesh material by the material or multiMaterial `id` property.
  5041. * The material `id` is a string identifying the material or the multiMaterial.
  5042. * This method returns nothing.
  5043. */
  5044. setMaterialByID(id: string): void;
  5045. /**
  5046. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  5047. */
  5048. getAnimatables(): IAnimatable[];
  5049. /**
  5050. * Modifies the mesh geometry according to the passed transformation matrix.
  5051. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  5052. * The mesh normals are modified accordingly the same transformation.
  5053. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  5054. * Note that, under the hood, this method sets a new VertexBuffer each call.
  5055. */
  5056. bakeTransformIntoVertices(transform: Matrix): void;
  5057. /**
  5058. * Modifies the mesh geometry according to its own current World Matrix.
  5059. * The mesh World Matrix is then reset.
  5060. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  5061. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  5062. * Note that, under the hood, this method sets a new VertexBuffer each call.
  5063. */
  5064. bakeCurrentTransformIntoVertices(): void;
  5065. _resetPointsArrayCache(): void;
  5066. _generatePointsArray(): boolean;
  5067. /**
  5068. * Returns a new `Mesh` object generated from the current mesh properties.
  5069. * This method must not get confused with createInstance().
  5070. * The parameter `name` is a string, the name given to the new mesh.
  5071. * The optional parameter `newParent` can be any `Node` object (default `null`).
  5072. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  5073. * The parameter `clonePhysicsImpostor` (default `true`) allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any.
  5074. */
  5075. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  5076. /**
  5077. * Disposes the mesh.
  5078. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  5079. */
  5080. dispose(doNotRecurse?: boolean): void;
  5081. /**
  5082. * Modifies the mesh geometry according to a displacement map.
  5083. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  5084. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  5085. * This method returns nothing.
  5086. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  5087. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  5088. * The parameter `onSuccess` is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
  5089. */
  5090. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
  5091. /**
  5092. * Modifies the mesh geometry according to a displacementMap buffer.
  5093. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  5094. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  5095. * This method returns nothing.
  5096. * The parameter `buffer` is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
  5097. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  5098. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  5099. */
  5100. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  5101. /**
  5102. * Modify the mesh to get a flat shading rendering.
  5103. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  5104. * This method returns nothing.
  5105. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  5106. */
  5107. convertToFlatShadedMesh(): void;
  5108. /**
  5109. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  5110. * In other words, more vertices, no more indices and a single bigger VBO.
  5111. * This method returns nothing.
  5112. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  5113. *
  5114. */
  5115. convertToUnIndexedMesh(): void;
  5116. /**
  5117. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  5118. * This method returns nothing.
  5119. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  5120. */
  5121. flipFaces(flipNormals?: boolean): void;
  5122. /**
  5123. * Creates a new `InstancedMesh` object from the mesh model.
  5124. * An instance shares the same properties and the same material than its model.
  5125. * Only these properties of each instance can then be set individually :
  5126. * - position
  5127. * - rotation
  5128. * - rotationQuaternion
  5129. * - setPivotMatrix
  5130. * - scaling
  5131. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  5132. * Warning : this method is not supported for `Line` mesh and `LineSystem`
  5133. */
  5134. createInstance(name: string): InstancedMesh;
  5135. /**
  5136. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  5137. * After this call, all the mesh instances have the same submeshes than the current mesh.
  5138. * This method returns nothing.
  5139. */
  5140. synchronizeInstances(): void;
  5141. /**
  5142. * Simplify the mesh according to the given array of settings.
  5143. * Function will return immediately and will simplify async. It returns nothing.
  5144. * @param settings a collection of simplification settings.
  5145. * @param parallelProcessing should all levels calculate parallel or one after the other.
  5146. * @param type the type of simplification to run.
  5147. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  5148. */
  5149. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
  5150. /**
  5151. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  5152. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  5153. * This should be used together with the simplification to avoid disappearing triangles.
  5154. * @param successCallback an optional success callback to be called after the optimization finished.
  5155. */
  5156. optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
  5157. /**
  5158. * Returns a new `Mesh` object what is a deep copy of the passed mesh.
  5159. * The parameter `parsedMesh` is the mesh to be copied.
  5160. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  5161. */
  5162. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  5163. /**
  5164. * Creates a ribbon mesh.
  5165. * Please consider using the same method from the `MeshBuilder` class instead.
  5166. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5167. *
  5168. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  5169. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  5170. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  5171. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  5172. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  5173. * It's the offset to join together the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  5174. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  5175. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5176. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5177. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5178. */
  5179. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  5180. /**
  5181. * Creates a plane polygonal mesh. By default, this is a disc.
  5182. * Please consider using the same method from the `MeshBuilder` class instead.
  5183. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  5184. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  5185. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5186. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5187. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5188. */
  5189. static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5190. /**
  5191. * Creates a box mesh.
  5192. * Please consider using the same method from the `MeshBuilder` class instead.
  5193. * The parameter `size` sets the size (float) of each box side (default 1).
  5194. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5195. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5196. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5197. */
  5198. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5199. /**
  5200. * Creates a sphere mesh.
  5201. * Please consider using the same method from the `MeshBuilder` class instead.
  5202. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  5203. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  5204. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5205. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5206. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5207. */
  5208. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5209. /**
  5210. * Creates a cylinder or a cone mesh.
  5211. * Please consider using the same method from the `MeshBuilder` class instead.
  5212. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  5213. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  5214. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  5215. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  5216. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  5217. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5218. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5219. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5220. */
  5221. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
  5222. /**
  5223. * Creates a torus mesh.
  5224. * Please consider using the same method from the `MeshBuilder` class instead.
  5225. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  5226. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  5227. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  5228. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5229. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5230. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5231. */
  5232. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5233. /**
  5234. * Creates a torus knot mesh.
  5235. * Please consider using the same method from the `MeshBuilder` class instead.
  5236. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  5237. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  5238. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  5239. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  5240. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5241. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5242. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5243. */
  5244. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5245. /**
  5246. * Creates a line mesh.
  5247. * Please consider using the same method from the `MeshBuilder` class instead.
  5248. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  5249. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  5250. * The parameter `points` is an array successive Vector3.
  5251. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  5252. * When updating an instance, remember that only point positions can change, not the number of points.
  5253. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5254. */
  5255. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  5256. /**
  5257. * Creates a dashed line mesh.
  5258. * Please consider using the same method from the `MeshBuilder` class instead.
  5259. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  5260. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  5261. * The parameter `points` is an array successive Vector3.
  5262. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  5263. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  5264. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  5265. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  5266. * When updating an instance, remember that only point positions can change, not the number of points.
  5267. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5268. */
  5269. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  5270. /**
  5271. * Creates an extruded shape mesh.
  5272. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5273. * Please consider using the same method from the `MeshBuilder` class instead.
  5274. *
  5275. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  5276. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  5277. * extruded along the Z axis.
  5278. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  5279. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  5280. * The parameter `scale` (float, default 1) is the value to scale the shape.
  5281. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5282. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  5283. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  5284. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5285. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5286. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5287. */
  5288. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  5289. /**
  5290. * Creates an custom extruded shape mesh.
  5291. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5292. * Please consider using the same method from the `MeshBuilder` class instead.
  5293. *
  5294. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  5295. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  5296. * extruded along the Z axis.
  5297. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  5298. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  5299. * and the distance of this point from the begining of the path :
  5300. * ```rotationFunction = function(i, distance) {
  5301. * // do things
  5302. * return rotationValue; }```
  5303. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  5304. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  5305. * and the distance of this point from the begining of the path :
  5306. * ````scaleFunction = function(i, distance) {
  5307. * // do things
  5308. * return scaleValue;}```
  5309. * It must returns a float value that will be the scale value applied to the shape on each path point.
  5310. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  5311. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  5312. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5313. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  5314. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  5315. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5316. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5317. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5318. */
  5319. 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;
  5320. /**
  5321. * Creates lathe mesh.
  5322. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  5323. * Please consider using the same method from the `MeshBuilder` class instead.
  5324. *
  5325. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  5326. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  5327. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  5328. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  5329. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5330. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5331. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5332. */
  5333. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5334. /**
  5335. * Creates a plane mesh.
  5336. * Please consider using the same method from the `MeshBuilder` class instead.
  5337. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  5338. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5339. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5340. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5341. */
  5342. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  5343. /**
  5344. * Creates a ground mesh.
  5345. * Please consider using the same method from the `MeshBuilder` class instead.
  5346. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  5347. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  5348. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5349. */
  5350. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  5351. /**
  5352. * Creates a tiled ground mesh.
  5353. * Please consider using the same method from the `MeshBuilder` class instead.
  5354. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  5355. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  5356. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  5357. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  5358. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  5359. * numbers of subdivisions on the ground width and height of each tile.
  5360. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5361. */
  5362. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  5363. w: number;
  5364. h: number;
  5365. }, precision: {
  5366. w: number;
  5367. h: number;
  5368. }, scene: Scene, updatable?: boolean): Mesh;
  5369. /**
  5370. * Creates a ground mesh from a height map.
  5371. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  5372. * Please consider using the same method from the `MeshBuilder` class instead.
  5373. * The parameter `url` sets the URL of the height map image resource.
  5374. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  5375. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  5376. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  5377. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  5378. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  5379. * This function is passed the newly built mesh : ```function(mesh) { // do things
  5380. * return; }```
  5381. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5382. */
  5383. 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;
  5384. /**
  5385. * Creates a tube mesh.
  5386. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5387. *
  5388. * Please consider using the same method from the `MeshBuilder` class instead.
  5389. * The parameter `path` is a required array of successive `Vector3`. It is the curve used as the axis of the tube.
  5390. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  5391. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  5392. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  5393. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  5394. * It must return a radius value (positive float) :
  5395. * ```var radiusFunction = function(i, distance) {
  5396. * // do things
  5397. * return radius; }```
  5398. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5399. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  5400. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5401. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5402. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5403. */
  5404. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  5405. (i: number, distance: number): number;
  5406. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  5407. /**
  5408. * Creates a polyhedron mesh.
  5409. *
  5410. * Please consider using the same method from the `MeshBuilder` class instead.
  5411. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  5412. * to choose the wanted type.
  5413. * The parameter `size` (positive float, default 1) sets the polygon size.
  5414. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  5415. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  5416. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  5417. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (`Color4`, default `(1, 1, 1, 1)`) and faceUV (`Vector4`, default `(0, 0, 1, 1)`).
  5418. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  5419. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  5420. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5421. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5422. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5423. */
  5424. static CreatePolyhedron(name: string, options: {
  5425. type?: number;
  5426. size?: number;
  5427. sizeX?: number;
  5428. sizeY?: number;
  5429. sizeZ?: number;
  5430. custom?: any;
  5431. faceUV?: Vector4[];
  5432. faceColors?: Color4[];
  5433. updatable?: boolean;
  5434. sideOrientation?: number;
  5435. }, scene: Scene): Mesh;
  5436. /**
  5437. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  5438. * Please consider using the same method from the `MeshBuilder` class instead.
  5439. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  5440. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  5441. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  5442. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  5443. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5444. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5445. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5446. */
  5447. static CreateIcoSphere(name: string, options: {
  5448. radius?: number;
  5449. flat?: boolean;
  5450. subdivisions?: number;
  5451. sideOrientation?: number;
  5452. updatable?: boolean;
  5453. }, scene: Scene): Mesh;
  5454. /**
  5455. * Creates a decal mesh.
  5456. * Please consider using the same method from the `MeshBuilder` class instead.
  5457. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  5458. * The parameter `position` (`Vector3`, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  5459. * The parameter `normal` (`Vector3`, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  5460. * The parameter `size` (`Vector3`, default `(1, 1, 1)`) sets the decal scaling.
  5461. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  5462. */
  5463. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  5464. /**
  5465. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  5466. */
  5467. setPositionsForCPUSkinning(): Float32Array;
  5468. /**
  5469. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  5470. */
  5471. setNormalsForCPUSkinning(): Float32Array;
  5472. /**
  5473. * Update the vertex buffers by applying transformation from the bones
  5474. * @param {skeleton} skeleton to apply
  5475. */
  5476. applySkeleton(skeleton: Skeleton): Mesh;
  5477. /**
  5478. * Returns an object `{min: Vector3, max: Vector3}`
  5479. * This min and max `Vector3` are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  5480. */
  5481. static MinMax(meshes: AbstractMesh[]): {
  5482. min: Vector3;
  5483. max: Vector3;
  5484. };
  5485. /**
  5486. * Returns a `Vector3`, the center of the `{min: Vector3, max: Vector3}` or the center of MinMax vector3 computed from a mesh array.
  5487. */
  5488. static Center(meshesOrMinMaxVector: any): Vector3;
  5489. /**
  5490. * Merge the array of meshes into a single mesh for performance reasons.
  5491. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  5492. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  5493. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  5494. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  5495. */
  5496. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
  5497. }
  5498. }
  5499. declare module BABYLON {
  5500. interface IGetSetVerticesData {
  5501. isVerticesDataPresent(kind: string): boolean;
  5502. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array;
  5503. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  5504. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  5505. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  5506. setIndices(indices: number[] | Int32Array): void;
  5507. }
  5508. class VertexData {
  5509. positions: number[] | Float32Array;
  5510. normals: number[] | Float32Array;
  5511. uvs: number[] | Float32Array;
  5512. uvs2: number[] | Float32Array;
  5513. uvs3: number[] | Float32Array;
  5514. uvs4: number[] | Float32Array;
  5515. uvs5: number[] | Float32Array;
  5516. uvs6: number[] | Float32Array;
  5517. colors: number[] | Float32Array;
  5518. matricesIndices: number[] | Float32Array;
  5519. matricesWeights: number[] | Float32Array;
  5520. matricesIndicesExtra: number[] | Float32Array;
  5521. matricesWeightsExtra: number[] | Float32Array;
  5522. indices: number[] | Int32Array;
  5523. set(data: number[] | Float32Array, kind: string): void;
  5524. applyToMesh(mesh: Mesh, updatable?: boolean): void;
  5525. applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  5526. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  5527. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  5528. private _applyTo(meshOrGeometry, updatable?);
  5529. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  5530. transform(matrix: Matrix): void;
  5531. merge(other: VertexData): void;
  5532. private _mergeElement(source, other);
  5533. serialize(): any;
  5534. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
  5535. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
  5536. private static _ExtractFrom(meshOrGeometry, copyWhenShared?);
  5537. static CreateRibbon(options: {
  5538. pathArray: Vector3[][];
  5539. closeArray?: boolean;
  5540. closePath?: boolean;
  5541. offset?: number;
  5542. sideOrientation?: number;
  5543. }): VertexData;
  5544. static CreateBox(options: {
  5545. size?: number;
  5546. width?: number;
  5547. height?: number;
  5548. depth?: number;
  5549. faceUV?: Vector4[];
  5550. faceColors?: Color4[];
  5551. sideOrientation?: number;
  5552. }): VertexData;
  5553. static CreateSphere(options: {
  5554. segments?: number;
  5555. diameter?: number;
  5556. diameterX?: number;
  5557. diameterY?: number;
  5558. diameterZ?: number;
  5559. arc?: number;
  5560. slice?: number;
  5561. sideOrientation?: number;
  5562. }): VertexData;
  5563. static CreateCylinder(options: {
  5564. height?: number;
  5565. diameterTop?: number;
  5566. diameterBottom?: number;
  5567. diameter?: number;
  5568. tessellation?: number;
  5569. subdivisions?: number;
  5570. arc?: number;
  5571. faceColors?: Color4[];
  5572. faceUV?: Vector4[];
  5573. hasRings?: boolean;
  5574. enclose?: boolean;
  5575. sideOrientation?: number;
  5576. }): VertexData;
  5577. static CreateTorus(options: {
  5578. diameter?: number;
  5579. thickness?: number;
  5580. tessellation?: number;
  5581. sideOrientation?: number;
  5582. }): VertexData;
  5583. static CreateLineSystem(options: {
  5584. lines: Vector3[][];
  5585. }): VertexData;
  5586. static CreateDashedLines(options: {
  5587. points: Vector3[];
  5588. dashSize?: number;
  5589. gapSize?: number;
  5590. dashNb?: number;
  5591. }): VertexData;
  5592. static CreateGround(options: {
  5593. width?: number;
  5594. height?: number;
  5595. subdivisions?: number;
  5596. }): VertexData;
  5597. static CreateTiledGround(options: {
  5598. xmin: number;
  5599. zmin: number;
  5600. xmax: number;
  5601. zmax: number;
  5602. subdivisions?: {
  5603. w: number;
  5604. h: number;
  5605. };
  5606. precision?: {
  5607. w: number;
  5608. h: number;
  5609. };
  5610. }): VertexData;
  5611. static CreateGroundFromHeightMap(options: {
  5612. width: number;
  5613. height: number;
  5614. subdivisions: number;
  5615. minHeight: number;
  5616. maxHeight: number;
  5617. buffer: Uint8Array;
  5618. bufferWidth: number;
  5619. bufferHeight: number;
  5620. }): VertexData;
  5621. static CreatePlane(options: {
  5622. size?: number;
  5623. width?: number;
  5624. height?: number;
  5625. sideOrientation?: number;
  5626. }): VertexData;
  5627. static CreateDisc(options: {
  5628. radius?: number;
  5629. tessellation?: number;
  5630. arc?: number;
  5631. sideOrientation?: number;
  5632. }): VertexData;
  5633. static CreateIcoSphere(options: {
  5634. radius?: number;
  5635. radiusX?: number;
  5636. radiusY?: number;
  5637. radiusZ?: number;
  5638. flat?: boolean;
  5639. subdivisions?: number;
  5640. sideOrientation?: number;
  5641. }): VertexData;
  5642. static CreatePolyhedron(options: {
  5643. type?: number;
  5644. size?: number;
  5645. sizeX?: number;
  5646. sizeY?: number;
  5647. sizeZ?: number;
  5648. custom?: any;
  5649. faceUV?: Vector4[];
  5650. faceColors?: Color4[];
  5651. flat?: boolean;
  5652. sideOrientation?: number;
  5653. }): VertexData;
  5654. static CreateTorusKnot(options: {
  5655. radius?: number;
  5656. tube?: number;
  5657. radialSegments?: number;
  5658. tubularSegments?: number;
  5659. p?: number;
  5660. q?: number;
  5661. sideOrientation?: number;
  5662. }): VertexData;
  5663. /**
  5664. * @param {any} - positions (number[] or Float32Array)
  5665. * @param {any} - indices (number[] or Uint16Array)
  5666. * @param {any} - normals (number[] or Float32Array)
  5667. */
  5668. static ComputeNormals(positions: any, indices: any, normals: any): void;
  5669. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs);
  5670. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  5671. }
  5672. }
  5673. declare module BABYLON {
  5674. class MeshBuilder {
  5675. /**
  5676. * Creates a box mesh.
  5677. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  5678. * The parameter `size` sets the size (float) of each box side (default 1).
  5679. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  5680. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 `Color3` elements) and `faceUV` (an array of 6 `Vector4` elements).
  5681. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  5682. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5683. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5684. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5685. */
  5686. static CreateBox(name: string, options: {
  5687. size?: number;
  5688. width?: number;
  5689. height?: number;
  5690. depth?: number;
  5691. faceUV?: Vector4[];
  5692. faceColors?: Color4[];
  5693. sideOrientation?: number;
  5694. updatable?: boolean;
  5695. }, scene: Scene): Mesh;
  5696. /**
  5697. * Creates a sphere mesh.
  5698. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  5699. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  5700. * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value than `diameter`).
  5701. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  5702. * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  5703. * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
  5704. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5705. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5706. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5707. */
  5708. static CreateSphere(name: string, options: {
  5709. segments?: number;
  5710. diameter?: number;
  5711. diameterX?: number;
  5712. diameterY?: number;
  5713. diameterZ?: number;
  5714. arc?: number;
  5715. slice?: number;
  5716. sideOrientation?: number;
  5717. updatable?: boolean;
  5718. }, scene: any): Mesh;
  5719. /**
  5720. * Creates a plane polygonal mesh. By default, this is a disc.
  5721. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  5722. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  5723. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  5724. * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
  5725. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5726. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5727. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5728. */
  5729. static CreateDisc(name: string, options: {
  5730. radius?: number;
  5731. tessellation?: number;
  5732. arc?: number;
  5733. updatable?: boolean;
  5734. sideOrientation?: number;
  5735. }, scene: Scene): Mesh;
  5736. /**
  5737. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  5738. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  5739. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  5740. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  5741. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  5742. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  5743. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5744. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5745. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5746. */
  5747. static CreateIcoSphere(name: string, options: {
  5748. radius?: number;
  5749. radiusX?: number;
  5750. radiusY?: number;
  5751. radiusZ?: number;
  5752. flat?: boolean;
  5753. subdivisions?: number;
  5754. sideOrientation?: number;
  5755. updatable?: boolean;
  5756. }, scene: Scene): Mesh;
  5757. /**
  5758. * Creates a ribbon mesh.
  5759. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5760. *
  5761. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  5762. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  5763. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  5764. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  5765. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  5766. * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  5767. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  5768. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5769. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5770. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5771. */
  5772. static CreateRibbon(name: string, options: {
  5773. pathArray: Vector3[][];
  5774. closeArray?: boolean;
  5775. closePath?: boolean;
  5776. offset?: number;
  5777. updatable?: boolean;
  5778. sideOrientation?: number;
  5779. instance?: Mesh;
  5780. }, scene?: Scene): Mesh;
  5781. /**
  5782. * Creates a cylinder or a cone mesh.
  5783. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  5784. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  5785. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  5786. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  5787. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  5788. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  5789. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  5790. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  5791. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  5792. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n `Color3` elements) and `faceUV` (an array of n `Vector4` elements).
  5793. * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
  5794. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  5795. * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
  5796. * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
  5797. * If `enclose` is false, a ring surface is one element.
  5798. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  5799. * Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
  5800. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5801. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5802. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5803. */
  5804. static CreateCylinder(name: string, options: {
  5805. height?: number;
  5806. diameterTop?: number;
  5807. diameterBottom?: number;
  5808. diameter?: number;
  5809. tessellation?: number;
  5810. subdivisions?: number;
  5811. arc?: number;
  5812. faceColors?: Color4[];
  5813. faceUV?: Vector4[];
  5814. updatable?: boolean;
  5815. hasRings?: boolean;
  5816. enclose?: boolean;
  5817. sideOrientation?: number;
  5818. }, scene: any): Mesh;
  5819. /**
  5820. * Creates a torus mesh.
  5821. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  5822. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  5823. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  5824. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  5825. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5826. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5827. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5828. */
  5829. static CreateTorus(name: string, options: {
  5830. diameter?: number;
  5831. thickness?: number;
  5832. tessellation?: number;
  5833. updatable?: boolean;
  5834. sideOrientation?: number;
  5835. }, scene: any): Mesh;
  5836. /**
  5837. * Creates a torus knot mesh.
  5838. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  5839. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  5840. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  5841. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  5842. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  5843. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5844. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5845. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5846. */
  5847. static CreateTorusKnot(name: string, options: {
  5848. radius?: number;
  5849. tube?: number;
  5850. radialSegments?: number;
  5851. tubularSegments?: number;
  5852. p?: number;
  5853. q?: number;
  5854. updatable?: boolean;
  5855. sideOrientation?: number;
  5856. }, scene: any): Mesh;
  5857. /**
  5858. * Creates a line system mesh.
  5859. * A line system is a pool of many lines gathered in a single mesh.
  5860. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  5861. * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter.
  5862. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  5863. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  5864. * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
  5865. * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  5866. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  5867. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5868. */
  5869. static CreateLineSystem(name: string, options: {
  5870. lines: Vector3[][];
  5871. updatable: boolean;
  5872. instance?: LinesMesh;
  5873. }, scene: Scene): LinesMesh;
  5874. /**
  5875. * Creates a line mesh.
  5876. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  5877. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  5878. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  5879. * The parameter `points` is an array successive Vector3.
  5880. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  5881. * When updating an instance, remember that only point positions can change, not the number of points.
  5882. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5883. */
  5884. static CreateLines(name: string, options: {
  5885. points: Vector3[];
  5886. updatable?: boolean;
  5887. instance?: LinesMesh;
  5888. }, scene: Scene): LinesMesh;
  5889. /**
  5890. * Creates a dashed line mesh.
  5891. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  5892. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  5893. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  5894. * The parameter `points` is an array successive Vector3.
  5895. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  5896. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  5897. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  5898. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  5899. * When updating an instance, remember that only point positions can change, not the number of points.
  5900. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5901. */
  5902. static CreateDashedLines(name: string, options: {
  5903. points: Vector3[];
  5904. dashSize?: number;
  5905. gapSize?: number;
  5906. dashNb?: number;
  5907. updatable?: boolean;
  5908. instance?: LinesMesh;
  5909. }, scene: Scene): LinesMesh;
  5910. /**
  5911. * Creates an extruded shape mesh.
  5912. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5913. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  5914. *
  5915. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  5916. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  5917. * extruded along the Z axis.
  5918. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  5919. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  5920. * The parameter `scale` (float, default 1) is the value to scale the shape.
  5921. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5922. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  5923. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  5924. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5925. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5926. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5927. */
  5928. static ExtrudeShape(name: string, options: {
  5929. shape: Vector3[];
  5930. path: Vector3[];
  5931. scale?: number;
  5932. rotation?: number;
  5933. cap?: number;
  5934. updatable?: boolean;
  5935. sideOrientation?: number;
  5936. instance?: Mesh;
  5937. }, scene: Scene): Mesh;
  5938. /**
  5939. * Creates an custom extruded shape mesh.
  5940. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  5941. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  5942. *
  5943. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  5944. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  5945. * extruded along the Z axis.
  5946. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  5947. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  5948. * and the distance of this point from the begining of the path :
  5949. * ```rotationFunction = function(i, distance) {
  5950. * // do things
  5951. * return rotationValue; }```
  5952. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  5953. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  5954. * and the distance of this point from the begining of the path :
  5955. * ````scaleFunction = function(i, distance) {
  5956. * // do things
  5957. * return scaleValue;}```
  5958. * It must returns a float value that will be the scale value applied to the shape on each path point.
  5959. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  5960. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  5961. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5962. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  5963. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  5964. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5965. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5966. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5967. */
  5968. static ExtrudeShapeCustom(name: string, options: {
  5969. shape: Vector3[];
  5970. path: Vector3[];
  5971. scaleFunction?: any;
  5972. rotationFunction?: any;
  5973. ribbonCloseArray?: boolean;
  5974. ribbonClosePath?: boolean;
  5975. cap?: number;
  5976. updatable?: boolean;
  5977. sideOrientation?: number;
  5978. instance?: Mesh;
  5979. }, scene: Scene): Mesh;
  5980. /**
  5981. * Creates lathe mesh.
  5982. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  5983. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  5984. *
  5985. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  5986. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  5987. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  5988. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  5989. * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
  5990. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  5991. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  5992. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  5993. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  5994. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  5995. */
  5996. static CreateLathe(name: string, options: {
  5997. shape: Vector3[];
  5998. radius?: number;
  5999. tessellation?: number;
  6000. arc?: number;
  6001. closed?: boolean;
  6002. updatable?: boolean;
  6003. sideOrientation?: number;
  6004. cap?: number;
  6005. }, scene: Scene): Mesh;
  6006. /**
  6007. * Creates a plane mesh.
  6008. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  6009. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6010. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  6011. * The parameter `sourcePlane` is a `Plane` instance. It builds a mesh plane from a Math plane.
  6012. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6013. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6014. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6015. */
  6016. static CreatePlane(name: string, options: {
  6017. size?: number;
  6018. width?: number;
  6019. height?: number;
  6020. sideOrientation?: number;
  6021. updatable?: boolean;
  6022. sourcePlane?: Plane;
  6023. }, scene: Scene): Mesh;
  6024. /**
  6025. * Creates a ground mesh.
  6026. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  6027. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6028. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6029. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6030. */
  6031. static CreateGround(name: string, options: {
  6032. width?: number;
  6033. height?: number;
  6034. subdivisions?: number;
  6035. updatable?: boolean;
  6036. }, scene: any): Mesh;
  6037. /**
  6038. * Creates a tiled ground mesh.
  6039. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  6040. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6041. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6042. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6043. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6044. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6045. * numbers of subdivisions on the ground width and height of each tile.
  6046. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6047. */
  6048. static CreateTiledGround(name: string, options: {
  6049. xmin: number;
  6050. zmin: number;
  6051. xmax: number;
  6052. zmax: number;
  6053. subdivisions?: {
  6054. w: number;
  6055. h: number;
  6056. };
  6057. precision?: {
  6058. w: number;
  6059. h: number;
  6060. };
  6061. updatable?: boolean;
  6062. }, scene: Scene): Mesh;
  6063. /**
  6064. * Creates a ground mesh from a height map.
  6065. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6066. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  6067. * The parameter `url` sets the URL of the height map image resource.
  6068. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6069. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6070. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6071. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6072. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  6073. * This function is passed the newly built mesh : ```function(mesh) { // do things
  6074. * return; }```
  6075. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6076. */
  6077. static CreateGroundFromHeightMap(name: string, url: string, options: {
  6078. width?: number;
  6079. height?: number;
  6080. subdivisions?: number;
  6081. minHeight?: number;
  6082. maxHeight?: number;
  6083. updatable?: boolean;
  6084. onReady?: (mesh: GroundMesh) => void;
  6085. }, scene: Scene): GroundMesh;
  6086. /**
  6087. * Creates a tube mesh.
  6088. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6089. *
  6090. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  6091. * The parameter `path` is a required array of successive `Vector3`. It is the curve used as the axis of the tube.
  6092. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6093. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6094. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6095. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  6096. * It must return a radius value (positive float) :
  6097. * ```var radiusFunction = function(i, distance) {
  6098. * // do things
  6099. * return radius; }```
  6100. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  6101. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6102. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  6103. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6104. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6105. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6106. */
  6107. static CreateTube(name: string, options: {
  6108. path: Vector3[];
  6109. radius?: number;
  6110. tessellation?: number;
  6111. radiusFunction?: {
  6112. (i: number, distance: number): number;
  6113. };
  6114. cap?: number;
  6115. arc?: number;
  6116. updatable?: boolean;
  6117. sideOrientation?: number;
  6118. instance?: Mesh;
  6119. }, scene: Scene): Mesh;
  6120. /**
  6121. * Creates a polyhedron mesh.
  6122. *
  6123. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  6124. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  6125. * to choose the wanted type.
  6126. * The parameter `size` (positive float, default 1) sets the polygon size.
  6127. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  6128. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  6129. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  6130. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (`Color4`, default `(1, 1, 1, 1)`) and faceUV (`Vector4`, default `(0, 0, 1, 1)`).
  6131. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  6132. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  6133. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6134. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6135. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6136. */
  6137. static CreatePolyhedron(name: string, options: {
  6138. type?: number;
  6139. size?: number;
  6140. sizeX?: number;
  6141. sizeY?: number;
  6142. sizeZ?: number;
  6143. custom?: any;
  6144. faceUV?: Vector4[];
  6145. faceColors?: Color4[];
  6146. flat?: boolean;
  6147. updatable?: boolean;
  6148. sideOrientation?: number;
  6149. }, scene: Scene): Mesh;
  6150. /**
  6151. * Creates a decal mesh.
  6152. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  6153. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  6154. * The parameter `position` (`Vector3`, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  6155. * The parameter `normal` (`Vector3`, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  6156. * The parameter `size` (`Vector3`, default `(1, 1, 1)`) sets the decal scaling.
  6157. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  6158. */
  6159. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  6160. position?: Vector3;
  6161. normal?: Vector3;
  6162. size?: Vector3;
  6163. angle?: number;
  6164. }): Mesh;
  6165. private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance);
  6166. }
  6167. }
  6168. declare module BABYLON.Internals {
  6169. class MeshLODLevel {
  6170. distance: number;
  6171. mesh: Mesh;
  6172. constructor(distance: number, mesh: Mesh);
  6173. }
  6174. }
  6175. declare module BABYLON {
  6176. /**
  6177. * A simplifier interface for future simplification implementations.
  6178. */
  6179. interface ISimplifier {
  6180. /**
  6181. * Simplification of a given mesh according to the given settings.
  6182. * Since this requires computation, it is assumed that the function runs async.
  6183. * @param settings The settings of the simplification, including quality and distance
  6184. * @param successCallback A callback that will be called after the mesh was simplified.
  6185. * @param errorCallback in case of an error, this callback will be called. optional.
  6186. */
  6187. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  6188. }
  6189. /**
  6190. * Expected simplification settings.
  6191. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  6192. */
  6193. interface ISimplificationSettings {
  6194. quality: number;
  6195. distance: number;
  6196. optimizeMesh?: boolean;
  6197. }
  6198. class SimplificationSettings implements ISimplificationSettings {
  6199. quality: number;
  6200. distance: number;
  6201. optimizeMesh: boolean;
  6202. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  6203. }
  6204. interface ISimplificationTask {
  6205. settings: Array<ISimplificationSettings>;
  6206. simplificationType: SimplificationType;
  6207. mesh: Mesh;
  6208. successCallback?: () => void;
  6209. parallelProcessing: boolean;
  6210. }
  6211. class SimplificationQueue {
  6212. private _simplificationArray;
  6213. running: any;
  6214. constructor();
  6215. addTask(task: ISimplificationTask): void;
  6216. executeNext(): void;
  6217. runSimplification(task: ISimplificationTask): void;
  6218. private getSimplifier(task);
  6219. }
  6220. /**
  6221. * The implemented types of simplification.
  6222. * At the moment only Quadratic Error Decimation is implemented.
  6223. */
  6224. enum SimplificationType {
  6225. QUADRATIC = 0,
  6226. }
  6227. class DecimationTriangle {
  6228. vertices: Array<DecimationVertex>;
  6229. normal: Vector3;
  6230. error: Array<number>;
  6231. deleted: boolean;
  6232. isDirty: boolean;
  6233. borderFactor: number;
  6234. deletePending: boolean;
  6235. originalOffset: number;
  6236. constructor(vertices: Array<DecimationVertex>);
  6237. }
  6238. class DecimationVertex {
  6239. position: Vector3;
  6240. id: any;
  6241. q: QuadraticMatrix;
  6242. isBorder: boolean;
  6243. triangleStart: number;
  6244. triangleCount: number;
  6245. originalOffsets: Array<number>;
  6246. constructor(position: Vector3, id: any);
  6247. updatePosition(newPosition: Vector3): void;
  6248. }
  6249. class QuadraticMatrix {
  6250. data: Array<number>;
  6251. constructor(data?: Array<number>);
  6252. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  6253. addInPlace(matrix: QuadraticMatrix): void;
  6254. addArrayInPlace(data: Array<number>): void;
  6255. add(matrix: QuadraticMatrix): QuadraticMatrix;
  6256. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  6257. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  6258. }
  6259. class Reference {
  6260. vertexId: number;
  6261. triangleId: number;
  6262. constructor(vertexId: number, triangleId: number);
  6263. }
  6264. /**
  6265. * An implementation of the Quadratic Error simplification algorithm.
  6266. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  6267. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  6268. * @author RaananW
  6269. */
  6270. class QuadraticErrorSimplification implements ISimplifier {
  6271. private _mesh;
  6272. private triangles;
  6273. private vertices;
  6274. private references;
  6275. private initialized;
  6276. private _reconstructedMesh;
  6277. syncIterations: number;
  6278. aggressiveness: number;
  6279. decimationIterations: number;
  6280. boundingBoxEpsilon: number;
  6281. constructor(_mesh: Mesh);
  6282. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  6283. private isTriangleOnBoundingBox(triangle);
  6284. private runDecimation(settings, submeshIndex, successCallback);
  6285. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  6286. private init(callback);
  6287. private reconstructMesh(submeshIndex);
  6288. private initDecimatedMesh();
  6289. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  6290. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  6291. private identifyBorder();
  6292. private updateMesh(identifyBorders?);
  6293. private vertexError(q, point);
  6294. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  6295. }
  6296. }
  6297. declare module BABYLON {
  6298. class Polygon {
  6299. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  6300. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  6301. static Parse(input: string): Vector2[];
  6302. static StartingAt(x: number, y: number): Path2;
  6303. }
  6304. class PolygonMeshBuilder {
  6305. private _swctx;
  6306. private _points;
  6307. private _outlinepoints;
  6308. private _holes;
  6309. private _name;
  6310. private _scene;
  6311. constructor(name: string, contours: Path2, scene: Scene);
  6312. constructor(name: string, contours: Vector2[], scene: Scene);
  6313. addHole(hole: Vector2[]): PolygonMeshBuilder;
  6314. build(updatable?: boolean, depth?: number): Mesh;
  6315. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  6316. }
  6317. }
  6318. declare module BABYLON {
  6319. class SubMesh {
  6320. materialIndex: number;
  6321. verticesStart: number;
  6322. verticesCount: number;
  6323. indexStart: any;
  6324. indexCount: number;
  6325. linesIndexCount: number;
  6326. private _mesh;
  6327. private _renderingMesh;
  6328. private _boundingInfo;
  6329. private _linesIndexBuffer;
  6330. _lastColliderWorldVertices: Vector3[];
  6331. _trianglePlanes: Plane[];
  6332. _lastColliderTransformMatrix: Matrix;
  6333. _renderId: number;
  6334. _alphaIndex: number;
  6335. _distanceToCamera: number;
  6336. _id: number;
  6337. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  6338. IsGlobal: boolean;
  6339. getBoundingInfo(): BoundingInfo;
  6340. getMesh(): AbstractMesh;
  6341. getRenderingMesh(): Mesh;
  6342. getMaterial(): Material;
  6343. refreshBoundingInfo(): void;
  6344. _checkCollision(collider: Collider): boolean;
  6345. updateBoundingInfo(world: Matrix): void;
  6346. isInFrustum(frustumPlanes: Plane[]): boolean;
  6347. render(enableAlphaMode: boolean): void;
  6348. getLinesIndexBuffer(indices: number[] | Int32Array, engine: any): WebGLBuffer;
  6349. canIntersects(ray: Ray): boolean;
  6350. intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo;
  6351. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  6352. dispose(): void;
  6353. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  6354. }
  6355. }
  6356. declare module BABYLON {
  6357. class VertexBuffer {
  6358. private _mesh;
  6359. private _engine;
  6360. private _buffer;
  6361. private _data;
  6362. private _updatable;
  6363. private _kind;
  6364. private _strideSize;
  6365. constructor(engine: any, data: number[] | Float32Array, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number);
  6366. isUpdatable(): boolean;
  6367. getData(): number[] | Float32Array;
  6368. getBuffer(): WebGLBuffer;
  6369. getStrideSize(): number;
  6370. create(data?: number[] | Float32Array): void;
  6371. update(data: number[] | Float32Array): void;
  6372. updateDirectly(data: Float32Array, offset: number): void;
  6373. dispose(): void;
  6374. private static _PositionKind;
  6375. private static _NormalKind;
  6376. private static _UVKind;
  6377. private static _UV2Kind;
  6378. private static _UV3Kind;
  6379. private static _UV4Kind;
  6380. private static _UV5Kind;
  6381. private static _UV6Kind;
  6382. private static _ColorKind;
  6383. private static _MatricesIndicesKind;
  6384. private static _MatricesWeightsKind;
  6385. private static _MatricesIndicesExtraKind;
  6386. private static _MatricesWeightsExtraKind;
  6387. static PositionKind: string;
  6388. static NormalKind: string;
  6389. static UVKind: string;
  6390. static UV2Kind: string;
  6391. static UV3Kind: string;
  6392. static UV4Kind: string;
  6393. static UV5Kind: string;
  6394. static UV6Kind: string;
  6395. static ColorKind: string;
  6396. static MatricesIndicesKind: string;
  6397. static MatricesWeightsKind: string;
  6398. static MatricesIndicesExtraKind: string;
  6399. static MatricesWeightsExtraKind: string;
  6400. }
  6401. }
  6402. declare module BABYLON {
  6403. class Particle {
  6404. position: Vector3;
  6405. direction: Vector3;
  6406. color: Color4;
  6407. colorStep: Color4;
  6408. lifeTime: number;
  6409. age: number;
  6410. size: number;
  6411. angle: number;
  6412. angularSpeed: number;
  6413. copyTo(other: Particle): void;
  6414. }
  6415. }
  6416. declare module BABYLON {
  6417. class ParticleSystem implements IDisposable, IAnimatable {
  6418. name: string;
  6419. static BLENDMODE_ONEONE: number;
  6420. static BLENDMODE_STANDARD: number;
  6421. animations: Animation[];
  6422. id: string;
  6423. renderingGroupId: number;
  6424. emitter: any;
  6425. emitRate: number;
  6426. manualEmitCount: number;
  6427. updateSpeed: number;
  6428. targetStopDuration: number;
  6429. disposeOnStop: boolean;
  6430. minEmitPower: number;
  6431. maxEmitPower: number;
  6432. minLifeTime: number;
  6433. maxLifeTime: number;
  6434. minSize: number;
  6435. maxSize: number;
  6436. minAngularSpeed: number;
  6437. maxAngularSpeed: number;
  6438. particleTexture: Texture;
  6439. layerMask: number;
  6440. onDispose: () => void;
  6441. updateFunction: (particles: Particle[]) => void;
  6442. blendMode: number;
  6443. forceDepthWrite: boolean;
  6444. gravity: Vector3;
  6445. direction1: Vector3;
  6446. direction2: Vector3;
  6447. minEmitBox: Vector3;
  6448. maxEmitBox: Vector3;
  6449. color1: Color4;
  6450. color2: Color4;
  6451. colorDead: Color4;
  6452. textureMask: Color4;
  6453. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  6454. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  6455. private particles;
  6456. private _capacity;
  6457. private _scene;
  6458. private _vertexDeclaration;
  6459. private _vertexStrideSize;
  6460. private _stockParticles;
  6461. private _newPartsExcess;
  6462. private _vertexBuffer;
  6463. private _indexBuffer;
  6464. private _vertices;
  6465. private _effect;
  6466. private _customEffect;
  6467. private _cachedDefines;
  6468. private _scaledColorStep;
  6469. private _colorDiff;
  6470. private _scaledDirection;
  6471. private _scaledGravity;
  6472. private _currentRenderId;
  6473. private _alive;
  6474. private _started;
  6475. private _stopped;
  6476. private _actualFrame;
  6477. private _scaledUpdateSpeed;
  6478. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  6479. recycleParticle(particle: Particle): void;
  6480. getCapacity(): number;
  6481. isAlive(): boolean;
  6482. isStarted(): boolean;
  6483. start(): void;
  6484. stop(): void;
  6485. _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  6486. private _update(newParticles);
  6487. private _getEffect();
  6488. animate(): void;
  6489. render(): number;
  6490. dispose(): void;
  6491. clone(name: string, newEmitter: any): ParticleSystem;
  6492. serialize(): any;
  6493. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  6494. }
  6495. }
  6496. declare module BABYLON {
  6497. class SolidParticle {
  6498. idx: number;
  6499. color: Color4;
  6500. position: Vector3;
  6501. rotation: Vector3;
  6502. rotationQuaternion: Quaternion;
  6503. scaling: Vector3;
  6504. uvs: Vector4;
  6505. velocity: Vector3;
  6506. alive: boolean;
  6507. _pos: number;
  6508. _model: ModelShape;
  6509. shapeId: number;
  6510. idxInShape: number;
  6511. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number);
  6512. scale: Vector3;
  6513. quaternion: Quaternion;
  6514. }
  6515. class ModelShape {
  6516. shapeID: number;
  6517. _shape: Vector3[];
  6518. _shapeUV: number[];
  6519. _positionFunction: (particle: SolidParticle, i: number, s: number) => void;
  6520. _vertexFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void;
  6521. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  6522. }
  6523. }
  6524. declare module BABYLON {
  6525. /**
  6526. * Full documentation here : http://doc.babylonjs.com/tutorials/Solid_Particle_System
  6527. */
  6528. class SolidParticleSystem implements IDisposable {
  6529. /**
  6530. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  6531. * Example : var p = SPS.particles[i];
  6532. */
  6533. particles: SolidParticle[];
  6534. /**
  6535. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  6536. */
  6537. nbParticles: number;
  6538. /**
  6539. * If the particles must ever face the camera (default false). Useful for planar particles.
  6540. */
  6541. billboard: boolean;
  6542. /**
  6543. * This a counter ofr your own usage. It's not set by any SPS functions.
  6544. */
  6545. counter: number;
  6546. /**
  6547. * The SPS name. This name is also given to the underlying mesh.
  6548. */
  6549. name: string;
  6550. /**
  6551. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  6552. */
  6553. mesh: Mesh;
  6554. /**
  6555. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  6556. * Please read : http://doc.babylonjs.com/tutorials/Solid_Particle_System#garbage-collector-concerns
  6557. */
  6558. vars: any;
  6559. /**
  6560. * This array is populated when the SPS is set as 'pickable'.
  6561. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  6562. * Each element of this array is an object `{idx: int, faceId: int}`.
  6563. * `idx` is the picked particle index in the `SPS.particles` array
  6564. * `faceId` is the picked face index counted within this particle.
  6565. * Please read : http://doc.babylonjs.com/tutorials/Solid_Particle_System#pickable-particles
  6566. */
  6567. pickedParticles: {
  6568. idx: number;
  6569. faceId: number;
  6570. }[];
  6571. private _scene;
  6572. private _positions;
  6573. private _indices;
  6574. private _normals;
  6575. private _colors;
  6576. private _uvs;
  6577. private _positions32;
  6578. private _normals32;
  6579. private _fixedNormal32;
  6580. private _colors32;
  6581. private _uvs32;
  6582. private _index;
  6583. private _updatable;
  6584. private _pickable;
  6585. private _isVisibilityBoxLocked;
  6586. private _alwaysVisible;
  6587. private _shapeCounter;
  6588. private _copy;
  6589. private _shape;
  6590. private _shapeUV;
  6591. private _color;
  6592. private _computeParticleColor;
  6593. private _computeParticleTexture;
  6594. private _computeParticleRotation;
  6595. private _computeParticleVertex;
  6596. private _computeBoundingBox;
  6597. private _cam_axisZ;
  6598. private _cam_axisY;
  6599. private _cam_axisX;
  6600. private _axisX;
  6601. private _axisY;
  6602. private _axisZ;
  6603. private _camera;
  6604. private _particle;
  6605. private _fakeCamPos;
  6606. private _rotMatrix;
  6607. private _invertMatrix;
  6608. private _rotated;
  6609. private _quaternion;
  6610. private _vertex;
  6611. private _normal;
  6612. private _yaw;
  6613. private _pitch;
  6614. private _roll;
  6615. private _halfroll;
  6616. private _halfpitch;
  6617. private _halfyaw;
  6618. private _sinRoll;
  6619. private _cosRoll;
  6620. private _sinPitch;
  6621. private _cosPitch;
  6622. private _sinYaw;
  6623. private _cosYaw;
  6624. private _w;
  6625. private _minimum;
  6626. private _maximum;
  6627. /**
  6628. * Creates a SPS (Solid Particle System) object.
  6629. * `name` (String) is the SPS name, this will be the underlying mesh name.
  6630. * `scene` (Scene) is the scene in which the SPS is added.
  6631. * `updatableè (default true) : if the SPS must be updatable or immutable.
  6632. * `isPickable` (default false) : if the solid particles must be pickable.
  6633. */
  6634. constructor(name: string, scene: Scene, options?: {
  6635. updatable?: boolean;
  6636. isPickable?: boolean;
  6637. });
  6638. /**
  6639. * Builds the SPS underlying mesh. Returns a standard Mesh.
  6640. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  6641. */
  6642. buildMesh(): Mesh;
  6643. /**
  6644. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  6645. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  6646. * Thus the particles generated from `digest()` have their property `position` set yet.
  6647. * `mesh` (`Mesh`) is the mesh to be digested
  6648. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  6649. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  6650. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  6651. */
  6652. digest(mesh: Mesh, options?: {
  6653. facetNb?: number;
  6654. number?: number;
  6655. delta?: number;
  6656. }): SolidParticleSystem;
  6657. private _resetCopy();
  6658. private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, idx, idxInShape, options);
  6659. private _posToShape(positions);
  6660. private _uvsToShapeUV(uvs);
  6661. private _addParticle(idx, idxpos, model, shapeId, idxInShape);
  6662. /**
  6663. * Adds some particles to the SPS from the model shape. Returns the shape id.
  6664. * Please read the doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#create-an-immutable-sps
  6665. * `mesh` is any `Mesh` object that will be used as a model for the solid particles.
  6666. * `nb` (positive integer) the number of particles to be created from this model
  6667. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  6668. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  6669. */
  6670. addShape(mesh: Mesh, nb: number, options?: {
  6671. positionFunction?: any;
  6672. vertexFunction?: any;
  6673. }): number;
  6674. private _rebuildParticle(particle);
  6675. /**
  6676. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  6677. */
  6678. rebuildMesh(): void;
  6679. /**
  6680. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  6681. * This method calls `updateParticle()` for each particle of the SPS.
  6682. * For an animated SPS, it is usually called within the render loop.
  6683. * @param start (default 0) the particle index in the particle array where to start to compute the particle property values
  6684. * @param end (default nbParticle - 1) the particle index in the particle array where to stop to compute the particle property values
  6685. * @param update (default true) if the mesh must be finally updated on this call after all the particle computations.
  6686. */
  6687. setParticles(start?: number, end?: number, update?: boolean): void;
  6688. private _quaternionRotationYPR();
  6689. private _quaternionToRotationMatrix();
  6690. /**
  6691. * Disposes the SPS
  6692. */
  6693. dispose(): void;
  6694. /**
  6695. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  6696. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
  6697. */
  6698. refreshVisibleSize(): void;
  6699. /**
  6700. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  6701. * @param size the size (float) of the visibility box
  6702. * note : this doesn't lock the SPS mesh bounding box.
  6703. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
  6704. */
  6705. setVisibilityBox(size: number): void;
  6706. /**
  6707. * Sets the SPS as always visible or not
  6708. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
  6709. */
  6710. isAlwaysVisible: boolean;
  6711. /**
  6712. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  6713. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
  6714. */
  6715. isVisibilityBoxLocked: boolean;
  6716. /**
  6717. * Tells to `setParticles()` to compute the particle rotations or not.
  6718. * Default value : true. The SPS is faster when it's set to false.
  6719. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  6720. */
  6721. computeParticleRotation: boolean;
  6722. /**
  6723. * Tells to `setParticles()` to compute the particle colors or not.
  6724. * Default value : true. The SPS is faster when it's set to false.
  6725. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  6726. */
  6727. computeParticleColor: boolean;
  6728. /**
  6729. * Tells to `setParticles()` to compute the particle textures or not.
  6730. * Default value : true. The SPS is faster when it's set to false.
  6731. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  6732. */
  6733. computeParticleTexture: boolean;
  6734. /**
  6735. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  6736. * Default value : false. The SPS is faster when it's set to false.
  6737. * Note : the particle custom vertex positions aren't stored values.
  6738. */
  6739. computeParticleVertex: boolean;
  6740. /**
  6741. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  6742. */
  6743. computeBoundingBox: boolean;
  6744. /**
  6745. * This function does nothing. It may be overwritten to set all the particle first values.
  6746. * The SPS doesn't call this function, you may have to call it by your own.
  6747. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management
  6748. */
  6749. initParticles(): void;
  6750. /**
  6751. * This function does nothing. It may be overwritten to recycle a particle.
  6752. * The SPS doesn't call this function, you may have to call it by your own.
  6753. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management
  6754. */
  6755. recycleParticle(particle: SolidParticle): SolidParticle;
  6756. /**
  6757. * Updates a particle : this function should be overwritten by the user.
  6758. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  6759. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management
  6760. * ex : just set a particle position or velocity and recycle conditions
  6761. */
  6762. updateParticle(particle: SolidParticle): SolidParticle;
  6763. /**
  6764. * Updates a vertex of a particle : it can be overwritten by the user.
  6765. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  6766. * @param particle the current particle
  6767. * @param vertex the current index of the current particle
  6768. * @param pt the index of the current vertex in the particle shape
  6769. * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#update-each-particle-shape
  6770. * ex : just set a vertex particle position
  6771. */
  6772. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  6773. /**
  6774. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  6775. * This does nothing and may be overwritten by the user.
  6776. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  6777. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  6778. * @param update the boolean update value actually passed to setParticles()
  6779. */
  6780. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  6781. /**
  6782. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  6783. * This will be passed three parameters.
  6784. * This does nothing and may be overwritten by the user.
  6785. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  6786. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  6787. * @param update the boolean update value actually passed to setParticles()
  6788. */
  6789. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  6790. }
  6791. }
  6792. declare module BABYLON {
  6793. interface PhysicsImpostorJoint {
  6794. mainImpostor: PhysicsImpostor;
  6795. connectedImpostor: PhysicsImpostor;
  6796. joint: PhysicsJoint;
  6797. }
  6798. class PhysicsEngine {
  6799. private _physicsPlugin;
  6800. gravity: Vector3;
  6801. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  6802. setGravity(gravity: Vector3): void;
  6803. /**
  6804. * Set the time step of the physics engine.
  6805. * default is 1/60.
  6806. * To slow it down, enter 1/600 for example.
  6807. * To speed it up, 1/30
  6808. * @param {number} newTimeStep the new timestep to apply to this world.
  6809. */
  6810. setTimeStep(newTimeStep?: number): void;
  6811. dispose(): void;
  6812. getPhysicsPluginName(): string;
  6813. /**
  6814. * @Deprecated
  6815. *
  6816. */
  6817. static NoImpostor: number;
  6818. static SphereImpostor: number;
  6819. static BoxImpostor: number;
  6820. static PlaneImpostor: number;
  6821. static MeshImpostor: number;
  6822. static CylinderImpostor: number;
  6823. static HeightmapImpostor: number;
  6824. static CapsuleImpostor: number;
  6825. static ConeImpostor: number;
  6826. static ConvexHullImpostor: number;
  6827. static Epsilon: number;
  6828. private _impostors;
  6829. private _joints;
  6830. /**
  6831. * Adding a new impostor for the impostor tracking.
  6832. * This will be done by the impostor itself.
  6833. * @param {PhysicsImpostor} impostor the impostor to add
  6834. */
  6835. addImpostor(impostor: PhysicsImpostor): void;
  6836. /**
  6837. * Remove an impostor from the engine.
  6838. * This impostor and its mesh will not longer be updated by the physics engine.
  6839. * @param {PhysicsImpostor} impostor the impostor to remove
  6840. */
  6841. removeImpostor(impostor: PhysicsImpostor): void;
  6842. /**
  6843. * Add a joint to the physics engine
  6844. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  6845. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  6846. * @param {PhysicsJoint} the joint that will connect both impostors.
  6847. */
  6848. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  6849. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  6850. /**
  6851. * Called by the scene. no need to call it.
  6852. */
  6853. _step(delta: number): void;
  6854. getPhysicsPlugin(): IPhysicsEnginePlugin;
  6855. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  6856. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  6857. }
  6858. interface IPhysicsEnginePlugin {
  6859. world: any;
  6860. name: string;
  6861. setGravity(gravity: Vector3): any;
  6862. setTimeStep(timeStep: number): any;
  6863. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  6864. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  6865. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  6866. generatePhysicsBody(impostor: PhysicsImpostor): any;
  6867. removePhysicsBody(impostor: PhysicsImpostor): any;
  6868. generateJoint(joint: PhysicsImpostorJoint): any;
  6869. removeJoint(joint: PhysicsImpostorJoint): any;
  6870. isSupported(): boolean;
  6871. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  6872. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  6873. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  6874. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  6875. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  6876. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  6877. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  6878. sleepBody(impostor: PhysicsImpostor): any;
  6879. wakeUpBody(impostor: PhysicsImpostor): any;
  6880. updateDistanceJoint(joint: DistanceJoint, maxDistance: number, minDistance?: number): any;
  6881. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  6882. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  6883. dispose(): any;
  6884. }
  6885. }
  6886. declare module BABYLON {
  6887. interface PhysicsImpostorParameters {
  6888. mass: number;
  6889. friction?: number;
  6890. restitution?: number;
  6891. nativeOptions?: any;
  6892. }
  6893. interface IPhysicsEnabledObject {
  6894. position: Vector3;
  6895. rotationQuaternion: Quaternion;
  6896. scaling: Vector3;
  6897. rotation?: Vector3;
  6898. parent?: any;
  6899. getBoundingInfo?(): BoundingInfo;
  6900. computeWorldMatrix?(force: boolean): void;
  6901. getChildMeshes?(): Array<AbstractMesh>;
  6902. getVerticesData?(kind: string): Array<number> | Float32Array;
  6903. getIndices?(): Array<number> | Int32Array;
  6904. getScene?(): Scene;
  6905. }
  6906. class PhysicsImpostor {
  6907. object: IPhysicsEnabledObject;
  6908. type: number;
  6909. private _options;
  6910. private _scene;
  6911. static DEFAULT_OBJECT_SIZE: Vector3;
  6912. private _physicsEngine;
  6913. private _physicsBody;
  6914. private _bodyUpdateRequired;
  6915. private _onBeforePhysicsStepCallbacks;
  6916. private _onAfterPhysicsStepCallbacks;
  6917. private _onPhysicsCollideCallbacks;
  6918. private _deltaPosition;
  6919. private _deltaRotation;
  6920. private _deltaRotationConjugated;
  6921. private _parent;
  6922. uniqueId: number;
  6923. private _joints;
  6924. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  6925. /**
  6926. * This function will completly initialize this impostor.
  6927. * It will create a new body - but only if this mesh has no parent.
  6928. * If it has, this impostor will not be used other than to define the impostor
  6929. * of the child mesh.
  6930. */
  6931. _init(): void;
  6932. private _getPhysicsParent();
  6933. /**
  6934. * Should a new body be generated.
  6935. */
  6936. isBodyInitRequired(): boolean;
  6937. setScalingUpdated(updated: boolean): void;
  6938. /**
  6939. * Force a regeneration of this or the parent's impostor's body.
  6940. * Use under cautious - This will remove all joints already implemented.
  6941. */
  6942. forceUpdate(): void;
  6943. /**
  6944. * Gets the body that holds this impostor. Either its own, or its parent.
  6945. */
  6946. /**
  6947. * Set the physics body. Used mainly by the physics engine/plugin
  6948. */
  6949. physicsBody: any;
  6950. parent: PhysicsImpostor;
  6951. resetUpdateFlags(): void;
  6952. getObjectExtendSize(): Vector3;
  6953. getObjectCenter(): Vector3;
  6954. /**
  6955. * Get a specific parametes from the options parameter.
  6956. */
  6957. getParam(paramName: string): any;
  6958. /**
  6959. * Sets a specific parameter in the options given to the physics plugin
  6960. */
  6961. setParam(paramName: string, value: number): void;
  6962. /**
  6963. * Specifically change the body's mass option. Won't recreate the physics body object
  6964. */
  6965. setMass(mass: number): void;
  6966. getLinearVelocity(): Vector3;
  6967. /**
  6968. * Set the body's linear velocity.
  6969. */
  6970. setLinearVelocity(velocity: Vector3): void;
  6971. getAngularVelocity(): Vector3;
  6972. /**
  6973. * Set the body's linear velocity.
  6974. */
  6975. setAngularVelocity(velocity: Vector3): void;
  6976. /**
  6977. * Execute a function with the physics plugin native code.
  6978. * Provide a function the will have two variables - the world object and the physics body object.
  6979. */
  6980. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  6981. /**
  6982. * Register a function that will be executed before the physics world is stepping forward.
  6983. */
  6984. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  6985. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  6986. /**
  6987. * Register a function that will be executed after the physics step
  6988. */
  6989. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  6990. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  6991. /**
  6992. * register a function that will be executed when this impostor collides against a different body.
  6993. */
  6994. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  6995. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  6996. private _tmpPositionWithDelta;
  6997. private _tmpRotationWithDelta;
  6998. /**
  6999. * this function is executed by the physics engine.
  7000. */
  7001. beforeStep: () => void;
  7002. /**
  7003. * this function is executed by the physics engine.
  7004. */
  7005. afterStep: () => void;
  7006. onCollide: (e: {
  7007. body: any;
  7008. }) => void;
  7009. /**
  7010. * Apply a force
  7011. */
  7012. applyForce(force: Vector3, contactPoint: Vector3): void;
  7013. /**
  7014. * Apply an impulse
  7015. */
  7016. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  7017. /**
  7018. * A help function to create a joint.
  7019. */
  7020. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  7021. /**
  7022. * Add a joint to this impostor with a different impostor.
  7023. */
  7024. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  7025. /**
  7026. * Will keep this body still, in a sleep mode.
  7027. */
  7028. sleep(): void;
  7029. /**
  7030. * Wake the body up.
  7031. */
  7032. wakeUp(): void;
  7033. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  7034. dispose(): void;
  7035. setDeltaPosition(position: Vector3): void;
  7036. setDeltaRotation(rotation: Quaternion): void;
  7037. static NoImpostor: number;
  7038. static SphereImpostor: number;
  7039. static BoxImpostor: number;
  7040. static PlaneImpostor: number;
  7041. static MeshImpostor: number;
  7042. static CylinderImpostor: number;
  7043. static ParticleImpostor: number;
  7044. static HeightmapImpostor: number;
  7045. }
  7046. }
  7047. declare module BABYLON {
  7048. interface PhysicsJointData {
  7049. mainPivot?: Vector3;
  7050. connectedPivot?: Vector3;
  7051. mainAxis?: Vector3;
  7052. connectedAxis?: Vector3;
  7053. collision?: boolean;
  7054. nativeParams?: any;
  7055. }
  7056. /**
  7057. * This is a holder class for the physics joint created by the physics plugin.
  7058. * It holds a set of functions to control the underlying joint.
  7059. */
  7060. class PhysicsJoint {
  7061. type: number;
  7062. jointData: PhysicsJointData;
  7063. private _physicsJoint;
  7064. protected _physicsPlugin: IPhysicsEnginePlugin;
  7065. constructor(type: number, jointData: PhysicsJointData);
  7066. physicsJoint: any;
  7067. physicsPlugin: IPhysicsEnginePlugin;
  7068. /**
  7069. * Execute a function that is physics-plugin specific.
  7070. * @param {Function} func the function that will be executed.
  7071. * It accepts two parameters: the physics world and the physics joint.
  7072. */
  7073. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  7074. static DistanceJoint: number;
  7075. static HingeJoint: number;
  7076. static BallAndSocketJoint: number;
  7077. static WheelJoint: number;
  7078. static SliderJoint: number;
  7079. static PrismaticJoint: number;
  7080. static UniversalJoint: number;
  7081. static Hinge2Joint: number;
  7082. static PointToPointJoint: number;
  7083. static SpringJoint: number;
  7084. }
  7085. /**
  7086. * A class representing a physics distance joint.
  7087. */
  7088. class DistanceJoint extends PhysicsJoint {
  7089. constructor(jointData: DistanceJointData);
  7090. /**
  7091. * Update the predefined distance.
  7092. */
  7093. updateDistance(maxDistance: number, minDistance?: number): void;
  7094. }
  7095. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  7096. constructor(type: number, jointData: PhysicsJointData);
  7097. /**
  7098. * Set the motor values.
  7099. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7100. * @param {number} force the force to apply
  7101. * @param {number} maxForce max force for this motor.
  7102. */
  7103. setMotor(force?: number, maxForce?: number): void;
  7104. /**
  7105. * Set the motor's limits.
  7106. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7107. */
  7108. setLimit(upperLimit: number, lowerLimit?: number): void;
  7109. }
  7110. /**
  7111. * This class represents a single hinge physics joint
  7112. */
  7113. class HingeJoint extends MotorEnabledJoint {
  7114. constructor(jointData: PhysicsJointData);
  7115. /**
  7116. * Set the motor values.
  7117. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7118. * @param {number} force the force to apply
  7119. * @param {number} maxForce max force for this motor.
  7120. */
  7121. setMotor(force?: number, maxForce?: number): void;
  7122. /**
  7123. * Set the motor's limits.
  7124. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7125. */
  7126. setLimit(upperLimit: number, lowerLimit?: number): void;
  7127. }
  7128. /**
  7129. * This class represents a dual hinge physics joint (same as wheel joint)
  7130. */
  7131. class Hinge2Joint extends MotorEnabledJoint {
  7132. constructor(jointData: PhysicsJointData);
  7133. /**
  7134. * Set the motor values.
  7135. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7136. * @param {number} force the force to apply
  7137. * @param {number} maxForce max force for this motor.
  7138. * @param {motorIndex} the motor's index, 0 or 1.
  7139. */
  7140. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  7141. /**
  7142. * Set the motor limits.
  7143. * Attention, this function is plugin specific. Engines won't react 100% the same.
  7144. * @param {number} upperLimit the upper limit
  7145. * @param {number} lowerLimit lower limit
  7146. * @param {motorIndex} the motor's index, 0 or 1.
  7147. */
  7148. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  7149. }
  7150. interface IMotorEnabledJoint {
  7151. physicsJoint: any;
  7152. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  7153. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  7154. }
  7155. interface DistanceJointData extends PhysicsJointData {
  7156. maxDistance: number;
  7157. }
  7158. interface SpringJointData extends PhysicsJointData {
  7159. length: number;
  7160. stiffness: number;
  7161. damping: number;
  7162. }
  7163. }
  7164. declare module BABYLON {
  7165. class ReflectionProbe {
  7166. name: string;
  7167. private _scene;
  7168. private _renderTargetTexture;
  7169. private _projectionMatrix;
  7170. private _viewMatrix;
  7171. private _target;
  7172. private _add;
  7173. private _attachedMesh;
  7174. invertYAxis: boolean;
  7175. position: Vector3;
  7176. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  7177. refreshRate: number;
  7178. getScene(): Scene;
  7179. cubeTexture: RenderTargetTexture;
  7180. renderList: AbstractMesh[];
  7181. attachToMesh(mesh: AbstractMesh): void;
  7182. dispose(): void;
  7183. }
  7184. }
  7185. declare module BABYLON {
  7186. class AnaglyphPostProcess extends PostProcess {
  7187. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7188. }
  7189. }
  7190. declare module BABYLON {
  7191. class BlackAndWhitePostProcess extends PostProcess {
  7192. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7193. }
  7194. }
  7195. declare module BABYLON {
  7196. class BlurPostProcess extends PostProcess {
  7197. direction: Vector2;
  7198. blurWidth: number;
  7199. constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7200. }
  7201. }
  7202. declare module BABYLON {
  7203. class ColorCorrectionPostProcess extends PostProcess {
  7204. private _colorTableTexture;
  7205. constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7206. }
  7207. }
  7208. declare module BABYLON {
  7209. class ConvolutionPostProcess extends PostProcess {
  7210. kernel: number[];
  7211. constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7212. static EdgeDetect0Kernel: number[];
  7213. static EdgeDetect1Kernel: number[];
  7214. static EdgeDetect2Kernel: number[];
  7215. static SharpenKernel: number[];
  7216. static EmbossKernel: number[];
  7217. static GaussianKernel: number[];
  7218. }
  7219. }
  7220. declare module BABYLON {
  7221. class DisplayPassPostProcess extends PostProcess {
  7222. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7223. }
  7224. }
  7225. declare module BABYLON {
  7226. class FilterPostProcess extends PostProcess {
  7227. kernelMatrix: Matrix;
  7228. constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7229. }
  7230. }
  7231. declare module BABYLON {
  7232. class FxaaPostProcess extends PostProcess {
  7233. texelWidth: number;
  7234. texelHeight: number;
  7235. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7236. }
  7237. }
  7238. declare module BABYLON {
  7239. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  7240. /**
  7241. * Public members
  7242. */
  7243. /**
  7244. * Gaussian blur coefficient
  7245. * @type {number}
  7246. */
  7247. gaussCoeff: number;
  7248. /**
  7249. * Gaussian blur mean
  7250. * @type {number}
  7251. */
  7252. gaussMean: number;
  7253. /**
  7254. * Gaussian blur standard deviation
  7255. * @type {number}
  7256. */
  7257. gaussStandDev: number;
  7258. /**
  7259. * Gaussian blur multiplier. Multiplies the blur effect
  7260. * @type {number}
  7261. */
  7262. gaussMultiplier: number;
  7263. /**
  7264. * Exposure, controls the overall intensity of the pipeline
  7265. * @type {number}
  7266. */
  7267. exposure: number;
  7268. /**
  7269. * Minimum luminance that the post-process can output. Luminance is >= 0
  7270. * @type {number}
  7271. */
  7272. minimumLuminance: number;
  7273. /**
  7274. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  7275. * @type {number}
  7276. */
  7277. maximumLuminance: number;
  7278. /**
  7279. * Increase rate for luminance: eye adaptation speed to dark
  7280. * @type {number}
  7281. */
  7282. luminanceIncreaserate: number;
  7283. /**
  7284. * Decrease rate for luminance: eye adaptation speed to bright
  7285. * @type {number}
  7286. */
  7287. luminanceDecreaseRate: number;
  7288. /**
  7289. * Minimum luminance needed to compute HDR
  7290. * @type {number}
  7291. */
  7292. brightThreshold: number;
  7293. /**
  7294. * Private members
  7295. */
  7296. private _guassianBlurHPostProcess;
  7297. private _guassianBlurVPostProcess;
  7298. private _brightPassPostProcess;
  7299. private _textureAdderPostProcess;
  7300. private _downSampleX4PostProcess;
  7301. private _originalPostProcess;
  7302. private _hdrPostProcess;
  7303. private _hdrCurrentLuminance;
  7304. private _hdrOutputLuminance;
  7305. static LUM_STEPS: number;
  7306. private _downSamplePostProcesses;
  7307. private _scene;
  7308. private _needUpdate;
  7309. /**
  7310. * @constructor
  7311. * @param {string} name - The rendering pipeline name
  7312. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7313. * @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)
  7314. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  7315. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7316. */
  7317. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  7318. /**
  7319. * Tells the pipeline to update its post-processes
  7320. */
  7321. update(): void;
  7322. /**
  7323. * Returns the current calculated luminance
  7324. */
  7325. getCurrentLuminance(): number;
  7326. /**
  7327. * Returns the currently drawn luminance
  7328. */
  7329. getOutputLuminance(): number;
  7330. /**
  7331. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  7332. */
  7333. dispose(): void;
  7334. /**
  7335. * Creates the HDR post-process and computes the luminance adaptation
  7336. */
  7337. private _createHDRPostProcess(scene, ratio);
  7338. /**
  7339. * Texture Adder post-process
  7340. */
  7341. private _createTextureAdderPostProcess(scene, ratio);
  7342. /**
  7343. * Down sample X4 post-process
  7344. */
  7345. private _createDownSampleX4PostProcess(scene, ratio);
  7346. /**
  7347. * Bright pass post-process
  7348. */
  7349. private _createBrightPassPostProcess(scene, ratio);
  7350. /**
  7351. * Luminance generator. Creates the luminance post-process and down sample post-processes
  7352. */
  7353. private _createLuminanceGeneratorPostProcess(scene);
  7354. /**
  7355. * Gaussian blur post-processes. Horizontal and Vertical
  7356. */
  7357. private _createGaussianBlurPostProcess(scene, ratio);
  7358. }
  7359. }
  7360. declare module BABYLON {
  7361. class LensRenderingPipeline extends PostProcessRenderPipeline {
  7362. /**
  7363. * The chromatic aberration PostProcess id in the pipeline
  7364. * @type {string}
  7365. */
  7366. LensChromaticAberrationEffect: string;
  7367. /**
  7368. * The highlights enhancing PostProcess id in the pipeline
  7369. * @type {string}
  7370. */
  7371. HighlightsEnhancingEffect: string;
  7372. /**
  7373. * The depth-of-field PostProcess id in the pipeline
  7374. * @type {string}
  7375. */
  7376. LensDepthOfFieldEffect: string;
  7377. private _scene;
  7378. private _depthTexture;
  7379. private _grainTexture;
  7380. private _chromaticAberrationPostProcess;
  7381. private _highlightsPostProcess;
  7382. private _depthOfFieldPostProcess;
  7383. private _edgeBlur;
  7384. private _grainAmount;
  7385. private _chromaticAberration;
  7386. private _distortion;
  7387. private _highlightsGain;
  7388. private _highlightsThreshold;
  7389. private _dofDistance;
  7390. private _dofAperture;
  7391. private _dofDarken;
  7392. private _dofPentagon;
  7393. private _blurNoise;
  7394. /**
  7395. * @constructor
  7396. *
  7397. * Effect parameters are as follow:
  7398. * {
  7399. * chromatic_aberration: number; // from 0 to x (1 for realism)
  7400. * edge_blur: number; // from 0 to x (1 for realism)
  7401. * distortion: number; // from 0 to x (1 for realism)
  7402. * grain_amount: number; // from 0 to 1
  7403. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  7404. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  7405. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  7406. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  7407. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  7408. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  7409. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  7410. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  7411. * }
  7412. * Note: if an effect parameter is unset, effect is disabled
  7413. *
  7414. * @param {string} name - The rendering pipeline name
  7415. * @param {object} parameters - An object containing all parameters (see above)
  7416. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7417. * @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)
  7418. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7419. */
  7420. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  7421. setEdgeBlur(amount: number): void;
  7422. disableEdgeBlur(): void;
  7423. setGrainAmount(amount: number): void;
  7424. disableGrain(): void;
  7425. setChromaticAberration(amount: number): void;
  7426. disableChromaticAberration(): void;
  7427. setEdgeDistortion(amount: number): void;
  7428. disableEdgeDistortion(): void;
  7429. setFocusDistance(amount: number): void;
  7430. disableDepthOfField(): void;
  7431. setAperture(amount: number): void;
  7432. setDarkenOutOfFocus(amount: number): void;
  7433. enablePentagonBokeh(): void;
  7434. disablePentagonBokeh(): void;
  7435. enableNoiseBlur(): void;
  7436. disableNoiseBlur(): void;
  7437. setHighlightsGain(amount: number): void;
  7438. setHighlightsThreshold(amount: number): void;
  7439. disableHighlights(): void;
  7440. /**
  7441. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  7442. */
  7443. dispose(disableDepthRender?: boolean): void;
  7444. private _createChromaticAberrationPostProcess(ratio);
  7445. private _createHighlightsPostProcess(ratio);
  7446. private _createDepthOfFieldPostProcess(ratio);
  7447. private _createGrainTexture();
  7448. }
  7449. }
  7450. declare module BABYLON {
  7451. class PassPostProcess extends PostProcess {
  7452. constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7453. }
  7454. }
  7455. declare module BABYLON {
  7456. class PostProcess {
  7457. name: string;
  7458. onApply: (effect: Effect) => void;
  7459. onBeforeRender: (effect: Effect) => void;
  7460. onAfterRender: (effect: Effect) => void;
  7461. onSizeChanged: () => void;
  7462. onActivate: (camera: Camera) => void;
  7463. width: number;
  7464. height: number;
  7465. renderTargetSamplingMode: number;
  7466. clearColor: Color4;
  7467. enablePixelPerfectMode: boolean;
  7468. private _camera;
  7469. private _scene;
  7470. private _engine;
  7471. private _renderRatio;
  7472. private _reusable;
  7473. private _textureType;
  7474. _textures: SmartArray<WebGLTexture>;
  7475. _currentRenderTextureInd: number;
  7476. private _effect;
  7477. private _samplers;
  7478. private _fragmentUrl;
  7479. private _parameters;
  7480. private _scaleRatio;
  7481. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
  7482. updateEffect(defines?: string): void;
  7483. isReusable(): boolean;
  7484. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  7485. isSupported: boolean;
  7486. apply(): Effect;
  7487. dispose(camera?: Camera): void;
  7488. }
  7489. }
  7490. declare module BABYLON {
  7491. class PostProcessManager {
  7492. private _scene;
  7493. private _indexBuffer;
  7494. private _vertexDeclaration;
  7495. private _vertexStrideSize;
  7496. private _vertexBuffer;
  7497. constructor(scene: Scene);
  7498. private _prepareBuffers();
  7499. _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  7500. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  7501. _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void;
  7502. dispose(): void;
  7503. }
  7504. }
  7505. declare module BABYLON {
  7506. class RefractionPostProcess extends PostProcess {
  7507. color: Color3;
  7508. depth: number;
  7509. colorLevel: number;
  7510. private _refRexture;
  7511. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  7512. dispose(camera: Camera): void;
  7513. }
  7514. }
  7515. declare module BABYLON {
  7516. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  7517. /**
  7518. * The PassPostProcess id in the pipeline that contains the original scene color
  7519. * @type {string}
  7520. */
  7521. SSAOOriginalSceneColorEffect: string;
  7522. /**
  7523. * The SSAO PostProcess id in the pipeline
  7524. * @type {string}
  7525. */
  7526. SSAORenderEffect: string;
  7527. /**
  7528. * The horizontal blur PostProcess id in the pipeline
  7529. * @type {string}
  7530. */
  7531. SSAOBlurHRenderEffect: string;
  7532. /**
  7533. * The vertical blur PostProcess id in the pipeline
  7534. * @type {string}
  7535. */
  7536. SSAOBlurVRenderEffect: string;
  7537. /**
  7538. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  7539. * @type {string}
  7540. */
  7541. SSAOCombineRenderEffect: string;
  7542. /**
  7543. * The output strength of the SSAO post-process. Default value is 1.0.
  7544. * @type {number}
  7545. */
  7546. totalStrength: number;
  7547. /**
  7548. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  7549. * @type {number}
  7550. */
  7551. radius: number;
  7552. /**
  7553. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  7554. * Must not be equal to fallOff and superior to fallOff.
  7555. * Default value is 0.975
  7556. * @type {number}
  7557. */
  7558. area: number;
  7559. /**
  7560. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  7561. * Must not be equal to area and inferior to area.
  7562. * Default value is 0.0
  7563. * @type {number}
  7564. */
  7565. fallOff: number;
  7566. /**
  7567. * The base color of the SSAO post-process
  7568. * The final result is "base + ssao" between [0, 1]
  7569. * @type {number}
  7570. */
  7571. base: number;
  7572. private _scene;
  7573. private _depthTexture;
  7574. private _randomTexture;
  7575. private _originalColorPostProcess;
  7576. private _ssaoPostProcess;
  7577. private _blurHPostProcess;
  7578. private _blurVPostProcess;
  7579. private _ssaoCombinePostProcess;
  7580. private _firstUpdate;
  7581. /**
  7582. * @constructor
  7583. * @param {string} name - The rendering pipeline name
  7584. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  7585. * @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 }
  7586. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  7587. */
  7588. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  7589. /**
  7590. * Returns the horizontal blur PostProcess
  7591. * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
  7592. */
  7593. getBlurHPostProcess(): BlurPostProcess;
  7594. /**
  7595. * Returns the vertical blur PostProcess
  7596. * @return {BABYLON.BlurPostProcess} The vertical blur post-process
  7597. */
  7598. getBlurVPostProcess(): BlurPostProcess;
  7599. /**
  7600. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  7601. */
  7602. dispose(disableDepthRender?: boolean): void;
  7603. private _createSSAOPostProcess(ratio);
  7604. private _createSSAOCombinePostProcess(ratio);
  7605. private _createRandomTexture();
  7606. }
  7607. }
  7608. declare module BABYLON {
  7609. class StereoscopicInterlacePostProcess extends PostProcess {
  7610. private _stepSize;
  7611. constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number);
  7612. }
  7613. }
  7614. declare module BABYLON {
  7615. enum TonemappingOperator {
  7616. Hable = 0,
  7617. Reinhard = 1,
  7618. HejiDawson = 2,
  7619. Photographic = 3,
  7620. }
  7621. class TonemapPostProcess extends PostProcess {
  7622. private _operator;
  7623. exposureAdjustment: number;
  7624. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  7625. }
  7626. }
  7627. declare module BABYLON {
  7628. class VolumetricLightScatteringPostProcess extends PostProcess {
  7629. private _volumetricLightScatteringPass;
  7630. private _volumetricLightScatteringRTT;
  7631. private _viewPort;
  7632. private _screenCoordinates;
  7633. private _cachedDefines;
  7634. /**
  7635. * If not undefined, the mesh position is computed from the attached node position
  7636. * @type {{position: Vector3}}
  7637. */
  7638. attachedNode: {
  7639. position: Vector3;
  7640. };
  7641. /**
  7642. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  7643. * @type {Vector3}
  7644. */
  7645. customMeshPosition: Vector3;
  7646. /**
  7647. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  7648. * @type {boolean}
  7649. */
  7650. useCustomMeshPosition: boolean;
  7651. /**
  7652. * If the post-process should inverse the light scattering direction
  7653. * @type {boolean}
  7654. */
  7655. invert: boolean;
  7656. /**
  7657. * The internal mesh used by the post-process
  7658. * @type {boolean}
  7659. */
  7660. mesh: Mesh;
  7661. useDiffuseColor: boolean;
  7662. /**
  7663. * Array containing the excluded meshes not rendered in the internal pass
  7664. */
  7665. excludedMeshes: AbstractMesh[];
  7666. /**
  7667. * Controls the overall intensity of the post-process
  7668. * @type {number}
  7669. */
  7670. exposure: number;
  7671. /**
  7672. * Dissipates each sample's contribution in range [0, 1]
  7673. * @type {number}
  7674. */
  7675. decay: number;
  7676. /**
  7677. * Controls the overall intensity of each sample
  7678. * @type {number}
  7679. */
  7680. weight: number;
  7681. /**
  7682. * Controls the density of each sample
  7683. * @type {number}
  7684. */
  7685. density: number;
  7686. /**
  7687. * @constructor
  7688. * @param {string} name - The post-process name
  7689. * @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)
  7690. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  7691. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  7692. * @param {number} samples - The post-process quality, default 100
  7693. * @param {number} samplingMode - The post-process filtering mode
  7694. * @param {BABYLON.Engine} engine - The babylon engine
  7695. * @param {boolean} reusable - If the post-process is reusable
  7696. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  7697. */
  7698. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  7699. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  7700. /**
  7701. * Sets the new light position for light scattering effect
  7702. * @param {BABYLON.Vector3} The new custom light position
  7703. */
  7704. setCustomMeshPosition(position: Vector3): void;
  7705. /**
  7706. * Returns the light position for light scattering effect
  7707. * @return {BABYLON.Vector3} The custom light position
  7708. */
  7709. getCustomMeshPosition(): Vector3;
  7710. /**
  7711. * Disposes the internal assets and detaches the post-process from the camera
  7712. */
  7713. dispose(camera: Camera): void;
  7714. /**
  7715. * Returns the render target texture used by the post-process
  7716. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  7717. */
  7718. getPass(): RenderTargetTexture;
  7719. private _meshExcluded(mesh);
  7720. private _createPass(scene, ratio);
  7721. private _updateMeshScreenCoordinates(scene);
  7722. /**
  7723. * Creates a default mesh for the Volumeric Light Scattering post-process
  7724. * @param {string} The mesh name
  7725. * @param {BABYLON.Scene} The scene where to create the mesh
  7726. * @return {BABYLON.Mesh} the default mesh
  7727. */
  7728. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  7729. }
  7730. }
  7731. declare module BABYLON {
  7732. class VRDistortionCorrectionPostProcess extends PostProcess {
  7733. aspectRatio: number;
  7734. private _isRightEye;
  7735. private _distortionFactors;
  7736. private _postProcessScaleFactor;
  7737. private _lensCenterOffset;
  7738. private _scaleIn;
  7739. private _scaleFactor;
  7740. private _lensCenter;
  7741. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  7742. }
  7743. }
  7744. declare module BABYLON {
  7745. class BoundingBoxRenderer {
  7746. frontColor: Color3;
  7747. backColor: Color3;
  7748. showBackLines: boolean;
  7749. renderList: SmartArray<BoundingBox>;
  7750. private _scene;
  7751. private _colorShader;
  7752. private _vb;
  7753. private _ib;
  7754. constructor(scene: Scene);
  7755. private _prepareRessources();
  7756. reset(): void;
  7757. render(): void;
  7758. dispose(): void;
  7759. }
  7760. }
  7761. declare module BABYLON {
  7762. class DepthRenderer {
  7763. private _scene;
  7764. private _depthMap;
  7765. private _effect;
  7766. private _viewMatrix;
  7767. private _projectionMatrix;
  7768. private _transformMatrix;
  7769. private _worldViewProjection;
  7770. private _cachedDefines;
  7771. constructor(scene: Scene, type?: number);
  7772. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  7773. getDepthMap(): RenderTargetTexture;
  7774. dispose(): void;
  7775. }
  7776. }
  7777. declare module BABYLON {
  7778. class EdgesRenderer {
  7779. edgesWidthScalerForOrthographic: number;
  7780. edgesWidthScalerForPerspective: number;
  7781. private _source;
  7782. private _linesPositions;
  7783. private _linesNormals;
  7784. private _linesIndices;
  7785. private _epsilon;
  7786. private _indicesCount;
  7787. private _lineShader;
  7788. private _vb0;
  7789. private _vb1;
  7790. private _ib;
  7791. private _buffers;
  7792. private _checkVerticesInsteadOfIndices;
  7793. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  7794. private _prepareRessources();
  7795. dispose(): void;
  7796. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  7797. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  7798. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  7799. _generateEdgesLines(): void;
  7800. render(): void;
  7801. }
  7802. }
  7803. declare module BABYLON {
  7804. class OutlineRenderer {
  7805. private _scene;
  7806. private _effect;
  7807. private _cachedDefines;
  7808. constructor(scene: Scene);
  7809. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  7810. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  7811. }
  7812. }
  7813. declare module BABYLON {
  7814. class RenderingGroup {
  7815. index: number;
  7816. private _scene;
  7817. private _opaqueSubMeshes;
  7818. private _transparentSubMeshes;
  7819. private _alphaTestSubMeshes;
  7820. private _activeVertices;
  7821. onBeforeTransparentRendering: () => void;
  7822. constructor(index: number, scene: Scene);
  7823. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
  7824. prepare(): void;
  7825. dispatch(subMesh: SubMesh): void;
  7826. }
  7827. }
  7828. declare module BABYLON {
  7829. class RenderingManager {
  7830. static MAX_RENDERINGGROUPS: number;
  7831. private _scene;
  7832. private _renderingGroups;
  7833. private _depthBufferAlreadyCleaned;
  7834. private _currentIndex;
  7835. private _currentActiveMeshes;
  7836. private _currentRenderParticles;
  7837. private _currentRenderSprites;
  7838. constructor(scene: Scene);
  7839. private _renderParticles(index, activeMeshes);
  7840. private _renderSprites(index);
  7841. private _clearDepthBuffer();
  7842. private _renderSpritesAndParticles();
  7843. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  7844. reset(): void;
  7845. dispatch(subMesh: SubMesh): void;
  7846. }
  7847. }
  7848. declare module BABYLON {
  7849. class Sprite {
  7850. name: string;
  7851. position: Vector3;
  7852. color: Color4;
  7853. width: number;
  7854. height: number;
  7855. angle: number;
  7856. cellIndex: number;
  7857. invertU: number;
  7858. invertV: number;
  7859. disposeWhenFinishedAnimating: boolean;
  7860. animations: Animation[];
  7861. isPickable: boolean;
  7862. actionManager: ActionManager;
  7863. private _animationStarted;
  7864. private _loopAnimation;
  7865. private _fromIndex;
  7866. private _toIndex;
  7867. private _delay;
  7868. private _direction;
  7869. private _frameCount;
  7870. private _manager;
  7871. private _time;
  7872. size: number;
  7873. constructor(name: string, manager: SpriteManager);
  7874. playAnimation(from: number, to: number, loop: boolean, delay: number): void;
  7875. stopAnimation(): void;
  7876. _animate(deltaTime: number): void;
  7877. dispose(): void;
  7878. }
  7879. }
  7880. declare module BABYLON {
  7881. class SpriteManager {
  7882. name: string;
  7883. cellSize: number;
  7884. sprites: Sprite[];
  7885. renderingGroupId: number;
  7886. layerMask: number;
  7887. onDispose: () => void;
  7888. fogEnabled: boolean;
  7889. isPickable: boolean;
  7890. private _capacity;
  7891. private _spriteTexture;
  7892. private _epsilon;
  7893. private _scene;
  7894. private _vertexDeclaration;
  7895. private _vertexStrideSize;
  7896. private _vertexBuffer;
  7897. private _indexBuffer;
  7898. private _vertices;
  7899. private _effectBase;
  7900. private _effectFog;
  7901. texture: Texture;
  7902. constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number);
  7903. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  7904. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  7905. render(): void;
  7906. dispose(): void;
  7907. }
  7908. }
  7909. declare module BABYLON.Internals {
  7910. class _AlphaState {
  7911. private _isAlphaBlendDirty;
  7912. private _isBlendFunctionParametersDirty;
  7913. private _alphaBlend;
  7914. private _blendFunctionParameters;
  7915. isDirty: boolean;
  7916. alphaBlend: boolean;
  7917. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  7918. reset(): void;
  7919. apply(gl: WebGLRenderingContext): void;
  7920. }
  7921. }
  7922. declare module BABYLON.Internals {
  7923. class _DepthCullingState {
  7924. private _isDepthTestDirty;
  7925. private _isDepthMaskDirty;
  7926. private _isDepthFuncDirty;
  7927. private _isCullFaceDirty;
  7928. private _isCullDirty;
  7929. private _isZOffsetDirty;
  7930. private _depthTest;
  7931. private _depthMask;
  7932. private _depthFunc;
  7933. private _cull;
  7934. private _cullFace;
  7935. private _zOffset;
  7936. isDirty: boolean;
  7937. zOffset: number;
  7938. cullFace: number;
  7939. cull: boolean;
  7940. depthFunc: number;
  7941. depthMask: boolean;
  7942. depthTest: boolean;
  7943. reset(): void;
  7944. apply(gl: WebGLRenderingContext): void;
  7945. }
  7946. }
  7947. declare module BABYLON.Internals {
  7948. class AndOrNotEvaluator {
  7949. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  7950. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  7951. private static _SimplifyNegation(booleanString);
  7952. }
  7953. }
  7954. declare module BABYLON {
  7955. interface IAssetTask {
  7956. onSuccess: (task: IAssetTask) => void;
  7957. onError: (task: IAssetTask) => void;
  7958. isCompleted: boolean;
  7959. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  7960. }
  7961. class MeshAssetTask implements IAssetTask {
  7962. name: string;
  7963. meshesNames: any;
  7964. rootUrl: string;
  7965. sceneFilename: string;
  7966. loadedMeshes: Array<AbstractMesh>;
  7967. loadedParticleSystems: Array<ParticleSystem>;
  7968. loadedSkeletons: Array<Skeleton>;
  7969. onSuccess: (task: IAssetTask) => void;
  7970. onError: (task: IAssetTask) => void;
  7971. isCompleted: boolean;
  7972. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  7973. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  7974. }
  7975. class TextFileAssetTask implements IAssetTask {
  7976. name: string;
  7977. url: string;
  7978. onSuccess: (task: IAssetTask) => void;
  7979. onError: (task: IAssetTask) => void;
  7980. isCompleted: boolean;
  7981. text: string;
  7982. constructor(name: string, url: string);
  7983. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  7984. }
  7985. class BinaryFileAssetTask implements IAssetTask {
  7986. name: string;
  7987. url: string;
  7988. onSuccess: (task: IAssetTask) => void;
  7989. onError: (task: IAssetTask) => void;
  7990. isCompleted: boolean;
  7991. data: ArrayBuffer;
  7992. constructor(name: string, url: string);
  7993. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  7994. }
  7995. class ImageAssetTask implements IAssetTask {
  7996. name: string;
  7997. url: string;
  7998. onSuccess: (task: IAssetTask) => void;
  7999. onError: (task: IAssetTask) => void;
  8000. isCompleted: boolean;
  8001. image: HTMLImageElement;
  8002. constructor(name: string, url: string);
  8003. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8004. }
  8005. class TextureAssetTask implements IAssetTask {
  8006. name: string;
  8007. url: string;
  8008. noMipmap: boolean;
  8009. invertY: boolean;
  8010. samplingMode: number;
  8011. onSuccess: (task: IAssetTask) => void;
  8012. onError: (task: IAssetTask) => void;
  8013. isCompleted: boolean;
  8014. texture: Texture;
  8015. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  8016. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  8017. }
  8018. class AssetsManager {
  8019. private _tasks;
  8020. private _scene;
  8021. private _waitingTasksCount;
  8022. onFinish: (tasks: IAssetTask[]) => void;
  8023. onTaskSuccess: (task: IAssetTask) => void;
  8024. onTaskError: (task: IAssetTask) => void;
  8025. useDefaultLoadingScreen: boolean;
  8026. constructor(scene: Scene);
  8027. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  8028. addTextFileTask(taskName: string, url: string): IAssetTask;
  8029. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  8030. addImageTask(taskName: string, url: string): IAssetTask;
  8031. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask;
  8032. private _decreaseWaitingTasksCount();
  8033. private _runTask(task);
  8034. reset(): AssetsManager;
  8035. load(): AssetsManager;
  8036. }
  8037. }
  8038. declare module BABYLON {
  8039. class Database {
  8040. private callbackManifestChecked;
  8041. private currentSceneUrl;
  8042. private db;
  8043. private enableSceneOffline;
  8044. private enableTexturesOffline;
  8045. private manifestVersionFound;
  8046. private mustUpdateRessources;
  8047. private hasReachedQuota;
  8048. private isSupported;
  8049. private idbFactory;
  8050. static IsUASupportingBlobStorage: boolean;
  8051. static IDBStorageEnabled: boolean;
  8052. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  8053. static parseURL: (url: string) => string;
  8054. static ReturnFullUrlLocation: (url: string) => string;
  8055. checkManifestFile(): void;
  8056. openAsync(successCallback: any, errorCallback: any): void;
  8057. loadImageFromDB(url: string, image: HTMLImageElement): void;
  8058. private _loadImageFromDBAsync(url, image, notInDBCallback);
  8059. private _saveImageIntoDBAsync(url, image);
  8060. private _checkVersionFromDB(url, versionLoaded);
  8061. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  8062. private _saveVersionIntoDBAsync(url, callback);
  8063. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  8064. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  8065. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  8066. }
  8067. }
  8068. declare module BABYLON {
  8069. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8070. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8071. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8072. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8073. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8074. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8075. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  8076. class SerializationHelper {
  8077. static Serialize<T>(entity: T, serializationObject?: any): any;
  8078. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  8079. static Clone<T>(creationFunction: () => T, source: T): T;
  8080. }
  8081. }
  8082. declare module BABYLON {
  8083. class DynamicFloatArrayElementInfo {
  8084. offset: number;
  8085. }
  8086. /**
  8087. * The purpose of this class is to store float32 based elements of a given size (defined by the stride argument) in a dynamic fashion, that is, you can add/free elements. You can then access to a defragmented/packed version of the underlying Float32Array by calling the pack() method.
  8088. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  8089. * It was first built to effiently maintain the WebGlBuffer that contain instancing based data.
  8090. * Allocating an Element will return a instance of DynamicFloatArrayElement which contains the offset into the Float32Array of where the element starts, you are then responsible to copy your data using this offset.
  8091. * Beware, calling pack() may change the offset of some Entries because this method will defrag the Float32Array to replace empty elements by moving allocated ones at their location.
  8092. * This method will return an ArrayBufferView on the existing Float32Array that describes the used elements. Use this View to update the WebGLBuffer and NOT the "buffer" field of the class. The pack() method won't shrink/reallocate the buffer to keep it GC friendly, all the empty space will be put at the end of the buffer, the method just ensure there're no "free holes".
  8093. */
  8094. class DynamicFloatArray {
  8095. /**
  8096. * Construct an instance of the dynamic float array
  8097. * @param stride size of one element in float (i.e. not bytes!)
  8098. * @param initialElementCount the number of available entries at construction
  8099. */
  8100. constructor(stride: number, initialElementCount: number);
  8101. /**
  8102. * Allocate an element in the array.
  8103. * @return the element info instance that contains the offset into the main buffer of the element's location.
  8104. * Beware, this offset may change when you call pack()
  8105. */
  8106. allocElement(): DynamicFloatArrayElementInfo;
  8107. /**
  8108. * Free the element corresponding to the given element info
  8109. * @param elInfo the element that describe the allocated element
  8110. */
  8111. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  8112. /**
  8113. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  8114. * Instances of DynamicFloatArrayElement may have their 'offset' member changed as data could be copied from one location to another, so be sure to read/write your data based on the value inside this member after you called pack().
  8115. * @return the subarray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  8116. */
  8117. pack(): Float32Array;
  8118. private _moveElement(element, destOffset);
  8119. private _growBuffer();
  8120. /**
  8121. * This is the main buffer, all elements are stored inside, you use the DynamicFloatArrayElement instance of a given element to know its location into this buffer, then you have the responsability to perform write operations in this buffer at the right location!
  8122. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  8123. */
  8124. buffer: Float32Array;
  8125. /**
  8126. * Get the total count of entries that can fit in the current buffer
  8127. * @returns the elements count
  8128. */
  8129. totalElementCount: number;
  8130. /**
  8131. * Get the count of free entries that can still be allocated without resizing the buffer
  8132. * @returns the free elements count
  8133. */
  8134. freeElementCount: number;
  8135. /**
  8136. * Get the count of allocated elements
  8137. * @returns the allocated elements count
  8138. */
  8139. usedElementCount: number;
  8140. /**
  8141. * Return the size of one element in float
  8142. * @returns the size in float
  8143. */
  8144. stride: number;
  8145. private _allEntries;
  8146. private _freeEntries;
  8147. private _stride;
  8148. private _lastUsed;
  8149. private _firstFree;
  8150. }
  8151. }
  8152. declare module BABYLON {
  8153. class FilesInput {
  8154. private _engine;
  8155. private _currentScene;
  8156. private _canvas;
  8157. private _sceneLoadedCallback;
  8158. private _progressCallback;
  8159. private _additionnalRenderLoopLogicCallback;
  8160. private _textureLoadingCallback;
  8161. private _startingProcessingFilesCallback;
  8162. private _elementToMonitor;
  8163. static FilesTextures: any[];
  8164. static FilesToLoad: any[];
  8165. private _sceneFileToLoad;
  8166. private _filesToLoad;
  8167. 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);
  8168. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  8169. private renderFunction();
  8170. private drag(e);
  8171. private drop(eventDrop);
  8172. loadFiles(event: any): void;
  8173. reload(): void;
  8174. }
  8175. }
  8176. declare module BABYLON {
  8177. class Gamepads {
  8178. private babylonGamepads;
  8179. private oneGamepadConnected;
  8180. private isMonitoring;
  8181. private gamepadEventSupported;
  8182. private gamepadSupportAvailable;
  8183. private _callbackGamepadConnected;
  8184. private _onGamepadConnectedEvent;
  8185. private _onGamepadDisonnectedEvent;
  8186. private static gamepadDOMInfo;
  8187. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  8188. dispose(): void;
  8189. private _onGamepadConnected(evt);
  8190. private _addNewGamepad(gamepad);
  8191. private _onGamepadDisconnected(evt);
  8192. private _startMonitoringGamepads();
  8193. private _stopMonitoringGamepads();
  8194. private _checkGamepadsStatus();
  8195. private _updateGamepadObjects();
  8196. }
  8197. class StickValues {
  8198. x: any;
  8199. y: any;
  8200. constructor(x: any, y: any);
  8201. }
  8202. class Gamepad {
  8203. id: string;
  8204. index: number;
  8205. browserGamepad: any;
  8206. private _leftStick;
  8207. private _rightStick;
  8208. private _onleftstickchanged;
  8209. private _onrightstickchanged;
  8210. constructor(id: string, index: number, browserGamepad: any);
  8211. onleftstickchanged(callback: (values: StickValues) => void): void;
  8212. onrightstickchanged(callback: (values: StickValues) => void): void;
  8213. leftStick: StickValues;
  8214. rightStick: StickValues;
  8215. update(): void;
  8216. }
  8217. class GenericPad extends Gamepad {
  8218. id: string;
  8219. index: number;
  8220. gamepad: any;
  8221. private _buttons;
  8222. private _onbuttondown;
  8223. private _onbuttonup;
  8224. onbuttondown(callback: (buttonPressed: number) => void): void;
  8225. onbuttonup(callback: (buttonReleased: number) => void): void;
  8226. constructor(id: string, index: number, gamepad: any);
  8227. private _setButtonValue(newValue, currentValue, buttonIndex);
  8228. update(): void;
  8229. }
  8230. enum Xbox360Button {
  8231. A = 0,
  8232. B = 1,
  8233. X = 2,
  8234. Y = 3,
  8235. Start = 4,
  8236. Back = 5,
  8237. LB = 6,
  8238. RB = 7,
  8239. LeftStick = 8,
  8240. RightStick = 9,
  8241. }
  8242. enum Xbox360Dpad {
  8243. Up = 0,
  8244. Down = 1,
  8245. Left = 2,
  8246. Right = 3,
  8247. }
  8248. class Xbox360Pad extends Gamepad {
  8249. private _leftTrigger;
  8250. private _rightTrigger;
  8251. private _onlefttriggerchanged;
  8252. private _onrighttriggerchanged;
  8253. private _onbuttondown;
  8254. private _onbuttonup;
  8255. private _ondpaddown;
  8256. private _ondpadup;
  8257. private _buttonA;
  8258. private _buttonB;
  8259. private _buttonX;
  8260. private _buttonY;
  8261. private _buttonBack;
  8262. private _buttonStart;
  8263. private _buttonLB;
  8264. private _buttonRB;
  8265. private _buttonLeftStick;
  8266. private _buttonRightStick;
  8267. private _dPadUp;
  8268. private _dPadDown;
  8269. private _dPadLeft;
  8270. private _dPadRight;
  8271. onlefttriggerchanged(callback: (value: number) => void): void;
  8272. onrighttriggerchanged(callback: (value: number) => void): void;
  8273. leftTrigger: number;
  8274. rightTrigger: number;
  8275. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  8276. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  8277. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  8278. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  8279. private _setButtonValue(newValue, currentValue, buttonType);
  8280. private _setDPadValue(newValue, currentValue, buttonType);
  8281. buttonA: number;
  8282. buttonB: number;
  8283. buttonX: number;
  8284. buttonY: number;
  8285. buttonStart: number;
  8286. buttonBack: number;
  8287. buttonLB: number;
  8288. buttonRB: number;
  8289. buttonLeftStick: number;
  8290. buttonRightStick: number;
  8291. dPadUp: number;
  8292. dPadDown: number;
  8293. dPadLeft: number;
  8294. dPadRight: number;
  8295. update(): void;
  8296. }
  8297. }
  8298. interface Navigator {
  8299. getGamepads(func?: any): any;
  8300. webkitGetGamepads(func?: any): any;
  8301. msGetGamepads(func?: any): any;
  8302. webkitGamepads(func?: any): any;
  8303. }
  8304. declare module BABYLON {
  8305. interface ILoadingScreen {
  8306. displayLoadingUI: () => void;
  8307. hideLoadingUI: () => void;
  8308. loadingUIBackgroundColor: string;
  8309. loadingUIText: string;
  8310. }
  8311. class DefaultLoadingScreen implements ILoadingScreen {
  8312. private _renderingCanvas;
  8313. private _loadingText;
  8314. private _loadingDivBackgroundColor;
  8315. private _loadingDiv;
  8316. private _loadingTextDiv;
  8317. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  8318. displayLoadingUI(): void;
  8319. hideLoadingUI(): void;
  8320. loadingUIText: string;
  8321. loadingUIBackgroundColor: string;
  8322. private _resizeLoadingUI;
  8323. }
  8324. }
  8325. declare module BABYLON {
  8326. /**
  8327. * A class serves as a medium between the observable and its observers
  8328. */
  8329. class EventState {
  8330. skipNextObservers: boolean;
  8331. /**
  8332. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  8333. */
  8334. constructor(skipNextObservers?: boolean);
  8335. }
  8336. class Observer<T> {
  8337. callback: (eventData: T, eventState: EventState) => void;
  8338. mask: number;
  8339. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  8340. }
  8341. class Observable<T> {
  8342. _observers: Observer<T>[];
  8343. /**
  8344. * Create a new Observer with the specified callback
  8345. * @param callback the callback that will be executed for that Observer
  8346. * @param mash the mask used to filter observers
  8347. * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
  8348. */
  8349. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  8350. /**
  8351. * Remove an Observer from the Observable object
  8352. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  8353. */
  8354. remove(observer: Observer<T>): boolean;
  8355. /**
  8356. * Remove a callback from the Observable object
  8357. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  8358. */
  8359. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  8360. /**
  8361. * Notify all Observers by calling their respective callback with the given data
  8362. * @param eventData
  8363. * @param mask
  8364. */
  8365. notifyObservers(eventData: T, mask?: number): void;
  8366. /**
  8367. * return true is the Observable has at least one Observer registered
  8368. */
  8369. hasObservers(): boolean;
  8370. /**
  8371. * Clear the list of observers
  8372. */
  8373. clear(): void;
  8374. /**
  8375. * Clone the current observable
  8376. */
  8377. clone(): Observable<T>;
  8378. }
  8379. }
  8380. declare module BABYLON {
  8381. /**
  8382. * This class describe a rectangle that were added to the map.
  8383. * You have access to its coordinates either in pixel or normalized (UV)
  8384. */
  8385. class PackedRect {
  8386. constructor(root: PackedRect, parent: PackedRect, pos: Vector2, size: Size);
  8387. /**
  8388. * @returns the position of this node into the map
  8389. */
  8390. pos: Vector2;
  8391. /**
  8392. * @returns the size of the rectangle this node handles
  8393. */
  8394. contentSize: Size;
  8395. /**
  8396. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  8397. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  8398. */
  8399. UVs: Vector2[];
  8400. /**
  8401. * Free this rectangle from the map.
  8402. * Call this method when you no longer need the rectangle to be in the map.
  8403. */
  8404. freeContent(): void;
  8405. protected isUsed: boolean;
  8406. protected findAndSplitNode(contentSize: Size): PackedRect;
  8407. private findNode(size);
  8408. private splitNode(contentSize);
  8409. private attemptDefrag();
  8410. private clearNode();
  8411. private isRecursiveFree;
  8412. protected evalFreeSize(size: number): number;
  8413. protected _root: PackedRect;
  8414. protected _parent: PackedRect;
  8415. private _contentSize;
  8416. private _initialSize;
  8417. private _leftNode;
  8418. private _rightNode;
  8419. private _bottomNode;
  8420. private _pos;
  8421. protected _size: Size;
  8422. }
  8423. /**
  8424. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimaly as possible.
  8425. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  8426. * Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their lifecycle.
  8427. */
  8428. class RectPackingMap extends PackedRect {
  8429. /**
  8430. * Create an instance of the object with a dimension using the given size
  8431. * @param size The dimension of the rectangle that will contain all the sub ones.
  8432. */
  8433. constructor(size: Size);
  8434. /**
  8435. * Add a rectangle, finding the best location to store it into the map
  8436. * @param size the dimension of the rectangle to store
  8437. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  8438. */
  8439. addRect(size: Size): PackedRect;
  8440. /**
  8441. * Return the current space free normalized between [0;1]
  8442. * @returns {}
  8443. */
  8444. freeSpace: number;
  8445. }
  8446. }
  8447. declare module BABYLON {
  8448. class SceneOptimization {
  8449. priority: number;
  8450. apply: (scene: Scene) => boolean;
  8451. constructor(priority?: number);
  8452. }
  8453. class TextureOptimization extends SceneOptimization {
  8454. priority: number;
  8455. maximumSize: number;
  8456. constructor(priority?: number, maximumSize?: number);
  8457. apply: (scene: Scene) => boolean;
  8458. }
  8459. class HardwareScalingOptimization extends SceneOptimization {
  8460. priority: number;
  8461. maximumScale: number;
  8462. private _currentScale;
  8463. constructor(priority?: number, maximumScale?: number);
  8464. apply: (scene: Scene) => boolean;
  8465. }
  8466. class ShadowsOptimization extends SceneOptimization {
  8467. apply: (scene: Scene) => boolean;
  8468. }
  8469. class PostProcessesOptimization extends SceneOptimization {
  8470. apply: (scene: Scene) => boolean;
  8471. }
  8472. class LensFlaresOptimization extends SceneOptimization {
  8473. apply: (scene: Scene) => boolean;
  8474. }
  8475. class ParticlesOptimization extends SceneOptimization {
  8476. apply: (scene: Scene) => boolean;
  8477. }
  8478. class RenderTargetsOptimization extends SceneOptimization {
  8479. apply: (scene: Scene) => boolean;
  8480. }
  8481. class MergeMeshesOptimization extends SceneOptimization {
  8482. static _UpdateSelectionTree: boolean;
  8483. static UpdateSelectionTree: boolean;
  8484. private _canBeMerged;
  8485. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  8486. }
  8487. class SceneOptimizerOptions {
  8488. targetFrameRate: number;
  8489. trackerDuration: number;
  8490. optimizations: SceneOptimization[];
  8491. constructor(targetFrameRate?: number, trackerDuration?: number);
  8492. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8493. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8494. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  8495. }
  8496. class SceneOptimizer {
  8497. static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void;
  8498. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  8499. }
  8500. }
  8501. declare module BABYLON {
  8502. class SceneSerializer {
  8503. static ClearCache(): void;
  8504. static Serialize(scene: Scene): any;
  8505. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  8506. }
  8507. }
  8508. declare module BABYLON {
  8509. class SmartArray<T> {
  8510. data: Array<T>;
  8511. length: number;
  8512. private _id;
  8513. private _duplicateId;
  8514. constructor(capacity: number);
  8515. push(value: any): void;
  8516. pushNoDuplicate(value: any): void;
  8517. sort(compareFn: any): void;
  8518. reset(): void;
  8519. concat(array: any): void;
  8520. concatWithNoDuplicate(array: any): void;
  8521. indexOf(value: any): number;
  8522. private static _GlobalId;
  8523. }
  8524. }
  8525. declare module BABYLON {
  8526. /**
  8527. * This class implement a typical dictionary using a string as key and the generic type T as value.
  8528. * The underlying implemetation relies on an associative array to ensure the best performances.
  8529. * The value can be anything including 'null' but except 'undefined'
  8530. */
  8531. class StringDictionary<T> {
  8532. /**
  8533. * Get a value based from its key
  8534. * @param key the given key to get the matching value from
  8535. * @return the value if found, otherwise undefined is returned
  8536. */
  8537. get(key: string): T;
  8538. /**
  8539. * Get a value from its key or add it if it doesn't exist.
  8540. * This method will ensure you that a given key/data will be present in the dictionary.
  8541. * @param key the given key to get the matchin value from
  8542. * @param factory the factory that will create the value if the key is not present in the dictionary.
  8543. * The factory will only be invoked if there's no data for the given key.
  8544. * @return the value corresponding to the key.
  8545. */
  8546. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  8547. /**
  8548. * Get a value from its key if present in the dictionary otherwise add it
  8549. * @param key the key to get the value from
  8550. * @param val if there's no such key/value pair in the dictionary add it with this value
  8551. * @return the value corresponding to the key
  8552. */
  8553. getOrAdd(key: string, val: T): T;
  8554. /**
  8555. * Check if there's a given key in the dictionary
  8556. * @param key the key to check for
  8557. * @return true if the key is present, false otherwise
  8558. */
  8559. contains(key: any): boolean;
  8560. /**
  8561. * Add a new key and its corresponding value
  8562. * @param key the key to add
  8563. * @param value the value corresponding to the key
  8564. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  8565. */
  8566. add(key: string, value: T): boolean;
  8567. /**
  8568. * Remove a key/value from the dictionary.
  8569. * @param key the key to remove
  8570. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  8571. */
  8572. remove(key: string): boolean;
  8573. /**
  8574. * Clear the whole content of the dictionary
  8575. */
  8576. clear(): void;
  8577. count: number;
  8578. /**
  8579. * Execute a callback on each key/val of the dictionary.
  8580. * Note that you can remove any element in this dictionary in the callback implementation
  8581. * @param callback the callback to execute on a given key/value pair
  8582. */
  8583. forEach(callback: (key: string, val: T) => void): void;
  8584. /**
  8585. * Execute a callback on every occurence of the dictionary until it returns a valid TRes object.
  8586. * If the callback returns null or undefined the method will iterate to the next key/value pair
  8587. * Note that you can remove any element in this dictionary in the callback implementation
  8588. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  8589. */
  8590. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  8591. private _count;
  8592. private _data;
  8593. }
  8594. }
  8595. declare module BABYLON {
  8596. class Tags {
  8597. static EnableFor(obj: any): void;
  8598. static DisableFor(obj: any): void;
  8599. static HasTags(obj: any): boolean;
  8600. static GetTags(obj: any, asString?: boolean): any;
  8601. static AddTagsTo(obj: any, tagsString: string): void;
  8602. static _AddTagTo(obj: any, tag: string): void;
  8603. static RemoveTagsFrom(obj: any, tagsString: string): void;
  8604. static _RemoveTagFrom(obj: any, tag: string): void;
  8605. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  8606. }
  8607. }
  8608. declare module BABYLON.Internals {
  8609. interface DDSInfo {
  8610. width: number;
  8611. height: number;
  8612. mipmapCount: number;
  8613. isFourCC: boolean;
  8614. isRGB: boolean;
  8615. isLuminance: boolean;
  8616. isCube: boolean;
  8617. }
  8618. class DDSTools {
  8619. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  8620. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  8621. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  8622. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  8623. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  8624. }
  8625. }
  8626. declare module BABYLON.Internals {
  8627. class TGATools {
  8628. private static _TYPE_NO_DATA;
  8629. private static _TYPE_INDEXED;
  8630. private static _TYPE_RGB;
  8631. private static _TYPE_GREY;
  8632. private static _TYPE_RLE_INDEXED;
  8633. private static _TYPE_RLE_RGB;
  8634. private static _TYPE_RLE_GREY;
  8635. private static _ORIGIN_MASK;
  8636. private static _ORIGIN_SHIFT;
  8637. private static _ORIGIN_BL;
  8638. private static _ORIGIN_BR;
  8639. private static _ORIGIN_UL;
  8640. private static _ORIGIN_UR;
  8641. static GetTGAHeader(data: Uint8Array): any;
  8642. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  8643. 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;
  8644. 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;
  8645. 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;
  8646. 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;
  8647. 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;
  8648. 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;
  8649. }
  8650. }
  8651. declare module BABYLON {
  8652. interface IAnimatable {
  8653. animations: Array<Animation>;
  8654. }
  8655. class Tools {
  8656. static BaseUrl: string;
  8657. static CorsBehavior: any;
  8658. static UseFallbackTexture: boolean;
  8659. static Instantiate(className: string): any;
  8660. static SetImmediate(action: () => void): void;
  8661. static IsExponentOfTwo(value: number): boolean;
  8662. static GetExponentOfTwo(value: number, max: number): number;
  8663. static GetFilename(path: string): string;
  8664. static GetDOMTextContent(element: HTMLElement): string;
  8665. static ToDegrees(angle: number): number;
  8666. static ToRadians(angle: number): number;
  8667. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  8668. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number, bias?: Vector2): {
  8669. minimum: Vector3;
  8670. maximum: Vector3;
  8671. };
  8672. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2): {
  8673. minimum: Vector3;
  8674. maximum: Vector3;
  8675. };
  8676. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  8677. static GetPointerPrefix(): string;
  8678. static QueueNewFrame(func: any): void;
  8679. static RequestFullscreen(element: any): void;
  8680. static ExitFullscreen(): void;
  8681. static CleanUrl(url: string): string;
  8682. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  8683. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  8684. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  8685. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  8686. static FileAsURL(content: string): string;
  8687. static Format(value: number, decimals?: number): string;
  8688. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  8689. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  8690. static IsEmpty(obj: any): boolean;
  8691. static RegisterTopRootEvents(events: {
  8692. name: string;
  8693. handler: EventListener;
  8694. }[]): void;
  8695. static UnregisterTopRootEvents(events: {
  8696. name: string;
  8697. handler: EventListener;
  8698. }[]): void;
  8699. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void): void;
  8700. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void): void;
  8701. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  8702. static getClassName(obj: any): string;
  8703. private static _NoneLogLevel;
  8704. private static _MessageLogLevel;
  8705. private static _WarningLogLevel;
  8706. private static _ErrorLogLevel;
  8707. private static _LogCache;
  8708. static errorsCount: number;
  8709. static OnNewCacheEntry: (entry: string) => void;
  8710. static NoneLogLevel: number;
  8711. static MessageLogLevel: number;
  8712. static WarningLogLevel: number;
  8713. static ErrorLogLevel: number;
  8714. static AllLogLevel: number;
  8715. private static _AddLogEntry(entry);
  8716. private static _FormatMessage(message);
  8717. static Log: (message: string) => void;
  8718. private static _LogDisabled(message);
  8719. private static _LogEnabled(message);
  8720. static Warn: (message: string) => void;
  8721. private static _WarnDisabled(message);
  8722. private static _WarnEnabled(message);
  8723. static Error: (message: string) => void;
  8724. private static _ErrorDisabled(message);
  8725. private static _ErrorEnabled(message);
  8726. static LogCache: string;
  8727. static ClearLogCache(): void;
  8728. static LogLevels: number;
  8729. private static _PerformanceNoneLogLevel;
  8730. private static _PerformanceUserMarkLogLevel;
  8731. private static _PerformanceConsoleLogLevel;
  8732. private static _performance;
  8733. static PerformanceNoneLogLevel: number;
  8734. static PerformanceUserMarkLogLevel: number;
  8735. static PerformanceConsoleLogLevel: number;
  8736. static PerformanceLogLevel: number;
  8737. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  8738. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  8739. static _StartUserMark(counterName: string, condition?: boolean): void;
  8740. static _EndUserMark(counterName: string, condition?: boolean): void;
  8741. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  8742. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  8743. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  8744. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  8745. static Now: number;
  8746. }
  8747. /**
  8748. * An implementation of a loop for asynchronous functions.
  8749. */
  8750. class AsyncLoop {
  8751. iterations: number;
  8752. private _fn;
  8753. private _successCallback;
  8754. index: number;
  8755. private _done;
  8756. /**
  8757. * Constroctor.
  8758. * @param iterations the number of iterations.
  8759. * @param _fn the function to run each iteration
  8760. * @param _successCallback the callback that will be called upon succesful execution
  8761. * @param offset starting offset.
  8762. */
  8763. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  8764. /**
  8765. * Execute the next iteration. Must be called after the last iteration was finished.
  8766. */
  8767. executeNext(): void;
  8768. /**
  8769. * Break the loop and run the success callback.
  8770. */
  8771. breakLoop(): void;
  8772. /**
  8773. * Helper function
  8774. */
  8775. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  8776. /**
  8777. * A for-loop that will run a given number of iterations synchronous and the rest async.
  8778. * @param iterations total number of iterations
  8779. * @param syncedIterations number of synchronous iterations in each async iteration.
  8780. * @param fn the function to call each iteration.
  8781. * @param callback a success call back that will be called when iterating stops.
  8782. * @param breakFunction a break condition (optional)
  8783. * @param timeout timeout settings for the setTimeout function. default - 0.
  8784. * @constructor
  8785. */
  8786. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  8787. }
  8788. }
  8789. declare module BABYLON {
  8790. enum JoystickAxis {
  8791. X = 0,
  8792. Y = 1,
  8793. Z = 2,
  8794. }
  8795. class VirtualJoystick {
  8796. reverseLeftRight: boolean;
  8797. reverseUpDown: boolean;
  8798. deltaPosition: Vector3;
  8799. pressed: boolean;
  8800. private static _globalJoystickIndex;
  8801. private static vjCanvas;
  8802. private static vjCanvasContext;
  8803. private static vjCanvasWidth;
  8804. private static vjCanvasHeight;
  8805. private static halfWidth;
  8806. private static halfHeight;
  8807. private _action;
  8808. private _axisTargetedByLeftAndRight;
  8809. private _axisTargetedByUpAndDown;
  8810. private _joystickSensibility;
  8811. private _inversedSensibility;
  8812. private _rotationSpeed;
  8813. private _inverseRotationSpeed;
  8814. private _rotateOnAxisRelativeToMesh;
  8815. private _joystickPointerID;
  8816. private _joystickColor;
  8817. private _joystickPointerPos;
  8818. private _joystickPreviousPointerPos;
  8819. private _joystickPointerStartPos;
  8820. private _deltaJoystickVector;
  8821. private _leftJoystick;
  8822. private _joystickIndex;
  8823. private _touches;
  8824. private _onPointerDownHandlerRef;
  8825. private _onPointerMoveHandlerRef;
  8826. private _onPointerUpHandlerRef;
  8827. private _onPointerOutHandlerRef;
  8828. private _onResize;
  8829. constructor(leftJoystick?: boolean);
  8830. setJoystickSensibility(newJoystickSensibility: number): void;
  8831. private _onPointerDown(e);
  8832. private _onPointerMove(e);
  8833. private _onPointerUp(e);
  8834. /**
  8835. * Change the color of the virtual joystick
  8836. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  8837. */
  8838. setJoystickColor(newColor: string): void;
  8839. setActionOnTouch(action: () => any): void;
  8840. setAxisForLeftRight(axis: JoystickAxis): void;
  8841. setAxisForUpDown(axis: JoystickAxis): void;
  8842. private _clearCanvas();
  8843. private _drawVirtualJoystick();
  8844. releaseCanvas(): void;
  8845. }
  8846. }
  8847. declare module BABYLON {
  8848. class VRCameraMetrics {
  8849. hResolution: number;
  8850. vResolution: number;
  8851. hScreenSize: number;
  8852. vScreenSize: number;
  8853. vScreenCenter: number;
  8854. eyeToScreenDistance: number;
  8855. lensSeparationDistance: number;
  8856. interpupillaryDistance: number;
  8857. distortionK: number[];
  8858. chromaAbCorrection: number[];
  8859. postProcessScaleFactor: number;
  8860. lensCenterOffset: number;
  8861. compensateDistortion: boolean;
  8862. aspectRatio: number;
  8863. aspectRatioFov: number;
  8864. leftHMatrix: Matrix;
  8865. rightHMatrix: Matrix;
  8866. leftPreViewMatrix: Matrix;
  8867. rightPreViewMatrix: Matrix;
  8868. static GetDefault(): VRCameraMetrics;
  8869. }
  8870. }
  8871. declare module BABYLON {
  8872. class VRDeviceOrientationFreeCamera extends FreeCamera {
  8873. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean);
  8874. getTypeName(): string;
  8875. }
  8876. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  8877. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean);
  8878. getTypeName(): string;
  8879. }
  8880. }
  8881. declare var HMDVRDevice: any;
  8882. declare var PositionSensorVRDevice: any;
  8883. declare module BABYLON {
  8884. class WebVRFreeCamera extends FreeCamera {
  8885. _hmdDevice: any;
  8886. _sensorDevice: any;
  8887. _cacheState: any;
  8888. _cacheQuaternion: Quaternion;
  8889. _cacheRotation: Vector3;
  8890. _vrEnabled: boolean;
  8891. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean);
  8892. private _getWebVRDevices(devices);
  8893. _checkInputs(): void;
  8894. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8895. detachControl(element: HTMLElement): void;
  8896. getTypeName(): string;
  8897. }
  8898. }
  8899. declare module BABYLON {
  8900. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  8901. camera: ArcRotateCamera;
  8902. gamepad: Gamepad;
  8903. private _gamepads;
  8904. gamepadRotationSensibility: number;
  8905. gamepadMoveSensibility: number;
  8906. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8907. detachControl(element: HTMLElement): void;
  8908. checkInputs(): void;
  8909. private _onNewGameConnected(gamepad);
  8910. getTypeName(): string;
  8911. getSimpleName(): string;
  8912. }
  8913. }
  8914. declare module BABYLON {
  8915. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  8916. camera: ArcRotateCamera;
  8917. private _keys;
  8918. private _onKeyDown;
  8919. private _onKeyUp;
  8920. private _onLostFocus;
  8921. keysUp: number[];
  8922. keysDown: number[];
  8923. keysLeft: number[];
  8924. keysRight: number[];
  8925. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8926. detachControl(element: HTMLElement): void;
  8927. checkInputs(): void;
  8928. getTypeName(): string;
  8929. getSimpleName(): string;
  8930. }
  8931. }
  8932. declare module BABYLON {
  8933. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  8934. camera: ArcRotateCamera;
  8935. private _wheel;
  8936. private _observer;
  8937. wheelPrecision: number;
  8938. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8939. detachControl(element: HTMLElement): void;
  8940. getTypeName(): string;
  8941. getSimpleName(): string;
  8942. }
  8943. }
  8944. declare module BABYLON {
  8945. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  8946. camera: ArcRotateCamera;
  8947. angularSensibilityX: number;
  8948. angularSensibilityY: number;
  8949. pinchPrecision: number;
  8950. panningSensibility: number;
  8951. private _isRightClick;
  8952. private _isCtrlPushed;
  8953. pinchInwards: boolean;
  8954. private _pointerInput;
  8955. private _observer;
  8956. private _onKeyDown;
  8957. private _onKeyUp;
  8958. private _onMouseMove;
  8959. private _onGestureStart;
  8960. private _onGesture;
  8961. private _MSGestureHandler;
  8962. private _onLostFocus;
  8963. private _onContextMenu;
  8964. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8965. detachControl(element: HTMLElement): void;
  8966. getTypeName(): string;
  8967. getSimpleName(): string;
  8968. }
  8969. }
  8970. declare module BABYLON {
  8971. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  8972. camera: ArcRotateCamera;
  8973. alphaCorrection: number;
  8974. betaCorrection: number;
  8975. gammaCorrection: number;
  8976. private _alpha;
  8977. private _beta;
  8978. private _gamma;
  8979. private _dirty;
  8980. private _offsetOrientation;
  8981. private _deviceOrientationHandler;
  8982. constructor();
  8983. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  8984. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  8985. checkInputs(): void;
  8986. detachControl(element: HTMLElement): void;
  8987. getTypeName(): string;
  8988. getSimpleName(): string;
  8989. }
  8990. }
  8991. declare module BABYLON {
  8992. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  8993. camera: FreeCamera;
  8994. private _offsetX;
  8995. private _offsetY;
  8996. private _orientationGamma;
  8997. private _orientationBeta;
  8998. private _initialOrientationGamma;
  8999. private _initialOrientationBeta;
  9000. private _orientationChanged;
  9001. private _resetOrientationGamma;
  9002. angularSensibility: number;
  9003. moveSensibility: number;
  9004. constructor();
  9005. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9006. resetOrientationGamma(): void;
  9007. orientationChanged(evt: any): void;
  9008. detachControl(element: HTMLElement): void;
  9009. checkInputs(): void;
  9010. getTypeName(): string;
  9011. getSimpleName(): string;
  9012. }
  9013. }
  9014. declare module BABYLON {
  9015. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  9016. camera: FreeCamera;
  9017. gamepad: Gamepad;
  9018. private _gamepads;
  9019. gamepadAngularSensibility: number;
  9020. gamepadMoveSensibility: number;
  9021. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9022. detachControl(element: HTMLElement): void;
  9023. checkInputs(): void;
  9024. private _onNewGameConnected(gamepad);
  9025. getTypeName(): string;
  9026. getSimpleName(): string;
  9027. }
  9028. }
  9029. declare module BABYLON {
  9030. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  9031. camera: FreeCamera;
  9032. private _keys;
  9033. private _onKeyDown;
  9034. private _onKeyUp;
  9035. keysUp: number[];
  9036. keysDown: number[];
  9037. keysLeft: number[];
  9038. keysRight: number[];
  9039. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9040. detachControl(element: HTMLElement): void;
  9041. checkInputs(): void;
  9042. getTypeName(): string;
  9043. _onLostFocus(e: FocusEvent): void;
  9044. getSimpleName(): string;
  9045. }
  9046. }
  9047. declare module BABYLON {
  9048. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  9049. touchEnabled: boolean;
  9050. camera: FreeCamera;
  9051. angularSensibility: number;
  9052. private _pointerInput;
  9053. private _observer;
  9054. private previousPosition;
  9055. constructor(touchEnabled?: boolean);
  9056. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9057. detachControl(element: HTMLElement): void;
  9058. getTypeName(): string;
  9059. getSimpleName(): string;
  9060. }
  9061. }
  9062. declare module BABYLON {
  9063. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  9064. camera: FreeCamera;
  9065. private _offsetX;
  9066. private _offsetY;
  9067. private _pointerCount;
  9068. private _pointerPressed;
  9069. private _pointerInput;
  9070. private _observer;
  9071. private _onLostFocus;
  9072. touchAngularSensibility: number;
  9073. touchMoveSensibility: number;
  9074. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9075. detachControl(element: HTMLElement): void;
  9076. checkInputs(): void;
  9077. getTypeName(): string;
  9078. getSimpleName(): string;
  9079. }
  9080. }
  9081. declare module BABYLON {
  9082. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  9083. camera: FreeCamera;
  9084. private _leftjoystick;
  9085. private _rightjoystick;
  9086. getLeftJoystick(): VirtualJoystick;
  9087. getRightJoystick(): VirtualJoystick;
  9088. checkInputs(): void;
  9089. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9090. detachControl(element: HTMLElement): void;
  9091. getTypeName(): string;
  9092. getSimpleName(): string;
  9093. }
  9094. }
  9095. declare module BABYLON {
  9096. class FreeCameraVRDeviceOrientationInput implements ICameraInput<FreeCamera> {
  9097. camera: FreeCamera;
  9098. alphaCorrection: number;
  9099. betaCorrection: number;
  9100. gammaCorrection: number;
  9101. private _alpha;
  9102. private _beta;
  9103. private _gamma;
  9104. private _dirty;
  9105. private _offsetOrientation;
  9106. private _deviceOrientationHandler;
  9107. constructor();
  9108. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  9109. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  9110. checkInputs(): void;
  9111. detachControl(element: HTMLElement): void;
  9112. getTypeName(): string;
  9113. getSimpleName(): string;
  9114. }
  9115. }
  9116. declare module BABYLON {
  9117. interface IOctreeContainer<T> {
  9118. blocks: Array<OctreeBlock<T>>;
  9119. }
  9120. class Octree<T> {
  9121. maxDepth: number;
  9122. blocks: Array<OctreeBlock<T>>;
  9123. dynamicContent: T[];
  9124. private _maxBlockCapacity;
  9125. private _selectionContent;
  9126. private _creationFunc;
  9127. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  9128. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  9129. addMesh(entry: T): void;
  9130. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  9131. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  9132. intersectsRay(ray: Ray): SmartArray<T>;
  9133. 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;
  9134. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  9135. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  9136. }
  9137. }
  9138. declare module BABYLON {
  9139. class OctreeBlock<T> {
  9140. entries: T[];
  9141. blocks: Array<OctreeBlock<T>>;
  9142. private _depth;
  9143. private _maxDepth;
  9144. private _capacity;
  9145. private _minPoint;
  9146. private _maxPoint;
  9147. private _boundingVectors;
  9148. private _creationFunc;
  9149. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  9150. capacity: number;
  9151. minPoint: Vector3;
  9152. maxPoint: Vector3;
  9153. addEntry(entry: T): void;
  9154. addEntries(entries: T[]): void;
  9155. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  9156. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  9157. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  9158. createInnerBlocks(): void;
  9159. }
  9160. }
  9161. declare module BABYLON {
  9162. class ShadowGenerator {
  9163. private static _FILTER_NONE;
  9164. private static _FILTER_VARIANCESHADOWMAP;
  9165. private static _FILTER_POISSONSAMPLING;
  9166. private static _FILTER_BLURVARIANCESHADOWMAP;
  9167. static FILTER_NONE: number;
  9168. static FILTER_VARIANCESHADOWMAP: number;
  9169. static FILTER_POISSONSAMPLING: number;
  9170. static FILTER_BLURVARIANCESHADOWMAP: number;
  9171. private _filter;
  9172. blurScale: number;
  9173. private _blurBoxOffset;
  9174. private _bias;
  9175. private _lightDirection;
  9176. forceBackFacesOnly: boolean;
  9177. bias: number;
  9178. blurBoxOffset: number;
  9179. filter: number;
  9180. useVarianceShadowMap: boolean;
  9181. usePoissonSampling: boolean;
  9182. useBlurVarianceShadowMap: boolean;
  9183. private _light;
  9184. private _scene;
  9185. private _shadowMap;
  9186. private _shadowMap2;
  9187. private _darkness;
  9188. private _transparencyShadow;
  9189. private _effect;
  9190. private _viewMatrix;
  9191. private _projectionMatrix;
  9192. private _transformMatrix;
  9193. private _worldViewProjection;
  9194. private _cachedPosition;
  9195. private _cachedDirection;
  9196. private _cachedDefines;
  9197. private _currentRenderID;
  9198. private _downSamplePostprocess;
  9199. private _boxBlurPostprocess;
  9200. private _mapSize;
  9201. private _currentFaceIndex;
  9202. private _currentFaceIndexCache;
  9203. constructor(mapSize: number, light: IShadowLight);
  9204. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9205. getShadowMap(): RenderTargetTexture;
  9206. getShadowMapForRendering(): RenderTargetTexture;
  9207. getLight(): IShadowLight;
  9208. getTransformMatrix(): Matrix;
  9209. getDarkness(): number;
  9210. setDarkness(darkness: number): void;
  9211. setTransparencyShadow(hasShadow: boolean): void;
  9212. private _packHalf(depth);
  9213. dispose(): void;
  9214. serialize(): any;
  9215. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  9216. }
  9217. }
  9218. declare module BABYLON.Internals {
  9219. }
  9220. declare module BABYLON {
  9221. class BaseTexture {
  9222. name: string;
  9223. hasAlpha: boolean;
  9224. getAlphaFromRGB: boolean;
  9225. level: number;
  9226. coordinatesIndex: number;
  9227. coordinatesMode: number;
  9228. wrapU: number;
  9229. wrapV: number;
  9230. anisotropicFilteringLevel: number;
  9231. isCube: boolean;
  9232. isRenderTarget: boolean;
  9233. animations: Animation[];
  9234. onDispose: () => void;
  9235. delayLoadState: number;
  9236. _cachedAnisotropicFilteringLevel: number;
  9237. private _scene;
  9238. _texture: WebGLTexture;
  9239. constructor(scene: Scene);
  9240. getScene(): Scene;
  9241. getTextureMatrix(): Matrix;
  9242. getReflectionTextureMatrix(): Matrix;
  9243. getInternalTexture(): WebGLTexture;
  9244. isReady(): boolean;
  9245. getSize(): ISize;
  9246. getBaseSize(): ISize;
  9247. scale(ratio: number): void;
  9248. canRescale: boolean;
  9249. _removeFromCache(url: string, noMipmap: boolean): void;
  9250. _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture;
  9251. delayLoad(): void;
  9252. clone(): BaseTexture;
  9253. releaseInternalTexture(): void;
  9254. dispose(): void;
  9255. serialize(): any;
  9256. }
  9257. }
  9258. declare module BABYLON {
  9259. class CubeTexture extends BaseTexture {
  9260. url: string;
  9261. coordinatesMode: number;
  9262. private _noMipmap;
  9263. private _files;
  9264. private _extensions;
  9265. private _textureMatrix;
  9266. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  9267. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[]);
  9268. delayLoad(): void;
  9269. getReflectionTextureMatrix(): Matrix;
  9270. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  9271. clone(): CubeTexture;
  9272. }
  9273. }
  9274. declare module BABYLON {
  9275. class DynamicTexture extends Texture {
  9276. private _generateMipMaps;
  9277. private _canvas;
  9278. private _context;
  9279. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  9280. canRescale: boolean;
  9281. scale(ratio: number): void;
  9282. getContext(): CanvasRenderingContext2D;
  9283. clear(): void;
  9284. update(invertY?: boolean): void;
  9285. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  9286. clone(): DynamicTexture;
  9287. }
  9288. }
  9289. declare module BABYLON {
  9290. /**
  9291. * This represents a texture coming from an HDR input.
  9292. *
  9293. * The only supported format is currently panorama picture stored in RGBE format.
  9294. * Example of such files can be found on HDRLib: http://hdrlib.com/
  9295. */
  9296. class HDRCubeTexture extends BaseTexture {
  9297. private static _facesMapping;
  9298. private _useInGammaSpace;
  9299. private _generateHarmonics;
  9300. private _noMipmap;
  9301. private _extensions;
  9302. private _textureMatrix;
  9303. private _size;
  9304. private _usePMREMGenerator;
  9305. private _isBABYLONPreprocessed;
  9306. /**
  9307. * The texture URL.
  9308. */
  9309. url: string;
  9310. /**
  9311. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  9312. */
  9313. coordinatesMode: number;
  9314. /**
  9315. * The spherical polynomial data extracted from the texture.
  9316. */
  9317. sphericalPolynomial: SphericalPolynomial;
  9318. /**
  9319. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  9320. * This is usefull at run time to apply the good shader.
  9321. */
  9322. isPMREM: boolean;
  9323. /**
  9324. * Instantiates an HDRTexture from the following parameters.
  9325. *
  9326. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  9327. * @param scene The scene the texture will be used in
  9328. * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
  9329. * @param noMipmap Forces to not generate the mipmap if true
  9330. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  9331. * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  9332. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  9333. */
  9334. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  9335. /**
  9336. * Occurs when the file is a preprocessed .babylon.hdr file.
  9337. */
  9338. private loadBabylonTexture();
  9339. /**
  9340. * Occurs when the file is raw .hdr file.
  9341. */
  9342. private loadHDRTexture();
  9343. /**
  9344. * Starts the loading process of the texture.
  9345. */
  9346. private loadTexture();
  9347. clone(): HDRCubeTexture;
  9348. delayLoad(): void;
  9349. getReflectionTextureMatrix(): Matrix;
  9350. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  9351. serialize(): any;
  9352. /**
  9353. * Saves as a file the data contained in the texture in a binary format.
  9354. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  9355. * as the spherical used in the lighting.
  9356. * @param url The HDR file url.
  9357. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  9358. * @param onError Method called if any error happens during download.
  9359. * @return The packed binary data.
  9360. */
  9361. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  9362. /**
  9363. * Serializes the data contained in the texture in a binary format.
  9364. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  9365. * as the spherical used in the lighting.
  9366. * @param url The HDR file url.
  9367. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  9368. * @param onError Method called if any error happens during download.
  9369. * @return The packed binary data.
  9370. */
  9371. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer) => void), onError?: (() => void)): void;
  9372. }
  9373. }
  9374. declare module BABYLON {
  9375. class MirrorTexture extends RenderTargetTexture {
  9376. mirrorPlane: Plane;
  9377. private _transformMatrix;
  9378. private _mirrorMatrix;
  9379. private _savedViewMatrix;
  9380. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  9381. clone(): MirrorTexture;
  9382. serialize(): any;
  9383. }
  9384. }
  9385. declare module BABYLON {
  9386. class RawTexture extends Texture {
  9387. format: number;
  9388. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  9389. update(data: ArrayBufferView): void;
  9390. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9391. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9392. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9393. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9394. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  9395. }
  9396. }
  9397. declare module BABYLON {
  9398. /**
  9399. * Creates a refraction texture used by refraction channel of the standard material.
  9400. * @param name the texture name
  9401. * @param size size of the underlying texture
  9402. * @param scene root scene
  9403. */
  9404. class RefractionTexture extends RenderTargetTexture {
  9405. refractionPlane: Plane;
  9406. depth: number;
  9407. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  9408. clone(): RefractionTexture;
  9409. serialize(): any;
  9410. }
  9411. }
  9412. declare module BABYLON {
  9413. class RenderTargetTexture extends Texture {
  9414. isCube: boolean;
  9415. static _REFRESHRATE_RENDER_ONCE: number;
  9416. static _REFRESHRATE_RENDER_ONEVERYFRAME: number;
  9417. static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  9418. static REFRESHRATE_RENDER_ONCE: number;
  9419. static REFRESHRATE_RENDER_ONEVERYFRAME: number;
  9420. static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  9421. renderList: AbstractMesh[];
  9422. renderParticles: boolean;
  9423. renderSprites: boolean;
  9424. coordinatesMode: number;
  9425. onBeforeRender: (faceIndex: number) => void;
  9426. onAfterRender: (faceIndex: number) => void;
  9427. onAfterUnbind: () => void;
  9428. onClear: (engine: Engine) => void;
  9429. activeCamera: Camera;
  9430. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  9431. private _size;
  9432. _generateMipMaps: boolean;
  9433. private _renderingManager;
  9434. _waitingRenderList: string[];
  9435. private _doNotChangeAspectRatio;
  9436. private _currentRefreshId;
  9437. private _refreshRate;
  9438. private _textureMatrix;
  9439. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean);
  9440. resetRefreshCounter(): void;
  9441. refreshRate: number;
  9442. _shouldRender(): boolean;
  9443. isReady(): boolean;
  9444. getRenderSize(): number;
  9445. canRescale: boolean;
  9446. scale(ratio: number): void;
  9447. getReflectionTextureMatrix(): Matrix;
  9448. resize(size: any, generateMipMaps?: boolean): void;
  9449. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  9450. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  9451. clone(): RenderTargetTexture;
  9452. serialize(): any;
  9453. }
  9454. }
  9455. declare module BABYLON {
  9456. class Texture extends BaseTexture {
  9457. static NEAREST_SAMPLINGMODE: number;
  9458. static BILINEAR_SAMPLINGMODE: number;
  9459. static TRILINEAR_SAMPLINGMODE: number;
  9460. static EXPLICIT_MODE: number;
  9461. static SPHERICAL_MODE: number;
  9462. static PLANAR_MODE: number;
  9463. static CUBIC_MODE: number;
  9464. static PROJECTION_MODE: number;
  9465. static SKYBOX_MODE: number;
  9466. static INVCUBIC_MODE: number;
  9467. static EQUIRECTANGULAR_MODE: number;
  9468. static FIXED_EQUIRECTANGULAR_MODE: number;
  9469. static CLAMP_ADDRESSMODE: number;
  9470. static WRAP_ADDRESSMODE: number;
  9471. static MIRROR_ADDRESSMODE: number;
  9472. url: string;
  9473. uOffset: number;
  9474. vOffset: number;
  9475. uScale: number;
  9476. vScale: number;
  9477. uAng: number;
  9478. vAng: number;
  9479. wAng: number;
  9480. private _noMipmap;
  9481. _invertY: boolean;
  9482. private _rowGenerationMatrix;
  9483. private _cachedTextureMatrix;
  9484. private _projectionModeMatrix;
  9485. private _t0;
  9486. private _t1;
  9487. private _t2;
  9488. private _cachedUOffset;
  9489. private _cachedVOffset;
  9490. private _cachedUScale;
  9491. private _cachedVScale;
  9492. private _cachedUAng;
  9493. private _cachedVAng;
  9494. private _cachedWAng;
  9495. private _cachedCoordinatesMode;
  9496. _samplingMode: number;
  9497. private _buffer;
  9498. private _deleteBuffer;
  9499. private _delayedOnLoad;
  9500. private _delayedOnError;
  9501. constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
  9502. delayLoad(): void;
  9503. updateSamplingMode(samplingMode: number): void;
  9504. private _prepareRowForTextureGeneration(x, y, z, t);
  9505. getTextureMatrix(): Matrix;
  9506. getReflectionTextureMatrix(): Matrix;
  9507. clone(): Texture;
  9508. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  9509. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  9510. }
  9511. }
  9512. declare module BABYLON {
  9513. class VideoTexture extends Texture {
  9514. video: HTMLVideoElement;
  9515. private _autoLaunch;
  9516. private _lastUpdate;
  9517. private _generateMipMaps;
  9518. /**
  9519. * Creates a video texture.
  9520. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  9521. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  9522. * @param {BABYLON.Scene} scene is obviously the current scene.
  9523. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  9524. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  9525. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  9526. */
  9527. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  9528. private _createTexture();
  9529. update(): boolean;
  9530. }
  9531. }
  9532. declare module BABYLON {
  9533. class CannonJSPlugin implements IPhysicsEnginePlugin {
  9534. private _useDeltaForWorldStep;
  9535. world: any;
  9536. name: string;
  9537. private _physicsMaterials;
  9538. private _fixedTimeStep;
  9539. private _currentCollisionGroup;
  9540. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  9541. setGravity(gravity: Vector3): void;
  9542. setTimeStep(timeStep: number): void;
  9543. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  9544. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  9545. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  9546. generatePhysicsBody(impostor: PhysicsImpostor): void;
  9547. private _processChildMeshes(mainImpostor);
  9548. removePhysicsBody(impostor: PhysicsImpostor): void;
  9549. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  9550. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  9551. private _addMaterial(name, friction, restitution);
  9552. private _checkWithEpsilon(value);
  9553. private _createShape(impostor);
  9554. private _createHeightmap(object, pointDepth?);
  9555. private _minus90X;
  9556. private _plus90X;
  9557. private _tmpPosition;
  9558. private _tmpQuaternion;
  9559. private _tmpDeltaPosition;
  9560. private _tmpDeltaRotation;
  9561. private _tmpUnityRotation;
  9562. private _updatePhysicsBodyTransformation(impostor);
  9563. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  9564. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  9565. isSupported(): boolean;
  9566. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  9567. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  9568. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  9569. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  9570. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  9571. sleepBody(impostor: PhysicsImpostor): void;
  9572. wakeUpBody(impostor: PhysicsImpostor): void;
  9573. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  9574. private enableMotor(joint, motorIndex?);
  9575. private disableMotor(joint, motorIndex?);
  9576. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  9577. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  9578. dispose(): void;
  9579. }
  9580. }
  9581. declare module BABYLON {
  9582. class OimoJSPlugin {
  9583. world: any;
  9584. name: string;
  9585. constructor(iterations?: number);
  9586. setGravity(gravity: Vector3): void;
  9587. setTimeStep(timeStep: number): void;
  9588. private _tmpImpostorsArray;
  9589. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  9590. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  9591. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  9592. generatePhysicsBody(impostor: PhysicsImpostor): void;
  9593. private _tmpPositionVector;
  9594. removePhysicsBody(impostor: PhysicsImpostor): void;
  9595. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  9596. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  9597. isSupported(): boolean;
  9598. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  9599. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  9600. private _getLastShape(body);
  9601. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  9602. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  9603. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  9604. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  9605. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  9606. sleepBody(impostor: PhysicsImpostor): void;
  9607. wakeUpBody(impostor: PhysicsImpostor): void;
  9608. updateDistanceJoint(joint: IMotorEnabledJoint, maxDistance: number, minDistance?: number): void;
  9609. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  9610. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  9611. dispose(): void;
  9612. }
  9613. }
  9614. declare module BABYLON {
  9615. class PostProcessRenderEffect {
  9616. private _engine;
  9617. private _postProcesses;
  9618. private _getPostProcess;
  9619. private _singleInstance;
  9620. private _cameras;
  9621. private _indicesForCamera;
  9622. private _renderPasses;
  9623. private _renderEffectAsPasses;
  9624. _name: string;
  9625. applyParameters: (postProcess: PostProcess) => void;
  9626. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  9627. isSupported: boolean;
  9628. _update(): void;
  9629. addPass(renderPass: PostProcessRenderPass): void;
  9630. removePass(renderPass: PostProcessRenderPass): void;
  9631. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  9632. getPass(passName: string): void;
  9633. emptyPasses(): void;
  9634. _attachCameras(cameras: Camera): any;
  9635. _attachCameras(cameras: Camera[]): any;
  9636. _detachCameras(cameras: Camera): any;
  9637. _detachCameras(cameras: Camera[]): any;
  9638. _enable(cameras: Camera): any;
  9639. _enable(cameras: Camera[]): any;
  9640. _disable(cameras: Camera): any;
  9641. _disable(cameras: Camera[]): any;
  9642. getPostProcess(camera?: Camera): PostProcess;
  9643. private _linkParameters();
  9644. private _linkTextures(effect);
  9645. }
  9646. }
  9647. declare module BABYLON {
  9648. class PostProcessRenderPass {
  9649. private _enabled;
  9650. private _renderList;
  9651. private _renderTexture;
  9652. private _scene;
  9653. private _refCount;
  9654. _name: string;
  9655. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  9656. _incRefCount(): number;
  9657. _decRefCount(): number;
  9658. _update(): void;
  9659. setRenderList(renderList: Mesh[]): void;
  9660. getRenderTexture(): RenderTargetTexture;
  9661. }
  9662. }
  9663. declare module BABYLON {
  9664. class PostProcessRenderPipeline {
  9665. private _engine;
  9666. private _renderEffects;
  9667. private _renderEffectsForIsolatedPass;
  9668. private _cameras;
  9669. _name: string;
  9670. private static PASS_EFFECT_NAME;
  9671. private static PASS_SAMPLER_NAME;
  9672. constructor(engine: Engine, name: string);
  9673. isSupported: boolean;
  9674. addEffect(renderEffect: PostProcessRenderEffect): void;
  9675. _enableEffect(renderEffectName: string, cameras: Camera): any;
  9676. _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  9677. _disableEffect(renderEffectName: string, cameras: Camera): any;
  9678. _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  9679. _attachCameras(cameras: Camera, unique: boolean): any;
  9680. _attachCameras(cameras: Camera[], unique: boolean): any;
  9681. _detachCameras(cameras: Camera): any;
  9682. _detachCameras(cameras: Camera[]): any;
  9683. _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  9684. _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  9685. _disableDisplayOnlyPass(cameras: Camera): any;
  9686. _disableDisplayOnlyPass(cameras: Camera[]): any;
  9687. _update(): void;
  9688. dispose(): void;
  9689. }
  9690. }
  9691. declare module BABYLON {
  9692. class PostProcessRenderPipelineManager {
  9693. private _renderPipelines;
  9694. constructor();
  9695. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  9696. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  9697. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  9698. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  9699. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  9700. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  9701. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  9702. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  9703. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  9704. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  9705. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  9706. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  9707. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  9708. update(): void;
  9709. }
  9710. }
  9711. declare module BABYLON.Internals {
  9712. /**
  9713. * Helper class dealing with the extraction of spherical polynomial dataArray
  9714. * from a cube map.
  9715. */
  9716. class CubeMapToSphericalPolynomialTools {
  9717. private static FileFaces;
  9718. /**
  9719. * Converts a cubemap to the according Spherical Polynomial data.
  9720. * This extracts the first 3 orders only as they are the only one used in the lighting.
  9721. *
  9722. * @param cubeInfo The Cube map to extract the information from.
  9723. * @return The Spherical Polynomial data.
  9724. */
  9725. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  9726. }
  9727. }
  9728. declare module BABYLON.Internals {
  9729. /**
  9730. * Header information of HDR texture files.
  9731. */
  9732. interface HDRInfo {
  9733. /**
  9734. * The height of the texture in pixels.
  9735. */
  9736. height: number;
  9737. /**
  9738. * The width of the texture in pixels.
  9739. */
  9740. width: number;
  9741. /**
  9742. * The index of the beginning of the data in the binary file.
  9743. */
  9744. dataPosition: number;
  9745. }
  9746. /**
  9747. * This groups tools to convert HDR texture to native colors array.
  9748. */
  9749. class HDRTools {
  9750. private static Ldexp(mantissa, exponent);
  9751. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  9752. private static readStringLine(uint8array, startIndex);
  9753. /**
  9754. * Reads header information from an RGBE texture stored in a native array.
  9755. * More information on this format are available here:
  9756. * https://en.wikipedia.org/wiki/RGBE_image_format
  9757. *
  9758. * @param uint8array The binary file stored in native array.
  9759. * @return The header information.
  9760. */
  9761. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  9762. /**
  9763. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  9764. * This RGBE texture needs to store the information as a panorama.
  9765. *
  9766. * More information on this format are available here:
  9767. * https://en.wikipedia.org/wiki/RGBE_image_format
  9768. *
  9769. * @param buffer The binary file stored in an array buffer.
  9770. * @param size The expected size of the extracted cubemap.
  9771. * @return The Cube Map information.
  9772. */
  9773. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  9774. /**
  9775. * Returns the pixels data extracted from an RGBE texture.
  9776. * This pixels will be stored left to right up to down in the R G B order in one array.
  9777. *
  9778. * More information on this format are available here:
  9779. * https://en.wikipedia.org/wiki/RGBE_image_format
  9780. *
  9781. * @param uint8array The binary file stored in an array buffer.
  9782. * @param hdrInfo The header information of the file.
  9783. * @return The pixels data in RGB right to left up to down order.
  9784. */
  9785. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  9786. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  9787. }
  9788. }
  9789. declare module BABYLON.Internals {
  9790. /**
  9791. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  9792. */
  9793. interface CubeMapInfo {
  9794. /**
  9795. * The pixel array for the front face.
  9796. * This is stored in RGB, left to right, up to down format.
  9797. */
  9798. front: Float32Array;
  9799. /**
  9800. * The pixel array for the back face.
  9801. * This is stored in RGB, left to right, up to down format.
  9802. */
  9803. back: Float32Array;
  9804. /**
  9805. * The pixel array for the left face.
  9806. * This is stored in RGB, left to right, up to down format.
  9807. */
  9808. left: Float32Array;
  9809. /**
  9810. * The pixel array for the right face.
  9811. * This is stored in RGB, left to right, up to down format.
  9812. */
  9813. right: Float32Array;
  9814. /**
  9815. * The pixel array for the up face.
  9816. * This is stored in RGB, left to right, up to down format.
  9817. */
  9818. up: Float32Array;
  9819. /**
  9820. * The pixel array for the down face.
  9821. * This is stored in RGB, left to right, up to down format.
  9822. */
  9823. down: Float32Array;
  9824. /**
  9825. * The size of the cubemap stored.
  9826. *
  9827. * Each faces will be size * size pixels.
  9828. */
  9829. size: number;
  9830. }
  9831. /**
  9832. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  9833. */
  9834. class PanoramaToCubeMapTools {
  9835. private static FACE_FRONT;
  9836. private static FACE_BACK;
  9837. private static FACE_RIGHT;
  9838. private static FACE_LEFT;
  9839. private static FACE_DOWN;
  9840. private static FACE_UP;
  9841. /**
  9842. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  9843. *
  9844. * @param float32Array The source data.
  9845. * @param inputWidth The width of the input panorama.
  9846. * @param inputhHeight The height of the input panorama.
  9847. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  9848. * @return The cubemap data
  9849. */
  9850. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  9851. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  9852. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  9853. }
  9854. }
  9855. declare namespace BABYLON.Internals {
  9856. /**
  9857. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  9858. * required by the glossinees of a material.
  9859. *
  9860. * This only supports the cosine drop power as well as Warp fixup generation method.
  9861. *
  9862. * This is using the process from CubeMapGen described here:
  9863. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  9864. */
  9865. class PMREMGenerator {
  9866. input: ArrayBufferView[];
  9867. inputSize: number;
  9868. outputSize: number;
  9869. maxNumMipLevels: number;
  9870. numChannels: number;
  9871. isFloat: boolean;
  9872. specularPower: number;
  9873. cosinePowerDropPerMip: number;
  9874. excludeBase: boolean;
  9875. fixup: boolean;
  9876. private static CP_MAX_MIPLEVELS;
  9877. private static CP_UDIR;
  9878. private static CP_VDIR;
  9879. private static CP_FACEAXIS;
  9880. private static CP_FACE_X_POS;
  9881. private static CP_FACE_X_NEG;
  9882. private static CP_FACE_Y_POS;
  9883. private static CP_FACE_Y_NEG;
  9884. private static CP_FACE_Z_POS;
  9885. private static CP_FACE_Z_NEG;
  9886. private static CP_EDGE_LEFT;
  9887. private static CP_EDGE_RIGHT;
  9888. private static CP_EDGE_TOP;
  9889. private static CP_EDGE_BOTTOM;
  9890. private static CP_CORNER_NNN;
  9891. private static CP_CORNER_NNP;
  9892. private static CP_CORNER_NPN;
  9893. private static CP_CORNER_NPP;
  9894. private static CP_CORNER_PNN;
  9895. private static CP_CORNER_PNP;
  9896. private static CP_CORNER_PPN;
  9897. private static CP_CORNER_PPP;
  9898. private static _vectorTemp;
  9899. private static _sgFace2DMapping;
  9900. private static _sgCubeNgh;
  9901. private static _sgCubeEdgeList;
  9902. private static _sgCubeCornerList;
  9903. private _outputSurface;
  9904. private _normCubeMap;
  9905. private _filterLUT;
  9906. private _numMipLevels;
  9907. /**
  9908. * Constructor of the generator.
  9909. *
  9910. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  9911. * @param inputSize The size of the cubemap faces
  9912. * @param outputSize The size of the output cubemap faces
  9913. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  9914. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  9915. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  9916. * @param specularPower The max specular level of the desired cubemap
  9917. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  9918. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  9919. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  9920. */
  9921. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  9922. /**
  9923. * Launches the filter process and return the result.
  9924. *
  9925. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  9926. */
  9927. filterCubeMap(): ArrayBufferView[][];
  9928. private init();
  9929. private filterCubeMapMipChain();
  9930. private getBaseFilterAngle(cosinePower);
  9931. private precomputeFilterLookupTables(srcCubeMapWidth);
  9932. private buildNormalizerSolidAngleCubemap(size);
  9933. private texelCoordToVect(faceIdx, u, v, size, fixup);
  9934. private vectToTexelCoord(x, y, z, size);
  9935. private areaElement(x, y);
  9936. private texelCoordSolidAngle(faceIdx, u, v, size);
  9937. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  9938. private clearFilterExtents(filterExtents);
  9939. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  9940. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  9941. private fixupCubeEdges(cubeMap, cubeMapSize);
  9942. }
  9943. }
  9944. declare module BABYLON {
  9945. class CustomProceduralTexture extends ProceduralTexture {
  9946. private _animate;
  9947. private _time;
  9948. private _config;
  9949. private _texturePath;
  9950. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  9951. private loadJson(jsonUrl);
  9952. isReady(): boolean;
  9953. render(useCameraPostProcess?: boolean): void;
  9954. updateTextures(): void;
  9955. updateShaderUniforms(): void;
  9956. animate: boolean;
  9957. }
  9958. }
  9959. declare module BABYLON {
  9960. class ProceduralTexture extends Texture {
  9961. isCube: boolean;
  9962. private _size;
  9963. _generateMipMaps: boolean;
  9964. isEnabled: boolean;
  9965. private _doNotChangeAspectRatio;
  9966. private _currentRefreshId;
  9967. private _refreshRate;
  9968. onGenerated: () => void;
  9969. private _vertexBuffer;
  9970. private _indexBuffer;
  9971. private _effect;
  9972. private _vertexDeclaration;
  9973. private _vertexStrideSize;
  9974. private _uniforms;
  9975. private _samplers;
  9976. private _fragment;
  9977. _textures: Texture[];
  9978. private _floats;
  9979. private _floatsArrays;
  9980. private _colors3;
  9981. private _colors4;
  9982. private _vectors2;
  9983. private _vectors3;
  9984. private _matrices;
  9985. private _fallbackTexture;
  9986. private _fallbackTextureUsed;
  9987. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  9988. reset(): void;
  9989. isReady(): boolean;
  9990. resetRefreshCounter(): void;
  9991. setFragment(fragment: any): void;
  9992. refreshRate: number;
  9993. _shouldRender(): boolean;
  9994. getRenderSize(): number;
  9995. resize(size: any, generateMipMaps: any): void;
  9996. private _checkUniform(uniformName);
  9997. setTexture(name: string, texture: Texture): ProceduralTexture;
  9998. setFloat(name: string, value: number): ProceduralTexture;
  9999. setFloats(name: string, value: number[]): ProceduralTexture;
  10000. setColor3(name: string, value: Color3): ProceduralTexture;
  10001. setColor4(name: string, value: Color4): ProceduralTexture;
  10002. setVector2(name: string, value: Vector2): ProceduralTexture;
  10003. setVector3(name: string, value: Vector3): ProceduralTexture;
  10004. setMatrix(name: string, value: Matrix): ProceduralTexture;
  10005. render(useCameraPostProcess?: boolean): void;
  10006. clone(): ProceduralTexture;
  10007. dispose(): void;
  10008. }
  10009. }