index.d.ts 499 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457
  1. declare module 'babylonjs/core' {
  2. class EffectFallbacks {
  3. private _defines;
  4. private _currentRank;
  5. private _maxRank;
  6. private _mesh;
  7. unBindMesh(): void;
  8. addFallback(rank: number, define: string): void;
  9. addCPUSkinningFallback(rank: number, mesh: AbstractMesh): void;
  10. readonly isMoreFallbacks: boolean;
  11. reduce(currentDefines: string): string;
  12. }
  13. class EffectCreationOptions {
  14. attributes: string[];
  15. uniformsNames: string[];
  16. uniformBuffersNames: string[];
  17. samplers: string[];
  18. defines: any;
  19. fallbacks: Nullable<EffectFallbacks>;
  20. onCompiled: Nullable<(effect: Effect) => void>;
  21. onError: Nullable<(effect: Effect, errors: string) => void>;
  22. indexParameters: any;
  23. maxSimultaneousLights: number;
  24. transformFeedbackVaryings: Nullable<string[]>;
  25. }
  26. class Effect {
  27. name: any;
  28. defines: string;
  29. onCompiled: Nullable<(effect: Effect) => void>;
  30. onError: Nullable<(effect: Effect, errors: string) => void>;
  31. onBind: Nullable<(effect: Effect) => void>;
  32. uniqueId: number;
  33. onCompileObservable: Observable<Effect>;
  34. onErrorObservable: Observable<Effect>;
  35. onBindObservable: Observable<Effect>;
  36. private static _uniqueIdSeed;
  37. private _engine;
  38. private _uniformBuffersNames;
  39. private _uniformsNames;
  40. private _samplers;
  41. private _isReady;
  42. private _compilationError;
  43. private _attributesNames;
  44. private _attributes;
  45. private _uniforms;
  46. _key: string;
  47. private _indexParameters;
  48. private _fallbacks;
  49. private _vertexSourceCode;
  50. private _fragmentSourceCode;
  51. private _vertexSourceCodeOverride;
  52. private _fragmentSourceCodeOverride;
  53. private _transformFeedbackVaryings;
  54. _program: WebGLProgram;
  55. private _valueCache;
  56. private static _baseCache;
  57. constructor(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: Nullable<string[]>, engine?: Engine, defines?: Nullable<string>, fallbacks?: Nullable<EffectFallbacks>, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any);
  58. readonly key: string;
  59. isReady(): boolean;
  60. getEngine(): Engine;
  61. getProgram(): WebGLProgram;
  62. getAttributesNames(): string[];
  63. getAttributeLocation(index: number): number;
  64. getAttributeLocationByName(name: string): number;
  65. getAttributesCount(): number;
  66. getUniformIndex(uniformName: string): number;
  67. getUniform(uniformName: string): Nullable<WebGLUniformLocation>;
  68. getSamplers(): string[];
  69. getCompilationError(): string;
  70. executeWhenCompiled(func: (effect: Effect) => void): void;
  71. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  72. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  73. private _dumpShadersSource(vertexCode, fragmentCode, defines);
  74. private _processShaderConversion(sourceCode, isFragment, callback);
  75. private _processIncludes(sourceCode, callback);
  76. private _processPrecision(source);
  77. _rebuildProgram(vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (program: WebGLProgram) => void, onError: (message: string) => void): void;
  78. getSpecificUniformLocations(names: string[]): Nullable<WebGLUniformLocation>[];
  79. _prepareEffect(): void;
  80. readonly isSupported: boolean;
  81. _bindTexture(channel: string, texture: InternalTexture): void;
  82. setTexture(channel: string, texture: Nullable<BaseTexture>): void;
  83. setTextureArray(channel: string, textures: BaseTexture[]): void;
  84. setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void;
  85. _cacheMatrix(uniformName: string, matrix: Matrix): boolean;
  86. _cacheFloat2(uniformName: string, x: number, y: number): boolean;
  87. _cacheFloat3(uniformName: string, x: number, y: number, z: number): boolean;
  88. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): boolean;
  89. bindUniformBuffer(buffer: WebGLBuffer, name: string): void;
  90. bindUniformBlock(blockName: string, index: number): void;
  91. setInt(uniformName: string, value: number): Effect;
  92. setIntArray(uniformName: string, array: Int32Array): Effect;
  93. setIntArray2(uniformName: string, array: Int32Array): Effect;
  94. setIntArray3(uniformName: string, array: Int32Array): Effect;
  95. setIntArray4(uniformName: string, array: Int32Array): Effect;
  96. setFloatArray(uniformName: string, array: Float32Array): Effect;
  97. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  98. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  99. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  100. setArray(uniformName: string, array: number[]): Effect;
  101. setArray2(uniformName: string, array: number[]): Effect;
  102. setArray3(uniformName: string, array: number[]): Effect;
  103. setArray4(uniformName: string, array: number[]): Effect;
  104. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  105. setMatrix(uniformName: string, matrix: Matrix): Effect;
  106. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  107. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  108. setFloat(uniformName: string, value: number): Effect;
  109. setBool(uniformName: string, bool: boolean): Effect;
  110. setVector2(uniformName: string, vector2: Vector2): Effect;
  111. setFloat2(uniformName: string, x: number, y: number): Effect;
  112. setVector3(uniformName: string, vector3: Vector3): Effect;
  113. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  114. setVector4(uniformName: string, vector4: Vector4): Effect;
  115. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  116. setColor3(uniformName: string, color3: Color3): Effect;
  117. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  118. static ShadersStore: {
  119. [key: string]: string;
  120. };
  121. static IncludesShadersStore: {
  122. [key: string]: string;
  123. };
  124. static ResetCache(): void;
  125. }
  126. }
  127. declare module 'babylonjs/core' {
  128. type Nullable<T> = T | null;
  129. type float = number;
  130. type double = number;
  131. type int = number;
  132. type FloatArray = number[] | Float32Array;
  133. type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;
  134. }
  135. declare module 'babylonjs/core' {
  136. class KeyboardEventTypes {
  137. static _KEYDOWN: number;
  138. static _KEYUP: number;
  139. static readonly KEYDOWN: number;
  140. static readonly KEYUP: number;
  141. }
  142. class KeyboardInfo {
  143. type: number;
  144. event: KeyboardEvent;
  145. constructor(type: number, event: KeyboardEvent);
  146. }
  147. /**
  148. * This class is used to store keyboard related info for the onPreKeyboardObservable event.
  149. * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
  150. */
  151. class KeyboardInfoPre extends KeyboardInfo {
  152. constructor(type: number, event: KeyboardEvent);
  153. skipOnPointerObservable: boolean;
  154. }
  155. }
  156. declare module 'babylonjs/core' {
  157. class PointerEventTypes {
  158. static _POINTERDOWN: number;
  159. static _POINTERUP: number;
  160. static _POINTERMOVE: number;
  161. static _POINTERWHEEL: number;
  162. static _POINTERPICK: number;
  163. static _POINTERTAP: number;
  164. static _POINTERDOUBLETAP: number;
  165. static readonly POINTERDOWN: number;
  166. static readonly POINTERUP: number;
  167. static readonly POINTERMOVE: number;
  168. static readonly POINTERWHEEL: number;
  169. static readonly POINTERPICK: number;
  170. static readonly POINTERTAP: number;
  171. static readonly POINTERDOUBLETAP: number;
  172. }
  173. class PointerInfoBase {
  174. type: number;
  175. event: PointerEvent | MouseWheelEvent;
  176. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  177. }
  178. /**
  179. * This class is used to store pointer related info for the onPrePointerObservable event.
  180. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  181. */
  182. class PointerInfoPre extends PointerInfoBase {
  183. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
  184. localPosition: Vector2;
  185. skipOnPointerObservable: boolean;
  186. }
  187. /**
  188. * This type contains all the data related to a pointer event in Babylon.js.
  189. * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
  190. */
  191. class PointerInfo extends PointerInfoBase {
  192. pickInfo: Nullable<PickingInfo>;
  193. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
  194. }
  195. }
  196. declare module 'babylonjs/core' {
  197. const ToGammaSpace: number;
  198. const ToLinearSpace = 2.2;
  199. const Epsilon = 0.001;
  200. class Color3 {
  201. r: number;
  202. g: number;
  203. b: number;
  204. /**
  205. * Creates a new Color3 object from red, green, blue values, all between 0 and 1.
  206. */
  207. constructor(r?: number, g?: number, b?: number);
  208. /**
  209. * Returns a string with the Color3 current values.
  210. */
  211. toString(): string;
  212. /**
  213. * Returns the string "Color3".
  214. */
  215. getClassName(): string;
  216. /**
  217. * Returns the Color3 hash code.
  218. */
  219. getHashCode(): number;
  220. /**
  221. * Stores in the passed array from the passed starting index the red, green, blue values as successive elements.
  222. * Returns the Color3.
  223. */
  224. toArray(array: FloatArray, index?: number): Color3;
  225. /**
  226. * Returns a new Color4 object from the current Color3 and the passed alpha.
  227. */
  228. toColor4(alpha?: number): Color4;
  229. /**
  230. * Returns a new array populated with 3 numeric elements : red, green and blue values.
  231. */
  232. asArray(): number[];
  233. /**
  234. * Returns the luminance value (float).
  235. */
  236. toLuminance(): number;
  237. /**
  238. * Multiply each Color3 rgb values by the passed Color3 rgb values in a new Color3 object.
  239. * Returns this new object.
  240. */
  241. multiply(otherColor: Color3): Color3;
  242. /**
  243. * Multiply the rgb values of the Color3 and the passed Color3 and stores the result in the object "result".
  244. * Returns the current Color3.
  245. */
  246. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  247. /**
  248. * Boolean : True if the rgb values are equal to the passed ones.
  249. */
  250. equals(otherColor: Color3): boolean;
  251. /**
  252. * Boolean : True if the rgb values are equal to the passed ones.
  253. */
  254. equalsFloats(r: number, g: number, b: number): boolean;
  255. /**
  256. * Multiplies in place each rgb value by scale.
  257. * Returns the updated Color3.
  258. */
  259. scale(scale: number): Color3;
  260. /**
  261. * Multiplies the rgb values by scale and stores the result into "result".
  262. * Returns the unmodified current Color3.
  263. */
  264. scaleToRef(scale: number, result: Color3): Color3;
  265. /**
  266. * Returns a new Color3 set with the added values of the current Color3 and of the passed one.
  267. */
  268. add(otherColor: Color3): Color3;
  269. /**
  270. * Stores the result of the addition of the current Color3 and passed one rgb values into "result".
  271. * Returns the unmodified current Color3.
  272. */
  273. addToRef(otherColor: Color3, result: Color3): Color3;
  274. /**
  275. * Returns a new Color3 set with the subtracted values of the passed one from the current Color3 .
  276. */
  277. subtract(otherColor: Color3): Color3;
  278. /**
  279. * Stores the result of the subtraction of passed one from the current Color3 rgb values into "result".
  280. * Returns the unmodified current Color3.
  281. */
  282. subtractToRef(otherColor: Color3, result: Color3): Color3;
  283. /**
  284. * Returns a new Color3 copied the current one.
  285. */
  286. clone(): Color3;
  287. /**
  288. * Copies the rgb values from the source in the current Color3.
  289. * Returns the updated Color3.
  290. */
  291. copyFrom(source: Color3): Color3;
  292. /**
  293. * Updates the Color3 rgb values from the passed floats.
  294. * Returns the Color3.
  295. */
  296. copyFromFloats(r: number, g: number, b: number): Color3;
  297. /**
  298. * Updates the Color3 rgb values from the passed floats.
  299. * Returns the Color3.
  300. */
  301. set(r: number, g: number, b: number): Color3;
  302. /**
  303. * Returns the Color3 hexadecimal code as a string.
  304. */
  305. toHexString(): string;
  306. /**
  307. * Returns a new Color3 converted to linear space.
  308. */
  309. toLinearSpace(): Color3;
  310. /**
  311. * Converts the Color3 values to linear space and stores the result in "convertedColor".
  312. * Returns the unmodified Color3.
  313. */
  314. toLinearSpaceToRef(convertedColor: Color3): Color3;
  315. /**
  316. * Returns a new Color3 converted to gamma space.
  317. */
  318. toGammaSpace(): Color3;
  319. /**
  320. * Converts the Color3 values to gamma space and stores the result in "convertedColor".
  321. * Returns the unmodified Color3.
  322. */
  323. toGammaSpaceToRef(convertedColor: Color3): Color3;
  324. /**
  325. * Creates a new Color3 from the string containing valid hexadecimal values.
  326. */
  327. static FromHexString(hex: string): Color3;
  328. /**
  329. * Creates a new Vector3 from the startind index of the passed array.
  330. */
  331. static FromArray(array: ArrayLike<number>, offset?: number): Color3;
  332. /**
  333. * Creates a new Color3 from integer values ( < 256).
  334. */
  335. static FromInts(r: number, g: number, b: number): Color3;
  336. /**
  337. * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3.
  338. */
  339. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  340. static Red(): Color3;
  341. static Green(): Color3;
  342. static Blue(): Color3;
  343. static Black(): Color3;
  344. static White(): Color3;
  345. static Purple(): Color3;
  346. static Magenta(): Color3;
  347. static Yellow(): Color3;
  348. static Gray(): Color3;
  349. static Teal(): Color3;
  350. static Random(): Color3;
  351. }
  352. class Color4 {
  353. r: number;
  354. g: number;
  355. b: number;
  356. a: number;
  357. /**
  358. * Creates a new Color4 object from the passed float values ( < 1) : red, green, blue, alpha.
  359. */
  360. constructor(r?: number, g?: number, b?: number, a?: number);
  361. /**
  362. * Adds in place the passed Color4 values to the current Color4.
  363. * Returns the updated Color4.
  364. */
  365. addInPlace(right: Color4): Color4;
  366. /**
  367. * Returns a new array populated with 4 numeric elements : red, green, blue, alpha values.
  368. */
  369. asArray(): number[];
  370. /**
  371. * Stores from the starting index in the passed array the Color4 successive values.
  372. * Returns the Color4.
  373. */
  374. toArray(array: number[], index?: number): Color4;
  375. /**
  376. * Returns a new Color4 set with the added values of the current Color4 and of the passed one.
  377. */
  378. add(right: Color4): Color4;
  379. /**
  380. * Returns a new Color4 set with the subtracted values of the passed one from the current Color4.
  381. */
  382. subtract(right: Color4): Color4;
  383. /**
  384. * Subtracts the passed ones from the current Color4 values and stores the results in "result".
  385. * Returns the Color4.
  386. */
  387. subtractToRef(right: Color4, result: Color4): Color4;
  388. /**
  389. * Creates a new Color4 with the current Color4 values multiplied by scale.
  390. */
  391. scale(scale: number): Color4;
  392. /**
  393. * Multiplies the current Color4 values by scale and stores the result in "result".
  394. * Returns the Color4.
  395. */
  396. scaleToRef(scale: number, result: Color4): Color4;
  397. /**
  398. * Multipy an RGBA Color4 value by another and return a new Color4 object
  399. * @param color The Color4 (RGBA) value to multiply by
  400. * @returns A new Color4.
  401. */
  402. multiply(color: Color4): Color4;
  403. /**
  404. * Multipy an RGBA Color4 value by another and push the result in a reference value
  405. * @param color The Color4 (RGBA) value to multiply by
  406. * @param result The Color4 (RGBA) to fill the result in
  407. * @returns the result Color4.
  408. */
  409. multiplyToRef(color: Color4, result: Color4): Color4;
  410. /**
  411. * Returns a string with the Color4 values.
  412. */
  413. toString(): string;
  414. /**
  415. * Returns the string "Color4"
  416. */
  417. getClassName(): string;
  418. /**
  419. * Return the Color4 hash code as a number.
  420. */
  421. getHashCode(): number;
  422. /**
  423. * Creates a new Color4 copied from the current one.
  424. */
  425. clone(): Color4;
  426. /**
  427. * Copies the passed Color4 values into the current one.
  428. * Returns the updated Color4.
  429. */
  430. copyFrom(source: Color4): Color4;
  431. /**
  432. * Copies the passed float values into the current one.
  433. * Returns the updated Color4.
  434. */
  435. copyFromFloats(r: number, g: number, b: number, a: number): Color4;
  436. /**
  437. * Copies the passed float values into the current one.
  438. * Returns the updated Color4.
  439. */
  440. set(r: number, g: number, b: number, a: number): Color4;
  441. /**
  442. * Returns a string containing the hexadecimal Color4 code.
  443. */
  444. toHexString(): string;
  445. /**
  446. * Returns a new Color4 converted to linear space.
  447. */
  448. toLinearSpace(): Color4;
  449. /**
  450. * Converts the Color4 values to linear space and stores the result in "convertedColor".
  451. * Returns the unmodified Color4.
  452. */
  453. toLinearSpaceToRef(convertedColor: Color4): Color4;
  454. /**
  455. * Returns a new Color4 converted to gamma space.
  456. */
  457. toGammaSpace(): Color4;
  458. /**
  459. * Converts the Color4 values to gamma space and stores the result in "convertedColor".
  460. * Returns the unmodified Color4.
  461. */
  462. toGammaSpaceToRef(convertedColor: Color4): Color4;
  463. /**
  464. * Creates a new Color4 from the valid hexadecimal value contained in the passed string.
  465. */
  466. static FromHexString(hex: string): Color4;
  467. /**
  468. * Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  469. */
  470. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  471. /**
  472. * Set the passed "result" with the linearly interpolated values of "amount" between the left Color4 and the right Color4.
  473. */
  474. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  475. /**
  476. * Creates a new Color4 from the starting index element of the passed array.
  477. */
  478. static FromArray(array: ArrayLike<number>, offset?: number): Color4;
  479. /**
  480. * Creates a new Color4 from the passed integers ( < 256 ).
  481. */
  482. static FromInts(r: number, g: number, b: number, a: number): Color4;
  483. static CheckColors4(colors: number[], count: number): number[];
  484. }
  485. class Vector2 {
  486. x: number;
  487. y: number;
  488. /**
  489. * Creates a new Vector2 from the passed x and y coordinates.
  490. */
  491. constructor(x: number, y: number);
  492. /**
  493. * Returns a string with the Vector2 coordinates.
  494. */
  495. toString(): string;
  496. /**
  497. * Returns the string "Vector2"
  498. */
  499. getClassName(): string;
  500. /**
  501. * Returns the Vector2 hash code as a number.
  502. */
  503. getHashCode(): number;
  504. /**
  505. * Sets the Vector2 coordinates in the passed array or Float32Array from the passed index.
  506. * Returns the Vector2.
  507. */
  508. toArray(array: FloatArray, index?: number): Vector2;
  509. /**
  510. * Returns a new array with 2 elements : the Vector2 coordinates.
  511. */
  512. asArray(): number[];
  513. /**
  514. * Sets the Vector2 coordinates with the passed Vector2 coordinates.
  515. * Returns the updated Vector2.
  516. */
  517. copyFrom(source: Vector2): Vector2;
  518. /**
  519. * Sets the Vector2 coordinates with the passed floats.
  520. * Returns the updated Vector2.
  521. */
  522. copyFromFloats(x: number, y: number): Vector2;
  523. /**
  524. * Sets the Vector2 coordinates with the passed floats.
  525. * Returns the updated Vector2.
  526. */
  527. set(x: number, y: number): Vector2;
  528. /**
  529. * Returns a new Vector2 set with the addition of the current Vector2 and the passed one coordinates.
  530. */
  531. add(otherVector: Vector2): Vector2;
  532. /**
  533. * Sets the "result" coordinates with the addition of the current Vector2 and the passed one coordinates.
  534. * Returns the Vector2.
  535. */
  536. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  537. /**
  538. * Set the Vector2 coordinates by adding the passed Vector2 coordinates.
  539. * Returns the updated Vector2.
  540. */
  541. addInPlace(otherVector: Vector2): Vector2;
  542. /**
  543. * Returns a new Vector2 by adding the current Vector2 coordinates to the passed Vector3 x, y coordinates.
  544. */
  545. addVector3(otherVector: Vector3): Vector2;
  546. /**
  547. * Returns a new Vector2 set with the subtracted coordinates of the passed one from the current Vector2.
  548. */
  549. subtract(otherVector: Vector2): Vector2;
  550. /**
  551. * Sets the "result" coordinates with the subtraction of the passed one from the current Vector2 coordinates.
  552. * Returns the Vector2.
  553. */
  554. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  555. /**
  556. * Sets the current Vector2 coordinates by subtracting from it the passed one coordinates.
  557. * Returns the updated Vector2.
  558. */
  559. subtractInPlace(otherVector: Vector2): Vector2;
  560. /**
  561. * Multiplies in place the current Vector2 coordinates by the passed ones.
  562. * Returns the updated Vector2.
  563. */
  564. multiplyInPlace(otherVector: Vector2): Vector2;
  565. /**
  566. * Returns a new Vector2 set with the multiplication of the current Vector2 and the passed one coordinates.
  567. */
  568. multiply(otherVector: Vector2): Vector2;
  569. /**
  570. * Sets "result" coordinates with the multiplication of the current Vector2 and the passed one coordinates.
  571. * Returns the Vector2.
  572. */
  573. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  574. /**
  575. * Returns a new Vector2 set with the Vector2 coordinates multiplied by the passed floats.
  576. */
  577. multiplyByFloats(x: number, y: number): Vector2;
  578. /**
  579. * Returns a new Vector2 set with the Vector2 coordinates divided by the passed one coordinates.
  580. */
  581. divide(otherVector: Vector2): Vector2;
  582. /**
  583. * Sets the "result" coordinates with the Vector2 divided by the passed one coordinates.
  584. * Returns the Vector2.
  585. */
  586. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  587. /**
  588. * Divides the current Vector3 coordinates by the passed ones.
  589. * Returns the updated Vector3.
  590. */
  591. divideInPlace(otherVector: Vector2): Vector2;
  592. /**
  593. * Returns a new Vector2 with current Vector2 negated coordinates.
  594. */
  595. negate(): Vector2;
  596. /**
  597. * Multiply the Vector2 coordinates by scale.
  598. * Returns the updated Vector2.
  599. */
  600. scaleInPlace(scale: number): Vector2;
  601. /**
  602. * Returns a new Vector2 scaled by "scale" from the current Vector2.
  603. */
  604. scale(scale: number): Vector2;
  605. /**
  606. * Boolean : True if the passed vector coordinates strictly equal the current Vector2 ones.
  607. */
  608. equals(otherVector: Vector2): boolean;
  609. /**
  610. * Boolean : True if the passed vector coordinates are close to the current ones by a distance of epsilon.
  611. */
  612. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  613. /**
  614. * Returns the vector length (float).
  615. */
  616. length(): number;
  617. /**
  618. * Returns the vector squared length (float);
  619. */
  620. lengthSquared(): number;
  621. /**
  622. * Normalize the vector.
  623. * Returns the updated Vector2.
  624. */
  625. normalize(): Vector2;
  626. /**
  627. * Returns a new Vector2 copied from the Vector2.
  628. */
  629. clone(): Vector2;
  630. /**
  631. * Returns a new Vector2(0, 0)
  632. */
  633. static Zero(): Vector2;
  634. /**
  635. * Returns a new Vector2(1, 1)
  636. */
  637. static One(): Vector2;
  638. /**
  639. * Returns a new Vector2 set from the passed index element of the passed array.
  640. */
  641. static FromArray(array: ArrayLike<number>, offset?: number): Vector2;
  642. /**
  643. * Sets "result" from the passed index element of the passed array.
  644. */
  645. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector2): void;
  646. /**
  647. * Retuns a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the passed four Vector2.
  648. */
  649. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  650. /**
  651. * Returns a new Vector2 set with same the coordinates than "value" ones if the vector "value" is in the square defined by "min" and "max".
  652. * If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate.
  653. * If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate.
  654. */
  655. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  656. /**
  657. * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value3", "tangent1", "tangent2".
  658. */
  659. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  660. /**
  661. * Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end".
  662. */
  663. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  664. /**
  665. * Returns the dot product (float) of the vector "left" and the vector "right".
  666. */
  667. static Dot(left: Vector2, right: Vector2): number;
  668. /**
  669. * Returns a new Vector2 equal to the normalized passed vector.
  670. */
  671. static Normalize(vector: Vector2): Vector2;
  672. /**
  673. * Returns a new Vecto2 set with the minimal coordinate values from the "left" and "right" vectors.
  674. */
  675. static Minimize(left: Vector2, right: Vector2): Vector2;
  676. /**
  677. * Returns a new Vecto2 set with the maximal coordinate values from the "left" and "right" vectors.
  678. */
  679. static Maximize(left: Vector2, right: Vector2): Vector2;
  680. /**
  681. * Returns a new Vecto2 set with the transformed coordinates of the passed vector by the passed transformation matrix.
  682. */
  683. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  684. /**
  685. * Transforms the passed vector coordinates by the passed transformation matrix and stores the result in the vector "result" coordinates.
  686. */
  687. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  688. /**
  689. * Boolean : True if the point "p" is in the triangle defined by the vertors "p0", "p1", "p2"
  690. */
  691. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  692. /**
  693. * Returns the distance (float) between the vectors "value1" and "value2".
  694. */
  695. static Distance(value1: Vector2, value2: Vector2): number;
  696. /**
  697. * Returns the squared distance (float) between the vectors "value1" and "value2".
  698. */
  699. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  700. /**
  701. * Returns a new Vecto2 located at the center of the vectors "value1" and "value2".
  702. */
  703. static Center(value1: Vector2, value2: Vector2): Vector2;
  704. /**
  705. * Returns the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB".
  706. */
  707. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  708. }
  709. class Vector3 {
  710. x: number;
  711. y: number;
  712. z: number;
  713. /**
  714. * Creates a new Vector3 object from the passed x, y, z (floats) coordinates.
  715. * A Vector3 is the main object used in 3D geometry.
  716. * It can represent etiher the coordinates of a point the space, either a direction.
  717. */
  718. constructor(x: number, y: number, z: number);
  719. /**
  720. * Returns a string with the Vector3 coordinates.
  721. */
  722. toString(): string;
  723. /**
  724. * Returns the string "Vector3"
  725. */
  726. getClassName(): string;
  727. /**
  728. * Returns the Vector hash code.
  729. */
  730. getHashCode(): number;
  731. /**
  732. * Returns a new array with three elements : the coordinates the Vector3.
  733. */
  734. asArray(): number[];
  735. /**
  736. * Populates the passed array or Float32Array from the passed index with the successive coordinates of the Vector3.
  737. * Returns the Vector3.
  738. */
  739. toArray(array: FloatArray, index?: number): Vector3;
  740. /**
  741. * Returns a new Quaternion object, computed from the Vector3 coordinates.
  742. */
  743. toQuaternion(): Quaternion;
  744. /**
  745. * Adds the passed vector to the current Vector3.
  746. * Returns the updated Vector3.
  747. */
  748. addInPlace(otherVector: Vector3): Vector3;
  749. /**
  750. * Returns a new Vector3, result of the addition the current Vector3 and the passed vector.
  751. */
  752. add(otherVector: Vector3): Vector3;
  753. /**
  754. * Adds the current Vector3 to the passed one and stores the result in the vector "result".
  755. * Returns the current Vector3.
  756. */
  757. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  758. /**
  759. * Subtract the passed vector from the current Vector3.
  760. * Returns the updated Vector3.
  761. */
  762. subtractInPlace(otherVector: Vector3): Vector3;
  763. /**
  764. * Returns a new Vector3, result of the subtraction of the passed vector from the current Vector3.
  765. */
  766. subtract(otherVector: Vector3): Vector3;
  767. /**
  768. * Subtracts the passed vector from the current Vector3 and stores the result in the vector "result".
  769. * Returns the current Vector3.
  770. */
  771. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  772. /**
  773. * Returns a new Vector3 set with the subtraction of the passed floats from the current Vector3 coordinates.
  774. */
  775. subtractFromFloats(x: number, y: number, z: number): Vector3;
  776. /**
  777. * Subtracts the passed floats from the current Vector3 coordinates and set the passed vector "result" with this result.
  778. * Returns the current Vector3.
  779. */
  780. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  781. /**
  782. * Returns a new Vector3 set with the current Vector3 negated coordinates.
  783. */
  784. negate(): Vector3;
  785. /**
  786. * Multiplies the Vector3 coordinates by the float "scale".
  787. * Returns the updated Vector3.
  788. */
  789. scaleInPlace(scale: number): Vector3;
  790. /**
  791. * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale".
  792. */
  793. scale(scale: number): Vector3;
  794. /**
  795. * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the passed vector "result" coordinates.
  796. * Returns the current Vector3.
  797. */
  798. scaleToRef(scale: number, result: Vector3): Vector3;
  799. /**
  800. * Boolean : True if the current Vector3 and the passed vector coordinates are strictly equal.
  801. */
  802. equals(otherVector: Vector3): boolean;
  803. /**
  804. * Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
  805. */
  806. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  807. /**
  808. * Boolean : True if the current Vector3 coordinate equal the passed floats.
  809. */
  810. equalsToFloats(x: number, y: number, z: number): boolean;
  811. /**
  812. * Muliplies the current Vector3 coordinates by the passed ones.
  813. * Returns the updated Vector3.
  814. */
  815. multiplyInPlace(otherVector: Vector3): Vector3;
  816. /**
  817. * Returns a new Vector3, result of the multiplication of the current Vector3 by the passed vector.
  818. */
  819. multiply(otherVector: Vector3): Vector3;
  820. /**
  821. * Multiplies the current Vector3 by the passed one and stores the result in the passed vector "result".
  822. * Returns the current Vector3.
  823. */
  824. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  825. /**
  826. * Returns a new Vector3 set witth the result of the mulliplication of the current Vector3 coordinates by the passed floats.
  827. */
  828. multiplyByFloats(x: number, y: number, z: number): Vector3;
  829. /**
  830. * Returns a new Vector3 set witth the result of the division of the current Vector3 coordinates by the passed ones.
  831. */
  832. divide(otherVector: Vector3): Vector3;
  833. /**
  834. * Divides the current Vector3 coordinates by the passed ones and stores the result in the passed vector "result".
  835. * Returns the current Vector3.
  836. */
  837. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  838. /**
  839. * Divides the current Vector3 coordinates by the passed ones.
  840. * Returns the updated Vector3.
  841. */
  842. divideInPlace(otherVector: Vector3): Vector3;
  843. /**
  844. * Updates the current Vector3 with the minimal coordinate values between its and the passed vector ones.
  845. * Returns the updated Vector3.
  846. */
  847. MinimizeInPlace(other: Vector3): Vector3;
  848. /**
  849. * Updates the current Vector3 with the maximal coordinate values between its and the passed vector ones.
  850. * Returns the updated Vector3.
  851. */
  852. MaximizeInPlace(other: Vector3): Vector3;
  853. /**
  854. * Return true is the vector is non uniform meaning x, y or z are not all the same.
  855. */
  856. readonly isNonUniform: boolean;
  857. /**
  858. * Returns the length of the Vector3 (float).
  859. */
  860. length(): number;
  861. /**
  862. * Returns the squared length of the Vector3 (float).
  863. */
  864. lengthSquared(): number;
  865. /**
  866. * Normalize the current Vector3.
  867. * Returns the updated Vector3.
  868. * /!\ In place operation.
  869. */
  870. normalize(): Vector3;
  871. /**
  872. * Normalize the current Vector3 to a new vector.
  873. * @returns the new Vector3.
  874. */
  875. normalizeToNew(): Vector3;
  876. /**
  877. * Normalize the current Vector3 to the reference.
  878. * @param the reference to update.
  879. * @returns the updated Vector3.
  880. */
  881. normalizeToRef(reference: Vector3): Vector3;
  882. /**
  883. * Returns a new Vector3 copied from the current Vector3.
  884. */
  885. clone(): Vector3;
  886. /**
  887. * Copies the passed vector coordinates to the current Vector3 ones.
  888. * Returns the updated Vector3.
  889. */
  890. copyFrom(source: Vector3): Vector3;
  891. /**
  892. * Copies the passed floats to the current Vector3 coordinates.
  893. * Returns the updated Vector3.
  894. */
  895. copyFromFloats(x: number, y: number, z: number): Vector3;
  896. /**
  897. * Copies the passed floats to the current Vector3 coordinates.
  898. * Returns the updated Vector3.
  899. */
  900. set(x: number, y: number, z: number): Vector3;
  901. /**
  902. *
  903. */
  904. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: number): number;
  905. /**
  906. * Returns a new Vector3 set from the index "offset" of the passed array.
  907. */
  908. static FromArray(array: ArrayLike<number>, offset?: number): Vector3;
  909. /**
  910. * Returns a new Vector3 set from the index "offset" of the passed Float32Array.
  911. * This function is deprecated. Use FromArray instead.
  912. */
  913. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  914. /**
  915. * Sets the passed vector "result" with the element values from the index "offset" of the passed array.
  916. */
  917. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector3): void;
  918. /**
  919. * Sets the passed vector "result" with the element values from the index "offset" of the passed Float32Array.
  920. * This function is deprecated. Use FromArrayToRef instead.
  921. */
  922. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  923. /**
  924. * Sets the passed vector "result" with the passed floats.
  925. */
  926. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  927. /**
  928. * Returns a new Vector3 set to (0.0, 0.0, 0.0).
  929. */
  930. static Zero(): Vector3;
  931. /**
  932. * Returns a new Vector3 set to (1.0, 1.0, 1.0).
  933. */
  934. static One(): Vector3;
  935. /**
  936. * Returns a new Vector3 set to (0.0, 1.0, 0.0)
  937. */
  938. static Up(): Vector3;
  939. /**
  940. * Returns a new Vector3 set to (0.0, 0.0, 1.0)
  941. */
  942. static Forward(): Vector3;
  943. /**
  944. * Returns a new Vector3 set to (1.0, 0.0, 0.0)
  945. */
  946. static Right(): Vector3;
  947. /**
  948. * Returns a new Vector3 set to (-1.0, 0.0, 0.0)
  949. */
  950. static Left(): Vector3;
  951. /**
  952. * Returns a new Vector3 set with the result of the transformation by the passed matrix of the passed vector.
  953. * This method computes tranformed coordinates only, not transformed direction vectors.
  954. */
  955. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  956. /**
  957. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed vector.
  958. * This method computes tranformed coordinates only, not transformed direction vectors.
  959. */
  960. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  961. /**
  962. * Sets the passed vector "result" coordinates with the result of the transformation by the passed matrix of the passed floats (x, y, z).
  963. * This method computes tranformed coordinates only, not transformed direction vectors.
  964. */
  965. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  966. /**
  967. * Returns a new Vector3 set with the result of the normal transformation by the passed matrix of the passed vector.
  968. * This methods computes transformed normalized direction vectors only.
  969. */
  970. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  971. /**
  972. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  973. * This methods computes transformed normalized direction vectors only.
  974. */
  975. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  976. /**
  977. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z).
  978. * This methods computes transformed normalized direction vectors only.
  979. */
  980. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  981. /**
  982. * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4".
  983. */
  984. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  985. /**
  986. * Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max".
  987. * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one.
  988. * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one.
  989. */
  990. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  991. /**
  992. * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  993. */
  994. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  995. /**
  996. * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end".
  997. */
  998. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  999. /**
  1000. * Sets the passed vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end".
  1001. */
  1002. static LerpToRef(start: Vector3, end: Vector3, amount: number, result: Vector3): void;
  1003. /**
  1004. * Returns the dot product (float) between the vectors "left" and "right".
  1005. */
  1006. static Dot(left: Vector3, right: Vector3): number;
  1007. /**
  1008. * Returns a new Vector3 as the cross product of the vectors "left" and "right".
  1009. * The cross product is then orthogonal to both "left" and "right".
  1010. */
  1011. static Cross(left: Vector3, right: Vector3): Vector3;
  1012. /**
  1013. * Sets the passed vector "result" with the cross product of "left" and "right".
  1014. * The cross product is then orthogonal to both "left" and "right".
  1015. */
  1016. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  1017. /**
  1018. * Returns a new Vector3 as the normalization of the passed vector.
  1019. */
  1020. static Normalize(vector: Vector3): Vector3;
  1021. /**
  1022. * Sets the passed vector "result" with the normalization of the passed first vector.
  1023. */
  1024. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  1025. private static _viewportMatrixCache;
  1026. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  1027. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  1028. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  1029. static UnprojectToRef(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix, result: Vector3): void;
  1030. static UnprojectFloatsToRef(sourceX: float, sourceY: float, sourceZ: float, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix, result: Vector3): void;
  1031. static Minimize(left: Vector3, right: Vector3): Vector3;
  1032. static Maximize(left: Vector3, right: Vector3): Vector3;
  1033. /**
  1034. * Returns the distance (float) between the vectors "value1" and "value2".
  1035. */
  1036. static Distance(value1: Vector3, value2: Vector3): number;
  1037. /**
  1038. * Returns the squared distance (float) between the vectors "value1" and "value2".
  1039. */
  1040. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  1041. /**
  1042. * Returns a new Vector3 located at the center between "value1" and "value2".
  1043. */
  1044. static Center(value1: Vector3, value2: Vector3): Vector3;
  1045. /**
  1046. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  1047. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  1048. * to something in order to rotate it from its local system to the given target system.
  1049. * Note : axis1, axis2 and axis3 are normalized during this operation.
  1050. * Returns a new Vector3.
  1051. */
  1052. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  1053. /**
  1054. * The same than RotationFromAxis but updates the passed ref Vector3 parameter instead of returning a new Vector3.
  1055. */
  1056. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  1057. }
  1058. class Vector4 {
  1059. x: number;
  1060. y: number;
  1061. z: number;
  1062. w: number;
  1063. /**
  1064. * Creates a Vector4 object from the passed floats.
  1065. */
  1066. constructor(x: number, y: number, z: number, w: number);
  1067. /**
  1068. * Returns the string with the Vector4 coordinates.
  1069. */
  1070. toString(): string;
  1071. /**
  1072. * Returns the string "Vector4".
  1073. */
  1074. getClassName(): string;
  1075. /**
  1076. * Returns the Vector4 hash code.
  1077. */
  1078. getHashCode(): number;
  1079. /**
  1080. * Returns a new array populated with 4 elements : the Vector4 coordinates.
  1081. */
  1082. asArray(): number[];
  1083. /**
  1084. * Populates the passed array from the passed index with the Vector4 coordinates.
  1085. * Returns the Vector4.
  1086. */
  1087. toArray(array: FloatArray, index?: number): Vector4;
  1088. /**
  1089. * Adds the passed vector to the current Vector4.
  1090. * Returns the updated Vector4.
  1091. */
  1092. addInPlace(otherVector: Vector4): Vector4;
  1093. /**
  1094. * Returns a new Vector4 as the result of the addition of the current Vector4 and the passed one.
  1095. */
  1096. add(otherVector: Vector4): Vector4;
  1097. /**
  1098. * Updates the passed vector "result" with the result of the addition of the current Vector4 and the passed one.
  1099. * Returns the current Vector4.
  1100. */
  1101. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  1102. /**
  1103. * Subtract in place the passed vector from the current Vector4.
  1104. * Returns the updated Vector4.
  1105. */
  1106. subtractInPlace(otherVector: Vector4): Vector4;
  1107. /**
  1108. * Returns a new Vector4 with the result of the subtraction of the passed vector from the current Vector4.
  1109. */
  1110. subtract(otherVector: Vector4): Vector4;
  1111. /**
  1112. * Sets the passed vector "result" with the result of the subtraction of the passed vector from the current Vector4.
  1113. * Returns the current Vector4.
  1114. */
  1115. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  1116. /**
  1117. * Returns a new Vector4 set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  1118. */
  1119. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  1120. /**
  1121. * Sets the passed vector "result" set with the result of the subtraction of the passed floats from the current Vector4 coordinates.
  1122. * Returns the current Vector4.
  1123. */
  1124. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  1125. /**
  1126. * Returns a new Vector4 set with the current Vector4 negated coordinates.
  1127. */
  1128. negate(): Vector4;
  1129. /**
  1130. * Multiplies the current Vector4 coordinates by scale (float).
  1131. * Returns the updated Vector4.
  1132. */
  1133. scaleInPlace(scale: number): Vector4;
  1134. /**
  1135. * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).
  1136. */
  1137. scale(scale: number): Vector4;
  1138. /**
  1139. * Sets the passed vector "result" with the current Vector4 coordinates multiplied by scale (float).
  1140. * Returns the current Vector4.
  1141. */
  1142. scaleToRef(scale: number, result: Vector4): Vector4;
  1143. /**
  1144. * Boolean : True if the current Vector4 coordinates are stricly equal to the passed ones.
  1145. */
  1146. equals(otherVector: Vector4): boolean;
  1147. /**
  1148. * Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the passed vector ones.
  1149. */
  1150. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  1151. /**
  1152. * Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
  1153. */
  1154. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  1155. /**
  1156. * Multiplies in place the current Vector4 by the passed one.
  1157. * Returns the updated Vector4.
  1158. */
  1159. multiplyInPlace(otherVector: Vector4): Vector4;
  1160. /**
  1161. * Returns a new Vector4 set with the multiplication result of the current Vector4 and the passed one.
  1162. */
  1163. multiply(otherVector: Vector4): Vector4;
  1164. /**
  1165. * Updates the passed vector "result" with the multiplication result of the current Vector4 and the passed one.
  1166. * Returns the current Vector4.
  1167. */
  1168. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  1169. /**
  1170. * Returns a new Vector4 set with the multiplication result of the passed floats and the current Vector4 coordinates.
  1171. */
  1172. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  1173. /**
  1174. * Returns a new Vector4 set with the division result of the current Vector4 by the passed one.
  1175. */
  1176. divide(otherVector: Vector4): Vector4;
  1177. /**
  1178. * Updates the passed vector "result" with the division result of the current Vector4 by the passed one.
  1179. * Returns the current Vector4.
  1180. */
  1181. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  1182. /**
  1183. * Divides the current Vector3 coordinates by the passed ones.
  1184. * Returns the updated Vector3.
  1185. */
  1186. divideInPlace(otherVector: Vector4): Vector4;
  1187. /**
  1188. * Updates the Vector4 coordinates with the minimum values between its own and the passed vector ones.
  1189. */
  1190. MinimizeInPlace(other: Vector4): Vector4;
  1191. /**
  1192. * Updates the Vector4 coordinates with the maximum values between its own and the passed vector ones.
  1193. */
  1194. MaximizeInPlace(other: Vector4): Vector4;
  1195. /**
  1196. * Returns the Vector4 length (float).
  1197. */
  1198. length(): number;
  1199. /**
  1200. * Returns the Vector4 squared length (float).
  1201. */
  1202. lengthSquared(): number;
  1203. /**
  1204. * Normalizes in place the Vector4.
  1205. * Returns the updated Vector4.
  1206. */
  1207. normalize(): Vector4;
  1208. /**
  1209. * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
  1210. */
  1211. toVector3(): Vector3;
  1212. /**
  1213. * Returns a new Vector4 copied from the current one.
  1214. */
  1215. clone(): Vector4;
  1216. /**
  1217. * Updates the current Vector4 with the passed one coordinates.
  1218. * Returns the updated Vector4.
  1219. */
  1220. copyFrom(source: Vector4): Vector4;
  1221. /**
  1222. * Updates the current Vector4 coordinates with the passed floats.
  1223. * Returns the updated Vector4.
  1224. */
  1225. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  1226. /**
  1227. * Updates the current Vector4 coordinates with the passed floats.
  1228. * Returns the updated Vector4.
  1229. */
  1230. set(x: number, y: number, z: number, w: number): Vector4;
  1231. /**
  1232. * Returns a new Vector4 set from the starting index of the passed array.
  1233. */
  1234. static FromArray(array: ArrayLike<number>, offset?: number): Vector4;
  1235. /**
  1236. * Updates the passed vector "result" from the starting index of the passed array.
  1237. */
  1238. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector4): void;
  1239. /**
  1240. * Updates the passed vector "result" from the starting index of the passed Float32Array.
  1241. */
  1242. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  1243. /**
  1244. * Updates the passed vector "result" coordinates from the passed floats.
  1245. */
  1246. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  1247. /**
  1248. * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)
  1249. */
  1250. static Zero(): Vector4;
  1251. /**
  1252. * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)
  1253. */
  1254. static One(): Vector4;
  1255. /**
  1256. * Returns a new normalized Vector4 from the passed one.
  1257. */
  1258. static Normalize(vector: Vector4): Vector4;
  1259. /**
  1260. * Updates the passed vector "result" from the normalization of the passed one.
  1261. */
  1262. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  1263. static Minimize(left: Vector4, right: Vector4): Vector4;
  1264. static Maximize(left: Vector4, right: Vector4): Vector4;
  1265. /**
  1266. * Returns the distance (float) between the vectors "value1" and "value2".
  1267. */
  1268. static Distance(value1: Vector4, value2: Vector4): number;
  1269. /**
  1270. * Returns the squared distance (float) between the vectors "value1" and "value2".
  1271. */
  1272. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  1273. /**
  1274. * Returns a new Vector4 located at the center between the vectors "value1" and "value2".
  1275. */
  1276. static Center(value1: Vector4, value2: Vector4): Vector4;
  1277. /**
  1278. * Returns a new Vector4 set with the result of the normal transformation by the passed matrix of the passed vector.
  1279. * This methods computes transformed normalized direction vectors only.
  1280. */
  1281. static TransformNormal(vector: Vector4, transformation: Matrix): Vector4;
  1282. /**
  1283. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed vector.
  1284. * This methods computes transformed normalized direction vectors only.
  1285. */
  1286. static TransformNormalToRef(vector: Vector4, transformation: Matrix, result: Vector4): void;
  1287. /**
  1288. * Sets the passed vector "result" with the result of the normal transformation by the passed matrix of the passed floats (x, y, z, w).
  1289. * This methods computes transformed normalized direction vectors only.
  1290. */
  1291. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: Matrix, result: Vector4): void;
  1292. }
  1293. interface ISize {
  1294. width: number;
  1295. height: number;
  1296. }
  1297. class Size implements ISize {
  1298. width: number;
  1299. height: number;
  1300. /**
  1301. * Creates a Size object from the passed width and height (floats).
  1302. */
  1303. constructor(width: number, height: number);
  1304. toString(): string;
  1305. /**
  1306. * Returns the string "Size"
  1307. */
  1308. getClassName(): string;
  1309. /**
  1310. * Returns the Size hash code.
  1311. */
  1312. getHashCode(): number;
  1313. /**
  1314. * Updates the current size from the passed one.
  1315. * Returns the updated Size.
  1316. */
  1317. copyFrom(src: Size): void;
  1318. /**
  1319. * Updates in place the current Size from the passed floats.
  1320. * Returns the updated Size.
  1321. */
  1322. copyFromFloats(width: number, height: number): Size;
  1323. /**
  1324. * Updates in place the current Size from the passed floats.
  1325. * Returns the updated Size.
  1326. */
  1327. set(width: number, height: number): Size;
  1328. /**
  1329. * Returns a new Size set with the multiplication result of the current Size and the passed floats.
  1330. */
  1331. multiplyByFloats(w: number, h: number): Size;
  1332. /**
  1333. * Returns a new Size copied from the passed one.
  1334. */
  1335. clone(): Size;
  1336. /**
  1337. * Boolean : True if the current Size and the passed one width and height are strictly equal.
  1338. */
  1339. equals(other: Size): boolean;
  1340. /**
  1341. * Returns the surface of the Size : width * height (float).
  1342. */
  1343. readonly surface: number;
  1344. /**
  1345. * Returns a new Size set to (0.0, 0.0)
  1346. */
  1347. static Zero(): Size;
  1348. /**
  1349. * Returns a new Size set as the addition result of the current Size and the passed one.
  1350. */
  1351. add(otherSize: Size): Size;
  1352. /**
  1353. * Returns a new Size set as the subtraction result of the passed one from the current Size.
  1354. */
  1355. subtract(otherSize: Size): Size;
  1356. /**
  1357. * Returns a new Size set at the linear interpolation "amount" between "start" and "end".
  1358. */
  1359. static Lerp(start: Size, end: Size, amount: number): Size;
  1360. }
  1361. class Quaternion {
  1362. x: number;
  1363. y: number;
  1364. z: number;
  1365. w: number;
  1366. /**
  1367. * Creates a new Quaternion from the passed floats.
  1368. */
  1369. constructor(x?: number, y?: number, z?: number, w?: number);
  1370. /**
  1371. * Returns a string with the Quaternion coordinates.
  1372. */
  1373. toString(): string;
  1374. /**
  1375. * Returns the string "Quaternion".
  1376. */
  1377. getClassName(): string;
  1378. /**
  1379. * Returns the Quaternion hash code.
  1380. */
  1381. getHashCode(): number;
  1382. /**
  1383. * Returns a new array populated with 4 elements : the Quaternion coordinates.
  1384. */
  1385. asArray(): number[];
  1386. /**
  1387. * Boolean : True if the current Quaterion and the passed one coordinates are strictly equal.
  1388. */
  1389. equals(otherQuaternion: Quaternion): boolean;
  1390. /**
  1391. * Returns a new Quaternion copied from the current one.
  1392. */
  1393. clone(): Quaternion;
  1394. /**
  1395. * Updates the current Quaternion from the passed one coordinates.
  1396. * Returns the updated Quaterion.
  1397. */
  1398. copyFrom(other: Quaternion): Quaternion;
  1399. /**
  1400. * Updates the current Quaternion from the passed float coordinates.
  1401. * Returns the updated Quaterion.
  1402. */
  1403. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  1404. /**
  1405. * Updates the current Quaternion from the passed float coordinates.
  1406. * Returns the updated Quaterion.
  1407. */
  1408. set(x: number, y: number, z: number, w: number): Quaternion;
  1409. /**
  1410. * Returns a new Quaternion as the addition result of the passed one and the current Quaternion.
  1411. */
  1412. add(other: Quaternion): Quaternion;
  1413. /**
  1414. * Returns a new Quaternion as the subtraction result of the passed one from the current Quaternion.
  1415. */
  1416. subtract(other: Quaternion): Quaternion;
  1417. /**
  1418. * Returns a new Quaternion set by multiplying the current Quaterion coordinates by the float "scale".
  1419. */
  1420. scale(value: number): Quaternion;
  1421. /**
  1422. * Returns a new Quaternion set as the quaternion mulplication result of the current one with the passed one "q1".
  1423. */
  1424. multiply(q1: Quaternion): Quaternion;
  1425. /**
  1426. * Sets the passed "result" as the quaternion mulplication result of the current one with the passed one "q1".
  1427. * Returns the current Quaternion.
  1428. */
  1429. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  1430. /**
  1431. * Updates the current Quaternion with the quaternion mulplication result of itself with the passed one "q1".
  1432. * Returns the updated Quaternion.
  1433. */
  1434. multiplyInPlace(q1: Quaternion): Quaternion;
  1435. /**
  1436. * Sets the passed "ref" with the conjugation of the current Quaternion.
  1437. * Returns the current Quaternion.
  1438. */
  1439. conjugateToRef(ref: Quaternion): Quaternion;
  1440. /**
  1441. * Conjugates in place the current Quaternion.
  1442. * Returns the updated Quaternion.
  1443. */
  1444. conjugateInPlace(): Quaternion;
  1445. /**
  1446. * Returns a new Quaternion as the conjugate of the current Quaternion.
  1447. */
  1448. conjugate(): Quaternion;
  1449. /**
  1450. * Returns the Quaternion length (float).
  1451. */
  1452. length(): number;
  1453. /**
  1454. * Normalize in place the current Quaternion.
  1455. * Returns the updated Quaternion.
  1456. */
  1457. normalize(): Quaternion;
  1458. /**
  1459. * Returns a new Vector3 set with the Euler angles translated from the current Quaternion.
  1460. */
  1461. toEulerAngles(order?: string): Vector3;
  1462. /**
  1463. * Sets the passed vector3 "result" with the Euler angles translated from the current Quaternion.
  1464. * Returns the current Quaternion.
  1465. */
  1466. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  1467. /**
  1468. * Updates the passed rotation matrix with the current Quaternion values.
  1469. * Returns the current Quaternion.
  1470. */
  1471. toRotationMatrix(result: Matrix): Quaternion;
  1472. /**
  1473. * Updates the current Quaternion from the passed rotation matrix values.
  1474. * Returns the updated Quaternion.
  1475. */
  1476. fromRotationMatrix(matrix: Matrix): Quaternion;
  1477. /**
  1478. * Returns a new Quaternion set from the passed rotation matrix values.
  1479. */
  1480. static FromRotationMatrix(matrix: Matrix): Quaternion;
  1481. /**
  1482. * Updates the passed quaternion "result" with the passed rotation matrix values.
  1483. */
  1484. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  1485. /**
  1486. * Returns a new Quaternion set to (0.0, 0.0, 0.0).
  1487. */
  1488. static Zero(): Quaternion;
  1489. /**
  1490. * Returns a new Quaternion as the inverted current Quaternion.
  1491. */
  1492. static Inverse(q: Quaternion): Quaternion;
  1493. /**
  1494. * Returns the identity Quaternion.
  1495. */
  1496. static Identity(): Quaternion;
  1497. static IsIdentity(quaternion: Quaternion): boolean;
  1498. /**
  1499. * Returns a new Quaternion set from the passed axis (Vector3) and angle in radians (float).
  1500. */
  1501. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  1502. /**
  1503. * Sets the passed quaternion "result" from the passed axis (Vector3) and angle in radians (float).
  1504. */
  1505. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  1506. /**
  1507. * Retuns a new Quaternion set from the starting index of the passed array.
  1508. */
  1509. static FromArray(array: ArrayLike<number>, offset?: number): Quaternion;
  1510. /**
  1511. * Returns a new Quaternion set from the passed Euler float angles (y, x, z).
  1512. */
  1513. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  1514. /**
  1515. * Sets the passed quaternion "result" from the passed float Euler angles (y, x, z).
  1516. */
  1517. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  1518. /**
  1519. * Returns a new Quaternion from the passed float Euler angles expressed in z-x-z orientation
  1520. */
  1521. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  1522. /**
  1523. * Sets the passed quaternion "result" from the passed float Euler angles expressed in z-x-z orientation
  1524. */
  1525. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  1526. /**
  1527. * Returns a new Quaternion as the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  1528. * cf to Vector3.RotationFromAxis() documentation.
  1529. * Note : axis1, axis2 and axis3 are normalized during this operation.
  1530. */
  1531. static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): Quaternion;
  1532. /**
  1533. * Sets the passed quaternion "ref" with the quaternion rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system.
  1534. * cf to Vector3.RotationFromAxis() documentation.
  1535. * Note : axis1, axis2 and axis3 are normalized during this operation.
  1536. */
  1537. static RotationQuaternionFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Quaternion): void;
  1538. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  1539. static SlerpToRef(left: Quaternion, right: Quaternion, amount: number, result: Quaternion): void;
  1540. /**
  1541. * Returns a new Quaternion located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2".
  1542. */
  1543. static Hermite(value1: Quaternion, tangent1: Quaternion, value2: Quaternion, tangent2: Quaternion, amount: number): Quaternion;
  1544. }
  1545. class Matrix {
  1546. private static _tempQuaternion;
  1547. private static _xAxis;
  1548. private static _yAxis;
  1549. private static _zAxis;
  1550. private static _updateFlagSeed;
  1551. private static _identityReadOnly;
  1552. private _isIdentity;
  1553. private _isIdentityDirty;
  1554. updateFlag: number;
  1555. m: Float32Array;
  1556. _markAsUpdated(): void;
  1557. constructor();
  1558. /**
  1559. * Boolean : True is the matrix is the identity matrix
  1560. */
  1561. isIdentity(considerAsTextureMatrix?: boolean): boolean;
  1562. /**
  1563. * Returns the matrix determinant (float).
  1564. */
  1565. determinant(): number;
  1566. /**
  1567. * Returns the matrix underlying array.
  1568. */
  1569. toArray(): Float32Array;
  1570. /**
  1571. * Returns the matrix underlying array.
  1572. */
  1573. asArray(): Float32Array;
  1574. /**
  1575. * Inverts in place the Matrix.
  1576. * Returns the Matrix inverted.
  1577. */
  1578. invert(): Matrix;
  1579. /**
  1580. * Sets all the matrix elements to zero.
  1581. * Returns the Matrix.
  1582. */
  1583. reset(): Matrix;
  1584. /**
  1585. * Returns a new Matrix as the addition result of the current Matrix and the passed one.
  1586. */
  1587. add(other: Matrix): Matrix;
  1588. /**
  1589. * Sets the passed matrix "result" with the ddition result of the current Matrix and the passed one.
  1590. * Returns the Matrix.
  1591. */
  1592. addToRef(other: Matrix, result: Matrix): Matrix;
  1593. /**
  1594. * Adds in place the passed matrix to the current Matrix.
  1595. * Returns the updated Matrix.
  1596. */
  1597. addToSelf(other: Matrix): Matrix;
  1598. /**
  1599. * Sets the passed matrix with the current inverted Matrix.
  1600. * Returns the unmodified current Matrix.
  1601. */
  1602. invertToRef(other: Matrix): Matrix;
  1603. /**
  1604. * Inserts the translation vector (using 3 x floats) in the current Matrix.
  1605. * Returns the updated Matrix.
  1606. */
  1607. setTranslationFromFloats(x: number, y: number, z: number): Matrix;
  1608. /**
  1609. * Inserts the translation vector in the current Matrix.
  1610. * Returns the updated Matrix.
  1611. */
  1612. setTranslation(vector3: Vector3): Matrix;
  1613. /**
  1614. * Returns a new Vector3 as the extracted translation from the Matrix.
  1615. */
  1616. getTranslation(): Vector3;
  1617. /**
  1618. * Fill a Vector3 with the extracted translation from the Matrix.
  1619. */
  1620. getTranslationToRef(result: Vector3): Matrix;
  1621. /**
  1622. * Remove rotation and scaling part from the Matrix.
  1623. * Returns the updated Matrix.
  1624. */
  1625. removeRotationAndScaling(): Matrix;
  1626. /**
  1627. * Returns a new Matrix set with the multiplication result of the current Matrix and the passed one.
  1628. */
  1629. multiply(other: Matrix): Matrix;
  1630. /**
  1631. * Updates the current Matrix from the passed one values.
  1632. * Returns the updated Matrix.
  1633. */
  1634. copyFrom(other: Matrix): Matrix;
  1635. /**
  1636. * Populates the passed array from the starting index with the Matrix values.
  1637. * Returns the Matrix.
  1638. */
  1639. copyToArray(array: Float32Array, offset?: number): Matrix;
  1640. /**
  1641. * Sets the passed matrix "result" with the multiplication result of the current Matrix and the passed one.
  1642. */
  1643. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  1644. /**
  1645. * Sets the Float32Array "result" from the passed index "offset" with the multiplication result of the current Matrix and the passed one.
  1646. */
  1647. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  1648. /**
  1649. * Boolean : True is the current Matrix and the passed one values are strictly equal.
  1650. */
  1651. equals(value: Matrix): boolean;
  1652. /**
  1653. * Returns a new Matrix from the current Matrix.
  1654. */
  1655. clone(): Matrix;
  1656. /**
  1657. * Returns the string "Matrix"
  1658. */
  1659. getClassName(): string;
  1660. /**
  1661. * Returns the Matrix hash code.
  1662. */
  1663. getHashCode(): number;
  1664. /**
  1665. * Decomposes the current Matrix into :
  1666. * - a scale vector3 passed as a reference to update,
  1667. * - a rotation quaternion passed as a reference to update,
  1668. * - a translation vector3 passed as a reference to update.
  1669. * Returns the boolean `true`.
  1670. */
  1671. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  1672. /**
  1673. * Returns a new Matrix as the extracted rotation matrix from the current one.
  1674. */
  1675. getRotationMatrix(): Matrix;
  1676. /**
  1677. * Extracts the rotation matrix from the current one and sets it as the passed "result".
  1678. * Returns the current Matrix.
  1679. */
  1680. getRotationMatrixToRef(result: Matrix): Matrix;
  1681. /**
  1682. * Returns a new Matrix set from the starting index of the passed array.
  1683. */
  1684. static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
  1685. /**
  1686. * Sets the passed "result" matrix from the starting index of the passed array.
  1687. */
  1688. static FromArrayToRef(array: ArrayLike<number>, offset: number, result: Matrix): void;
  1689. /**
  1690. * Sets the passed "result" matrix from the starting index of the passed Float32Array by multiplying each element by the float "scale".
  1691. */
  1692. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  1693. /**
  1694. * Sets the passed matrix "result" with the 16 passed floats.
  1695. */
  1696. 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;
  1697. /**
  1698. * Returns the index-th row of the current matrix as a new Vector4.
  1699. */
  1700. getRow(index: number): Nullable<Vector4>;
  1701. /**
  1702. * Sets the index-th row of the current matrix with the passed Vector4 values.
  1703. * Returns the updated Matrix.
  1704. */
  1705. setRow(index: number, row: Vector4): Matrix;
  1706. /**
  1707. * Compute the transpose of the matrix.
  1708. * Returns a new Matrix.
  1709. */
  1710. transpose(): Matrix;
  1711. /**
  1712. * Compute the transpose of the matrix.
  1713. * Returns the current matrix.
  1714. */
  1715. transposeToRef(result: Matrix): Matrix;
  1716. /**
  1717. * Sets the index-th row of the current matrix with the passed 4 x float values.
  1718. * Returns the updated Matrix.
  1719. */
  1720. setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix;
  1721. /**
  1722. * Static identity matrix to be used as readonly matrix
  1723. * Must not be updated.
  1724. */
  1725. static readonly IdentityReadOnly: Matrix;
  1726. /**
  1727. * Returns a new Matrix set from the 16 passed floats.
  1728. */
  1729. 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;
  1730. /**
  1731. * Returns a new Matrix composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  1732. */
  1733. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  1734. /**
  1735. * Update a Matrix with values composed by the passed scale (vector3), rotation (quaternion) and translation (vector3).
  1736. */
  1737. static ComposeToRef(scale: Vector3, rotation: Quaternion, translation: Vector3, result: Matrix): void;
  1738. /**
  1739. * Returns a new indentity Matrix.
  1740. */
  1741. static Identity(): Matrix;
  1742. /**
  1743. * Sets the passed "result" as an identity matrix.
  1744. */
  1745. static IdentityToRef(result: Matrix): void;
  1746. /**
  1747. * Returns a new zero Matrix.
  1748. */
  1749. static Zero(): Matrix;
  1750. /**
  1751. * Returns a new rotation matrix for "angle" radians around the X axis.
  1752. */
  1753. static RotationX(angle: number): Matrix;
  1754. /**
  1755. * Returns a new Matrix as the passed inverted one.
  1756. */
  1757. static Invert(source: Matrix): Matrix;
  1758. /**
  1759. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the X axis.
  1760. */
  1761. static RotationXToRef(angle: number, result: Matrix): void;
  1762. /**
  1763. * Returns a new rotation matrix for "angle" radians around the Y axis.
  1764. */
  1765. static RotationY(angle: number): Matrix;
  1766. /**
  1767. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Y axis.
  1768. */
  1769. static RotationYToRef(angle: number, result: Matrix): void;
  1770. /**
  1771. * Returns a new rotation matrix for "angle" radians around the Z axis.
  1772. */
  1773. static RotationZ(angle: number): Matrix;
  1774. /**
  1775. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the Z axis.
  1776. */
  1777. static RotationZToRef(angle: number, result: Matrix): void;
  1778. /**
  1779. * Returns a new rotation matrix for "angle" radians around the passed axis.
  1780. */
  1781. static RotationAxis(axis: Vector3, angle: number): Matrix;
  1782. /**
  1783. * Sets the passed matrix "result" as a rotation matrix for "angle" radians around the passed axis.
  1784. */
  1785. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  1786. /**
  1787. * Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z).
  1788. */
  1789. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  1790. /**
  1791. * Sets the passed matrix "result" as a rotation matrix from the Euler angles (y, x, z).
  1792. */
  1793. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  1794. /**
  1795. * Returns a new Matrix as a scaling matrix from the passed floats (x, y, z).
  1796. */
  1797. static Scaling(x: number, y: number, z: number): Matrix;
  1798. /**
  1799. * Sets the passed matrix "result" as a scaling matrix from the passed floats (x, y, z).
  1800. */
  1801. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  1802. /**
  1803. * Returns a new Matrix as a translation matrix from the passed floats (x, y, z).
  1804. */
  1805. static Translation(x: number, y: number, z: number): Matrix;
  1806. /**
  1807. * Sets the passed matrix "result" as a translation matrix from the passed floats (x, y, z).
  1808. */
  1809. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  1810. /**
  1811. * Returns a new Matrix whose values are the interpolated values for "gradien" (float) between the ones of the matrices "startValue" and "endValue".
  1812. */
  1813. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1814. /**
  1815. * Returns a new Matrix whose values are computed by :
  1816. * - decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices,
  1817. * - interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end,
  1818. * - recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices.
  1819. */
  1820. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  1821. /**
  1822. * Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  1823. * This methods works for a Left-Handed system.
  1824. */
  1825. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  1826. /**
  1827. * Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  1828. * This methods works for a Left-Handed system.
  1829. */
  1830. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  1831. /**
  1832. * Returns a new rotation Matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  1833. * This methods works for a Right-Handed system.
  1834. */
  1835. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  1836. /**
  1837. * Sets the passed "result" Matrix as a rotation matrix used to rotate a mesh so as it looks at the target Vector3, from the eye Vector3, the UP vector3 being orientated like "up".
  1838. * This methods works for a Left-Handed system.
  1839. */
  1840. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  1841. /**
  1842. * Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  1843. */
  1844. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  1845. /**
  1846. * Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  1847. */
  1848. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  1849. /**
  1850. * Returns a new Matrix as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  1851. */
  1852. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  1853. /**
  1854. * Sets the passed matrix "result" as a left-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  1855. */
  1856. static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  1857. /**
  1858. * Returns a new Matrix as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  1859. */
  1860. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  1861. /**
  1862. * Sets the passed matrix "result" as a right-handed orthographic projection matrix computed from the passed floats : left, right, top and bottom being the coordinates of the projection plane, z near and far limits.
  1863. */
  1864. static OrthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  1865. /**
  1866. * Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : width and height of the projection plane, z near and far limits.
  1867. */
  1868. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  1869. /**
  1870. * Returns a new Matrix as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  1871. */
  1872. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  1873. /**
  1874. * Sets the passed matrix "result" as a left-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  1875. */
  1876. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  1877. /**
  1878. * Returns a new Matrix as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  1879. */
  1880. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  1881. /**
  1882. * Sets the passed matrix "result" as a right-handed perspective projection matrix computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  1883. */
  1884. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  1885. /**
  1886. * Sets the passed matrix "result" as a left-handed perspective projection matrix for WebVR computed from the passed floats : vertical angle of view (fov), width/height ratio (aspect), z near and far limits.
  1887. */
  1888. static PerspectiveFovWebVRToRef(fov: {
  1889. upDegrees: number;
  1890. downDegrees: number;
  1891. leftDegrees: number;
  1892. rightDegrees: number;
  1893. }, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void;
  1894. /**
  1895. * Returns the final transformation matrix : world * view * projection * viewport
  1896. */
  1897. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  1898. /**
  1899. * Returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the passed Matrix.
  1900. */
  1901. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  1902. /**
  1903. * Returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the passed Matrix.
  1904. */
  1905. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  1906. /**
  1907. * Compute the transpose of the passed Matrix.
  1908. * Returns a new Matrix.
  1909. */
  1910. static Transpose(matrix: Matrix): Matrix;
  1911. /**
  1912. * Compute the transpose of the passed Matrix and store it in the result matrix.
  1913. */
  1914. static TransposeToRef(matrix: Matrix, result: Matrix): void;
  1915. /**
  1916. * Returns a new Matrix as the reflection matrix across the passed plane.
  1917. */
  1918. static Reflection(plane: Plane): Matrix;
  1919. /**
  1920. * Sets the passed matrix "result" as the reflection matrix across the passed plane.
  1921. */
  1922. static ReflectionToRef(plane: Plane, result: Matrix): void;
  1923. /**
  1924. * Sets the passed matrix "mat" as a rotation matrix composed from the 3 passed left handed axis.
  1925. */
  1926. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: Matrix): void;
  1927. /**
  1928. * Sets the passed matrix "result" as a rotation matrix according to the passed quaternion.
  1929. */
  1930. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  1931. }
  1932. class Plane {
  1933. normal: Vector3;
  1934. d: number;
  1935. /**
  1936. * Creates a Plane object according to the passed floats a, b, c, d and the plane equation : ax + by + cz + d = 0
  1937. */
  1938. constructor(a: number, b: number, c: number, d: number);
  1939. /**
  1940. * Returns the plane coordinates as a new array of 4 elements [a, b, c, d].
  1941. */
  1942. asArray(): number[];
  1943. /**
  1944. * Returns a new plane copied from the current Plane.
  1945. */
  1946. clone(): Plane;
  1947. /**
  1948. * Returns the string "Plane".
  1949. */
  1950. getClassName(): string;
  1951. /**
  1952. * Returns the Plane hash code.
  1953. */
  1954. getHashCode(): number;
  1955. /**
  1956. * Normalize the current Plane in place.
  1957. * Returns the updated Plane.
  1958. */
  1959. normalize(): Plane;
  1960. /**
  1961. * Returns a new Plane as the result of the transformation of the current Plane by the passed matrix.
  1962. */
  1963. transform(transformation: Matrix): Plane;
  1964. /**
  1965. * Returns the dot product (float) of the point coordinates and the plane normal.
  1966. */
  1967. dotCoordinate(point: Vector3): number;
  1968. /**
  1969. * Updates the current Plane from the plane defined by the three passed points.
  1970. * Returns the updated Plane.
  1971. */
  1972. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  1973. /**
  1974. * Boolean : True is the vector "direction" is the same side than the plane normal.
  1975. */
  1976. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  1977. /**
  1978. * Returns the signed distance (float) from the passed point to the Plane.
  1979. */
  1980. signedDistanceTo(point: Vector3): number;
  1981. /**
  1982. * Returns a new Plane from the passed array.
  1983. */
  1984. static FromArray(array: ArrayLike<number>): Plane;
  1985. /**
  1986. * Returns a new Plane defined by the three passed points.
  1987. */
  1988. static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  1989. /**
  1990. * Returns a new Plane the normal vector to this plane at the passed origin point.
  1991. * Note : the vector "normal" is updated because normalized.
  1992. */
  1993. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  1994. /**
  1995. * Returns the signed distance between the plane defined by the normal vector at the "origin"" point and the passed other point.
  1996. */
  1997. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  1998. }
  1999. class Viewport {
  2000. x: number;
  2001. y: number;
  2002. width: number;
  2003. height: number;
  2004. /**
  2005. * Creates a Viewport object located at (x, y) and sized (width, height).
  2006. */
  2007. constructor(x: number, y: number, width: number, height: number);
  2008. toGlobal(renderWidthOrEngine: number | Engine, renderHeight: number): Viewport;
  2009. /**
  2010. * Returns a new Viewport copied from the current one.
  2011. */
  2012. clone(): Viewport;
  2013. }
  2014. class Frustum {
  2015. /**
  2016. * Returns a new array of 6 Frustum planes computed by the passed transformation matrix.
  2017. */
  2018. static GetPlanes(transform: Matrix): Plane[];
  2019. static GetNearPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2020. static GetFarPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2021. static GetLeftPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2022. static GetRightPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2023. static GetTopPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2024. static GetBottomPlaneToRef(transform: Matrix, frustumPlane: Plane): void;
  2025. /**
  2026. * Sets the passed array "frustumPlanes" with the 6 Frustum planes computed by the passed transformation matrix.
  2027. */
  2028. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  2029. }
  2030. enum Space {
  2031. LOCAL = 0,
  2032. WORLD = 1,
  2033. BONE = 2,
  2034. }
  2035. class Axis {
  2036. static X: Vector3;
  2037. static Y: Vector3;
  2038. static Z: Vector3;
  2039. }
  2040. class BezierCurve {
  2041. /**
  2042. * Returns the cubic Bezier interpolated value (float) at "t" (float) from the passed x1, y1, x2, y2 floats.
  2043. */
  2044. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  2045. }
  2046. enum Orientation {
  2047. CW = 0,
  2048. CCW = 1,
  2049. }
  2050. class Angle {
  2051. private _radians;
  2052. /**
  2053. * Creates an Angle object of "radians" radians (float).
  2054. */
  2055. constructor(radians: number);
  2056. /**
  2057. * Returns the Angle value in degrees (float).
  2058. */
  2059. degrees: () => number;
  2060. /**
  2061. * Returns the Angle value in radians (float).
  2062. */
  2063. radians: () => number;
  2064. /**
  2065. * Returns a new Angle object valued with the angle value in radians between the two passed vectors.
  2066. */
  2067. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  2068. /**
  2069. * Returns a new Angle object from the passed float in radians.
  2070. */
  2071. static FromRadians(radians: number): Angle;
  2072. /**
  2073. * Returns a new Angle object from the passed float in degrees.
  2074. */
  2075. static FromDegrees(degrees: number): Angle;
  2076. }
  2077. class Arc2 {
  2078. startPoint: Vector2;
  2079. midPoint: Vector2;
  2080. endPoint: Vector2;
  2081. centerPoint: Vector2;
  2082. radius: number;
  2083. angle: Angle;
  2084. startAngle: Angle;
  2085. orientation: Orientation;
  2086. /**
  2087. * Creates an Arc object from the three passed points : start, middle and end.
  2088. */
  2089. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  2090. }
  2091. class Path2 {
  2092. private _points;
  2093. private _length;
  2094. closed: boolean;
  2095. /**
  2096. * Creates a Path2 object from the starting 2D coordinates x and y.
  2097. */
  2098. constructor(x: number, y: number);
  2099. /**
  2100. * Adds a new segment until the passed coordinates (x, y) to the current Path2.
  2101. * Returns the updated Path2.
  2102. */
  2103. addLineTo(x: number, y: number): Path2;
  2104. /**
  2105. * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.
  2106. * Returns the updated Path2.
  2107. */
  2108. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  2109. /**
  2110. * Closes the Path2.
  2111. * Returns the Path2.
  2112. */
  2113. close(): Path2;
  2114. /**
  2115. * Returns the Path2 total length (float).
  2116. */
  2117. length(): number;
  2118. /**
  2119. * Returns the Path2 internal array of points.
  2120. */
  2121. getPoints(): Vector2[];
  2122. /**
  2123. * Returns a new Vector2 located at a percentage of the Path2 total length on this path.
  2124. */
  2125. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  2126. /**
  2127. * Returns a new Path2 starting at the coordinates (x, y).
  2128. */
  2129. static StartingAt(x: number, y: number): Path2;
  2130. }
  2131. class Path3D {
  2132. path: Vector3[];
  2133. private _curve;
  2134. private _distances;
  2135. private _tangents;
  2136. private _normals;
  2137. private _binormals;
  2138. private _raw;
  2139. /**
  2140. * new Path3D(path, normal, raw)
  2141. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  2142. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  2143. * path : an array of Vector3, the curve axis of the Path3D
  2144. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  2145. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  2146. */
  2147. constructor(path: Vector3[], firstNormal?: Nullable<Vector3>, raw?: boolean);
  2148. /**
  2149. * Returns the Path3D array of successive Vector3 designing its curve.
  2150. */
  2151. getCurve(): Vector3[];
  2152. /**
  2153. * Returns an array populated with tangent vectors on each Path3D curve point.
  2154. */
  2155. getTangents(): Vector3[];
  2156. /**
  2157. * Returns an array populated with normal vectors on each Path3D curve point.
  2158. */
  2159. getNormals(): Vector3[];
  2160. /**
  2161. * Returns an array populated with binormal vectors on each Path3D curve point.
  2162. */
  2163. getBinormals(): Vector3[];
  2164. /**
  2165. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  2166. */
  2167. getDistances(): number[];
  2168. /**
  2169. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  2170. * Returns the same object updated.
  2171. */
  2172. update(path: Vector3[], firstNormal?: Nullable<Vector3>): Path3D;
  2173. private _compute(firstNormal);
  2174. private _getFirstNonNullVector(index);
  2175. private _getLastNonNullVector(index);
  2176. private _normalVector(v0, vt, va);
  2177. }
  2178. class Curve3 {
  2179. private _points;
  2180. private _length;
  2181. /**
  2182. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  2183. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  2184. * @param v1 (Vector3) the control point
  2185. * @param v2 (Vector3) the end point of the Quadratic Bezier
  2186. * @param nbPoints (integer) the wanted number of points in the curve
  2187. */
  2188. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  2189. /**
  2190. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  2191. * @param v0 (Vector3) the origin point of the Cubic Bezier
  2192. * @param v1 (Vector3) the first control point
  2193. * @param v2 (Vector3) the second control point
  2194. * @param v3 (Vector3) the end point of the Cubic Bezier
  2195. * @param nbPoints (integer) the wanted number of points in the curve
  2196. */
  2197. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  2198. /**
  2199. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  2200. * @param p1 (Vector3) the origin point of the Hermite Spline
  2201. * @param t1 (Vector3) the tangent vector at the origin point
  2202. * @param p2 (Vector3) the end point of the Hermite Spline
  2203. * @param t2 (Vector3) the tangent vector at the end point
  2204. * @param nbPoints (integer) the wanted number of points in the curve
  2205. */
  2206. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  2207. /**
  2208. * Returns a Curve3 object along a CatmullRom Spline curve :
  2209. * @param points (array of Vector3) the points the spline must pass through. At least, four points required.
  2210. * @param nbPoints (integer) the wanted number of points between each curve control points.
  2211. */
  2212. static CreateCatmullRomSpline(points: Vector3[], nbPoints: number): Curve3;
  2213. /**
  2214. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  2215. * A Curve3 is designed from a series of successive Vector3.
  2216. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  2217. */
  2218. constructor(points: Vector3[]);
  2219. /**
  2220. * Returns the Curve3 stored array of successive Vector3
  2221. */
  2222. getPoints(): Vector3[];
  2223. /**
  2224. * Returns the computed length (float) of the curve.
  2225. */
  2226. length(): number;
  2227. /**
  2228. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  2229. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  2230. * curveA and curveB keep unchanged.
  2231. */
  2232. continue(curve: Curve3): Curve3;
  2233. private _computeLength(path);
  2234. }
  2235. class PositionNormalVertex {
  2236. position: Vector3;
  2237. normal: Vector3;
  2238. constructor(position?: Vector3, normal?: Vector3);
  2239. clone(): PositionNormalVertex;
  2240. }
  2241. class PositionNormalTextureVertex {
  2242. position: Vector3;
  2243. normal: Vector3;
  2244. uv: Vector2;
  2245. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  2246. clone(): PositionNormalTextureVertex;
  2247. }
  2248. class Tmp {
  2249. static Color3: Color3[];
  2250. static Vector2: Vector2[];
  2251. static Vector3: Vector3[];
  2252. static Vector4: Vector4[];
  2253. static Quaternion: Quaternion[];
  2254. static Matrix: Matrix[];
  2255. }
  2256. }
  2257. declare module 'babylonjs/core' {
  2258. class Scalar {
  2259. /**
  2260. * Two pi constants convenient for computation.
  2261. */
  2262. static TwoPi: number;
  2263. /**
  2264. * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  2265. */
  2266. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  2267. /**
  2268. * Returns a string : the upper case translation of the number i to hexadecimal.
  2269. */
  2270. static ToHex(i: number): string;
  2271. /**
  2272. * Returns -1 if value is negative and +1 is value is positive.
  2273. * Returns the value itself if it's equal to zero.
  2274. */
  2275. static Sign(value: number): number;
  2276. /**
  2277. * Returns the value itself if it's between min and max.
  2278. * Returns min if the value is lower than min.
  2279. * Returns max if the value is greater than max.
  2280. */
  2281. static Clamp(value: number, min?: number, max?: number): number;
  2282. /**
  2283. * Returns the log2 of value.
  2284. */
  2285. static Log2(value: number): number;
  2286. /**
  2287. * Loops the value, so that it is never larger than length and never smaller than 0.
  2288. *
  2289. * This is similar to the modulo operator but it works with floating point numbers.
  2290. * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
  2291. * With t = 5 and length = 2.5, the result would be 0.0.
  2292. * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
  2293. */
  2294. static Repeat(value: number, length: number): number;
  2295. /**
  2296. * Normalize the value between 0.0 and 1.0 using min and max values
  2297. */
  2298. static Normalize(value: number, min: number, max: number): number;
  2299. /**
  2300. * Denormalize the value from 0.0 and 1.0 using min and max values
  2301. */
  2302. static Denormalize(normalized: number, min: number, max: number): number;
  2303. /**
  2304. * Calculates the shortest difference between two given angles given in degrees.
  2305. */
  2306. static DeltaAngle(current: number, target: number): number;
  2307. /**
  2308. * PingPongs the value t, so that it is never larger than length and never smaller than 0.
  2309. *
  2310. * The returned value will move back and forth between 0 and length
  2311. */
  2312. static PingPong(tx: number, length: number): number;
  2313. /**
  2314. * Interpolates between min and max with smoothing at the limits.
  2315. *
  2316. * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
  2317. * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
  2318. */
  2319. static SmoothStep(from: number, to: number, tx: number): number;
  2320. /**
  2321. * Moves a value current towards target.
  2322. *
  2323. * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
  2324. * Negative values of maxDelta pushes the value away from target.
  2325. */
  2326. static MoveTowards(current: number, target: number, maxDelta: number): number;
  2327. /**
  2328. * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
  2329. *
  2330. * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
  2331. * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
  2332. */
  2333. static MoveTowardsAngle(current: number, target: number, maxDelta: number): number;
  2334. /**
  2335. * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
  2336. */
  2337. static Lerp(start: number, end: number, amount: number): number;
  2338. /**
  2339. * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
  2340. * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
  2341. */
  2342. static LerpAngle(start: number, end: number, amount: number): number;
  2343. /**
  2344. * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
  2345. */
  2346. static InverseLerp(a: number, b: number, value: number): number;
  2347. /**
  2348. * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
  2349. */
  2350. static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number;
  2351. /**
  2352. * Returns a random float number between and min and max values
  2353. */
  2354. static RandomRange(min: number, max: number): number;
  2355. /**
  2356. * This function returns percentage of a number in a given range.
  2357. *
  2358. * RangeToPercent(40,20,60) will return 0.5 (50%)
  2359. * RangeToPercent(34,0,100) will return 0.34 (34%)
  2360. */
  2361. static RangeToPercent(number: number, min: number, max: number): number;
  2362. /**
  2363. * This function returns number that corresponds to the percentage in a given range.
  2364. *
  2365. * PercentToRange(0.34,0,100) will return 34.
  2366. */
  2367. static PercentToRange(percent: number, min: number, max: number): number;
  2368. /**
  2369. * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
  2370. * @param angle The angle to normalize in radian.
  2371. * @return The converted angle.
  2372. */
  2373. static NormalizeRadians(angle: number): number;
  2374. }
  2375. }
  2376. export interface Window {
  2377. mozIndexedDB: IDBFactory;
  2378. webkitIndexedDB: IDBFactory;
  2379. msIndexedDB: IDBFactory;
  2380. webkitURL: typeof URL;
  2381. mozRequestAnimationFrame(callback: FrameRequestCallback): number;
  2382. oRequestAnimationFrame(callback: FrameRequestCallback): number;
  2383. WebGLRenderingContext: WebGLRenderingContext;
  2384. MSGesture: MSGesture;
  2385. CANNON: any;
  2386. SIMD: any;
  2387. AudioContext: AudioContext;
  2388. webkitAudioContext: AudioContext;
  2389. PointerEvent: any;
  2390. Math: Math;
  2391. Uint8Array: Uint8ArrayConstructor;
  2392. Float32Array: Float32ArrayConstructor;
  2393. mozURL: typeof URL;
  2394. msURL: typeof URL;
  2395. VRFrameData: any;
  2396. }
  2397. export interface WebGLRenderingContext {
  2398. drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void;
  2399. drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void;
  2400. vertexAttribDivisor(index: number, divisor: number): void;
  2401. createVertexArray(): any;
  2402. bindVertexArray(vao?: WebGLVertexArrayObject | null): void;
  2403. deleteVertexArray(vao: WebGLVertexArrayObject): void;
  2404. blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void;
  2405. renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void;
  2406. bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void;
  2407. getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number;
  2408. uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void;
  2409. createQuery(): WebGLQuery;
  2410. deleteQuery(query: WebGLQuery): void;
  2411. beginQuery(target: number, query: WebGLQuery): void;
  2412. endQuery(target: number): void;
  2413. getQueryParameter(query: WebGLQuery, pname: number): any;
  2414. getQuery(target: number, pname: number): any;
  2415. MAX_SAMPLES: number;
  2416. RGBA8: number;
  2417. READ_FRAMEBUFFER: number;
  2418. DRAW_FRAMEBUFFER: number;
  2419. UNIFORM_BUFFER: number;
  2420. HALF_FLOAT_OES: number;
  2421. RGBA16F: number;
  2422. RGBA32F: number;
  2423. DEPTH24_STENCIL8: number;
  2424. drawBuffers(buffers: number[]): void;
  2425. readBuffer(src: number): void;
  2426. readonly COLOR_ATTACHMENT0: number;
  2427. readonly COLOR_ATTACHMENT1: number;
  2428. readonly COLOR_ATTACHMENT2: number;
  2429. readonly COLOR_ATTACHMENT3: number;
  2430. ANY_SAMPLES_PASSED_CONSERVATIVE: number;
  2431. ANY_SAMPLES_PASSED: number;
  2432. QUERY_RESULT_AVAILABLE: number;
  2433. QUERY_RESULT: number;
  2434. }
  2435. export interface Document {
  2436. mozCancelFullScreen(): void;
  2437. msCancelFullScreen(): void;
  2438. mozFullScreen: boolean;
  2439. msIsFullScreen: boolean;
  2440. fullscreen: boolean;
  2441. mozPointerLockElement: HTMLElement;
  2442. msPointerLockElement: HTMLElement;
  2443. webkitPointerLockElement: HTMLElement;
  2444. }
  2445. export interface HTMLCanvasElement {
  2446. msRequestPointerLock?(): void;
  2447. mozRequestPointerLock?(): void;
  2448. webkitRequestPointerLock?(): void;
  2449. }
  2450. export interface CanvasRenderingContext2D {
  2451. msImageSmoothingEnabled: boolean;
  2452. }
  2453. export interface WebGLBuffer {
  2454. references: number;
  2455. capacity: number;
  2456. is32Bits: boolean;
  2457. }
  2458. export interface WebGLProgram {
  2459. transformFeedback?: WebGLTransformFeedback | null;
  2460. __SPECTOR_rebuildProgram?: ((vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (program: WebGLProgram) => void, onError: (message: string) => void) => void) | null;
  2461. }
  2462. export interface MouseEvent {
  2463. mozMovementX: number;
  2464. mozMovementY: number;
  2465. webkitMovementX: number;
  2466. webkitMovementY: number;
  2467. msMovementX: number;
  2468. msMovementY: number;
  2469. }
  2470. export interface Navigator {
  2471. getVRDisplays: () => any;
  2472. mozGetVRDevices: (any: any) => any;
  2473. webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  2474. mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  2475. msGetUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
  2476. webkitGetGamepads(): Gamepad[];
  2477. msGetGamepads(): Gamepad[];
  2478. webkitGamepads(): Gamepad[];
  2479. }
  2480. export interface HTMLVideoElement {
  2481. mozSrcObject: any;
  2482. }
  2483. export interface Screen {
  2484. orientation: string;
  2485. mozOrientation: string;
  2486. }
  2487. export interface Math {
  2488. fround(x: number): number;
  2489. imul(a: number, b: number): number;
  2490. }
  2491. export interface SIMDglobal {
  2492. SIMD: SIMD;
  2493. Math: Math;
  2494. Uint8Array: Uint8ArrayConstructor;
  2495. Float32Array: Float32ArrayConstructor;
  2496. }
  2497. export interface SIMD {
  2498. Float32x4: SIMD.Float32x4Constructor;
  2499. Int32x4: SIMD.Int32x4Constructor;
  2500. Int16x8: SIMD.Int16x8Constructor;
  2501. Int8x16: SIMD.Int8x16Constructor;
  2502. Uint32x4: SIMD.Uint32x4Constructor;
  2503. Uint16x8: SIMD.Uint16x8Constructor;
  2504. Uint8x16: SIMD.Uint8x16Constructor;
  2505. Bool32x4: SIMD.Bool32x4Constructor;
  2506. Bool16x8: SIMD.Bool16x8Constructor;
  2507. Bool8x16: SIMD.Bool8x16Constructor;
  2508. }
  2509. export interface GamepadPose {
  2510. hasOrientation: boolean;
  2511. hasPosition: boolean;
  2512. position?: Float32Array;
  2513. linearVelocity?: Float32Array;
  2514. linearAcceleration?: Float32Array;
  2515. orientation?: Float32Array;
  2516. angularVelocity?: Float32Array;
  2517. angularAcceleration?: Float32Array;
  2518. }
  2519. declare namespace SIMD {
  2520. interface Float32x4 {
  2521. constructor: Float32x4Constructor;
  2522. valueOf(): Float32x4;
  2523. toLocaleString(): string;
  2524. toString(): string;
  2525. }
  2526. interface Float32x4Constructor {
  2527. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  2528. prototype: Float32x4;
  2529. extractLane(simd: SIMD.Float32x4, lane: number): number;
  2530. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  2531. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  2532. check(a: SIMD.Float32x4): SIMD.Float32x4;
  2533. splat(n: number): SIMD.Float32x4;
  2534. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  2535. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2536. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2537. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2538. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2539. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2540. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2541. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  2542. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2543. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2544. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2545. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2546. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  2547. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  2548. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2549. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2550. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2551. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  2552. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  2553. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  2554. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  2555. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  2556. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  2557. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  2558. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  2559. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  2560. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  2561. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  2562. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  2563. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  2564. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  2565. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  2566. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  2567. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  2568. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  2569. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  2570. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  2571. }
  2572. interface Int32x4 {
  2573. constructor: Int32x4Constructor;
  2574. valueOf(): Int32x4;
  2575. toLocaleString(): string;
  2576. toString(): string;
  2577. }
  2578. interface Int32x4Constructor {
  2579. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  2580. prototype: Int32x4;
  2581. extractLane(simd: SIMD.Int32x4, lane: number): number;
  2582. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  2583. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  2584. check(a: SIMD.Int32x4): SIMD.Int32x4;
  2585. splat(n: number): SIMD.Int32x4;
  2586. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  2587. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2588. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2589. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2590. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2591. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2592. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2593. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  2594. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2595. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2596. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2597. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2598. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2599. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2600. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  2601. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  2602. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  2603. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  2604. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  2605. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  2606. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  2607. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  2608. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  2609. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  2610. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  2611. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  2612. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  2613. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  2614. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  2615. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  2616. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  2617. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  2618. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  2619. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  2620. }
  2621. interface Int16x8 {
  2622. constructor: Int16x8Constructor;
  2623. valueOf(): Int16x8;
  2624. toLocaleString(): string;
  2625. toString(): string;
  2626. }
  2627. interface Int16x8Constructor {
  2628. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  2629. prototype: Int16x8;
  2630. extractLane(simd: SIMD.Int16x8, lane: number): number;
  2631. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  2632. shuffle(a: SIMD.Int16x8, b: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  2633. check(a: SIMD.Int16x8): SIMD.Int16x8;
  2634. splat(n: number): SIMD.Int16x8;
  2635. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  2636. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2637. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2638. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2639. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2640. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2641. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2642. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  2643. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2644. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2645. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2646. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2647. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2648. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2649. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2650. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  2651. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  2652. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  2653. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2654. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  2655. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  2656. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  2657. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  2658. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  2659. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  2660. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  2661. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  2662. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  2663. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  2664. }
  2665. interface Int8x16 {
  2666. constructor: Int8x16Constructor;
  2667. valueOf(): Int8x16;
  2668. toLocaleString(): string;
  2669. toString(): string;
  2670. }
  2671. interface Int8x16Constructor {
  2672. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Int8x16;
  2673. prototype: Int8x16;
  2674. extractLane(simd: SIMD.Int8x16, lane: number): number;
  2675. swizzle(a: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  2676. shuffle(a: SIMD.Int8x16, b: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  2677. check(a: SIMD.Int8x16): SIMD.Int8x16;
  2678. splat(n: number): SIMD.Int8x16;
  2679. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  2680. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2681. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2682. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2683. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2684. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2685. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2686. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  2687. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2688. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2689. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2690. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2691. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2692. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2693. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2694. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  2695. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  2696. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  2697. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2698. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  2699. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  2700. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  2701. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  2702. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  2703. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  2704. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  2705. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  2706. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  2707. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  2708. }
  2709. interface Uint32x4 {
  2710. constructor: Uint32x4Constructor;
  2711. valueOf(): Uint32x4;
  2712. toLocaleString(): string;
  2713. toString(): string;
  2714. }
  2715. interface Uint32x4Constructor {
  2716. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  2717. prototype: Uint32x4;
  2718. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  2719. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  2720. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  2721. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  2722. splat(n: number): SIMD.Uint32x4;
  2723. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  2724. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2725. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2726. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2727. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2728. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2729. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2730. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  2731. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2732. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2733. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2734. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2735. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2736. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2737. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  2738. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  2739. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  2740. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  2741. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  2742. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  2743. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  2744. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  2745. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  2746. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  2747. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  2748. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  2749. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  2750. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  2751. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  2752. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  2753. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  2754. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  2755. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  2756. }
  2757. interface Uint16x8 {
  2758. constructor: Uint16x8Constructor;
  2759. valueOf(): Uint16x8;
  2760. toLocaleString(): string;
  2761. toString(): string;
  2762. }
  2763. interface Uint16x8Constructor {
  2764. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  2765. prototype: Uint16x8;
  2766. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  2767. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  2768. shuffle(a: SIMD.Uint16x8, b: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  2769. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  2770. splat(n: number): SIMD.Uint16x8;
  2771. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  2772. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2773. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2774. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2775. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2776. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2777. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2778. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  2779. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2780. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2781. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2782. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2783. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2784. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2785. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2786. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  2787. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  2788. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2789. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  2790. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  2791. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  2792. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  2793. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  2794. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  2795. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  2796. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  2797. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  2798. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  2799. }
  2800. interface Uint8x16 {
  2801. constructor: Uint8x16Constructor;
  2802. valueOf(): Uint8x16;
  2803. toLocaleString(): string;
  2804. toString(): string;
  2805. }
  2806. interface Uint8x16Constructor {
  2807. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Uint8x16;
  2808. prototype: Uint8x16;
  2809. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  2810. swizzle(a: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  2811. shuffle(a: SIMD.Uint8x16, b: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  2812. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  2813. splat(n: number): SIMD.Uint8x16;
  2814. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  2815. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2816. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2817. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2818. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2819. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2820. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2821. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  2822. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2823. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2824. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2825. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2826. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2827. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2828. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2829. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  2830. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  2831. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2832. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  2833. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  2834. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  2835. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  2836. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  2837. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  2838. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  2839. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  2840. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  2841. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  2842. }
  2843. interface Bool32x4 {
  2844. constructor: Bool32x4Constructor;
  2845. valueOf(): Bool32x4;
  2846. toLocaleString(): string;
  2847. toString(): string;
  2848. }
  2849. interface Bool32x4Constructor {
  2850. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  2851. prototype: Bool32x4;
  2852. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  2853. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  2854. splat(n: boolean): SIMD.Bool32x4;
  2855. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  2856. allTrue(a: SIMD.Bool32x4): boolean;
  2857. anyTrue(a: SIMD.Bool32x4): boolean;
  2858. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  2859. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  2860. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  2861. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  2862. }
  2863. interface Bool16x8 {
  2864. constructor: Bool16x8Constructor;
  2865. valueOf(): Bool16x8;
  2866. toLocaleString(): string;
  2867. toString(): string;
  2868. }
  2869. interface Bool16x8Constructor {
  2870. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  2871. prototype: Bool16x8;
  2872. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  2873. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  2874. splat(n: boolean): SIMD.Bool16x8;
  2875. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  2876. allTrue(a: SIMD.Bool16x8): boolean;
  2877. anyTrue(a: SIMD.Bool16x8): boolean;
  2878. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  2879. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  2880. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  2881. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  2882. }
  2883. interface Bool8x16 {
  2884. constructor: Bool8x16Constructor;
  2885. valueOf(): Bool8x16;
  2886. toLocaleString(): string;
  2887. toString(): string;
  2888. }
  2889. interface Bool8x16Constructor {
  2890. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean, s8?: boolean, s9?: boolean, s10?: boolean, s11?: boolean, s12?: boolean, s13?: boolean, s14?: boolean, s15?: boolean): Bool8x16;
  2891. prototype: Bool8x16;
  2892. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  2893. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  2894. splat(n: boolean): SIMD.Bool8x16;
  2895. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  2896. allTrue(a: SIMD.Bool8x16): boolean;
  2897. anyTrue(a: SIMD.Bool8x16): boolean;
  2898. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  2899. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  2900. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  2901. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  2902. }
  2903. }
  2904. export interface EXT_disjoint_timer_query {
  2905. QUERY_COUNTER_BITS_EXT: number;
  2906. TIME_ELAPSED_EXT: number;
  2907. TIMESTAMP_EXT: number;
  2908. GPU_DISJOINT_EXT: number;
  2909. QUERY_RESULT_EXT: number;
  2910. QUERY_RESULT_AVAILABLE_EXT: number;
  2911. queryCounterEXT(query: WebGLQuery, target: number): void;
  2912. createQueryEXT(): WebGLQuery;
  2913. beginQueryEXT(target: number, query: WebGLQuery): void;
  2914. endQueryEXT(target: number): void;
  2915. getQueryObjectEXT(query: WebGLQuery, target: number): any;
  2916. deleteQueryEXT(query: WebGLQuery): void;
  2917. }
  2918. export interface WebGLRenderingContext {
  2919. readonly RASTERIZER_DISCARD: number;
  2920. readonly TEXTURE_3D: number;
  2921. readonly TEXTURE_2D_ARRAY: number;
  2922. readonly TEXTURE_WRAP_R: number;
  2923. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ArrayBufferView | null): void;
  2924. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ArrayBufferView, offset: number): void;
  2925. texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pixels: ImageBitmap | ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;
  2926. compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, data: ArrayBufferView, offset?: number, length?: number): void;
  2927. readonly TRANSFORM_FEEDBACK: number;
  2928. readonly INTERLEAVED_ATTRIBS: number;
  2929. readonly TRANSFORM_FEEDBACK_BUFFER: number;
  2930. createTransformFeedback(): WebGLTransformFeedback;
  2931. deleteTransformFeedback(transformFeedbac: WebGLTransformFeedback): void;
  2932. bindTransformFeedback(target: number, transformFeedback: WebGLTransformFeedback | null): void;
  2933. beginTransformFeedback(primitiveMode: number): void;
  2934. endTransformFeedback(): void;
  2935. transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: number): void;
  2936. }
  2937. export interface ImageBitmap {
  2938. readonly width: number;
  2939. readonly height: number;
  2940. close(): void;
  2941. }
  2942. export interface WebGLQuery extends WebGLObject {
  2943. }
  2944. declare var WebGLQuery: {
  2945. prototype: WebGLQuery;
  2946. new (): WebGLQuery;
  2947. };
  2948. export interface WebGLSampler extends WebGLObject {
  2949. }
  2950. declare var WebGLSampler: {
  2951. prototype: WebGLSampler;
  2952. new (): WebGLSampler;
  2953. };
  2954. export interface WebGLSync extends WebGLObject {
  2955. }
  2956. declare var WebGLSync: {
  2957. prototype: WebGLSync;
  2958. new (): WebGLSync;
  2959. };
  2960. export interface WebGLTransformFeedback extends WebGLObject {
  2961. }
  2962. declare var WebGLTransformFeedback: {
  2963. prototype: WebGLTransformFeedback;
  2964. new (): WebGLTransformFeedback;
  2965. };
  2966. export interface WebGLVertexArrayObject extends WebGLObject {
  2967. }
  2968. declare var WebGLVertexArrayObject: {
  2969. prototype: WebGLVertexArrayObject;
  2970. new (): WebGLVertexArrayObject;
  2971. };
  2972. declare module 'babylonjs/core' {
  2973. function expandToProperty(callback: string, targetKey?: Nullable<string>): (target: any, propertyKey: string) => void;
  2974. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2975. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2976. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2977. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2978. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2979. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2980. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2981. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2982. function serializeAsColor4(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2983. function serializeAsImageProcessingConfiguration(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2984. function serializeAsQuaternion(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  2985. class SerializationHelper {
  2986. static Serialize<T>(entity: T, serializationObject?: any): any;
  2987. static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T;
  2988. static Clone<T>(creationFunction: () => T, source: T): T;
  2989. static Instanciate<T>(creationFunction: () => T, source: T): T;
  2990. }
  2991. }
  2992. declare module 'babylonjs/core' {
  2993. /**
  2994. * A class serves as a medium between the observable and its observers
  2995. */
  2996. class EventState {
  2997. /**
  2998. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  2999. */
  3000. constructor(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any);
  3001. initalize(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any): EventState;
  3002. /**
  3003. * An Observer can set this property to true to prevent subsequent observers of being notified
  3004. */
  3005. skipNextObservers: boolean;
  3006. /**
  3007. * Get the mask value that were used to trigger the event corresponding to this EventState object
  3008. */
  3009. mask: number;
  3010. /**
  3011. * The object that originally notified the event
  3012. */
  3013. target?: any;
  3014. /**
  3015. * The current object in the bubbling phase
  3016. */
  3017. currentTarget?: any;
  3018. }
  3019. /**
  3020. * Represent an Observer registered to a given Observable object.
  3021. */
  3022. class Observer<T> {
  3023. callback: (eventData: T, eventState: EventState) => void;
  3024. mask: number;
  3025. scope: any;
  3026. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number, scope?: any);
  3027. }
  3028. /**
  3029. * Represent a list of observers registered to multiple Observables object.
  3030. */
  3031. class MultiObserver<T> {
  3032. private _observers;
  3033. private _observables;
  3034. dispose(): void;
  3035. static Watch<T>(observables: Observable<T>[], callback: (eventData: T, eventState: EventState) => void, mask?: number, scope?: any): MultiObserver<T>;
  3036. }
  3037. /**
  3038. * The Observable class is a simple implementation of the Observable pattern.
  3039. * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
  3040. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  3041. * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
  3042. * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
  3043. */
  3044. class Observable<T> {
  3045. _observers: Observer<T>[];
  3046. private _eventState;
  3047. private _onObserverAdded;
  3048. constructor(onObserverAdded?: (observer: Observer<T>) => void);
  3049. /**
  3050. * Create a new Observer with the specified callback
  3051. * @param callback the callback that will be executed for that Observer
  3052. * @param mask the mask used to filter observers
  3053. * @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.
  3054. * @param scope optional scope for the callback to be called from
  3055. */
  3056. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean, scope?: any): Nullable<Observer<T>>;
  3057. /**
  3058. * Remove an Observer from the Observable object
  3059. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  3060. */
  3061. remove(observer: Nullable<Observer<T>>): boolean;
  3062. /**
  3063. * Remove a callback from the Observable object
  3064. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  3065. * @param scope optional scope. If used only the callbacks with this scope will be removed.
  3066. */
  3067. removeCallback(callback: (eventData: T, eventState: EventState) => void, scope?: any): boolean;
  3068. /**
  3069. * Notify all Observers by calling their respective callback with the given data
  3070. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  3071. * @param eventData
  3072. * @param mask
  3073. */
  3074. notifyObservers(eventData: T, mask?: number, target?: any, currentTarget?: any): boolean;
  3075. /**
  3076. * Notify a specific observer
  3077. * @param eventData
  3078. * @param mask
  3079. */
  3080. notifyObserver(observer: Observer<T>, eventData: T, mask?: number): void;
  3081. /**
  3082. * return true is the Observable has at least one Observer registered
  3083. */
  3084. hasObservers(): boolean;
  3085. /**
  3086. * Clear the list of observers
  3087. */
  3088. clear(): void;
  3089. /**
  3090. * Clone the current observable
  3091. */
  3092. clone(): Observable<T>;
  3093. /**
  3094. * Does this observable handles observer registered with a given mask
  3095. * @param {number} trigger - the mask to be tested
  3096. * @return {boolean} whether or not one observer registered with the given mask is handeled
  3097. **/
  3098. hasSpecificMask(mask?: number): boolean;
  3099. }
  3100. }
  3101. declare module 'babylonjs/core' {
  3102. class SmartArray<T> {
  3103. data: Array<T>;
  3104. length: number;
  3105. protected _id: number;
  3106. [index: number]: T;
  3107. constructor(capacity: number);
  3108. push(value: T): void;
  3109. forEach(func: (content: T) => void): void;
  3110. sort(compareFn: (a: T, b: T) => number): void;
  3111. reset(): void;
  3112. dispose(): void;
  3113. concat(array: any): void;
  3114. indexOf(value: T): number;
  3115. contains(value: T): boolean;
  3116. private static _GlobalId;
  3117. }
  3118. class SmartArrayNoDuplicate<T> extends SmartArray<T> {
  3119. private _duplicateId;
  3120. [index: number]: T;
  3121. push(value: T): void;
  3122. pushNoDuplicate(value: T): boolean;
  3123. reset(): void;
  3124. concatWithNoDuplicate(array: any): void;
  3125. }
  3126. }
  3127. declare module 'babylonjs/core' {
  3128. interface IAnimatable {
  3129. animations: Array<Animation>;
  3130. }
  3131. class LoadFileError extends Error {
  3132. request: XMLHttpRequest | undefined;
  3133. private static _setPrototypeOf;
  3134. constructor(message: string, request?: XMLHttpRequest | undefined);
  3135. }
  3136. class RetryStrategy {
  3137. static ExponentialBackoff(maxRetries?: number, baseInterval?: number): (url: string, request: XMLHttpRequest, retryIndex: number) => number;
  3138. }
  3139. interface IFileRequest {
  3140. /**
  3141. * Raised when the request is complete (success or error).
  3142. */
  3143. onCompleteObservable: Observable<IFileRequest>;
  3144. /**
  3145. * Aborts the request for a file.
  3146. */
  3147. abort: () => void;
  3148. }
  3149. class Tools {
  3150. static BaseUrl: string;
  3151. static DefaultRetryStrategy: (url: string, request: XMLHttpRequest, retryIndex: number) => number;
  3152. /**
  3153. * Default behaviour for cors in the application.
  3154. * It can be a string if the expected behavior is identical in the entire app.
  3155. * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)
  3156. */
  3157. static CorsBehavior: string | ((url: string | string[]) => string);
  3158. static UseFallbackTexture: boolean;
  3159. /**
  3160. * Use this object to register external classes like custom textures or material
  3161. * to allow the laoders to instantiate them
  3162. */
  3163. static RegisteredExternalClasses: {
  3164. [key: string]: Object;
  3165. };
  3166. static fallbackTexture: string;
  3167. /**
  3168. * Interpolates between a and b via alpha
  3169. * @param a The lower value (returned when alpha = 0)
  3170. * @param b The upper value (returned when alpha = 1)
  3171. * @param alpha The interpolation-factor
  3172. * @return The mixed value
  3173. */
  3174. static Mix(a: number, b: number, alpha: number): number;
  3175. static Instantiate(className: string): any;
  3176. static SetImmediate(action: () => void): void;
  3177. static IsExponentOfTwo(value: number): boolean;
  3178. /**
  3179. * Find the next highest power of two.
  3180. * @param x Number to start search from.
  3181. * @return Next highest power of two.
  3182. */
  3183. static CeilingPOT(x: number): number;
  3184. /**
  3185. * Find the next lowest power of two.
  3186. * @param x Number to start search from.
  3187. * @return Next lowest power of two.
  3188. */
  3189. static FloorPOT(x: number): number;
  3190. /**
  3191. * Find the nearest power of two.
  3192. * @param x Number to start search from.
  3193. * @return Next nearest power of two.
  3194. */
  3195. static NearestPOT(x: number): number;
  3196. static GetExponentOfTwo(value: number, max: number, mode?: number): number;
  3197. static GetFilename(path: string): string;
  3198. static GetFolderPath(uri: string): string;
  3199. static GetDOMTextContent(element: HTMLElement): string;
  3200. static ToDegrees(angle: number): number;
  3201. static ToRadians(angle: number): number;
  3202. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  3203. static ExtractMinAndMaxIndexed(positions: FloatArray, indices: IndicesArray, indexStart: number, indexCount: number, bias?: Nullable<Vector2>): {
  3204. minimum: Vector3;
  3205. maximum: Vector3;
  3206. };
  3207. static ExtractMinAndMax(positions: FloatArray, start: number, count: number, bias?: Nullable<Vector2>, stride?: number): {
  3208. minimum: Vector3;
  3209. maximum: Vector3;
  3210. };
  3211. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i: number) => Nullable<Vector2>;
  3212. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Nullable<Vector2>): {
  3213. minimum: Vector2;
  3214. maximum: Vector2;
  3215. };
  3216. static MakeArray(obj: any, allowsNullUndefined?: boolean): Nullable<Array<any>>;
  3217. static GetPointerPrefix(): string;
  3218. /**
  3219. * @param func - the function to be called
  3220. * @param requester - the object that will request the next frame. Falls back to window.
  3221. */
  3222. static QueueNewFrame(func: () => void, requester?: any): number;
  3223. static RequestFullscreen(element: HTMLElement): void;
  3224. static ExitFullscreen(): void;
  3225. static SetCorsBehavior(url: string | string[], element: {
  3226. crossOrigin: string | null;
  3227. }): void;
  3228. static CleanUrl(url: string): string;
  3229. static PreprocessUrl: (url: string) => string;
  3230. static LoadImage(url: any, onLoad: (img: HTMLImageElement) => void, onError: (message?: string, exception?: any) => void, database: Nullable<Database>): HTMLImageElement;
  3231. static LoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, database?: Database, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
  3232. /**
  3233. * Load a script (identified by an url). When the url returns, the
  3234. * content of this file is added into a new script element, attached to the DOM (body element)
  3235. */
  3236. static LoadScript(scriptUrl: string, onSuccess: () => void, onError?: (message?: string, exception?: any) => void): void;
  3237. static ReadFileAsDataURL(fileToLoad: Blob, callback: (data: any) => void, progressCallback: (this: MSBaseReader, ev: ProgressEvent) => any): IFileRequest;
  3238. static ReadFile(fileToLoad: File, callback: (data: any) => void, progressCallBack?: (this: MSBaseReader, ev: ProgressEvent) => any, useArrayBuffer?: boolean): IFileRequest;
  3239. static FileAsURL(content: string): string;
  3240. static Format(value: number, decimals?: number): string;
  3241. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  3242. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  3243. static IsEmpty(obj: any): boolean;
  3244. static RegisterTopRootEvents(events: {
  3245. name: string;
  3246. handler: Nullable<(e: FocusEvent) => any>;
  3247. }[]): void;
  3248. static UnregisterTopRootEvents(events: {
  3249. name: string;
  3250. handler: Nullable<(e: FocusEvent) => any>;
  3251. }[]): void;
  3252. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string, fileName?: string): void;
  3253. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string, fileName?: string): void;
  3254. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  3255. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string): void;
  3256. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  3257. /**
  3258. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  3259. * Be aware Math.random() could cause collisions, but:
  3260. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  3261. */
  3262. static RandomId(): string;
  3263. private static _NoneLogLevel;
  3264. private static _MessageLogLevel;
  3265. private static _WarningLogLevel;
  3266. private static _ErrorLogLevel;
  3267. private static _LogCache;
  3268. static errorsCount: number;
  3269. static OnNewCacheEntry: (entry: string) => void;
  3270. static readonly NoneLogLevel: number;
  3271. static readonly MessageLogLevel: number;
  3272. static readonly WarningLogLevel: number;
  3273. static readonly ErrorLogLevel: number;
  3274. static readonly AllLogLevel: number;
  3275. private static _AddLogEntry(entry);
  3276. private static _FormatMessage(message);
  3277. private static _LogDisabled(message);
  3278. private static _LogEnabled(message);
  3279. private static _WarnDisabled(message);
  3280. private static _WarnEnabled(message);
  3281. private static _ErrorDisabled(message);
  3282. private static _ErrorEnabled(message);
  3283. static Log: (message: string) => void;
  3284. static Warn: (message: string) => void;
  3285. static Error: (message: string) => void;
  3286. static readonly LogCache: string;
  3287. static ClearLogCache(): void;
  3288. static LogLevels: number;
  3289. static IsWindowObjectExist(): boolean;
  3290. private static _PerformanceNoneLogLevel;
  3291. private static _PerformanceUserMarkLogLevel;
  3292. private static _PerformanceConsoleLogLevel;
  3293. private static _performance;
  3294. static readonly PerformanceNoneLogLevel: number;
  3295. static readonly PerformanceUserMarkLogLevel: number;
  3296. static readonly PerformanceConsoleLogLevel: number;
  3297. static PerformanceLogLevel: number;
  3298. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  3299. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  3300. static _StartUserMark(counterName: string, condition?: boolean): void;
  3301. static _EndUserMark(counterName: string, condition?: boolean): void;
  3302. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  3303. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  3304. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  3305. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  3306. static readonly Now: number;
  3307. /**
  3308. * This method will return the name of the class used to create the instance of the given object.
  3309. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  3310. * @param object the object to get the class name from
  3311. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  3312. */
  3313. static GetClassName(object: any, isType?: boolean): string;
  3314. static First<T>(array: Array<T>, predicate: (item: T) => boolean): Nullable<T>;
  3315. /**
  3316. * This method will return the name of the full name of the class, including its owning module (if any).
  3317. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).
  3318. * @param object the object to get the class name from
  3319. * @return a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.
  3320. */
  3321. static getFullClassName(object: any, isType?: boolean): Nullable<string>;
  3322. /**
  3323. * This method can be used with hashCodeFromStream when your input is an array of values that are either: number, string, boolean or custom type implementing the getHashCode():number method.
  3324. * @param array
  3325. */
  3326. static arrayOrStringFeeder(array: any): (i: number) => number;
  3327. /**
  3328. * Compute the hashCode of a stream of number
  3329. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  3330. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  3331. * @return the hash code computed
  3332. */
  3333. static hashCodeFromStream(feeder: (index: number) => number): number;
  3334. }
  3335. /**
  3336. * This class is used to track a performance counter which is number based.
  3337. * The user has access to many properties which give statistics of different nature
  3338. *
  3339. * The implementer can track two kinds of Performance Counter: time and count
  3340. * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
  3341. * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
  3342. */
  3343. class PerfCounter {
  3344. static Enabled: boolean;
  3345. /**
  3346. * Returns the smallest value ever
  3347. */
  3348. readonly min: number;
  3349. /**
  3350. * Returns the biggest value ever
  3351. */
  3352. readonly max: number;
  3353. /**
  3354. * Returns the average value since the performance counter is running
  3355. */
  3356. readonly average: number;
  3357. /**
  3358. * Returns the average value of the last second the counter was monitored
  3359. */
  3360. readonly lastSecAverage: number;
  3361. /**
  3362. * Returns the current value
  3363. */
  3364. readonly current: number;
  3365. readonly total: number;
  3366. readonly count: number;
  3367. constructor();
  3368. /**
  3369. * Call this method to start monitoring a new frame.
  3370. * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
  3371. */
  3372. fetchNewFrame(): void;
  3373. /**
  3374. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  3375. * @param newCount the count value to add to the monitored count
  3376. * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
  3377. */
  3378. addCount(newCount: number, fetchResult: boolean): void;
  3379. /**
  3380. * Start monitoring this performance counter
  3381. */
  3382. beginMonitoring(): void;
  3383. /**
  3384. * Compute the time lapsed since the previous beginMonitoring() call.
  3385. * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
  3386. */
  3387. endMonitoring(newFrame?: boolean): void;
  3388. private _fetchResult();
  3389. private _startMonitoringTime;
  3390. private _min;
  3391. private _max;
  3392. private _average;
  3393. private _current;
  3394. private _totalValueCount;
  3395. private _totalAccumulated;
  3396. private _lastSecAverage;
  3397. private _lastSecAccumulated;
  3398. private _lastSecTime;
  3399. private _lastSecValueCount;
  3400. }
  3401. /**
  3402. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  3403. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  3404. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  3405. * @param name The name of the class, case should be preserved
  3406. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  3407. */
  3408. function className(name: string, module?: string): (target: Object) => void;
  3409. /**
  3410. * An implementation of a loop for asynchronous functions.
  3411. */
  3412. class AsyncLoop {
  3413. iterations: number;
  3414. private _fn;
  3415. private _successCallback;
  3416. index: number;
  3417. private _done;
  3418. /**
  3419. * Constroctor.
  3420. * @param iterations the number of iterations.
  3421. * @param _fn the function to run each iteration
  3422. * @param _successCallback the callback that will be called upon succesful execution
  3423. * @param offset starting offset.
  3424. */
  3425. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  3426. /**
  3427. * Execute the next iteration. Must be called after the last iteration was finished.
  3428. */
  3429. executeNext(): void;
  3430. /**
  3431. * Break the loop and run the success callback.
  3432. */
  3433. breakLoop(): void;
  3434. /**
  3435. * Helper function
  3436. */
  3437. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  3438. /**
  3439. * A for-loop that will run a given number of iterations synchronous and the rest async.
  3440. * @param iterations total number of iterations
  3441. * @param syncedIterations number of synchronous iterations in each async iteration.
  3442. * @param fn the function to call each iteration.
  3443. * @param callback a success call back that will be called when iterating stops.
  3444. * @param breakFunction a break condition (optional)
  3445. * @param timeout timeout settings for the setTimeout function. default - 0.
  3446. * @constructor
  3447. */
  3448. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  3449. }
  3450. }
  3451. declare module 'babylonjs/core' {
  3452. class _AlphaState {
  3453. private _isAlphaBlendDirty;
  3454. private _isBlendFunctionParametersDirty;
  3455. private _isBlendEquationParametersDirty;
  3456. private _isBlendConstantsDirty;
  3457. private _alphaBlend;
  3458. private _blendFunctionParameters;
  3459. private _blendEquationParameters;
  3460. private _blendConstants;
  3461. /**
  3462. * Initializes the state.
  3463. */
  3464. constructor();
  3465. readonly isDirty: boolean;
  3466. alphaBlend: boolean;
  3467. setAlphaBlendConstants(r: number, g: number, b: number, a: number): void;
  3468. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  3469. setAlphaEquationParameters(rgb: number, alpha: number): void;
  3470. reset(): void;
  3471. apply(gl: WebGLRenderingContext): void;
  3472. }
  3473. }
  3474. declare module 'babylonjs/core' {
  3475. class _DepthCullingState {
  3476. private _isDepthTestDirty;
  3477. private _isDepthMaskDirty;
  3478. private _isDepthFuncDirty;
  3479. private _isCullFaceDirty;
  3480. private _isCullDirty;
  3481. private _isZOffsetDirty;
  3482. private _isFrontFaceDirty;
  3483. private _depthTest;
  3484. private _depthMask;
  3485. private _depthFunc;
  3486. private _cull;
  3487. private _cullFace;
  3488. private _zOffset;
  3489. private _frontFace;
  3490. /**
  3491. * Initializes the state.
  3492. */
  3493. constructor();
  3494. readonly isDirty: boolean;
  3495. zOffset: number;
  3496. cullFace: Nullable<number>;
  3497. cull: Nullable<boolean>;
  3498. depthFunc: Nullable<number>;
  3499. depthMask: boolean;
  3500. depthTest: boolean;
  3501. frontFace: Nullable<number>;
  3502. reset(): void;
  3503. apply(gl: WebGLRenderingContext): void;
  3504. }
  3505. }
  3506. declare module 'babylonjs/core' {
  3507. class _StencilState {
  3508. private _isStencilTestDirty;
  3509. private _isStencilMaskDirty;
  3510. private _isStencilFuncDirty;
  3511. private _isStencilOpDirty;
  3512. private _stencilTest;
  3513. private _stencilMask;
  3514. private _stencilFunc;
  3515. private _stencilFuncRef;
  3516. private _stencilFuncMask;
  3517. private _stencilOpStencilFail;
  3518. private _stencilOpDepthFail;
  3519. private _stencilOpStencilDepthPass;
  3520. readonly isDirty: boolean;
  3521. stencilFunc: number;
  3522. stencilFuncRef: number;
  3523. stencilFuncMask: number;
  3524. stencilOpStencilFail: number;
  3525. stencilOpDepthFail: number;
  3526. stencilOpStencilDepthPass: number;
  3527. stencilMask: number;
  3528. stencilTest: boolean;
  3529. constructor();
  3530. reset(): void;
  3531. apply(gl: WebGLRenderingContext): void;
  3532. }
  3533. }
  3534. declare module 'babylonjs/core' {
  3535. class InstancingAttributeInfo {
  3536. /**
  3537. * Index/offset of the attribute in the vertex shader
  3538. */
  3539. index: number;
  3540. /**
  3541. * size of the attribute, 1, 2, 3 or 4
  3542. */
  3543. attributeSize: number;
  3544. /**
  3545. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  3546. * default is FLOAT
  3547. */
  3548. attribyteType: number;
  3549. /**
  3550. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  3551. */
  3552. normalized: boolean;
  3553. /**
  3554. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  3555. */
  3556. offset: number;
  3557. /**
  3558. * Name of the GLSL attribute, for debugging purpose only
  3559. */
  3560. attributeName: string;
  3561. }
  3562. /**
  3563. * Define options used to create a render target texture
  3564. */
  3565. class RenderTargetCreationOptions {
  3566. generateMipMaps?: boolean;
  3567. generateDepthBuffer?: boolean;
  3568. generateStencilBuffer?: boolean;
  3569. type?: number;
  3570. samplingMode?: number;
  3571. }
  3572. /**
  3573. * Regroup several parameters relative to the browser in use
  3574. */
  3575. class EngineCapabilities {
  3576. /** The maximum textures image */
  3577. maxTexturesImageUnits: number;
  3578. maxVertexTextureImageUnits: number;
  3579. maxCombinedTexturesImageUnits: number;
  3580. /** The maximum texture size */
  3581. maxTextureSize: number;
  3582. maxCubemapTextureSize: number;
  3583. maxRenderTextureSize: number;
  3584. maxVertexAttribs: number;
  3585. maxVaryingVectors: number;
  3586. maxVertexUniformVectors: number;
  3587. maxFragmentUniformVectors: number;
  3588. standardDerivatives: boolean;
  3589. s3tc: Nullable<WEBGL_compressed_texture_s3tc>;
  3590. pvrtc: any;
  3591. etc1: any;
  3592. etc2: any;
  3593. astc: any;
  3594. textureFloat: boolean;
  3595. vertexArrayObject: boolean;
  3596. textureAnisotropicFilterExtension: Nullable<EXT_texture_filter_anisotropic>;
  3597. maxAnisotropy: number;
  3598. instancedArrays: boolean;
  3599. uintIndices: boolean;
  3600. highPrecisionShaderSupported: boolean;
  3601. fragmentDepthSupported: boolean;
  3602. textureFloatLinearFiltering: boolean;
  3603. textureFloatRender: boolean;
  3604. textureHalfFloat: boolean;
  3605. textureHalfFloatLinearFiltering: boolean;
  3606. textureHalfFloatRender: boolean;
  3607. textureLOD: boolean;
  3608. drawBuffersExtension: boolean;
  3609. depthTextureExtension: boolean;
  3610. colorBufferFloat: boolean;
  3611. timerQuery: EXT_disjoint_timer_query;
  3612. canUseTimestampForTimerQuery: boolean;
  3613. }
  3614. interface EngineOptions extends WebGLContextAttributes {
  3615. limitDeviceRatio?: number;
  3616. autoEnableWebVR?: boolean;
  3617. disableWebGL2Support?: boolean;
  3618. audioEngine?: boolean;
  3619. deterministicLockstep?: boolean;
  3620. lockstepMaxSteps?: number;
  3621. doNotHandleContextLost?: boolean;
  3622. }
  3623. interface IDisplayChangedEventArgs {
  3624. vrDisplay: any;
  3625. vrSupported: boolean;
  3626. }
  3627. /**
  3628. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  3629. */
  3630. class Engine {
  3631. /** Use this array to turn off some WebGL2 features on known buggy browsers version */
  3632. static ExceptionList: ({
  3633. key: string;
  3634. capture: string;
  3635. captureConstraint: number;
  3636. targets: string[];
  3637. } | {
  3638. key: string;
  3639. capture: null;
  3640. captureConstraint: null;
  3641. targets: string[];
  3642. })[];
  3643. static Instances: Engine[];
  3644. static readonly LastCreatedEngine: Nullable<Engine>;
  3645. static readonly LastCreatedScene: Nullable<Scene>;
  3646. /**
  3647. * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation
  3648. */
  3649. static MarkAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  3650. private static _ALPHA_DISABLE;
  3651. private static _ALPHA_ADD;
  3652. private static _ALPHA_COMBINE;
  3653. private static _ALPHA_SUBTRACT;
  3654. private static _ALPHA_MULTIPLY;
  3655. private static _ALPHA_MAXIMIZED;
  3656. private static _ALPHA_ONEONE;
  3657. private static _ALPHA_PREMULTIPLIED;
  3658. private static _ALPHA_PREMULTIPLIED_PORTERDUFF;
  3659. private static _ALPHA_INTERPOLATE;
  3660. private static _ALPHA_SCREENMODE;
  3661. private static _DELAYLOADSTATE_NONE;
  3662. private static _DELAYLOADSTATE_LOADED;
  3663. private static _DELAYLOADSTATE_LOADING;
  3664. private static _DELAYLOADSTATE_NOTLOADED;
  3665. private static _TEXTUREFORMAT_ALPHA;
  3666. private static _TEXTUREFORMAT_LUMINANCE;
  3667. private static _TEXTUREFORMAT_LUMINANCE_ALPHA;
  3668. private static _TEXTUREFORMAT_RGB;
  3669. private static _TEXTUREFORMAT_RGBA;
  3670. private static _TEXTURETYPE_UNSIGNED_INT;
  3671. private static _TEXTURETYPE_FLOAT;
  3672. private static _TEXTURETYPE_HALF_FLOAT;
  3673. private static _NEVER;
  3674. private static _ALWAYS;
  3675. private static _LESS;
  3676. private static _EQUAL;
  3677. private static _LEQUAL;
  3678. private static _GREATER;
  3679. private static _GEQUAL;
  3680. private static _NOTEQUAL;
  3681. static readonly NEVER: number;
  3682. static readonly ALWAYS: number;
  3683. static readonly LESS: number;
  3684. static readonly EQUAL: number;
  3685. static readonly LEQUAL: number;
  3686. static readonly GREATER: number;
  3687. static readonly GEQUAL: number;
  3688. static readonly NOTEQUAL: number;
  3689. private static _KEEP;
  3690. private static _REPLACE;
  3691. private static _INCR;
  3692. private static _DECR;
  3693. private static _INVERT;
  3694. private static _INCR_WRAP;
  3695. private static _DECR_WRAP;
  3696. static readonly KEEP: number;
  3697. static readonly REPLACE: number;
  3698. static readonly INCR: number;
  3699. static readonly DECR: number;
  3700. static readonly INVERT: number;
  3701. static readonly INCR_WRAP: number;
  3702. static readonly DECR_WRAP: number;
  3703. static readonly ALPHA_DISABLE: number;
  3704. static readonly ALPHA_ONEONE: number;
  3705. static readonly ALPHA_ADD: number;
  3706. static readonly ALPHA_COMBINE: number;
  3707. static readonly ALPHA_SUBTRACT: number;
  3708. static readonly ALPHA_MULTIPLY: number;
  3709. static readonly ALPHA_MAXIMIZED: number;
  3710. static readonly ALPHA_PREMULTIPLIED: number;
  3711. static readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;
  3712. static readonly ALPHA_INTERPOLATE: number;
  3713. static readonly ALPHA_SCREENMODE: number;
  3714. static readonly DELAYLOADSTATE_NONE: number;
  3715. static readonly DELAYLOADSTATE_LOADED: number;
  3716. static readonly DELAYLOADSTATE_LOADING: number;
  3717. static readonly DELAYLOADSTATE_NOTLOADED: number;
  3718. static readonly TEXTUREFORMAT_ALPHA: number;
  3719. static readonly TEXTUREFORMAT_LUMINANCE: number;
  3720. static readonly TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  3721. static readonly TEXTUREFORMAT_RGB: number;
  3722. static readonly TEXTUREFORMAT_RGBA: number;
  3723. static readonly TEXTURETYPE_UNSIGNED_INT: number;
  3724. static readonly TEXTURETYPE_FLOAT: number;
  3725. static readonly TEXTURETYPE_HALF_FLOAT: number;
  3726. private static _SCALEMODE_FLOOR;
  3727. private static _SCALEMODE_NEAREST;
  3728. private static _SCALEMODE_CEILING;
  3729. static readonly SCALEMODE_FLOOR: number;
  3730. static readonly SCALEMODE_NEAREST: number;
  3731. static readonly SCALEMODE_CEILING: number;
  3732. static readonly Version: string;
  3733. static CollisionsEpsilon: number;
  3734. static CodeRepository: string;
  3735. static ShadersRepository: string;
  3736. forcePOTTextures: boolean;
  3737. isFullscreen: boolean;
  3738. isPointerLock: boolean;
  3739. cullBackFaces: boolean;
  3740. renderEvenInBackground: boolean;
  3741. preventCacheWipeBetweenFrames: boolean;
  3742. enableOfflineSupport: boolean;
  3743. scenes: Scene[];
  3744. postProcesses: PostProcess[];
  3745. /**
  3746. * Observable event triggered each time the rendering canvas is resized
  3747. */
  3748. onResizeObservable: Observable<Engine>;
  3749. /**
  3750. * Observable event triggered each time the canvas loses focus
  3751. */
  3752. onCanvasBlurObservable: Observable<Engine>;
  3753. /**
  3754. * Observable event triggered each time the canvas gains focus
  3755. */
  3756. onCanvasFocusObservable: Observable<Engine>;
  3757. /**
  3758. * Observable event triggered each time the canvas receives pointerout event
  3759. */
  3760. onCanvasPointerOutObservable: Observable<Engine>;
  3761. /**
  3762. * Observable event triggered before each texture is initialized
  3763. */
  3764. onBeforeTextureInitObservable: Observable<Texture>;
  3765. private _vrDisplay;
  3766. private _vrSupported;
  3767. private _oldSize;
  3768. private _oldHardwareScaleFactor;
  3769. private _vrExclusivePointerMode;
  3770. readonly isInVRExclusivePointerMode: boolean;
  3771. disableUniformBuffers: boolean;
  3772. _uniformBuffers: UniformBuffer[];
  3773. readonly supportsUniformBuffers: boolean;
  3774. /**
  3775. * Observable raised when the engine begins a new frame
  3776. */
  3777. onBeginFrameObservable: Observable<Engine>;
  3778. /**
  3779. * Observable raised when the engine ends the current frame
  3780. */
  3781. onEndFrameObservable: Observable<Engine>;
  3782. /**
  3783. * Observable raised when the engine is about to compile a shader
  3784. */
  3785. onBeforeShaderCompilationObservable: Observable<Engine>;
  3786. /**
  3787. * Observable raised when the engine has jsut compiled a shader
  3788. */
  3789. onAfterShaderCompilationObservable: Observable<Engine>;
  3790. private _gl;
  3791. private _renderingCanvas;
  3792. private _windowIsBackground;
  3793. private _webGLVersion;
  3794. readonly needPOTTextures: boolean;
  3795. private _badOS;
  3796. readonly badOS: boolean;
  3797. private _badDesktopOS;
  3798. readonly badDesktopOS: boolean;
  3799. static audioEngine: AudioEngine;
  3800. private _onFocus;
  3801. private _onBlur;
  3802. private _onCanvasPointerOut;
  3803. private _onCanvasBlur;
  3804. private _onCanvasFocus;
  3805. private _onFullscreenChange;
  3806. private _onPointerLockChange;
  3807. private _onVRDisplayPointerRestricted;
  3808. private _onVRDisplayPointerUnrestricted;
  3809. private _onVrDisplayConnect;
  3810. private _onVrDisplayDisconnect;
  3811. private _onVrDisplayPresentChange;
  3812. onVRDisplayChangedObservable: Observable<IDisplayChangedEventArgs>;
  3813. onVRRequestPresentComplete: Observable<boolean>;
  3814. onVRRequestPresentStart: Observable<Engine>;
  3815. private _hardwareScalingLevel;
  3816. protected _caps: EngineCapabilities;
  3817. private _pointerLockRequested;
  3818. private _alphaTest;
  3819. private _isStencilEnable;
  3820. private _colorWrite;
  3821. private _loadingScreen;
  3822. _drawCalls: PerfCounter;
  3823. _textureCollisions: PerfCounter;
  3824. private _glVersion;
  3825. private _glRenderer;
  3826. private _glVendor;
  3827. private _videoTextureSupported;
  3828. private _renderingQueueLaunched;
  3829. private _activeRenderLoops;
  3830. private _deterministicLockstep;
  3831. private _lockstepMaxSteps;
  3832. onContextLostObservable: Observable<Engine>;
  3833. onContextRestoredObservable: Observable<Engine>;
  3834. private _onContextLost;
  3835. private _onContextRestored;
  3836. private _contextWasLost;
  3837. private _doNotHandleContextLost;
  3838. private _performanceMonitor;
  3839. private _fps;
  3840. private _deltaTime;
  3841. /**
  3842. * Turn this value on if you want to pause FPS computation when in background
  3843. */
  3844. disablePerformanceMonitorInBackground: boolean;
  3845. readonly performanceMonitor: PerformanceMonitor;
  3846. protected _depthCullingState: _DepthCullingState;
  3847. protected _stencilState: _StencilState;
  3848. protected _alphaState: _AlphaState;
  3849. protected _alphaMode: number;
  3850. private _internalTexturesCache;
  3851. protected _activeChannel: number;
  3852. protected _boundTexturesCache: {
  3853. [key: string]: Nullable<InternalTexture>;
  3854. };
  3855. protected _boundTexturesStack: InternalTexture[];
  3856. protected _currentEffect: Nullable<Effect>;
  3857. protected _currentProgram: Nullable<WebGLProgram>;
  3858. private _compiledEffects;
  3859. private _vertexAttribArraysEnabled;
  3860. protected _cachedViewport: Nullable<Viewport>;
  3861. private _cachedVertexArrayObject;
  3862. protected _cachedVertexBuffers: any;
  3863. protected _cachedIndexBuffer: Nullable<WebGLBuffer>;
  3864. protected _cachedEffectForVertexBuffers: Nullable<Effect>;
  3865. protected _currentRenderTarget: Nullable<InternalTexture>;
  3866. private _uintIndicesCurrentlySet;
  3867. private _currentBoundBuffer;
  3868. protected _currentFramebuffer: Nullable<WebGLFramebuffer>;
  3869. private _currentBufferPointers;
  3870. private _currentInstanceLocations;
  3871. private _currentInstanceBuffers;
  3872. private _textureUnits;
  3873. private _workingCanvas;
  3874. private _workingContext;
  3875. private _rescalePostProcess;
  3876. private _dummyFramebuffer;
  3877. private _externalData;
  3878. private _bindedRenderFunction;
  3879. private _vaoRecordInProgress;
  3880. private _mustWipeVertexAttributes;
  3881. private _emptyTexture;
  3882. private _emptyCubeTexture;
  3883. private _emptyTexture3D;
  3884. private _frameHandler;
  3885. private _nextFreeTextureSlots;
  3886. private _activeRequests;
  3887. private _texturesSupported;
  3888. private _textureFormatInUse;
  3889. readonly texturesSupported: Array<string>;
  3890. readonly textureFormatInUse: Nullable<string>;
  3891. readonly currentViewport: Nullable<Viewport>;
  3892. readonly emptyTexture: InternalTexture;
  3893. readonly emptyTexture3D: InternalTexture;
  3894. readonly emptyCubeTexture: InternalTexture;
  3895. /**
  3896. * @constructor
  3897. * @param {HTMLCanvasElement | WebGLRenderingContext} canvasOrContext - the canvas or the webgl context to be used for rendering
  3898. * @param {boolean} [antialias] - enable antialias
  3899. * @param options - further options to be sent to the getContext function
  3900. */
  3901. constructor(canvasOrContext: Nullable<HTMLCanvasElement | WebGLRenderingContext>, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  3902. private _rebuildInternalTextures();
  3903. private _rebuildEffects();
  3904. private _rebuildBuffers();
  3905. private _initGLContext();
  3906. readonly webGLVersion: number;
  3907. /**
  3908. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  3909. */
  3910. readonly isStencilEnable: boolean;
  3911. private _prepareWorkingCanvas();
  3912. resetTextureCache(): void;
  3913. isDeterministicLockStep(): boolean;
  3914. getLockstepMaxSteps(): number;
  3915. getGlInfo(): {
  3916. vendor: string;
  3917. renderer: string;
  3918. version: string;
  3919. };
  3920. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  3921. getRenderWidth(useScreen?: boolean): number;
  3922. getRenderHeight(useScreen?: boolean): number;
  3923. getRenderingCanvas(): Nullable<HTMLCanvasElement>;
  3924. getRenderingCanvasClientRect(): Nullable<ClientRect>;
  3925. setHardwareScalingLevel(level: number): void;
  3926. getHardwareScalingLevel(): number;
  3927. getLoadedTexturesCache(): InternalTexture[];
  3928. getCaps(): EngineCapabilities;
  3929. /** The number of draw calls submitted last frame */
  3930. readonly drawCalls: number;
  3931. readonly drawCallsPerfCounter: Nullable<PerfCounter>;
  3932. getDepthFunction(): Nullable<number>;
  3933. setDepthFunction(depthFunc: number): void;
  3934. setDepthFunctionToGreater(): void;
  3935. setDepthFunctionToGreaterOrEqual(): void;
  3936. setDepthFunctionToLess(): void;
  3937. setDepthFunctionToLessOrEqual(): void;
  3938. getStencilBuffer(): boolean;
  3939. setStencilBuffer(enable: boolean): void;
  3940. getStencilMask(): number;
  3941. setStencilMask(mask: number): void;
  3942. getStencilFunction(): number;
  3943. getStencilFunctionReference(): number;
  3944. getStencilFunctionMask(): number;
  3945. setStencilFunction(stencilFunc: number): void;
  3946. setStencilFunctionReference(reference: number): void;
  3947. setStencilFunctionMask(mask: number): void;
  3948. getStencilOperationFail(): number;
  3949. getStencilOperationDepthFail(): number;
  3950. getStencilOperationPass(): number;
  3951. setStencilOperationFail(operation: number): void;
  3952. setStencilOperationDepthFail(operation: number): void;
  3953. setStencilOperationPass(operation: number): void;
  3954. setDitheringState(value: boolean): void;
  3955. setRasterizerState(value: boolean): void;
  3956. /**
  3957. * stop executing a render loop function and remove it from the execution array
  3958. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  3959. */
  3960. stopRenderLoop(renderFunction?: () => void): void;
  3961. _renderLoop(): void;
  3962. /**
  3963. * Register and execute a render loop. The engine can have more than one render function.
  3964. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  3965. * @example
  3966. * engine.runRenderLoop(function () {
  3967. * scene.render()
  3968. * })
  3969. */
  3970. runRenderLoop(renderFunction: () => void): void;
  3971. /**
  3972. * Toggle full screen mode.
  3973. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  3974. * @param {any} options - an options object to be sent to the requestFullscreen function
  3975. */
  3976. switchFullscreen(requestPointerLock: boolean): void;
  3977. clear(color: Nullable<Color4>, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  3978. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  3979. /**
  3980. * Set the WebGL's viewport
  3981. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  3982. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  3983. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  3984. */
  3985. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  3986. /**
  3987. * Directly set the WebGL Viewport
  3988. * The x, y, width & height are directly passed to the WebGL call
  3989. * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state.
  3990. */
  3991. setDirectViewport(x: number, y: number, width: number, height: number): Nullable<Viewport>;
  3992. beginFrame(): void;
  3993. endFrame(): void;
  3994. /**
  3995. * resize the view according to the canvas' size.
  3996. * @example
  3997. * window.addEventListener("resize", function () {
  3998. * engine.resize();
  3999. * });
  4000. */
  4001. resize(): void;
  4002. /**
  4003. * force a specific size of the canvas
  4004. * @param {number} width - the new canvas' width
  4005. * @param {number} height - the new canvas' height
  4006. */
  4007. setSize(width: number, height: number): void;
  4008. isVRDevicePresent(): boolean;
  4009. getVRDevice(): any;
  4010. initWebVR(): Observable<{
  4011. vrDisplay: any;
  4012. vrSupported: any;
  4013. }>;
  4014. enableVR(): void;
  4015. disableVR(): void;
  4016. private _onVRFullScreenTriggered;
  4017. private _getVRDisplays(callback);
  4018. bindFramebuffer(texture: InternalTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void;
  4019. private bindUnboundFramebuffer(framebuffer);
  4020. unBindFramebuffer(texture: InternalTexture, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  4021. unBindMultiColorAttachmentFramebuffer(textures: InternalTexture[], disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  4022. generateMipMapsForCubemap(texture: InternalTexture): void;
  4023. flushFramebuffer(): void;
  4024. restoreDefaultFramebuffer(): void;
  4025. createUniformBuffer(elements: FloatArray): WebGLBuffer;
  4026. createDynamicUniformBuffer(elements: FloatArray): WebGLBuffer;
  4027. updateUniformBuffer(uniformBuffer: WebGLBuffer, elements: FloatArray, offset?: number, count?: number): void;
  4028. private _resetVertexBufferBinding();
  4029. createVertexBuffer(vertices: FloatArray): WebGLBuffer;
  4030. createDynamicVertexBuffer(vertices: FloatArray): WebGLBuffer;
  4031. updateDynamicIndexBuffer(indexBuffer: WebGLBuffer, indices: IndicesArray, offset?: number): void;
  4032. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: FloatArray, offset?: number, count?: number): void;
  4033. private _resetIndexBufferBinding();
  4034. createIndexBuffer(indices: IndicesArray, updatable?: boolean): WebGLBuffer;
  4035. bindArrayBuffer(buffer: Nullable<WebGLBuffer>): void;
  4036. bindUniformBuffer(buffer: Nullable<WebGLBuffer>): void;
  4037. bindUniformBufferBase(buffer: WebGLBuffer, location: number): void;
  4038. bindUniformBlock(shaderProgram: WebGLProgram, blockName: string, index: number): void;
  4039. private bindIndexBuffer(buffer);
  4040. private bindBuffer(buffer, target);
  4041. updateArrayBuffer(data: Float32Array): void;
  4042. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  4043. private _bindIndexBufferWithCache(indexBuffer);
  4044. private _bindVertexBuffersAttributes(vertexBuffers, effect);
  4045. recordVertexArrayObject(vertexBuffers: {
  4046. [key: string]: VertexBuffer;
  4047. }, indexBuffer: Nullable<WebGLBuffer>, effect: Effect): WebGLVertexArrayObject;
  4048. bindVertexArrayObject(vertexArrayObject: WebGLVertexArrayObject, indexBuffer: Nullable<WebGLBuffer>): void;
  4049. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  4050. private _unbindVertexArrayObject();
  4051. bindBuffers(vertexBuffers: {
  4052. [key: string]: Nullable<VertexBuffer>;
  4053. }, indexBuffer: Nullable<WebGLBuffer>, effect: Effect): void;
  4054. unbindInstanceAttributes(): void;
  4055. releaseVertexArrayObject(vao: WebGLVertexArrayObject): void;
  4056. _releaseBuffer(buffer: WebGLBuffer): boolean;
  4057. createInstancesBuffer(capacity: number): WebGLBuffer;
  4058. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  4059. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  4060. applyStates(): void;
  4061. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  4062. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  4063. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  4064. drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void;
  4065. drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  4066. private DrawMode(fillMode);
  4067. _releaseEffect(effect: Effect): void;
  4068. _deleteProgram(program: WebGLProgram): void;
  4069. /**
  4070. * @param baseName The base name of the effect (The name of file without .fragment.fx or .vertex.fx)
  4071. * @param samplers An array of string used to represent textures
  4072. */
  4073. createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
  4074. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  4075. createRawShaderProgram(vertexCode: string, fragmentCode: string, context?: WebGLRenderingContext, transformFeedbackVaryings?: Nullable<string[]>): WebGLProgram;
  4076. createShaderProgram(vertexCode: string, fragmentCode: string, defines: Nullable<string>, context?: WebGLRenderingContext, transformFeedbackVaryings?: Nullable<string[]>): WebGLProgram;
  4077. private _createShaderProgram(vertexShader, fragmentShader, context, transformFeedbackVaryings?);
  4078. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): Nullable<WebGLUniformLocation>[];
  4079. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  4080. enableEffect(effect: Nullable<Effect>): void;
  4081. setIntArray(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  4082. setIntArray2(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  4083. setIntArray3(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  4084. setIntArray4(uniform: Nullable<WebGLUniformLocation>, array: Int32Array): void;
  4085. setFloatArray(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  4086. setFloatArray2(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  4087. setFloatArray3(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  4088. setFloatArray4(uniform: Nullable<WebGLUniformLocation>, array: Float32Array): void;
  4089. setArray(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  4090. setArray2(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  4091. setArray3(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  4092. setArray4(uniform: Nullable<WebGLUniformLocation>, array: number[]): void;
  4093. setMatrices(uniform: Nullable<WebGLUniformLocation>, matrices: Float32Array): void;
  4094. setMatrix(uniform: Nullable<WebGLUniformLocation>, matrix: Matrix): void;
  4095. setMatrix3x3(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void;
  4096. setMatrix2x2(uniform: Nullable<WebGLUniformLocation>, matrix: Float32Array): void;
  4097. setInt(uniform: Nullable<WebGLUniformLocation>, value: number): void;
  4098. setFloat(uniform: Nullable<WebGLUniformLocation>, value: number): void;
  4099. setFloat2(uniform: Nullable<WebGLUniformLocation>, x: number, y: number): void;
  4100. setFloat3(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number): void;
  4101. setBool(uniform: Nullable<WebGLUniformLocation>, bool: number): void;
  4102. setFloat4(uniform: Nullable<WebGLUniformLocation>, x: number, y: number, z: number, w: number): void;
  4103. setColor3(uniform: Nullable<WebGLUniformLocation>, color3: Color3): void;
  4104. setColor4(uniform: Nullable<WebGLUniformLocation>, color3: Color3, alpha: number): void;
  4105. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  4106. setZOffset(value: number): void;
  4107. getZOffset(): number;
  4108. setDepthBuffer(enable: boolean): void;
  4109. getDepthWrite(): boolean;
  4110. setDepthWrite(enable: boolean): void;
  4111. setColorWrite(enable: boolean): void;
  4112. getColorWrite(): boolean;
  4113. setAlphaConstants(r: number, g: number, b: number, a: number): void;
  4114. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  4115. getAlphaMode(): number;
  4116. setAlphaTesting(enable: boolean): void;
  4117. getAlphaTesting(): boolean;
  4118. wipeCaches(bruteForce?: boolean): void;
  4119. /**
  4120. * Set the compressed texture format to use, based on the formats you have, and the formats
  4121. * supported by the hardware / browser.
  4122. *
  4123. * Khronos Texture Container (.ktx) files are used to support this. This format has the
  4124. * advantage of being specifically designed for OpenGL. Header elements directly correspond
  4125. * to API arguments needed to compressed textures. This puts the burden on the container
  4126. * generator to house the arcane code for determining these for current & future formats.
  4127. *
  4128. * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
  4129. * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
  4130. *
  4131. * Note: The result of this call is not taken into account when a texture is base64.
  4132. *
  4133. * @param {Array<string>} formatsAvailable- The list of those format families you have created
  4134. * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)
  4135. *
  4136. * Current families are astc, dxt, pvrtc, etc2, & etc1.
  4137. * @returns The extension selected.
  4138. */
  4139. setTextureFormatToUse(formatsAvailable: Array<string>): Nullable<string>;
  4140. _createTexture(): WebGLTexture;
  4141. /**
  4142. * Usually called from BABYLON.Texture.ts. Passed information to create a WebGLTexture.
  4143. * @param {string} urlArg- This contains one of the following:
  4144. * 1. A conventional http URL, e.g. 'http://...' or 'file://...'
  4145. * 2. A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
  4146. * 3. An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
  4147. *
  4148. * @param {boolean} noMipmap- When true, no mipmaps shall be generated. Ignored for compressed textures. They must be in the file.
  4149. * @param {boolean} invertY- When true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file.
  4150. * @param {Scene} scene- Needed for loading to the correct scene.
  4151. * @param {number} samplingMode- Mode with should be used sample / access the texture. Default: TRILINEAR
  4152. * @param {callback} onLoad- Optional callback to be called upon successful completion.
  4153. * @param {callback} onError- Optional callback to be called upon failure.
  4154. * @param {ArrayBuffer | HTMLImageElement} buffer- A source of a file previously fetched as either an ArrayBuffer (compressed or image format) or HTMLImageElement (image format)
  4155. * @param {WebGLTexture} fallback- An internal argument in case the function must be called again, due to etc1 not having alpha capabilities.
  4156. * @param {number} format- Internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures.
  4157. *
  4158. * @returns {WebGLTexture} for assignment back into BABYLON.Texture
  4159. */
  4160. createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
  4161. private _rescaleTexture(source, destination, scene, internalFormat, onComplete);
  4162. private _getInternalFormat(format);
  4163. updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number): void;
  4164. createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number): InternalTexture;
  4165. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
  4166. updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
  4167. updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
  4168. updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;
  4169. createRenderTargetTexture(size: number | {
  4170. width: number;
  4171. height: number;
  4172. }, options: boolean | RenderTargetCreationOptions): InternalTexture;
  4173. createMultipleRenderTarget(size: any, options: any): InternalTexture[];
  4174. private _setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples?);
  4175. updateRenderTargetTextureSampleCount(texture: Nullable<InternalTexture>, samples: number): number;
  4176. updateMultipleRenderTargetTextureSampleCount(textures: Nullable<InternalTexture[]>, samples: number): number;
  4177. _uploadDataToTexture(target: number, lod: number, internalFormat: number, width: number, height: number, format: number, type: number, data: ArrayBufferView): void;
  4178. _uploadCompressedDataToTexture(target: number, lod: number, internalFormat: number, width: number, height: number, data: ArrayBufferView): void;
  4179. createRenderTargetCubeTexture(size: number, options?: RenderTargetCreationOptions): InternalTexture;
  4180. createPrefilteredCubeTexture(rootUrl: string, scene: Nullable<Scene>, scale: number, offset: number, onLoad?: Nullable<(internalTexture: Nullable<InternalTexture>) => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, forcedExtension?: any): InternalTexture;
  4181. createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap?: boolean, onLoad?: Nullable<(data?: any) => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, forcedExtension?: any): InternalTexture;
  4182. private setCubeMapTextureParams(gl, loadMipmap);
  4183. updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression?: Nullable<string>, level?: number): void;
  4184. createRawCubeTexture(data: Nullable<ArrayBufferView[]>, size: number, format: number, type: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
  4185. createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>, mipmmapGenerator: Nullable<((faces: ArrayBufferView[]) => ArrayBufferView[][])>, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, samplingMode?: number, invertY?: boolean): InternalTexture;
  4186. updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>): void;
  4187. createRawTexture3D(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
  4188. private _prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);
  4189. private _prepareWebGLTexture(texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode?);
  4190. private _convertRGBtoRGBATextureData(rgbData, width, height, textureType);
  4191. _releaseFramebufferObjects(texture: InternalTexture): void;
  4192. _releaseTexture(texture: InternalTexture): void;
  4193. private setProgram(program);
  4194. private _boundUniforms;
  4195. bindSamplers(effect: Effect): void;
  4196. private _activateTextureChannel(channel);
  4197. private _moveBoundTextureOnTop(internalTexture);
  4198. private _removeDesignatedSlot(internalTexture);
  4199. _bindTextureDirectly(target: number, texture: Nullable<InternalTexture>, doNotBindUniformToTextureChannel?: boolean): void;
  4200. _bindTexture(channel: number, texture: Nullable<InternalTexture>): void;
  4201. setTextureFromPostProcess(channel: number, postProcess: Nullable<PostProcess>): void;
  4202. unbindAllTextures(): void;
  4203. setTexture(channel: number, uniform: Nullable<WebGLUniformLocation>, texture: Nullable<BaseTexture>): void;
  4204. private _getCorrectTextureChannel(channel, internalTexture);
  4205. private _bindSamplerUniformToChannel(sourceSlot, destination);
  4206. private _setTexture(channel, texture, isPartOfTextureArray?);
  4207. setTextureArray(channel: number, uniform: Nullable<WebGLUniformLocation>, textures: BaseTexture[]): void;
  4208. _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  4209. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  4210. /**
  4211. * Add an externaly attached data from its key.
  4212. * This method call will fail and return false, if such key already exists.
  4213. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  4214. * @param key the unique key that identifies the data
  4215. * @param data the data object to associate to the key for this Engine instance
  4216. * @return true if no such key were already present and the data was added successfully, false otherwise
  4217. */
  4218. addExternalData<T>(key: string, data: T): boolean;
  4219. /**
  4220. * Get an externaly attached data from its key
  4221. * @param key the unique key that identifies the data
  4222. * @return the associated data, if present (can be null), or undefined if not present
  4223. */
  4224. getExternalData<T>(key: string): T;
  4225. /**
  4226. * Get an externaly attached data from its key, create it using a factory if it's not already present
  4227. * @param key the unique key that identifies the data
  4228. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  4229. * @return the associated data, can be null if the factory returned null.
  4230. */
  4231. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  4232. /**
  4233. * Remove an externaly attached data from the Engine instance
  4234. * @param key the unique key that identifies the data
  4235. * @return true if the data was successfully removed, false if it doesn't exist
  4236. */
  4237. removeExternalData(key: string): boolean;
  4238. unbindAllAttributes(): void;
  4239. releaseEffects(): void;
  4240. dispose(): void;
  4241. displayLoadingUI(): void;
  4242. hideLoadingUI(): void;
  4243. loadingScreen: ILoadingScreen;
  4244. loadingUIText: string;
  4245. loadingUIBackgroundColor: string;
  4246. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  4247. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  4248. getVertexShaderSource(program: WebGLProgram): Nullable<string>;
  4249. getFragmentShaderSource(program: WebGLProgram): Nullable<string>;
  4250. getError(): number;
  4251. getFps(): number;
  4252. getDeltaTime(): number;
  4253. private _measureFps();
  4254. _readTexturePixels(texture: InternalTexture, width: number, height: number, faceIndex?: number): ArrayBufferView;
  4255. private _canRenderToFloatFramebuffer();
  4256. private _canRenderToHalfFloatFramebuffer();
  4257. private _canRenderToFramebuffer(type);
  4258. _getWebGLTextureType(type: number): number;
  4259. _getRGBABufferInternalSizedFormat(type: number): number;
  4260. _getRGBAMultiSampleBufferFormat(type: number): number;
  4261. createQuery(): WebGLQuery;
  4262. deleteQuery(query: WebGLQuery): Engine;
  4263. isQueryResultAvailable(query: WebGLQuery): boolean;
  4264. getQueryResult(query: WebGLQuery): number;
  4265. beginOcclusionQuery(algorithmType: number, query: WebGLQuery): Engine;
  4266. endOcclusionQuery(algorithmType: number): Engine;
  4267. private _createTimeQuery();
  4268. private _deleteTimeQuery(query);
  4269. private _getTimeQueryResult(query);
  4270. private _getTimeQueryAvailability(query);
  4271. private _currentNonTimestampToken;
  4272. startTimeQuery(): Nullable<_TimeToken>;
  4273. endTimeQuery(token: _TimeToken): int;
  4274. private getGlAlgorithmType(algorithmType);
  4275. createTransformFeedback(): WebGLTransformFeedback;
  4276. deleteTransformFeedback(value: WebGLTransformFeedback): void;
  4277. bindTransformFeedback(value: Nullable<WebGLTransformFeedback>): void;
  4278. beginTransformFeedback(usePoints?: boolean): void;
  4279. endTransformFeedback(): void;
  4280. setTranformFeedbackVaryings(program: WebGLProgram, value: string[]): void;
  4281. bindTransformFeedbackBuffer(value: Nullable<WebGLBuffer>): void;
  4282. _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, database?: Database, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
  4283. private _partialLoadFile(url, index, loadedFiles, scene, onfinish, onErrorCallBack?);
  4284. private _cascadeLoadFiles(rootUrl, scene, onfinish, files, onError?);
  4285. static isSupported(): boolean;
  4286. }
  4287. }
  4288. declare module 'babylonjs/core' {
  4289. /**
  4290. * Node is the basic class for all scene objects (Mesh, Light Camera).
  4291. */
  4292. class Node {
  4293. name: string;
  4294. id: string;
  4295. uniqueId: number;
  4296. state: string;
  4297. metadata: any;
  4298. doNotSerialize: boolean;
  4299. animations: Animation[];
  4300. private _ranges;
  4301. onReady: (node: Node) => void;
  4302. private _isEnabled;
  4303. private _isReady;
  4304. _currentRenderId: number;
  4305. private _parentRenderId;
  4306. _waitingParentId: Nullable<string>;
  4307. private _scene;
  4308. _cache: any;
  4309. private _parentNode;
  4310. private _children;
  4311. parent: Nullable<Node>;
  4312. getClassName(): string;
  4313. /**
  4314. * An event triggered when the mesh is disposed.
  4315. * @type {BABYLON.Observable}
  4316. */
  4317. onDisposeObservable: Observable<Node>;
  4318. private _onDisposeObserver;
  4319. onDispose: () => void;
  4320. /**
  4321. * @constructor
  4322. * @param {string} name - the name and id to be given to this node
  4323. * @param {BABYLON.Scene} the scene this node will be added to
  4324. */
  4325. constructor(name: string, scene?: Nullable<Scene>);
  4326. getScene(): Scene;
  4327. getEngine(): Engine;
  4328. private _behaviors;
  4329. addBehavior(behavior: Behavior<Node>): Node;
  4330. removeBehavior(behavior: Behavior<Node>): Node;
  4331. readonly behaviors: Behavior<Node>[];
  4332. getBehaviorByName(name: string): Nullable<Behavior<Node>>;
  4333. getWorldMatrix(): Matrix;
  4334. _initCache(): void;
  4335. updateCache(force?: boolean): void;
  4336. _updateCache(ignoreParentClass?: boolean): void;
  4337. _isSynchronized(): boolean;
  4338. _markSyncedWithParent(): void;
  4339. isSynchronizedWithParent(): boolean;
  4340. isSynchronized(updateCache?: boolean): boolean;
  4341. hasNewParent(update?: boolean): boolean;
  4342. /**
  4343. * Is this node ready to be used/rendered
  4344. * @return {boolean} is it ready
  4345. */
  4346. isReady(): boolean;
  4347. /**
  4348. * Is this node enabled.
  4349. * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true.
  4350. * @param {boolean} [checkAncestors=true] - Indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors.
  4351. * @return {boolean} whether this node (and its parent) is enabled.
  4352. * @see setEnabled
  4353. */
  4354. isEnabled(checkAncestors?: boolean): boolean;
  4355. /**
  4356. * Set the enabled state of this node.
  4357. * @param {boolean} value - the new enabled state
  4358. * @see isEnabled
  4359. */
  4360. setEnabled(value: boolean): void;
  4361. /**
  4362. * Is this node a descendant of the given node.
  4363. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  4364. * @param {BABYLON.Node} ancestor - The parent node to inspect
  4365. * @see parent
  4366. */
  4367. isDescendantOf(ancestor: Node): boolean;
  4368. /**
  4369. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  4370. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  4371. * @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.
  4372. * @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.
  4373. */
  4374. _getDescendants(results: Node[], directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): void;
  4375. /**
  4376. * Will return all nodes that have this node as ascendant.
  4377. * @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.
  4378. * @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.
  4379. * @return {BABYLON.Node[]} all children nodes of all types.
  4380. */
  4381. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  4382. /**
  4383. * Get all child-meshes of this node.
  4384. */
  4385. getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  4386. /**
  4387. * Get all child-transformNodes of this node.
  4388. */
  4389. getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): TransformNode[];
  4390. /**
  4391. * Get all direct children of this node.
  4392. */
  4393. getChildren(predicate?: (node: Node) => boolean): Node[];
  4394. _setReady(state: boolean): void;
  4395. getAnimationByName(name: string): Nullable<Animation>;
  4396. createAnimationRange(name: string, from: number, to: number): void;
  4397. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  4398. getAnimationRange(name: string): Nullable<AnimationRange>;
  4399. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  4400. serializeAnimationRanges(): any;
  4401. computeWorldMatrix(force?: boolean): Matrix;
  4402. dispose(): void;
  4403. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  4404. }
  4405. }
  4406. declare module 'babylonjs/core' {
  4407. class BoundingSphere {
  4408. minimum: Vector3;
  4409. maximum: Vector3;
  4410. center: Vector3;
  4411. radius: number;
  4412. centerWorld: Vector3;
  4413. radiusWorld: number;
  4414. private _tempRadiusVector;
  4415. constructor(minimum: Vector3, maximum: Vector3);
  4416. _update(world: Matrix): void;
  4417. isInFrustum(frustumPlanes: Plane[]): boolean;
  4418. intersectsPoint(point: Vector3): boolean;
  4419. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  4420. }
  4421. }
  4422. declare module 'babylonjs/core' {
  4423. class BoundingBox implements ICullable {
  4424. minimum: Vector3;
  4425. maximum: Vector3;
  4426. vectors: Vector3[];
  4427. center: Vector3;
  4428. centerWorld: Vector3;
  4429. extendSize: Vector3;
  4430. extendSizeWorld: Vector3;
  4431. directions: Vector3[];
  4432. vectorsWorld: Vector3[];
  4433. minimumWorld: Vector3;
  4434. maximumWorld: Vector3;
  4435. private _worldMatrix;
  4436. constructor(minimum: Vector3, maximum: Vector3);
  4437. getWorldMatrix(): Matrix;
  4438. setWorldMatrix(matrix: Matrix): BoundingBox;
  4439. _update(world: Matrix): void;
  4440. isInFrustum(frustumPlanes: Plane[]): boolean;
  4441. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4442. intersectsPoint(point: Vector3): boolean;
  4443. intersectsSphere(sphere: BoundingSphere): boolean;
  4444. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  4445. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  4446. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  4447. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  4448. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  4449. }
  4450. }
  4451. declare module 'babylonjs/core' {
  4452. interface ICullable {
  4453. isInFrustum(frustumPlanes: Plane[]): boolean;
  4454. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4455. }
  4456. class BoundingInfo implements ICullable {
  4457. minimum: Vector3;
  4458. maximum: Vector3;
  4459. boundingBox: BoundingBox;
  4460. boundingSphere: BoundingSphere;
  4461. private _isLocked;
  4462. constructor(minimum: Vector3, maximum: Vector3);
  4463. isLocked: boolean;
  4464. update(world: Matrix): void;
  4465. /**
  4466. * Recreate the bounding info to be centered around a specific point given a specific extend.
  4467. * @param center New center of the bounding info
  4468. * @param extend New extend of the bounding info
  4469. */
  4470. centerOn(center: Vector3, extend: Vector3): BoundingInfo;
  4471. isInFrustum(frustumPlanes: Plane[]): boolean;
  4472. /**
  4473. * Gets the world distance between the min and max points of the bounding box
  4474. */
  4475. readonly diagonalLength: number;
  4476. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  4477. _checkCollision(collider: Collider): boolean;
  4478. intersectsPoint(point: Vector3): boolean;
  4479. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  4480. }
  4481. }
  4482. declare module 'babylonjs/core' {
  4483. class TransformNode extends Node {
  4484. static BILLBOARDMODE_NONE: number;
  4485. static BILLBOARDMODE_X: number;
  4486. static BILLBOARDMODE_Y: number;
  4487. static BILLBOARDMODE_Z: number;
  4488. static BILLBOARDMODE_ALL: number;
  4489. private _rotation;
  4490. private _rotationQuaternion;
  4491. protected _scaling: Vector3;
  4492. protected _isDirty: boolean;
  4493. private _transformToBoneReferal;
  4494. billboardMode: number;
  4495. scalingDeterminant: number;
  4496. infiniteDistance: boolean;
  4497. position: Vector3;
  4498. _poseMatrix: Matrix;
  4499. private _localWorld;
  4500. _worldMatrix: Matrix;
  4501. _worldMatrixDeterminant: number;
  4502. private _absolutePosition;
  4503. private _pivotMatrix;
  4504. private _pivotMatrixInverse;
  4505. private _postMultiplyPivotMatrix;
  4506. protected _isWorldMatrixFrozen: boolean;
  4507. /**
  4508. * An event triggered after the world matrix is updated
  4509. * @type {BABYLON.Observable}
  4510. */
  4511. onAfterWorldMatrixUpdateObservable: Observable<TransformNode>;
  4512. constructor(name: string, scene?: Nullable<Scene>, isPure?: boolean);
  4513. /**
  4514. * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
  4515. * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
  4516. * Default : (0.0, 0.0, 0.0)
  4517. */
  4518. rotation: Vector3;
  4519. /**
  4520. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  4521. * Default : (1.0, 1.0, 1.0)
  4522. */
  4523. /**
  4524. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  4525. * Default : (1.0, 1.0, 1.0)
  4526. */
  4527. scaling: Vector3;
  4528. /**
  4529. * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
  4530. * It's null by default.
  4531. * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
  4532. */
  4533. rotationQuaternion: Nullable<Quaternion>;
  4534. /**
  4535. * Returns the latest update of the World matrix
  4536. * Returns a Matrix.
  4537. */
  4538. getWorldMatrix(): Matrix;
  4539. /**
  4540. * Returns the latest update of the World matrix determinant.
  4541. */
  4542. protected _getWorldMatrixDeterminant(): number;
  4543. /**
  4544. * Returns directly the latest state of the mesh World matrix.
  4545. * A Matrix is returned.
  4546. */
  4547. readonly worldMatrixFromCache: Matrix;
  4548. /**
  4549. * Copies the paramater passed Matrix into the mesh Pose matrix.
  4550. * Returns the AbstractMesh.
  4551. */
  4552. updatePoseMatrix(matrix: Matrix): TransformNode;
  4553. /**
  4554. * Returns the mesh Pose matrix.
  4555. * Returned object : Matrix
  4556. */
  4557. getPoseMatrix(): Matrix;
  4558. _isSynchronized(): boolean;
  4559. _initCache(): void;
  4560. markAsDirty(property: string): TransformNode;
  4561. /**
  4562. * Returns the current mesh absolute position.
  4563. * Retuns a Vector3.
  4564. */
  4565. readonly absolutePosition: Vector3;
  4566. /**
  4567. * Sets a new pivot matrix to the mesh.
  4568. * Returns the AbstractMesh.
  4569. */
  4570. setPivotMatrix(matrix: Matrix, postMultiplyPivotMatrix?: boolean): TransformNode;
  4571. /**
  4572. * Returns the mesh pivot matrix.
  4573. * Default : Identity.
  4574. * A Matrix is returned.
  4575. */
  4576. getPivotMatrix(): Matrix;
  4577. /**
  4578. * Prevents the World matrix to be computed any longer.
  4579. * Returns the AbstractMesh.
  4580. */
  4581. freezeWorldMatrix(): TransformNode;
  4582. /**
  4583. * Allows back the World matrix computation.
  4584. * Returns the AbstractMesh.
  4585. */
  4586. unfreezeWorldMatrix(): this;
  4587. /**
  4588. * True if the World matrix has been frozen.
  4589. * Returns a boolean.
  4590. */
  4591. readonly isWorldMatrixFrozen: boolean;
  4592. /**
  4593. * Retuns the mesh absolute position in the World.
  4594. * Returns a Vector3.
  4595. */
  4596. getAbsolutePosition(): Vector3;
  4597. /**
  4598. * Sets the mesh absolute position in the World from a Vector3 or an Array(3).
  4599. * Returns the AbstractMesh.
  4600. */
  4601. setAbsolutePosition(absolutePosition: Vector3): TransformNode;
  4602. /**
  4603. * Sets the mesh position in its local space.
  4604. * Returns the AbstractMesh.
  4605. */
  4606. setPositionWithLocalVector(vector3: Vector3): TransformNode;
  4607. /**
  4608. * Returns the mesh position in the local space from the current World matrix values.
  4609. * Returns a new Vector3.
  4610. */
  4611. getPositionExpressedInLocalSpace(): Vector3;
  4612. /**
  4613. * Translates the mesh along the passed Vector3 in its local space.
  4614. * Returns the AbstractMesh.
  4615. */
  4616. locallyTranslate(vector3: Vector3): TransformNode;
  4617. private static _lookAtVectorCache;
  4618. /**
  4619. * Orients a mesh towards a target point. Mesh must be drawn facing user.
  4620. * @param targetPoint the position (must be in same space as current mesh) to look at
  4621. * @param yawCor optional yaw (y-axis) correction in radians
  4622. * @param pitchCor optional pitch (x-axis) correction in radians
  4623. * @param rollCor optional roll (z-axis) correction in radians
  4624. * @param space the choosen space of the target
  4625. * @returns the TransformNode.
  4626. */
  4627. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): TransformNode;
  4628. /**
  4629. * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.
  4630. * This Vector3 is expressed in the World space.
  4631. */
  4632. getDirection(localAxis: Vector3): Vector3;
  4633. /**
  4634. * Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
  4635. * localAxis is expressed in the mesh local space.
  4636. * result is computed in the Wordl space from the mesh World matrix.
  4637. * Returns the AbstractMesh.
  4638. */
  4639. getDirectionToRef(localAxis: Vector3, result: Vector3): TransformNode;
  4640. setPivotPoint(point: Vector3, space?: Space): TransformNode;
  4641. /**
  4642. * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
  4643. */
  4644. getPivotPoint(): Vector3;
  4645. /**
  4646. * Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
  4647. * Returns the AbstractMesh.
  4648. */
  4649. getPivotPointToRef(result: Vector3): TransformNode;
  4650. /**
  4651. * Returns a new Vector3 set with the mesh pivot point World coordinates.
  4652. */
  4653. getAbsolutePivotPoint(): Vector3;
  4654. /**
  4655. * Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
  4656. * Returns the AbstractMesh.
  4657. */
  4658. getAbsolutePivotPointToRef(result: Vector3): TransformNode;
  4659. /**
  4660. * Defines the passed node as the parent of the current node.
  4661. * The node will remain exactly where it is and its position / rotation will be updated accordingly
  4662. * Returns the TransformNode.
  4663. */
  4664. setParent(node: Nullable<Node>): TransformNode;
  4665. private _nonUniformScaling;
  4666. readonly nonUniformScaling: boolean;
  4667. _updateNonUniformScalingState(value: boolean): boolean;
  4668. /**
  4669. * Attach the current TransformNode to another TransformNode associated with a bone
  4670. * @param bone Bone affecting the TransformNode
  4671. * @param affectedTransformNode TransformNode associated with the bone
  4672. */
  4673. attachToBone(bone: Bone, affectedTransformNode: TransformNode): TransformNode;
  4674. detachFromBone(): TransformNode;
  4675. private static _rotationAxisCache;
  4676. /**
  4677. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
  4678. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  4679. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  4680. * The passed axis is also normalized.
  4681. * Returns the AbstractMesh.
  4682. */
  4683. rotate(axis: Vector3, amount: number, space?: Space): TransformNode;
  4684. /**
  4685. * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
  4686. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
  4687. * The passed axis is also normalized.
  4688. * Returns the AbstractMesh.
  4689. * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
  4690. */
  4691. rotateAround(point: Vector3, axis: Vector3, amount: number): TransformNode;
  4692. /**
  4693. * Translates the mesh along the axis vector for the passed distance in the given space.
  4694. * space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD.
  4695. * Returns the AbstractMesh.
  4696. */
  4697. translate(axis: Vector3, distance: number, space?: Space): TransformNode;
  4698. /**
  4699. * Adds a rotation step to the mesh current rotation.
  4700. * x, y, z are Euler angles expressed in radians.
  4701. * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
  4702. * This means this rotation is made in the mesh local space only.
  4703. * It's useful to set a custom rotation order different from the BJS standard one YXZ.
  4704. * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
  4705. * ```javascript
  4706. * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
  4707. * ```
  4708. * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
  4709. * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
  4710. * Returns the AbstractMesh.
  4711. */
  4712. addRotation(x: number, y: number, z: number): TransformNode;
  4713. /**
  4714. * Computes the mesh World matrix and returns it.
  4715. * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
  4716. * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
  4717. * If the parameter `force`is set to `true`, the actual computation is done.
  4718. * Returns the mesh World Matrix.
  4719. */
  4720. computeWorldMatrix(force?: boolean): Matrix;
  4721. protected _afterComputeWorldMatrix(): void;
  4722. /**
  4723. * If you'd like to be called back after the mesh position, rotation or scaling has been updated.
  4724. * @param func: callback function to add
  4725. *
  4726. * Returns the TransformNode.
  4727. */
  4728. registerAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode;
  4729. /**
  4730. * Removes a registered callback function.
  4731. * Returns the TransformNode.
  4732. */
  4733. unregisterAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode;
  4734. /**
  4735. * Clone the current transform node
  4736. * Returns the new transform node
  4737. * @param name Name of the new clone
  4738. * @param newParent New parent for the clone
  4739. * @param doNotCloneChildren Do not clone children hierarchy
  4740. */
  4741. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Nullable<TransformNode>;
  4742. serialize(currentSerializationObject?: any): any;
  4743. /**
  4744. * Returns a new TransformNode object parsed from the source provided.
  4745. * The parameter `parsedMesh` is the source.
  4746. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  4747. */
  4748. static Parse(parsedTransformNode: any, scene: Scene, rootUrl: string): TransformNode;
  4749. /**
  4750. * Disposes the TransformNode.
  4751. * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  4752. * Returns nothing.
  4753. */
  4754. dispose(doNotRecurse?: boolean): void;
  4755. }
  4756. }
  4757. declare module 'babylonjs/core' {
  4758. class AbstractMesh extends TransformNode implements IDisposable, ICullable, IGetSetVerticesData {
  4759. static OCCLUSION_TYPE_NONE: number;
  4760. static OCCLUSION_TYPE_OPTIMISTIC: number;
  4761. static OCCLUSION_TYPE_STRICT: number;
  4762. static OCCLUSION_ALGORITHM_TYPE_ACCURATE: number;
  4763. static OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE: number;
  4764. static readonly BILLBOARDMODE_NONE: number;
  4765. static readonly BILLBOARDMODE_X: number;
  4766. static readonly BILLBOARDMODE_Y: number;
  4767. static readonly BILLBOARDMODE_Z: number;
  4768. static readonly BILLBOARDMODE_ALL: number;
  4769. private _facetPositions;
  4770. private _facetNormals;
  4771. private _facetPartitioning;
  4772. private _facetNb;
  4773. private _partitioningSubdivisions;
  4774. private _partitioningBBoxRatio;
  4775. private _facetDataEnabled;
  4776. private _facetParameters;
  4777. private _bbSize;
  4778. private _subDiv;
  4779. private _facetDepthSort;
  4780. private _facetDepthSortEnabled;
  4781. private _depthSortedIndices;
  4782. private _depthSortedFacets;
  4783. private _facetDepthSortFunction;
  4784. private _facetDepthSortFrom;
  4785. private _facetDepthSortOrigin;
  4786. private _invertedMatrix;
  4787. /**
  4788. * Read-only : the number of facets in the mesh
  4789. */
  4790. readonly facetNb: number;
  4791. /**
  4792. * The number (integer) of subdivisions per axis in the partioning space
  4793. */
  4794. partitioningSubdivisions: number;
  4795. /**
  4796. * The ratio (float) to apply to the bouding box size to set to the partioning space.
  4797. * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box.
  4798. */
  4799. partitioningBBoxRatio: number;
  4800. /**
  4801. * Boolean : must the facet be depth sorted on next call to `updateFacetData()` ?
  4802. * Works only for updatable meshes.
  4803. * Doesn't work with multi-materials.
  4804. */
  4805. mustDepthSortFacets: boolean;
  4806. /**
  4807. * The location (Vector3) where the facet depth sort must be computed from.
  4808. * By default, the active camera position.
  4809. * Used only when facet depth sort is enabled.
  4810. */
  4811. facetDepthSortFrom: Vector3;
  4812. /**
  4813. * Read-only boolean : is the feature facetData enabled ?
  4814. */
  4815. readonly isFacetDataEnabled: boolean;
  4816. _updateNonUniformScalingState(value: boolean): boolean;
  4817. /**
  4818. * An event triggered when this mesh collides with another one
  4819. * @type {BABYLON.Observable}
  4820. */
  4821. onCollideObservable: Observable<AbstractMesh>;
  4822. private _onCollideObserver;
  4823. onCollide: () => void;
  4824. /**
  4825. * An event triggered when the collision's position changes
  4826. * @type {BABYLON.Observable}
  4827. */
  4828. onCollisionPositionChangeObservable: Observable<Vector3>;
  4829. private _onCollisionPositionChangeObserver;
  4830. onCollisionPositionChange: () => void;
  4831. /**
  4832. * An event triggered when material is changed
  4833. * @type {BABYLON.Observable}
  4834. */
  4835. onMaterialChangedObservable: Observable<AbstractMesh>;
  4836. definedFacingForward: boolean;
  4837. /**
  4838. * This property determines the type of occlusion query algorithm to run in WebGl, you can use:
  4839. * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
  4840. * or
  4841. * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
  4842. * for more info check WebGl documentations
  4843. */
  4844. occlusionQueryAlgorithmType: number;
  4845. /**
  4846. * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
  4847. * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
  4848. * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
  4849. * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
  4850. */
  4851. occlusionType: number;
  4852. /**
  4853. * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
  4854. * The default value is -1 which means don't break the query and wait till the result.
  4855. */
  4856. occlusionRetryCount: number;
  4857. private _occlusionInternalRetryCounter;
  4858. protected _isOccluded: boolean;
  4859. /**
  4860. * Property isOccluded : Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not.
  4861. */
  4862. isOccluded: boolean;
  4863. private _isOcclusionQueryInProgress;
  4864. /**
  4865. * Flag to check the progress status of the query
  4866. */
  4867. readonly isOcclusionQueryInProgress: boolean;
  4868. private _occlusionQuery;
  4869. visibility: number;
  4870. alphaIndex: number;
  4871. isVisible: boolean;
  4872. isPickable: boolean;
  4873. showBoundingBox: boolean;
  4874. showSubMeshesBoundingBox: boolean;
  4875. isBlocker: boolean;
  4876. enablePointerMoveEvents: boolean;
  4877. renderingGroupId: number;
  4878. private _material;
  4879. material: Nullable<Material>;
  4880. private _receiveShadows;
  4881. receiveShadows: boolean;
  4882. renderOutline: boolean;
  4883. outlineColor: Color3;
  4884. outlineWidth: number;
  4885. renderOverlay: boolean;
  4886. overlayColor: Color3;
  4887. overlayAlpha: number;
  4888. private _hasVertexAlpha;
  4889. hasVertexAlpha: boolean;
  4890. private _useVertexColors;
  4891. useVertexColors: boolean;
  4892. private _computeBonesUsingShaders;
  4893. computeBonesUsingShaders: boolean;
  4894. private _numBoneInfluencers;
  4895. numBoneInfluencers: number;
  4896. private _applyFog;
  4897. applyFog: boolean;
  4898. useOctreeForRenderingSelection: boolean;
  4899. useOctreeForPicking: boolean;
  4900. useOctreeForCollisions: boolean;
  4901. private _layerMask;
  4902. layerMask: number;
  4903. /**
  4904. * True if the mesh must be rendered in any case.
  4905. */
  4906. alwaysSelectAsActiveMesh: boolean;
  4907. /**
  4908. * This scene's action manager
  4909. * @type {BABYLON.ActionManager}
  4910. */
  4911. actionManager: Nullable<ActionManager>;
  4912. physicsImpostor: Nullable<PhysicsImpostor>;
  4913. private _checkCollisions;
  4914. private _collisionMask;
  4915. private _collisionGroup;
  4916. ellipsoid: Vector3;
  4917. ellipsoidOffset: Vector3;
  4918. private _collider;
  4919. private _oldPositionForCollisions;
  4920. private _diffPositionForCollisions;
  4921. collisionMask: number;
  4922. collisionGroup: number;
  4923. edgesWidth: number;
  4924. edgesColor: Color4;
  4925. _edgesRenderer: Nullable<EdgesRenderer>;
  4926. private _collisionsTransformMatrix;
  4927. private _collisionsScalingMatrix;
  4928. _masterMesh: Nullable<AbstractMesh>;
  4929. _boundingInfo: Nullable<BoundingInfo>;
  4930. _isDisposed: boolean;
  4931. _renderId: number;
  4932. subMeshes: SubMesh[];
  4933. _submeshesOctree: Octree<SubMesh>;
  4934. _intersectionsInProgress: AbstractMesh[];
  4935. _unIndexed: boolean;
  4936. _lightSources: Light[];
  4937. readonly _positions: Nullable<Vector3[]>;
  4938. _waitingActions: any;
  4939. _waitingFreezeWorldMatrix: Nullable<boolean>;
  4940. private _skeleton;
  4941. _bonesTransformMatrices: Nullable<Float32Array>;
  4942. skeleton: Nullable<Skeleton>;
  4943. constructor(name: string, scene?: Nullable<Scene>);
  4944. /**
  4945. * Boolean : true if the mesh has been disposed.
  4946. */
  4947. isDisposed(): boolean;
  4948. /**
  4949. * Returns the string "AbstractMesh"
  4950. */
  4951. getClassName(): string;
  4952. /**
  4953. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4954. */
  4955. toString(fullDetails?: boolean): string;
  4956. _rebuild(): void;
  4957. _resyncLightSources(): void;
  4958. _resyncLighSource(light: Light): void;
  4959. _removeLightSource(light: Light): void;
  4960. private _markSubMeshesAsDirty(func);
  4961. _markSubMeshesAsLightDirty(): void;
  4962. _markSubMeshesAsAttributesDirty(): void;
  4963. _markSubMeshesAsMiscDirty(): void;
  4964. /**
  4965. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  4966. * Default : (1.0, 1.0, 1.0)
  4967. */
  4968. /**
  4969. * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
  4970. * Default : (1.0, 1.0, 1.0)
  4971. */
  4972. scaling: Vector3;
  4973. /**
  4974. * Disables the mesh edger rendering mode.
  4975. * Returns the AbstractMesh.
  4976. */
  4977. disableEdgesRendering(): AbstractMesh;
  4978. /**
  4979. * Enables the edge rendering mode on the mesh.
  4980. * This mode makes the mesh edges visible.
  4981. * Returns the AbstractMesh.
  4982. */
  4983. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): AbstractMesh;
  4984. /**
  4985. * Returns true if the mesh is blocked. Used by the class Mesh.
  4986. * Returns the boolean `false` by default.
  4987. */
  4988. readonly isBlocked: boolean;
  4989. /**
  4990. * Returns the mesh itself by default, used by the class Mesh.
  4991. * Returned type : AbstractMesh
  4992. */
  4993. getLOD(camera: Camera): AbstractMesh;
  4994. /**
  4995. * Returns 0 by default, used by the class Mesh.
  4996. * Returns an integer.
  4997. */
  4998. getTotalVertices(): number;
  4999. /**
  5000. * Returns null by default, used by the class Mesh.
  5001. * Returned type : integer array
  5002. */
  5003. getIndices(): Nullable<IndicesArray>;
  5004. /**
  5005. * Returns the array of the requested vertex data kind. Used by the class Mesh. Returns null here.
  5006. * Returned type : float array or Float32Array
  5007. */
  5008. getVerticesData(kind: string): Nullable<FloatArray>;
  5009. /**
  5010. * Sets the vertex data of the mesh geometry for the requested `kind`.
  5011. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  5012. * The `data` are either a numeric array either a Float32Array.
  5013. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  5014. * 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).
  5015. * Note that a new underlying VertexBuffer object is created each call.
  5016. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  5017. *
  5018. * Possible `kind` values :
  5019. * - BABYLON.VertexBuffer.PositionKind
  5020. * - BABYLON.VertexBuffer.UVKind
  5021. * - BABYLON.VertexBuffer.UV2Kind
  5022. * - BABYLON.VertexBuffer.UV3Kind
  5023. * - BABYLON.VertexBuffer.UV4Kind
  5024. * - BABYLON.VertexBuffer.UV5Kind
  5025. * - BABYLON.VertexBuffer.UV6Kind
  5026. * - BABYLON.VertexBuffer.ColorKind
  5027. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5028. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5029. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5030. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5031. *
  5032. * Returns the Mesh.
  5033. */
  5034. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): AbstractMesh;
  5035. /**
  5036. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  5037. * If the mesh has no geometry, it is simply returned as it is.
  5038. * The `data` are either a numeric array either a Float32Array.
  5039. * No new underlying VertexBuffer object is created.
  5040. * 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.
  5041. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  5042. *
  5043. * Possible `kind` values :
  5044. * - BABYLON.VertexBuffer.PositionKind
  5045. * - BABYLON.VertexBuffer.UVKind
  5046. * - BABYLON.VertexBuffer.UV2Kind
  5047. * - BABYLON.VertexBuffer.UV3Kind
  5048. * - BABYLON.VertexBuffer.UV4Kind
  5049. * - BABYLON.VertexBuffer.UV5Kind
  5050. * - BABYLON.VertexBuffer.UV6Kind
  5051. * - BABYLON.VertexBuffer.ColorKind
  5052. * - BABYLON.VertexBuffer.MatricesIndicesKind
  5053. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  5054. * - BABYLON.VertexBuffer.MatricesWeightsKind
  5055. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  5056. *
  5057. * Returns the Mesh.
  5058. */
  5059. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): AbstractMesh;
  5060. /**
  5061. * Sets the mesh indices.
  5062. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  5063. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  5064. * This method creates a new index buffer each call.
  5065. * Returns the Mesh.
  5066. */
  5067. setIndices(indices: IndicesArray, totalVertices: Nullable<number>): AbstractMesh;
  5068. /** Returns false by default, used by the class Mesh.
  5069. * Returns a boolean
  5070. */
  5071. isVerticesDataPresent(kind: string): boolean;
  5072. /**
  5073. * Returns the mesh BoundingInfo object or creates a new one and returns it if undefined.
  5074. * Returns a BoundingInfo
  5075. */
  5076. getBoundingInfo(): BoundingInfo;
  5077. /**
  5078. * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units).
  5079. * @param includeDescendants Take the hierarchy's bounding box instead of the mesh's bounding box.
  5080. */
  5081. normalizeToUnitCube(includeDescendants?: boolean): AbstractMesh;
  5082. /**
  5083. * Sets a mesh new object BoundingInfo.
  5084. * Returns the AbstractMesh.
  5085. */
  5086. setBoundingInfo(boundingInfo: BoundingInfo): AbstractMesh;
  5087. readonly useBones: boolean;
  5088. _preActivate(): void;
  5089. _preActivateForIntermediateRendering(renderId: number): void;
  5090. _activate(renderId: number): void;
  5091. /**
  5092. * Returns the latest update of the World matrix
  5093. * Returns a Matrix.
  5094. */
  5095. getWorldMatrix(): Matrix;
  5096. /**
  5097. * Returns the latest update of the World matrix determinant.
  5098. */
  5099. protected _getWorldMatrixDeterminant(): number;
  5100. /**
  5101. * Perform relative position change from the point of view of behind the front of the mesh.
  5102. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5103. * Supports definition of mesh facing forward or backward.
  5104. * @param {number} amountRight
  5105. * @param {number} amountUp
  5106. * @param {number} amountForward
  5107. *
  5108. * Returns the AbstractMesh.
  5109. */
  5110. movePOV(amountRight: number, amountUp: number, amountForward: number): AbstractMesh;
  5111. /**
  5112. * Calculate relative position change from the point of view of behind the front of the mesh.
  5113. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5114. * Supports definition of mesh facing forward or backward.
  5115. * @param {number} amountRight
  5116. * @param {number} amountUp
  5117. * @param {number} amountForward
  5118. *
  5119. * Returns a new Vector3.
  5120. */
  5121. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  5122. /**
  5123. * Perform relative rotation change from the point of view of behind the front of the mesh.
  5124. * Supports definition of mesh facing forward or backward.
  5125. * @param {number} flipBack
  5126. * @param {number} twirlClockwise
  5127. * @param {number} tiltRight
  5128. *
  5129. * Returns the AbstractMesh.
  5130. */
  5131. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): AbstractMesh;
  5132. /**
  5133. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  5134. * Supports definition of mesh facing forward or backward.
  5135. * @param {number} flipBack
  5136. * @param {number} twirlClockwise
  5137. * @param {number} tiltRight
  5138. *
  5139. * Returns a new Vector3.
  5140. */
  5141. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  5142. /**
  5143. * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
  5144. * @param includeDescendants Include bounding info from descendants as well (true by default).
  5145. */
  5146. getHierarchyBoundingVectors(includeDescendants?: boolean): {
  5147. min: Vector3;
  5148. max: Vector3;
  5149. };
  5150. /**
  5151. * Updates the mesh BoundingInfo object and all its children BoundingInfo objects also.
  5152. * Returns the AbstractMesh.
  5153. */
  5154. _updateBoundingInfo(): AbstractMesh;
  5155. /**
  5156. * Update a mesh's children BoundingInfo objects only.
  5157. * Returns the AbstractMesh.
  5158. */
  5159. _updateSubMeshesBoundingInfo(matrix: Matrix): AbstractMesh;
  5160. protected _afterComputeWorldMatrix(): void;
  5161. /**
  5162. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  5163. * A mesh is in the frustum if its bounding box intersects the frustum.
  5164. * Boolean returned.
  5165. */
  5166. isInFrustum(frustumPlanes: Plane[]): boolean;
  5167. /**
  5168. * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.
  5169. * A mesh is completely in the frustum if its bounding box it completely inside the frustum.
  5170. * Boolean returned.
  5171. */
  5172. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  5173. /**
  5174. * True if the mesh intersects another mesh or a SolidParticle object.
  5175. * Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)
  5176. * includeDescendants can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes
  5177. * Returns a boolean.
  5178. */
  5179. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean, includeDescendants?: boolean): boolean;
  5180. /**
  5181. * Returns true if the passed point (Vector3) is inside the mesh bounding box.
  5182. * Returns a boolean.
  5183. */
  5184. intersectsPoint(point: Vector3): boolean;
  5185. getPhysicsImpostor(): Nullable<PhysicsImpostor>;
  5186. getPositionInCameraSpace(camera?: Nullable<Camera>): Vector3;
  5187. /**
  5188. * Returns the distance from the mesh to the active camera.
  5189. * Returns a float.
  5190. */
  5191. getDistanceToCamera(camera?: Nullable<Camera>): number;
  5192. applyImpulse(force: Vector3, contactPoint: Vector3): AbstractMesh;
  5193. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): AbstractMesh;
  5194. /**
  5195. * Property checkCollisions : Boolean, whether the camera should check the collisions against the mesh.
  5196. * Default `false`.
  5197. */
  5198. checkCollisions: boolean;
  5199. /**
  5200. * Gets Collider object used to compute collisions (not physics)
  5201. */
  5202. readonly collider: Collider;
  5203. moveWithCollisions(displacement: Vector3): AbstractMesh;
  5204. private _onCollisionPositionChange;
  5205. /**
  5206. * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.
  5207. * Please note that you must have a decent number of submeshes to get performance improvements when using an octree.
  5208. * Returns an Octree of submeshes.
  5209. */
  5210. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  5211. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): AbstractMesh;
  5212. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): AbstractMesh;
  5213. _checkCollision(collider: Collider): AbstractMesh;
  5214. _generatePointsArray(): boolean;
  5215. /**
  5216. * Checks if the passed Ray intersects with the mesh.
  5217. * Returns an object PickingInfo.
  5218. */
  5219. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  5220. /**
  5221. * Clones the mesh, used by the class Mesh.
  5222. * Just returns `null` for an AbstractMesh.
  5223. */
  5224. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Nullable<AbstractMesh>;
  5225. /**
  5226. * Disposes all the mesh submeshes.
  5227. * Returns the AbstractMesh.
  5228. */
  5229. releaseSubMeshes(): AbstractMesh;
  5230. /**
  5231. * Disposes the AbstractMesh.
  5232. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  5233. * Returns nothing.
  5234. */
  5235. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  5236. /**
  5237. * Adds the passed mesh as a child to the current mesh.
  5238. * Returns the AbstractMesh.
  5239. */
  5240. addChild(mesh: AbstractMesh): AbstractMesh;
  5241. /**
  5242. * Removes the passed mesh from the current mesh children list.
  5243. * Returns the AbstractMesh.
  5244. */
  5245. removeChild(mesh: AbstractMesh): AbstractMesh;
  5246. /**
  5247. * Initialize the facet data arrays : facetNormals, facetPositions and facetPartitioning.
  5248. * Returns the AbstractMesh.
  5249. */
  5250. private _initFacetData();
  5251. /**
  5252. * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
  5253. * This method can be called within the render loop.
  5254. * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation.
  5255. * Returns the AbstractMesh.
  5256. */
  5257. updateFacetData(): AbstractMesh;
  5258. /**
  5259. * Returns the facetLocalNormals array.
  5260. * The normals are expressed in the mesh local space.
  5261. */
  5262. getFacetLocalNormals(): Vector3[];
  5263. /**
  5264. * Returns the facetLocalPositions array.
  5265. * The facet positions are expressed in the mesh local space.
  5266. */
  5267. getFacetLocalPositions(): Vector3[];
  5268. /**
  5269. * Returns the facetLocalPartioning array.
  5270. */
  5271. getFacetLocalPartitioning(): number[][];
  5272. /**
  5273. * Returns the i-th facet position in the world system.
  5274. * This method allocates a new Vector3 per call.
  5275. */
  5276. getFacetPosition(i: number): Vector3;
  5277. /**
  5278. * Sets the reference Vector3 with the i-th facet position in the world system.
  5279. * Returns the AbstractMesh.
  5280. */
  5281. getFacetPositionToRef(i: number, ref: Vector3): AbstractMesh;
  5282. /**
  5283. * Returns the i-th facet normal in the world system.
  5284. * This method allocates a new Vector3 per call.
  5285. */
  5286. getFacetNormal(i: number): Vector3;
  5287. /**
  5288. * Sets the reference Vector3 with the i-th facet normal in the world system.
  5289. * Returns the AbstractMesh.
  5290. */
  5291. getFacetNormalToRef(i: number, ref: Vector3): this;
  5292. /**
  5293. * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system).
  5294. */
  5295. getFacetsAtLocalCoordinates(x: number, y: number, z: number): Nullable<number[]>;
  5296. /**
  5297. * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found.
  5298. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) World projection on the facet.
  5299. * If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
  5300. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  5301. * If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
  5302. */
  5303. getClosestFacetAtCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  5304. /**
  5305. * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found.
  5306. * If the parameter projected (vector3) is passed, it is set as the (x,y,z) local projection on the facet.
  5307. * If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
  5308. * If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
  5309. * If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
  5310. */
  5311. getClosestFacetAtLocalCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  5312. /**
  5313. * Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
  5314. */
  5315. getFacetDataParameters(): any;
  5316. /**
  5317. * Disables the feature FacetData and frees the related memory.
  5318. * Returns the AbstractMesh.
  5319. */
  5320. disableFacetData(): AbstractMesh;
  5321. /**
  5322. * Updates the AbstractMesh indices array. Actually, used by the Mesh object.
  5323. * Returns the mesh.
  5324. */
  5325. updateIndices(indices: IndicesArray): AbstractMesh;
  5326. /**
  5327. * The mesh Geometry. Actually used by the Mesh object.
  5328. * Returns a blank geometry object.
  5329. */
  5330. /**
  5331. * Creates new normals data for the mesh.
  5332. * @param updatable.
  5333. */
  5334. createNormals(updatable: boolean): void;
  5335. /**
  5336. * Align the mesh with a normal.
  5337. * Returns the mesh.
  5338. */
  5339. alignWithNormal(normal: Vector3, upDirection?: Vector3): AbstractMesh;
  5340. protected checkOcclusionQuery(): void;
  5341. }
  5342. }
  5343. declare module 'babylonjs/core' {
  5344. class Light extends Node {
  5345. private static _LIGHTMAP_DEFAULT;
  5346. private static _LIGHTMAP_SPECULAR;
  5347. private static _LIGHTMAP_SHADOWSONLY;
  5348. /**
  5349. * If every light affecting the material is in this lightmapMode,
  5350. * material.lightmapTexture adds or multiplies
  5351. * (depends on material.useLightmapAsShadowmap)
  5352. * after every other light calculations.
  5353. */
  5354. static readonly LIGHTMAP_DEFAULT: number;
  5355. /**
  5356. * material.lightmapTexture as only diffuse lighting from this light
  5357. * adds pnly specular lighting from this light
  5358. * adds dynamic shadows
  5359. */
  5360. static readonly LIGHTMAP_SPECULAR: number;
  5361. /**
  5362. * material.lightmapTexture as only lighting
  5363. * no light calculation from this light
  5364. * only adds dynamic shadows from this light
  5365. */
  5366. static readonly LIGHTMAP_SHADOWSONLY: number;
  5367. private static _INTENSITYMODE_AUTOMATIC;
  5368. private static _INTENSITYMODE_LUMINOUSPOWER;
  5369. private static _INTENSITYMODE_LUMINOUSINTENSITY;
  5370. private static _INTENSITYMODE_ILLUMINANCE;
  5371. private static _INTENSITYMODE_LUMINANCE;
  5372. /**
  5373. * Each light type uses the default quantity according to its type:
  5374. * point/spot lights use luminous intensity
  5375. * directional lights use illuminance
  5376. */
  5377. static readonly INTENSITYMODE_AUTOMATIC: number;
  5378. /**
  5379. * lumen (lm)
  5380. */
  5381. static readonly INTENSITYMODE_LUMINOUSPOWER: number;
  5382. /**
  5383. * candela (lm/sr)
  5384. */
  5385. static readonly INTENSITYMODE_LUMINOUSINTENSITY: number;
  5386. /**
  5387. * lux (lm/m^2)
  5388. */
  5389. static readonly INTENSITYMODE_ILLUMINANCE: number;
  5390. /**
  5391. * nit (cd/m^2)
  5392. */
  5393. static readonly INTENSITYMODE_LUMINANCE: number;
  5394. private static _LIGHTTYPEID_POINTLIGHT;
  5395. private static _LIGHTTYPEID_DIRECTIONALLIGHT;
  5396. private static _LIGHTTYPEID_SPOTLIGHT;
  5397. private static _LIGHTTYPEID_HEMISPHERICLIGHT;
  5398. /**
  5399. * Light type const id of the point light.
  5400. */
  5401. static readonly LIGHTTYPEID_POINTLIGHT: number;
  5402. /**
  5403. * Light type const id of the directional light.
  5404. */
  5405. static readonly LIGHTTYPEID_DIRECTIONALLIGHT: number;
  5406. /**
  5407. * Light type const id of the spot light.
  5408. */
  5409. static readonly LIGHTTYPEID_SPOTLIGHT: number;
  5410. /**
  5411. * Light type const id of the hemispheric light.
  5412. */
  5413. static readonly LIGHTTYPEID_HEMISPHERICLIGHT: number;
  5414. diffuse: Color3;
  5415. specular: Color3;
  5416. intensity: number;
  5417. range: number;
  5418. /**
  5419. * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type
  5420. * of light.
  5421. */
  5422. private _photometricScale;
  5423. private _intensityMode;
  5424. /**
  5425. * Gets the photometric scale used to interpret the intensity.
  5426. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  5427. */
  5428. /**
  5429. * Sets the photometric scale used to interpret the intensity.
  5430. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.
  5431. */
  5432. intensityMode: number;
  5433. private _radius;
  5434. /**
  5435. * Gets the light radius used by PBR Materials to simulate soft area lights.
  5436. */
  5437. /**
  5438. * sets the light radius used by PBR Materials to simulate soft area lights.
  5439. */
  5440. radius: number;
  5441. /**
  5442. * Defines the rendering priority of the lights. It can help in case of fallback or number of lights
  5443. * exceeding the number allowed of the materials.
  5444. */
  5445. private _renderPriority;
  5446. renderPriority: number;
  5447. /**
  5448. * Defines wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
  5449. * the current shadow generator.
  5450. */
  5451. shadowEnabled: boolean;
  5452. private _includedOnlyMeshes;
  5453. includedOnlyMeshes: AbstractMesh[];
  5454. private _excludedMeshes;
  5455. excludedMeshes: AbstractMesh[];
  5456. private _excludeWithLayerMask;
  5457. excludeWithLayerMask: number;
  5458. private _includeOnlyWithLayerMask;
  5459. includeOnlyWithLayerMask: number;
  5460. private _lightmapMode;
  5461. lightmapMode: number;
  5462. private _parentedWorldMatrix;
  5463. _shadowGenerator: Nullable<IShadowGenerator>;
  5464. _excludedMeshesIds: string[];
  5465. _includedOnlyMeshesIds: string[];
  5466. _uniformBuffer: UniformBuffer;
  5467. /**
  5468. * Creates a Light object in the scene.
  5469. * Documentation : http://doc.babylonjs.com/tutorials/lights
  5470. */
  5471. constructor(name: string, scene: Scene);
  5472. protected _buildUniformLayout(): void;
  5473. /**
  5474. * Returns the string "Light".
  5475. */
  5476. getClassName(): string;
  5477. /**
  5478. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5479. */
  5480. toString(fullDetails?: boolean): string;
  5481. /**
  5482. * Set the enabled state of this node.
  5483. * @param {boolean} value - the new enabled state
  5484. * @see isEnabled
  5485. */
  5486. setEnabled(value: boolean): void;
  5487. /**
  5488. * Returns the Light associated shadow generator.
  5489. */
  5490. getShadowGenerator(): Nullable<IShadowGenerator>;
  5491. /**
  5492. * Returns a Vector3, the absolute light position in the World.
  5493. */
  5494. getAbsolutePosition(): Vector3;
  5495. transferToEffect(effect: Effect, lightIndex: string): void;
  5496. _getWorldMatrix(): Matrix;
  5497. /**
  5498. * Boolean : True if the light will affect the passed mesh.
  5499. */
  5500. canAffectMesh(mesh: AbstractMesh): boolean;
  5501. /**
  5502. * Returns the light World matrix.
  5503. */
  5504. getWorldMatrix(): Matrix;
  5505. /**
  5506. * Sort function to order lights for rendering.
  5507. * @param a First Light object to compare to second.
  5508. * @param b Second Light object to compare first.
  5509. * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.
  5510. */
  5511. static compareLightsPriority(a: Light, b: Light): number;
  5512. /**
  5513. * Disposes the light.
  5514. */
  5515. dispose(): void;
  5516. /**
  5517. * Returns the light type ID (integer).
  5518. */
  5519. getTypeID(): number;
  5520. /**
  5521. * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.
  5522. */
  5523. getScaledIntensity(): number;
  5524. /**
  5525. * Returns a new Light object, named "name", from the current one.
  5526. */
  5527. clone(name: string): Nullable<Light>;
  5528. /**
  5529. * Serializes the current light into a Serialization object.
  5530. * Returns the serialized object.
  5531. */
  5532. serialize(): any;
  5533. /**
  5534. * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.
  5535. * This new light is named "name" and added to the passed scene.
  5536. */
  5537. static GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<() => Light>;
  5538. /**
  5539. * Parses the passed "parsedLight" and returns a new instanced Light from this parsing.
  5540. */
  5541. static Parse(parsedLight: any, scene: Scene): Nullable<Light>;
  5542. private _hookArrayForExcluded(array);
  5543. private _hookArrayForIncludedOnly(array);
  5544. private _resyncMeshes();
  5545. _markMeshesAsLightDirty(): void;
  5546. /**
  5547. * Recomputes the cached photometric scale if needed.
  5548. */
  5549. private _computePhotometricScale();
  5550. /**
  5551. * Returns the Photometric Scale according to the light type and intensity mode.
  5552. */
  5553. private _getPhotometricScale();
  5554. _reorderLightsInScene(): void;
  5555. }
  5556. }
  5557. declare module 'babylonjs/core' {
  5558. class Camera extends Node {
  5559. inputs: CameraInputsManager<Camera>;
  5560. private static _PERSPECTIVE_CAMERA;
  5561. private static _ORTHOGRAPHIC_CAMERA;
  5562. private static _FOVMODE_VERTICAL_FIXED;
  5563. private static _FOVMODE_HORIZONTAL_FIXED;
  5564. private static _RIG_MODE_NONE;
  5565. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  5566. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  5567. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  5568. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  5569. private static _RIG_MODE_VR;
  5570. private static _RIG_MODE_WEBVR;
  5571. static readonly PERSPECTIVE_CAMERA: number;
  5572. static readonly ORTHOGRAPHIC_CAMERA: number;
  5573. /**
  5574. * This is the default FOV mode for perspective cameras.
  5575. * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.
  5576. *
  5577. */
  5578. static readonly FOVMODE_VERTICAL_FIXED: number;
  5579. /**
  5580. * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.
  5581. *
  5582. */
  5583. static readonly FOVMODE_HORIZONTAL_FIXED: number;
  5584. static readonly RIG_MODE_NONE: number;
  5585. static readonly RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  5586. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  5587. static readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  5588. static readonly RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  5589. static readonly RIG_MODE_VR: number;
  5590. static readonly RIG_MODE_WEBVR: number;
  5591. static ForceAttachControlToAlwaysPreventDefault: boolean;
  5592. static UseAlternateWebVRRendering: boolean;
  5593. position: Vector3;
  5594. upVector: Vector3;
  5595. orthoLeft: Nullable<number>;
  5596. orthoRight: Nullable<number>;
  5597. orthoBottom: Nullable<number>;
  5598. orthoTop: Nullable<number>;
  5599. /**
  5600. * default : 0.8
  5601. * FOV is set in Radians.
  5602. */
  5603. fov: number;
  5604. minZ: number;
  5605. maxZ: number;
  5606. inertia: number;
  5607. mode: number;
  5608. isIntermediate: boolean;
  5609. viewport: Viewport;
  5610. /**
  5611. * Restricts the camera to viewing objects with the same layerMask.
  5612. * A camera with a layerMask of 1 will render meshes with no layerMask and meshes with a layerMask of 1.
  5613. */
  5614. layerMask: number;
  5615. /**
  5616. * default : FOVMODE_VERTICAL_FIXED
  5617. * fovMode sets the camera frustum bounds to the viewport bounds.
  5618. */
  5619. fovMode: number;
  5620. cameraRigMode: number;
  5621. interaxialDistance: number;
  5622. isStereoscopicSideBySide: boolean;
  5623. _cameraRigParams: any;
  5624. _rigCameras: Camera[];
  5625. _rigPostProcess: Nullable<PostProcess>;
  5626. protected _webvrViewMatrix: Matrix;
  5627. _skipRendering: boolean;
  5628. _alternateCamera: Camera;
  5629. customRenderTargets: RenderTargetTexture[];
  5630. onViewMatrixChangedObservable: Observable<Camera>;
  5631. onProjectionMatrixChangedObservable: Observable<Camera>;
  5632. onAfterCheckInputsObservable: Observable<Camera>;
  5633. onRestoreStateObservable: Observable<Camera>;
  5634. private _computedViewMatrix;
  5635. _projectionMatrix: Matrix;
  5636. private _doNotComputeProjectionMatrix;
  5637. private _worldMatrix;
  5638. _postProcesses: PostProcess[];
  5639. private _transformMatrix;
  5640. _activeMeshes: SmartArray<AbstractMesh>;
  5641. private _globalPosition;
  5642. private _frustumPlanes;
  5643. private _refreshFrustumPlanes;
  5644. constructor(name: string, position: Vector3, scene: Scene);
  5645. private _storedFov;
  5646. private _stateStored;
  5647. /**
  5648. * Store current camera state (fov, position, etc..)
  5649. */
  5650. storeState(): Camera;
  5651. /**
  5652. * Restores the camera state values if it has been stored. You must call storeState() first
  5653. */
  5654. protected _restoreStateValues(): boolean;
  5655. /**
  5656. * Restored camera state. You must call storeState() first
  5657. */
  5658. restoreState(): boolean;
  5659. getClassName(): string;
  5660. /**
  5661. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5662. */
  5663. toString(fullDetails?: boolean): string;
  5664. readonly globalPosition: Vector3;
  5665. getActiveMeshes(): SmartArray<AbstractMesh>;
  5666. isActiveMesh(mesh: Mesh): boolean;
  5667. _initCache(): void;
  5668. _updateCache(ignoreParentClass?: boolean): void;
  5669. _isSynchronized(): boolean;
  5670. _isSynchronizedViewMatrix(): boolean;
  5671. _isSynchronizedProjectionMatrix(): boolean;
  5672. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  5673. detachControl(element: HTMLElement): void;
  5674. update(): void;
  5675. _checkInputs(): void;
  5676. readonly rigCameras: Camera[];
  5677. readonly rigPostProcess: Nullable<PostProcess>;
  5678. private _cascadePostProcessesToRigCams();
  5679. attachPostProcess(postProcess: PostProcess, insertAt?: Nullable<number>): number;
  5680. detachPostProcess(postProcess: PostProcess): void;
  5681. getWorldMatrix(): Matrix;
  5682. _getViewMatrix(): Matrix;
  5683. getViewMatrix(force?: boolean): Matrix;
  5684. freezeProjectionMatrix(projection?: Matrix): void;
  5685. unfreezeProjectionMatrix(): void;
  5686. getProjectionMatrix(force?: boolean): Matrix;
  5687. getTranformationMatrix(): Matrix;
  5688. private updateFrustumPlanes();
  5689. isInFrustum(target: ICullable): boolean;
  5690. isCompletelyInFrustum(target: ICullable): boolean;
  5691. getForwardRay(length?: number, transform?: Matrix, origin?: Vector3): Ray;
  5692. dispose(): void;
  5693. readonly leftCamera: Nullable<FreeCamera>;
  5694. readonly rightCamera: Nullable<FreeCamera>;
  5695. getLeftTarget(): Nullable<Vector3>;
  5696. getRightTarget(): Nullable<Vector3>;
  5697. setCameraRigMode(mode: number, rigParams: any): void;
  5698. private _getVRProjectionMatrix();
  5699. protected _updateCameraRotationMatrix(): void;
  5700. protected _updateWebVRCameraRotationMatrix(): void;
  5701. /**
  5702. * This function MUST be overwritten by the different WebVR cameras available.
  5703. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  5704. */
  5705. protected _getWebVRProjectionMatrix(): Matrix;
  5706. /**
  5707. * This function MUST be overwritten by the different WebVR cameras available.
  5708. * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.
  5709. */
  5710. protected _getWebVRViewMatrix(): Matrix;
  5711. setCameraRigParameter(name: string, value: any): void;
  5712. /**
  5713. * needs to be overridden by children so sub has required properties to be copied
  5714. */
  5715. createRigCamera(name: string, cameraIndex: number): Nullable<Camera>;
  5716. /**
  5717. * May need to be overridden by children
  5718. */
  5719. _updateRigCameras(): void;
  5720. _setupInputs(): void;
  5721. serialize(): any;
  5722. clone(name: string): Camera;
  5723. getDirection(localAxis: Vector3): Vector3;
  5724. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  5725. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  5726. computeWorldMatrix(): Matrix;
  5727. static Parse(parsedCamera: any, scene: Scene): Camera;
  5728. }
  5729. }
  5730. declare module 'babylonjs/core' {
  5731. class RenderingManager {
  5732. /**
  5733. * The max id used for rendering groups (not included)
  5734. */
  5735. static MAX_RENDERINGGROUPS: number;
  5736. /**
  5737. * The min id used for rendering groups (included)
  5738. */
  5739. static MIN_RENDERINGGROUPS: number;
  5740. /**
  5741. * Used to globally prevent autoclearing scenes.
  5742. */
  5743. static AUTOCLEAR: boolean;
  5744. private _scene;
  5745. private _renderingGroups;
  5746. private _depthStencilBufferAlreadyCleaned;
  5747. private _autoClearDepthStencil;
  5748. private _customOpaqueSortCompareFn;
  5749. private _customAlphaTestSortCompareFn;
  5750. private _customTransparentSortCompareFn;
  5751. private _renderinGroupInfo;
  5752. constructor(scene: Scene);
  5753. private _clearDepthStencilBuffer(depth?, stencil?);
  5754. render(customRenderFunction: Nullable<(opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>) => void>, activeMeshes: Nullable<AbstractMesh[]>, renderParticles: boolean, renderSprites: boolean): void;
  5755. reset(): void;
  5756. dispose(): void;
  5757. private _prepareRenderingGroup(renderingGroupId);
  5758. dispatchSprites(spriteManager: SpriteManager): void;
  5759. dispatchParticles(particleSystem: IParticleSystem): void;
  5760. /**
  5761. * @param subMesh The submesh to dispatch
  5762. * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.
  5763. * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.
  5764. */
  5765. dispatch(subMesh: SubMesh, mesh?: AbstractMesh, material?: Nullable<Material>): void;
  5766. /**
  5767. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  5768. * This allowed control for front to back rendering or reversly depending of the special needs.
  5769. *
  5770. * @param renderingGroupId The rendering group id corresponding to its index
  5771. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  5772. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  5773. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  5774. */
  5775. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>): void;
  5776. /**
  5777. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  5778. *
  5779. * @param renderingGroupId The rendering group id corresponding to its index
  5780. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  5781. * @param depth Automatically clears depth between groups if true and autoClear is true.
  5782. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  5783. */
  5784. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  5785. }
  5786. }
  5787. declare module 'babylonjs/core' {
  5788. class RenderingGroup {
  5789. index: number;
  5790. private _scene;
  5791. private _opaqueSubMeshes;
  5792. private _transparentSubMeshes;
  5793. private _alphaTestSubMeshes;
  5794. private _depthOnlySubMeshes;
  5795. private _particleSystems;
  5796. private _spriteManagers;
  5797. private _opaqueSortCompareFn;
  5798. private _alphaTestSortCompareFn;
  5799. private _transparentSortCompareFn;
  5800. private _renderOpaque;
  5801. private _renderAlphaTest;
  5802. private _renderTransparent;
  5803. private _edgesRenderers;
  5804. onBeforeTransparentRendering: () => void;
  5805. /**
  5806. * Set the opaque sort comparison function.
  5807. * If null the sub meshes will be render in the order they were created
  5808. */
  5809. opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  5810. /**
  5811. * Set the alpha test sort comparison function.
  5812. * If null the sub meshes will be render in the order they were created
  5813. */
  5814. alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  5815. /**
  5816. * Set the transparent sort comparison function.
  5817. * If null the sub meshes will be render in the order they were created
  5818. */
  5819. transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number>;
  5820. /**
  5821. * Creates a new rendering group.
  5822. * @param index The rendering group index
  5823. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  5824. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  5825. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  5826. */
  5827. constructor(index: number, scene: Scene, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>);
  5828. /**
  5829. * Render all the sub meshes contained in the group.
  5830. * @param customRenderFunction Used to override the default render behaviour of the group.
  5831. * @returns true if rendered some submeshes.
  5832. */
  5833. render(customRenderFunction: Nullable<(opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>) => void>, renderSprites: boolean, renderParticles: boolean, activeMeshes: Nullable<AbstractMesh[]>): void;
  5834. /**
  5835. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  5836. * @param subMeshes The submeshes to render
  5837. */
  5838. private renderOpaqueSorted(subMeshes);
  5839. /**
  5840. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  5841. * @param subMeshes The submeshes to render
  5842. */
  5843. private renderAlphaTestSorted(subMeshes);
  5844. /**
  5845. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  5846. * @param subMeshes The submeshes to render
  5847. */
  5848. private renderTransparentSorted(subMeshes);
  5849. /**
  5850. * Renders the submeshes in a specified order.
  5851. * @param subMeshes The submeshes to sort before render
  5852. * @param sortCompareFn The comparison function use to sort
  5853. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  5854. * @param transparent Specifies to activate blending if true
  5855. */
  5856. private static renderSorted(subMeshes, sortCompareFn, camera, transparent);
  5857. /**
  5858. * Renders the submeshes in the order they were dispatched (no sort applied).
  5859. * @param subMeshes The submeshes to render
  5860. */
  5861. private static renderUnsorted(subMeshes);
  5862. /**
  5863. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  5864. * are rendered back to front if in the same alpha index.
  5865. *
  5866. * @param a The first submesh
  5867. * @param b The second submesh
  5868. * @returns The result of the comparison
  5869. */
  5870. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  5871. /**
  5872. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  5873. * are rendered back to front.
  5874. *
  5875. * @param a The first submesh
  5876. * @param b The second submesh
  5877. * @returns The result of the comparison
  5878. */
  5879. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  5880. /**
  5881. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  5882. * are rendered front to back (prevent overdraw).
  5883. *
  5884. * @param a The first submesh
  5885. * @param b The second submesh
  5886. * @returns The result of the comparison
  5887. */
  5888. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  5889. /**
  5890. * Resets the different lists of submeshes to prepare a new frame.
  5891. */
  5892. prepare(): void;
  5893. dispose(): void;
  5894. /**
  5895. * Inserts the submesh in its correct queue depending on its material.
  5896. * @param subMesh The submesh to dispatch
  5897. * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.
  5898. * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.
  5899. */
  5900. dispatch(subMesh: SubMesh, mesh?: AbstractMesh, material?: Nullable<Material>): void;
  5901. dispatchSprites(spriteManager: SpriteManager): void;
  5902. dispatchParticles(particleSystem: IParticleSystem): void;
  5903. private _renderParticles(activeMeshes);
  5904. private _renderSprites();
  5905. }
  5906. }
  5907. declare module 'babylonjs/core' {
  5908. interface IDisposable {
  5909. dispose(): void;
  5910. }
  5911. interface IActiveMeshCandidateProvider {
  5912. getMeshes(scene: Scene): AbstractMesh[];
  5913. readonly checksIsEnabled: boolean;
  5914. }
  5915. /**
  5916. * This class is used by the onRenderingGroupObservable
  5917. */
  5918. class RenderingGroupInfo {
  5919. /**
  5920. * The Scene that being rendered
  5921. */
  5922. scene: Scene;
  5923. /**
  5924. * The camera currently used for the rendering pass
  5925. */
  5926. camera: Nullable<Camera>;
  5927. /**
  5928. * The ID of the renderingGroup being processed
  5929. */
  5930. renderingGroupId: number;
  5931. /**
  5932. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  5933. */
  5934. renderStage: number;
  5935. /**
  5936. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  5937. * This stage will be fired no matter what
  5938. */
  5939. static STAGE_PRECLEAR: number;
  5940. /**
  5941. * Called before opaque object are rendered.
  5942. * This stage will be fired only if there's 3D Opaque content to render
  5943. */
  5944. static STAGE_PREOPAQUE: number;
  5945. /**
  5946. * Called after the opaque objects are rendered and before the transparent ones
  5947. * This stage will be fired only if there's 3D transparent content to render
  5948. */
  5949. static STAGE_PRETRANSPARENT: number;
  5950. /**
  5951. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  5952. * This stage will be fired no matter what
  5953. */
  5954. static STAGE_POSTTRANSPARENT: number;
  5955. }
  5956. /**
  5957. * Represents a scene to be rendered by the engine.
  5958. * @see http://doc.babylonjs.com/page.php?p=21911
  5959. */
  5960. class Scene implements IAnimatable {
  5961. private static _FOGMODE_NONE;
  5962. private static _FOGMODE_EXP;
  5963. private static _FOGMODE_EXP2;
  5964. private static _FOGMODE_LINEAR;
  5965. private static _uniqueIdCounter;
  5966. static MinDeltaTime: number;
  5967. static MaxDeltaTime: number;
  5968. /** The fog is deactivated */
  5969. static readonly FOGMODE_NONE: number;
  5970. /** The fog density is following an exponential function */
  5971. static readonly FOGMODE_EXP: number;
  5972. /** The fog density is following an exponential function faster than FOGMODE_EXP */
  5973. static readonly FOGMODE_EXP2: number;
  5974. /** The fog density is following a linear function. */
  5975. static readonly FOGMODE_LINEAR: number;
  5976. autoClear: boolean;
  5977. autoClearDepthAndStencil: boolean;
  5978. clearColor: Color4;
  5979. ambientColor: Color3;
  5980. _environmentBRDFTexture: BaseTexture;
  5981. protected _environmentTexture: BaseTexture;
  5982. /**
  5983. * Texture used in all pbr material as the reflection texture.
  5984. * As in the majority of the scene they are the same (exception for multi room and so on),
  5985. * this is easier to reference from here than from all the materials.
  5986. */
  5987. /**
  5988. * Texture used in all pbr material as the reflection texture.
  5989. * As in the majority of the scene they are the same (exception for multi room and so on),
  5990. * this is easier to set here than in all the materials.
  5991. */
  5992. environmentTexture: BaseTexture;
  5993. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  5994. /**
  5995. * Default image processing configuration used either in the rendering
  5996. * Forward main pass or through the imageProcessingPostProcess if present.
  5997. * As in the majority of the scene they are the same (exception for multi camera),
  5998. * this is easier to reference from here than from all the materials and post process.
  5999. *
  6000. * No setter as we it is a shared configuration, you can set the values instead.
  6001. */
  6002. readonly imageProcessingConfiguration: ImageProcessingConfiguration;
  6003. forceWireframe: boolean;
  6004. private _forcePointsCloud;
  6005. forcePointsCloud: boolean;
  6006. forceShowBoundingBoxes: boolean;
  6007. clipPlane: Nullable<Plane>;
  6008. animationsEnabled: boolean;
  6009. useConstantAnimationDeltaTime: boolean;
  6010. constantlyUpdateMeshUnderPointer: boolean;
  6011. hoverCursor: string;
  6012. defaultCursor: string;
  6013. /**
  6014. * This is used to call preventDefault() on pointer down
  6015. * in order to block unwanted artifacts like system double clicks
  6016. */
  6017. preventDefaultOnPointerDown: boolean;
  6018. metadata: any;
  6019. loadingPluginName: string;
  6020. private _spritePredicate;
  6021. /**
  6022. * An event triggered when the scene is disposed.
  6023. * @type {BABYLON.Observable}
  6024. */
  6025. onDisposeObservable: Observable<Scene>;
  6026. private _onDisposeObserver;
  6027. /** A function to be executed when this scene is disposed. */
  6028. onDispose: () => void;
  6029. /**
  6030. * An event triggered before rendering the scene (right after animations and physics)
  6031. * @type {BABYLON.Observable}
  6032. */
  6033. onBeforeRenderObservable: Observable<Scene>;
  6034. private _onBeforeRenderObserver;
  6035. /** A function to be executed before rendering this scene */
  6036. beforeRender: Nullable<() => void>;
  6037. /**
  6038. * An event triggered after rendering the scene
  6039. * @type {BABYLON.Observable}
  6040. */
  6041. onAfterRenderObservable: Observable<Scene>;
  6042. private _onAfterRenderObserver;
  6043. /** A function to be executed after rendering this scene */
  6044. afterRender: Nullable<() => void>;
  6045. /**
  6046. * An event triggered before animating the scene
  6047. * @type {BABYLON.Observable}
  6048. */
  6049. onBeforeAnimationsObservable: Observable<Scene>;
  6050. /**
  6051. * An event triggered after animations processing
  6052. * @type {BABYLON.Observable}
  6053. */
  6054. onAfterAnimationsObservable: Observable<Scene>;
  6055. /**
  6056. * An event triggered before draw calls are ready to be sent
  6057. * @type {BABYLON.Observable}
  6058. */
  6059. onBeforeDrawPhaseObservable: Observable<Scene>;
  6060. /**
  6061. * An event triggered after draw calls have been sent
  6062. * @type {BABYLON.Observable}
  6063. */
  6064. onAfterDrawPhaseObservable: Observable<Scene>;
  6065. /**
  6066. * An event triggered when physic simulation is about to be run
  6067. * @type {BABYLON.Observable}
  6068. */
  6069. onBeforePhysicsObservable: Observable<Scene>;
  6070. /**
  6071. * An event triggered when physic simulation has been done
  6072. * @type {BABYLON.Observable}
  6073. */
  6074. onAfterPhysicsObservable: Observable<Scene>;
  6075. /**
  6076. * An event triggered when the scene is ready
  6077. * @type {BABYLON.Observable}
  6078. */
  6079. onReadyObservable: Observable<Scene>;
  6080. /**
  6081. * An event triggered before rendering a camera
  6082. * @type {BABYLON.Observable}
  6083. */
  6084. onBeforeCameraRenderObservable: Observable<Camera>;
  6085. private _onBeforeCameraRenderObserver;
  6086. beforeCameraRender: () => void;
  6087. /**
  6088. * An event triggered after rendering a camera
  6089. * @type {BABYLON.Observable}
  6090. */
  6091. onAfterCameraRenderObservable: Observable<Camera>;
  6092. private _onAfterCameraRenderObserver;
  6093. afterCameraRender: () => void;
  6094. /**
  6095. * An event triggered when active meshes evaluation is about to start
  6096. * @type {BABYLON.Observable}
  6097. */
  6098. onBeforeActiveMeshesEvaluationObservable: Observable<Scene>;
  6099. /**
  6100. * An event triggered when active meshes evaluation is done
  6101. * @type {BABYLON.Observable}
  6102. */
  6103. onAfterActiveMeshesEvaluationObservable: Observable<Scene>;
  6104. /**
  6105. * An event triggered when particles rendering is about to start
  6106. * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)
  6107. * @type {BABYLON.Observable}
  6108. */
  6109. onBeforeParticlesRenderingObservable: Observable<Scene>;
  6110. /**
  6111. * An event triggered when particles rendering is done
  6112. * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)
  6113. * @type {BABYLON.Observable}
  6114. */
  6115. onAfterParticlesRenderingObservable: Observable<Scene>;
  6116. /**
  6117. * An event triggered when sprites rendering is about to start
  6118. * Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)
  6119. * @type {BABYLON.Observable}
  6120. */
  6121. onBeforeSpritesRenderingObservable: Observable<Scene>;
  6122. /**
  6123. * An event triggered when sprites rendering is done
  6124. * Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)
  6125. * @type {BABYLON.Observable}
  6126. */
  6127. onAfterSpritesRenderingObservable: Observable<Scene>;
  6128. /**
  6129. * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed
  6130. * @type {BABYLON.Observable}
  6131. */
  6132. onDataLoadedObservable: Observable<Scene>;
  6133. /**
  6134. * An event triggered when a camera is created
  6135. * @type {BABYLON.Observable}
  6136. */
  6137. onNewCameraAddedObservable: Observable<Camera>;
  6138. /**
  6139. * An event triggered when a camera is removed
  6140. * @type {BABYLON.Observable}
  6141. */
  6142. onCameraRemovedObservable: Observable<Camera>;
  6143. /**
  6144. * An event triggered when a light is created
  6145. * @type {BABYLON.Observable}
  6146. */
  6147. onNewLightAddedObservable: Observable<Light>;
  6148. /**
  6149. * An event triggered when a light is removed
  6150. * @type {BABYLON.Observable}
  6151. */
  6152. onLightRemovedObservable: Observable<Light>;
  6153. /**
  6154. * An event triggered when a geometry is created
  6155. * @type {BABYLON.Observable}
  6156. */
  6157. onNewGeometryAddedObservable: Observable<Geometry>;
  6158. /**
  6159. * An event triggered when a geometry is removed
  6160. * @type {BABYLON.Observable}
  6161. */
  6162. onGeometryRemovedObservable: Observable<Geometry>;
  6163. /**
  6164. * An event triggered when a transform node is created
  6165. * @type {BABYLON.Observable}
  6166. */
  6167. onNewTransformNodeAddedObservable: Observable<TransformNode>;
  6168. /**
  6169. * An event triggered when a transform node is removed
  6170. * @type {BABYLON.Observable}
  6171. */
  6172. onTransformNodeRemovedObservable: Observable<TransformNode>;
  6173. /**
  6174. * An event triggered when a mesh is created
  6175. * @type {BABYLON.Observable}
  6176. */
  6177. onNewMeshAddedObservable: Observable<AbstractMesh>;
  6178. /**
  6179. * An event triggered when a mesh is removed
  6180. * @type {BABYLON.Observable}
  6181. */
  6182. onMeshRemovedObservable: Observable<AbstractMesh>;
  6183. /**
  6184. * An event triggered when render targets are about to be rendered
  6185. * Can happen multiple times per frame.
  6186. * @type {BABYLON.Observable}
  6187. */
  6188. OnBeforeRenderTargetsRenderObservable: Observable<Scene>;
  6189. /**
  6190. * An event triggered when render targets were rendered.
  6191. * Can happen multiple times per frame.
  6192. * @type {BABYLON.Observable}
  6193. */
  6194. OnAfterRenderTargetsRenderObservable: Observable<Scene>;
  6195. /**
  6196. * An event triggered before calculating deterministic simulation step
  6197. * @type {BABYLON.Observable}
  6198. */
  6199. onBeforeStepObservable: Observable<Scene>;
  6200. /**
  6201. * An event triggered after calculating deterministic simulation step
  6202. * @type {BABYLON.Observable}
  6203. */
  6204. onAfterStepObservable: Observable<Scene>;
  6205. /**
  6206. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  6207. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  6208. * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)
  6209. */
  6210. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  6211. animations: Animation[];
  6212. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  6213. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  6214. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  6215. private _onPointerMove;
  6216. private _onPointerDown;
  6217. private _onPointerUp;
  6218. /** Deprecated. Use onPointerObservable instead */
  6219. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  6220. /** Deprecated. Use onPointerObservable instead */
  6221. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  6222. /** Deprecated. Use onPointerObservable instead */
  6223. onPointerUp: (evt: PointerEvent, pickInfo: Nullable<PickingInfo>) => void;
  6224. /** Deprecated. Use onPointerObservable instead */
  6225. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  6226. private _gamepadManager;
  6227. readonly gamepadManager: GamepadManager;
  6228. /**
  6229. * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).
  6230. * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true
  6231. */
  6232. onPrePointerObservable: Observable<PointerInfoPre>;
  6233. /**
  6234. * Observable event triggered each time an input event is received from the rendering canvas
  6235. */
  6236. onPointerObservable: Observable<PointerInfo>;
  6237. readonly unTranslatedPointer: Vector2;
  6238. /** The distance in pixel that you have to move to prevent some events */
  6239. static DragMovementThreshold: number;
  6240. /** Time in milliseconds to wait to raise long press events if button is still pressed */
  6241. static LongPressDelay: number;
  6242. /** Time in milliseconds with two consecutive clicks will be considered as a double click */
  6243. static DoubleClickDelay: number;
  6244. /** If you need to check double click without raising a single click at first click, enable this flag */
  6245. static ExclusiveDoubleClickMode: boolean;
  6246. private _initClickEvent;
  6247. private _initActionManager;
  6248. private _delayedSimpleClick;
  6249. private _delayedSimpleClickTimeout;
  6250. private _previousDelayedSimpleClickTimeout;
  6251. private _meshPickProceed;
  6252. private _previousButtonPressed;
  6253. private _currentPickResult;
  6254. private _previousPickResult;
  6255. private _totalPointersPressed;
  6256. private _doubleClickOccured;
  6257. /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */
  6258. cameraToUseForPointers: Nullable<Camera>;
  6259. private _pointerX;
  6260. private _pointerY;
  6261. private _unTranslatedPointerX;
  6262. private _unTranslatedPointerY;
  6263. private _startingPointerPosition;
  6264. private _previousStartingPointerPosition;
  6265. private _startingPointerTime;
  6266. private _previousStartingPointerTime;
  6267. private _timeAccumulator;
  6268. private _currentStepId;
  6269. private _currentInternalStep;
  6270. _mirroredCameraPosition: Nullable<Vector3>;
  6271. /**
  6272. * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()
  6273. * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true
  6274. */
  6275. onPreKeyboardObservable: Observable<KeyboardInfoPre>;
  6276. /**
  6277. * Observable event triggered each time an keyboard event is received from the hosting window
  6278. */
  6279. onKeyboardObservable: Observable<KeyboardInfo>;
  6280. private _onKeyDown;
  6281. private _onKeyUp;
  6282. private _onCanvasFocusObserver;
  6283. private _onCanvasBlurObserver;
  6284. /**
  6285. * use right-handed coordinate system on this scene.
  6286. * @type {boolean}
  6287. */
  6288. private _useRightHandedSystem;
  6289. useRightHandedSystem: boolean;
  6290. setStepId(newStepId: number): void;
  6291. getStepId(): number;
  6292. getInternalStep(): number;
  6293. private _fogEnabled;
  6294. /**
  6295. * is fog enabled on this scene.
  6296. */
  6297. fogEnabled: boolean;
  6298. private _fogMode;
  6299. fogMode: number;
  6300. fogColor: Color3;
  6301. fogDensity: number;
  6302. fogStart: number;
  6303. fogEnd: number;
  6304. /**
  6305. * is shadow enabled on this scene.
  6306. * @type {boolean}
  6307. */
  6308. private _shadowsEnabled;
  6309. shadowsEnabled: boolean;
  6310. /**
  6311. * is light enabled on this scene.
  6312. * @type {boolean}
  6313. */
  6314. private _lightsEnabled;
  6315. lightsEnabled: boolean;
  6316. /**
  6317. * All of the lights added to this scene.
  6318. * @see BABYLON.Light
  6319. * @type {BABYLON.Light[]}
  6320. */
  6321. lights: Light[];
  6322. /** All of the cameras added to this scene. */
  6323. cameras: Camera[];
  6324. /** All of the active cameras added to this scene. */
  6325. activeCameras: Camera[];
  6326. /** The current active camera */
  6327. activeCamera: Nullable<Camera>;
  6328. /**
  6329. * All of the tranform nodes added to this scene.
  6330. * @see BABYLON.TransformNode
  6331. * @type {BABYLON.TransformNode[]}
  6332. */
  6333. transformNodes: TransformNode[];
  6334. /**
  6335. * All of the (abstract) meshes added to this scene.
  6336. * @see BABYLON.AbstractMesh
  6337. * @type {BABYLON.AbstractMesh[]}
  6338. */
  6339. meshes: AbstractMesh[];
  6340. /**
  6341. * All of the animation groups added to this scene.
  6342. * @see BABYLON.AnimationGroup
  6343. * @type {BABYLON.AnimationGroup[]}
  6344. */
  6345. animationGroups: AnimationGroup[];
  6346. private _geometries;
  6347. materials: Material[];
  6348. multiMaterials: MultiMaterial[];
  6349. private _defaultMaterial;
  6350. /** The default material used on meshes when no material is affected */
  6351. /** The default material used on meshes when no material is affected */
  6352. defaultMaterial: Material;
  6353. private _texturesEnabled;
  6354. texturesEnabled: boolean;
  6355. textures: BaseTexture[];
  6356. particlesEnabled: boolean;
  6357. particleSystems: IParticleSystem[];
  6358. spritesEnabled: boolean;
  6359. spriteManagers: SpriteManager[];
  6360. layers: Layer[];
  6361. highlightLayers: HighlightLayer[];
  6362. private _skeletonsEnabled;
  6363. skeletonsEnabled: boolean;
  6364. skeletons: Skeleton[];
  6365. morphTargetManagers: MorphTargetManager[];
  6366. lensFlaresEnabled: boolean;
  6367. lensFlareSystems: LensFlareSystem[];
  6368. collisionsEnabled: boolean;
  6369. private _workerCollisions;
  6370. collisionCoordinator: ICollisionCoordinator;
  6371. /** Defines the gravity applied to this scene */
  6372. gravity: Vector3;
  6373. postProcesses: PostProcess[];
  6374. postProcessesEnabled: boolean;
  6375. postProcessManager: PostProcessManager;
  6376. private _postProcessRenderPipelineManager;
  6377. readonly postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  6378. renderTargetsEnabled: boolean;
  6379. dumpNextRenderTargets: boolean;
  6380. customRenderTargets: RenderTargetTexture[];
  6381. useDelayedTextureLoading: boolean;
  6382. importedMeshesFiles: String[];
  6383. probesEnabled: boolean;
  6384. reflectionProbes: ReflectionProbe[];
  6385. database: Database;
  6386. /**
  6387. * This scene's action manager
  6388. * @type {BABYLON.ActionManager}
  6389. */
  6390. actionManager: ActionManager;
  6391. _actionManagers: ActionManager[];
  6392. private _meshesForIntersections;
  6393. proceduralTexturesEnabled: boolean;
  6394. _proceduralTextures: ProceduralTexture[];
  6395. private _mainSoundTrack;
  6396. soundTracks: SoundTrack[];
  6397. private _audioEnabled;
  6398. private _headphone;
  6399. readonly mainSoundTrack: SoundTrack;
  6400. VRHelper: VRExperienceHelper;
  6401. simplificationQueue: SimplificationQueue;
  6402. private _engine;
  6403. private _totalVertices;
  6404. _activeIndices: PerfCounter;
  6405. _activeParticles: PerfCounter;
  6406. _activeBones: PerfCounter;
  6407. private _animationRatio;
  6408. private _animationTimeLast;
  6409. private _animationTime;
  6410. animationTimeScale: number;
  6411. _cachedMaterial: Nullable<Material>;
  6412. _cachedEffect: Nullable<Effect>;
  6413. _cachedVisibility: Nullable<number>;
  6414. private _renderId;
  6415. private _executeWhenReadyTimeoutId;
  6416. private _intermediateRendering;
  6417. private _viewUpdateFlag;
  6418. private _projectionUpdateFlag;
  6419. private _alternateViewUpdateFlag;
  6420. private _alternateProjectionUpdateFlag;
  6421. _toBeDisposed: SmartArray<Nullable<IDisposable>>;
  6422. private _activeRequests;
  6423. private _pendingData;
  6424. private _isDisposed;
  6425. dispatchAllSubMeshesOfActiveMeshes: boolean;
  6426. private _activeMeshes;
  6427. private _processedMaterials;
  6428. private _renderTargets;
  6429. _activeParticleSystems: SmartArray<IParticleSystem>;
  6430. private _activeSkeletons;
  6431. private _softwareSkinnedMeshes;
  6432. private _renderingManager;
  6433. private _physicsEngine;
  6434. _activeAnimatables: Animatable[];
  6435. private _transformMatrix;
  6436. private _sceneUbo;
  6437. private _alternateSceneUbo;
  6438. private _pickWithRayInverseMatrix;
  6439. private _boundingBoxRenderer;
  6440. private _outlineRenderer;
  6441. private _viewMatrix;
  6442. private _projectionMatrix;
  6443. private _alternateViewMatrix;
  6444. private _alternateProjectionMatrix;
  6445. private _alternateTransformMatrix;
  6446. private _useAlternateCameraConfiguration;
  6447. private _alternateRendering;
  6448. _forcedViewPosition: Nullable<Vector3>;
  6449. readonly _isAlternateRenderingEnabled: boolean;
  6450. private _frustumPlanes;
  6451. readonly frustumPlanes: Plane[];
  6452. requireLightSorting: boolean;
  6453. private _selectionOctree;
  6454. private _pointerOverMesh;
  6455. private _pointerOverSprite;
  6456. private _debugLayer;
  6457. private _depthRenderer;
  6458. private _geometryBufferRenderer;
  6459. private _pickedDownMesh;
  6460. private _pickedUpMesh;
  6461. private _pickedDownSprite;
  6462. private _externalData;
  6463. private _uid;
  6464. /**
  6465. * @constructor
  6466. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  6467. */
  6468. constructor(engine: Engine);
  6469. readonly debugLayer: DebugLayer;
  6470. workerCollisions: boolean;
  6471. readonly selectionOctree: Octree<AbstractMesh>;
  6472. /**
  6473. * The mesh that is currently under the pointer.
  6474. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  6475. */
  6476. readonly meshUnderPointer: Nullable<AbstractMesh>;
  6477. /**
  6478. * Current on-screen X position of the pointer
  6479. * @return {number} X position of the pointer
  6480. */
  6481. readonly pointerX: number;
  6482. /**
  6483. * Current on-screen Y position of the pointer
  6484. * @return {number} Y position of the pointer
  6485. */
  6486. readonly pointerY: number;
  6487. getCachedMaterial(): Nullable<Material>;
  6488. getCachedEffect(): Nullable<Effect>;
  6489. getCachedVisibility(): Nullable<number>;
  6490. isCachedMaterialInvalid(material: Material, effect: Effect, visibility?: number): boolean;
  6491. getBoundingBoxRenderer(): BoundingBoxRenderer;
  6492. getOutlineRenderer(): OutlineRenderer;
  6493. getEngine(): Engine;
  6494. getTotalVertices(): number;
  6495. readonly totalVerticesPerfCounter: PerfCounter;
  6496. getActiveIndices(): number;
  6497. readonly totalActiveIndicesPerfCounter: PerfCounter;
  6498. getActiveParticles(): number;
  6499. readonly activeParticlesPerfCounter: PerfCounter;
  6500. getActiveBones(): number;
  6501. readonly activeBonesPerfCounter: PerfCounter;
  6502. getInterFramePerfCounter(): number;
  6503. readonly interFramePerfCounter: Nullable<PerfCounter>;
  6504. getLastFrameDuration(): number;
  6505. readonly lastFramePerfCounter: Nullable<PerfCounter>;
  6506. getEvaluateActiveMeshesDuration(): number;
  6507. readonly evaluateActiveMeshesDurationPerfCounter: Nullable<PerfCounter>;
  6508. getActiveMeshes(): SmartArray<AbstractMesh>;
  6509. getRenderTargetsDuration(): number;
  6510. getRenderDuration(): number;
  6511. readonly renderDurationPerfCounter: Nullable<PerfCounter>;
  6512. getParticlesDuration(): number;
  6513. readonly particlesDurationPerfCounter: Nullable<PerfCounter>;
  6514. getSpritesDuration(): number;
  6515. readonly spriteDuractionPerfCounter: Nullable<PerfCounter>;
  6516. getAnimationRatio(): number;
  6517. getRenderId(): number;
  6518. incrementRenderId(): void;
  6519. private _updatePointerPosition(evt);
  6520. private _createUbo();
  6521. private _createAlternateUbo();
  6522. /**
  6523. * Use this method to simulate a pointer move on a mesh
  6524. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  6525. */
  6526. simulatePointerMove(pickResult: PickingInfo): Scene;
  6527. private _processPointerMove(pickResult, evt);
  6528. /**
  6529. * Use this method to simulate a pointer down on a mesh
  6530. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  6531. */
  6532. simulatePointerDown(pickResult: PickingInfo): Scene;
  6533. private _processPointerDown(pickResult, evt);
  6534. /**
  6535. * Use this method to simulate a pointer up on a mesh
  6536. * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
  6537. */
  6538. simulatePointerUp(pickResult: PickingInfo): Scene;
  6539. private _processPointerUp(pickResult, evt, clickInfo);
  6540. /**
  6541. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  6542. * @param attachUp defines if you want to attach events to pointerup
  6543. * @param attachDown defines if you want to attach events to pointerdown
  6544. * @param attachMove defines if you want to attach events to pointermove
  6545. */
  6546. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  6547. detachControl(): void;
  6548. isReady(): boolean;
  6549. resetCachedMaterial(): void;
  6550. registerBeforeRender(func: () => void): void;
  6551. unregisterBeforeRender(func: () => void): void;
  6552. registerAfterRender(func: () => void): void;
  6553. unregisterAfterRender(func: () => void): void;
  6554. private _executeOnceBeforeRender(func);
  6555. /**
  6556. * The provided function will run before render once and will be disposed afterwards.
  6557. * A timeout delay can be provided so that the function will be executed in N ms.
  6558. * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.
  6559. * @param func The function to be executed.
  6560. * @param timeout optional delay in ms
  6561. */
  6562. executeOnceBeforeRender(func: () => void, timeout?: number): void;
  6563. _addPendingData(data: any): void;
  6564. _removePendingData(data: any): void;
  6565. getWaitingItemsCount(): number;
  6566. readonly isLoading: boolean;
  6567. /**
  6568. * Registers a function to be executed when the scene is ready.
  6569. * @param {Function} func - the function to be executed.
  6570. */
  6571. executeWhenReady(func: () => void): void;
  6572. _checkIsReady(): void;
  6573. /**
  6574. * Will start the animation sequence of a given target
  6575. * @param target - the target
  6576. * @param {number} from - from which frame should animation start
  6577. * @param {number} to - till which frame should animation run.
  6578. * @param {boolean} [loop] - should the animation loop
  6579. * @param {number} [speedRatio] - the speed in which to run the animation
  6580. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  6581. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  6582. * Returns {BABYLON.Animatable} the animatable object created for this animation
  6583. * See BABYLON.Animatable
  6584. */
  6585. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  6586. /**
  6587. * Begin a new animation on a given node
  6588. * @param {BABYLON.Node} node defines the root node where the animation will take place
  6589. * @param {BABYLON.Animation[]} defines the list of animations to start
  6590. * @param {number} from defines the initial value
  6591. * @param {number} to defines the final value
  6592. * @param {boolean} loop defines if you want animation to loop (off by default)
  6593. * @param {number} speedRatio defines the speed ratio to apply to all animations
  6594. * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
  6595. * @returns the list of created animatables
  6596. */
  6597. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  6598. /**
  6599. * Begin a new animation on a given node and its hierarchy
  6600. * @param {BABYLON.Node} node defines the root node where the animation will take place
  6601. * @param {boolean} directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.
  6602. * @param {BABYLON.Animation[]} defines the list of animations to start
  6603. * @param {number} from defines the initial value
  6604. * @param {number} to defines the final value
  6605. * @param {boolean} loop defines if you want animation to loop (off by default)
  6606. * @param {number} speedRatio defines the speed ratio to apply to all animations
  6607. * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
  6608. * @returns the list of animatables created for all nodes
  6609. */
  6610. beginDirectHierarchyAnimation(target: Node, directDescendantsOnly: boolean, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable[];
  6611. getAnimatableByTarget(target: any): Nullable<Animatable>;
  6612. readonly animatables: Animatable[];
  6613. /**
  6614. * Will stop the animation of the given target
  6615. * @param target - the target
  6616. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  6617. * @see beginAnimation
  6618. */
  6619. stopAnimation(target: any, animationName?: string): void;
  6620. /**
  6621. * Stops and removes all animations that have been applied to the scene
  6622. */
  6623. stopAllAnimations(): void;
  6624. private _animate();
  6625. _switchToAlternateCameraConfiguration(active: boolean): void;
  6626. getViewMatrix(): Matrix;
  6627. getProjectionMatrix(): Matrix;
  6628. getTransformMatrix(): Matrix;
  6629. setTransformMatrix(view: Matrix, projection: Matrix): void;
  6630. _setAlternateTransformMatrix(view: Matrix, projection: Matrix): void;
  6631. getSceneUniformBuffer(): UniformBuffer;
  6632. getUniqueId(): number;
  6633. addMesh(newMesh: AbstractMesh): void;
  6634. removeMesh(toRemove: AbstractMesh): number;
  6635. addTransformNode(newTransformNode: TransformNode): void;
  6636. removeTransformNode(toRemove: TransformNode): number;
  6637. removeSkeleton(toRemove: Skeleton): number;
  6638. removeMorphTargetManager(toRemove: MorphTargetManager): number;
  6639. removeLight(toRemove: Light): number;
  6640. removeCamera(toRemove: Camera): number;
  6641. addLight(newLight: Light): void;
  6642. sortLightsByPriority(): void;
  6643. addCamera(newCamera: Camera): void;
  6644. /**
  6645. * Switch active camera
  6646. * @param {Camera} newCamera - new active camera
  6647. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  6648. */
  6649. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  6650. /**
  6651. * sets the active camera of the scene using its ID
  6652. * @param {string} id - the camera's ID
  6653. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  6654. * @see activeCamera
  6655. */
  6656. setActiveCameraByID(id: string): Nullable<Camera>;
  6657. /**
  6658. * sets the active camera of the scene using its name
  6659. * @param {string} name - the camera's name
  6660. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  6661. * @see activeCamera
  6662. */
  6663. setActiveCameraByName(name: string): Nullable<Camera>;
  6664. /**
  6665. * get an animation group using its name
  6666. * @param {string} the material's name
  6667. * @return {BABYLON.AnimationGroup|null} the animation group or null if none found.
  6668. */
  6669. getAnimationGroupByName(name: string): Nullable<AnimationGroup>;
  6670. /**
  6671. * get a material using its id
  6672. * @param {string} the material's ID
  6673. * @return {BABYLON.Material|null} the material or null if none found.
  6674. */
  6675. getMaterialByID(id: string): Nullable<Material>;
  6676. /**
  6677. * get a material using its name
  6678. * @param {string} the material's name
  6679. * @return {BABYLON.Material|null} the material or null if none found.
  6680. */
  6681. getMaterialByName(name: string): Nullable<Material>;
  6682. getLensFlareSystemByName(name: string): Nullable<LensFlareSystem>;
  6683. getLensFlareSystemByID(id: string): Nullable<LensFlareSystem>;
  6684. getCameraByID(id: string): Nullable<Camera>;
  6685. getCameraByUniqueID(uniqueId: number): Nullable<Camera>;
  6686. /**
  6687. * get a camera using its name
  6688. * @param {string} the camera's name
  6689. * @return {BABYLON.Camera|null} the camera or null if none found.
  6690. */
  6691. getCameraByName(name: string): Nullable<Camera>;
  6692. /**
  6693. * get a bone using its id
  6694. * @param {string} the bone's id
  6695. * @return {BABYLON.Bone|null} the bone or null if not found
  6696. */
  6697. getBoneByID(id: string): Nullable<Bone>;
  6698. /**
  6699. * get a bone using its id
  6700. * @param {string} the bone's name
  6701. * @return {BABYLON.Bone|null} the bone or null if not found
  6702. */
  6703. getBoneByName(name: string): Nullable<Bone>;
  6704. /**
  6705. * get a light node using its name
  6706. * @param {string} the light's name
  6707. * @return {BABYLON.Light|null} the light or null if none found.
  6708. */
  6709. getLightByName(name: string): Nullable<Light>;
  6710. /**
  6711. * get a light node using its ID
  6712. * @param {string} the light's id
  6713. * @return {BABYLON.Light|null} the light or null if none found.
  6714. */
  6715. getLightByID(id: string): Nullable<Light>;
  6716. /**
  6717. * get a light node using its scene-generated unique ID
  6718. * @param {number} the light's unique id
  6719. * @return {BABYLON.Light|null} the light or null if none found.
  6720. */
  6721. getLightByUniqueID(uniqueId: number): Nullable<Light>;
  6722. /**
  6723. * get a particle system by id
  6724. * @param id {number} the particle system id
  6725. * @return {BABYLON.IParticleSystem|null} the corresponding system or null if none found.
  6726. */
  6727. getParticleSystemByID(id: string): Nullable<IParticleSystem>;
  6728. /**
  6729. * get a geometry using its ID
  6730. * @param {string} the geometry's id
  6731. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  6732. */
  6733. getGeometryByID(id: string): Nullable<Geometry>;
  6734. /**
  6735. * add a new geometry to this scene.
  6736. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  6737. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  6738. * @return {boolean} was the geometry added or not
  6739. */
  6740. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  6741. /**
  6742. * Removes an existing geometry
  6743. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  6744. * @return {boolean} was the geometry removed or not
  6745. */
  6746. removeGeometry(geometry: Geometry): boolean;
  6747. getGeometries(): Geometry[];
  6748. /**
  6749. * Get the first added mesh found of a given ID
  6750. * @param {string} id - the id to search for
  6751. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  6752. */
  6753. getMeshByID(id: string): Nullable<AbstractMesh>;
  6754. getMeshesByID(id: string): Array<AbstractMesh>;
  6755. /**
  6756. * Get the first added transform node found of a given ID
  6757. * @param {string} id - the id to search for
  6758. * @return {BABYLON.TransformNode|null} the transform node found or null if not found at all.
  6759. */
  6760. getTransformNodeByID(id: string): Nullable<TransformNode>;
  6761. getTransformNodesByID(id: string): Array<TransformNode>;
  6762. /**
  6763. * Get a mesh with its auto-generated unique id
  6764. * @param {number} uniqueId - the unique id to search for
  6765. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  6766. */
  6767. getMeshByUniqueID(uniqueId: number): Nullable<AbstractMesh>;
  6768. /**
  6769. * Get a the last added mesh found of a given ID
  6770. * @param {string} id - the id to search for
  6771. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  6772. */
  6773. getLastMeshByID(id: string): Nullable<AbstractMesh>;
  6774. /**
  6775. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  6776. * @param {string} id - the id to search for
  6777. * @return {BABYLON.Node|null} the node found or null if not found at all.
  6778. */
  6779. getLastEntryByID(id: string): Nullable<Node>;
  6780. getNodeByID(id: string): Nullable<Node>;
  6781. getNodeByName(name: string): Nullable<Node>;
  6782. getMeshByName(name: string): Nullable<AbstractMesh>;
  6783. getTransformNodeByName(name: string): Nullable<TransformNode>;
  6784. getSoundByName(name: string): Nullable<Sound>;
  6785. getLastSkeletonByID(id: string): Nullable<Skeleton>;
  6786. getSkeletonById(id: string): Nullable<Skeleton>;
  6787. getSkeletonByName(name: string): Nullable<Skeleton>;
  6788. getMorphTargetManagerById(id: number): Nullable<MorphTargetManager>;
  6789. isActiveMesh(mesh: AbstractMesh): boolean;
  6790. /**
  6791. * Return a the first highlight layer of the scene with a given name.
  6792. * @param name The name of the highlight layer to look for.
  6793. * @return The highlight layer if found otherwise null.
  6794. */
  6795. getHighlightLayerByName(name: string): Nullable<HighlightLayer>;
  6796. /**
  6797. * Return a unique id as a string which can serve as an identifier for the scene
  6798. */
  6799. readonly uid: string;
  6800. /**
  6801. * Add an externaly attached data from its key.
  6802. * This method call will fail and return false, if such key already exists.
  6803. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  6804. * @param key the unique key that identifies the data
  6805. * @param data the data object to associate to the key for this Engine instance
  6806. * @return true if no such key were already present and the data was added successfully, false otherwise
  6807. */
  6808. addExternalData<T>(key: string, data: T): boolean;
  6809. /**
  6810. * Get an externaly attached data from its key
  6811. * @param key the unique key that identifies the data
  6812. * @return the associated data, if present (can be null), or undefined if not present
  6813. */
  6814. getExternalData<T>(key: string): Nullable<T>;
  6815. /**
  6816. * Get an externaly attached data from its key, create it using a factory if it's not already present
  6817. * @param key the unique key that identifies the data
  6818. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  6819. * @return the associated data, can be null if the factory returned null.
  6820. */
  6821. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  6822. /**
  6823. * Remove an externaly attached data from the Engine instance
  6824. * @param key the unique key that identifies the data
  6825. * @return true if the data was successfully removed, false if it doesn't exist
  6826. */
  6827. removeExternalData(key: string): boolean;
  6828. private _evaluateSubMesh(subMesh, mesh);
  6829. _isInIntermediateRendering(): boolean;
  6830. private _activeMeshCandidateProvider;
  6831. setActiveMeshCandidateProvider(provider: IActiveMeshCandidateProvider): void;
  6832. getActiveMeshCandidateProvider(): IActiveMeshCandidateProvider;
  6833. private _activeMeshesFrozen;
  6834. /**
  6835. * Use this function to stop evaluating active meshes. The current list will be keep alive between frames
  6836. */
  6837. freezeActiveMeshes(): Scene;
  6838. /**
  6839. * Use this function to restart evaluating active meshes on every frame
  6840. */
  6841. unfreezeActiveMeshes(): this;
  6842. private _evaluateActiveMeshes();
  6843. private _activeMesh(sourceMesh, mesh);
  6844. updateTransformMatrix(force?: boolean): void;
  6845. updateAlternateTransformMatrix(alternateCamera: Camera): void;
  6846. private _renderForCamera(camera);
  6847. private _processSubCameras(camera);
  6848. private _checkIntersections();
  6849. render(): void;
  6850. private _updateAudioParameters();
  6851. audioEnabled: boolean;
  6852. private _disableAudio();
  6853. private _enableAudio();
  6854. headphone: boolean;
  6855. private _switchAudioModeForHeadphones();
  6856. private _switchAudioModeForNormalSpeakers();
  6857. enableDepthRenderer(): DepthRenderer;
  6858. disableDepthRenderer(): void;
  6859. enableGeometryBufferRenderer(ratio?: number): Nullable<GeometryBufferRenderer>;
  6860. disableGeometryBufferRenderer(): void;
  6861. freezeMaterials(): void;
  6862. unfreezeMaterials(): void;
  6863. dispose(): void;
  6864. readonly isDisposed: boolean;
  6865. disposeSounds(): void;
  6866. getWorldExtends(): {
  6867. min: Vector3;
  6868. max: Vector3;
  6869. };
  6870. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  6871. createPickingRay(x: number, y: number, world: Matrix, camera: Nullable<Camera>, cameraViewSpace?: boolean): Ray;
  6872. createPickingRayToRef(x: number, y: number, world: Matrix, result: Ray, camera: Nullable<Camera>, cameraViewSpace?: boolean): Scene;
  6873. createPickingRayInCameraSpace(x: number, y: number, camera?: Camera): Ray;
  6874. createPickingRayInCameraSpaceToRef(x: number, y: number, result: Ray, camera?: Camera): Scene;
  6875. private _internalPick(rayFunction, predicate?, fastCheck?);
  6876. private _internalMultiPick(rayFunction, predicate?);
  6877. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  6878. private _tempPickingRay;
  6879. /** Launch a ray to try to pick a mesh in the scene
  6880. * @param x position on screen
  6881. * @param y position on screen
  6882. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  6883. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  6884. * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  6885. */
  6886. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Nullable<Camera>): Nullable<PickingInfo>;
  6887. /** Launch a ray to try to pick a sprite in the scene
  6888. * @param x position on screen
  6889. * @param y position on screen
  6890. * @param predicate Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true
  6891. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  6892. * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  6893. */
  6894. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): Nullable<PickingInfo>;
  6895. private _cachedRayForTransform;
  6896. /** Use the given ray to pick a mesh in the scene
  6897. * @param ray The ray to use to pick meshes
  6898. * @param predicate Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true
  6899. * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.
  6900. */
  6901. pickWithRay(ray: Ray, predicate: (mesh: AbstractMesh) => boolean, fastCheck?: boolean): Nullable<PickingInfo>;
  6902. /**
  6903. * Launch a ray to try to pick a mesh in the scene
  6904. * @param x X position on screen
  6905. * @param y Y position on screen
  6906. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  6907. * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used
  6908. */
  6909. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): Nullable<PickingInfo[]>;
  6910. /**
  6911. * Launch a ray to try to pick a mesh in the scene
  6912. * @param ray Ray to use
  6913. * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
  6914. */
  6915. multiPickWithRay(ray: Ray, predicate: (mesh: AbstractMesh) => boolean): Nullable<PickingInfo[]>;
  6916. setPointerOverMesh(mesh: Nullable<AbstractMesh>): void;
  6917. getPointerOverMesh(): Nullable<AbstractMesh>;
  6918. setPointerOverSprite(sprite: Nullable<Sprite>): void;
  6919. getPointerOverSprite(): Nullable<Sprite>;
  6920. getPhysicsEngine(): Nullable<PhysicsEngine>;
  6921. /**
  6922. * Enables physics to the current scene
  6923. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  6924. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  6925. * @return {boolean} was the physics engine initialized
  6926. */
  6927. enablePhysics(gravity?: Nullable<Vector3>, plugin?: IPhysicsEnginePlugin): boolean;
  6928. disablePhysicsEngine(): void;
  6929. isPhysicsEnabled(): boolean;
  6930. deleteCompoundImpostor(compound: any): void;
  6931. _rebuildGeometries(): void;
  6932. _rebuildTextures(): void;
  6933. createDefaultCameraOrLight(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void;
  6934. createDefaultSkybox(environmentTexture?: BaseTexture, pbr?: boolean, scale?: number, blur?: number): Nullable<Mesh>;
  6935. createDefaultEnvironment(options: Partial<IEnvironmentHelperOptions>): Nullable<EnvironmentHelper>;
  6936. createDefaultVRExperience(webVROptions?: VRExperienceHelperOptions): VRExperienceHelper;
  6937. private _getByTags(list, tagsQuery, forEach?);
  6938. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  6939. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  6940. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  6941. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  6942. /**
  6943. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  6944. * This allowed control for front to back rendering or reversly depending of the special needs.
  6945. *
  6946. * @param renderingGroupId The rendering group id corresponding to its index
  6947. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  6948. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  6949. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  6950. */
  6951. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>, transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>): void;
  6952. /**
  6953. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  6954. *
  6955. * @param renderingGroupId The rendering group id corresponding to its index
  6956. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  6957. * @param depth Automatically clears depth between groups if true and autoClear is true.
  6958. * @param stencil Automatically clears stencil between groups if true and autoClear is true.
  6959. */
  6960. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void;
  6961. /**
  6962. * Will flag all materials as dirty to trigger new shader compilation
  6963. * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty
  6964. */
  6965. markAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
  6966. _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, useDatabase?: boolean, useArrayBuffer?: boolean, onError?: (request?: XMLHttpRequest, exception?: any) => void): IFileRequest;
  6967. }
  6968. }
  6969. declare module 'babylonjs/core' {
  6970. class Buffer {
  6971. private _engine;
  6972. private _buffer;
  6973. private _data;
  6974. private _updatable;
  6975. private _strideSize;
  6976. private _instanced;
  6977. private _instanceDivisor;
  6978. constructor(engine: any, data: FloatArray, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  6979. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  6980. isUpdatable(): boolean;
  6981. getData(): Nullable<FloatArray>;
  6982. getBuffer(): Nullable<WebGLBuffer>;
  6983. getStrideSize(): number;
  6984. getIsInstanced(): boolean;
  6985. instanceDivisor: number;
  6986. create(data?: Nullable<FloatArray>): void;
  6987. _rebuild(): void;
  6988. update(data: FloatArray): void;
  6989. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  6990. dispose(): void;
  6991. }
  6992. }
  6993. declare module 'babylonjs/core' {
  6994. class VertexBuffer {
  6995. private _buffer;
  6996. private _kind;
  6997. private _offset;
  6998. private _size;
  6999. private _stride;
  7000. private _ownsBuffer;
  7001. constructor(engine: any, data: FloatArray | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  7002. _rebuild(): void;
  7003. /**
  7004. * Returns the kind of the VertexBuffer (string).
  7005. */
  7006. getKind(): string;
  7007. /**
  7008. * Boolean : is the VertexBuffer updatable ?
  7009. */
  7010. isUpdatable(): boolean;
  7011. /**
  7012. * Returns an array of numbers or a Float32Array containing the VertexBuffer data.
  7013. */
  7014. getData(): Nullable<FloatArray>;
  7015. /**
  7016. * Returns the WebGLBuffer associated to the VertexBuffer.
  7017. */
  7018. getBuffer(): Nullable<WebGLBuffer>;
  7019. /**
  7020. * Returns the stride of the VertexBuffer (integer).
  7021. */
  7022. getStrideSize(): number;
  7023. /**
  7024. * Returns the offset (integer).
  7025. */
  7026. getOffset(): number;
  7027. /**
  7028. * Returns the VertexBuffer total size (integer).
  7029. */
  7030. getSize(): number;
  7031. /**
  7032. * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
  7033. */
  7034. getIsInstanced(): boolean;
  7035. /**
  7036. * Returns the instancing divisor, zero for non-instanced (integer).
  7037. */
  7038. getInstanceDivisor(): number;
  7039. /**
  7040. * Creates the underlying WebGLBuffer from the passed numeric array or Float32Array.
  7041. * Returns the created WebGLBuffer.
  7042. */
  7043. create(data?: FloatArray): void;
  7044. /**
  7045. * Updates the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  7046. * Returns the updated WebGLBuffer.
  7047. */
  7048. update(data: FloatArray): void;
  7049. /**
  7050. * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.
  7051. * Returns the directly updated WebGLBuffer.
  7052. */
  7053. updateDirectly(data: Float32Array, offset: number): void;
  7054. /**
  7055. * Disposes the VertexBuffer and the underlying WebGLBuffer.
  7056. */
  7057. dispose(): void;
  7058. private static _PositionKind;
  7059. private static _NormalKind;
  7060. private static _TangentKind;
  7061. private static _UVKind;
  7062. private static _UV2Kind;
  7063. private static _UV3Kind;
  7064. private static _UV4Kind;
  7065. private static _UV5Kind;
  7066. private static _UV6Kind;
  7067. private static _ColorKind;
  7068. private static _MatricesIndicesKind;
  7069. private static _MatricesWeightsKind;
  7070. private static _MatricesIndicesExtraKind;
  7071. private static _MatricesWeightsExtraKind;
  7072. static readonly PositionKind: string;
  7073. static readonly NormalKind: string;
  7074. static readonly TangentKind: string;
  7075. static readonly UVKind: string;
  7076. static readonly UV2Kind: string;
  7077. static readonly UV3Kind: string;
  7078. static readonly UV4Kind: string;
  7079. static readonly UV5Kind: string;
  7080. static readonly UV6Kind: string;
  7081. static readonly ColorKind: string;
  7082. static readonly MatricesIndicesKind: string;
  7083. static readonly MatricesWeightsKind: string;
  7084. static readonly MatricesIndicesExtraKind: string;
  7085. static readonly MatricesWeightsExtraKind: string;
  7086. }
  7087. }
  7088. declare module 'babylonjs/core' {
  7089. class InternalTexture {
  7090. static DATASOURCE_UNKNOWN: number;
  7091. static DATASOURCE_URL: number;
  7092. static DATASOURCE_TEMP: number;
  7093. static DATASOURCE_RAW: number;
  7094. static DATASOURCE_DYNAMIC: number;
  7095. static DATASOURCE_RENDERTARGET: number;
  7096. static DATASOURCE_MULTIRENDERTARGET: number;
  7097. static DATASOURCE_CUBE: number;
  7098. static DATASOURCE_CUBERAW: number;
  7099. static DATASOURCE_CUBEPREFILTERED: number;
  7100. static DATASOURCE_RAW3D: number;
  7101. isReady: boolean;
  7102. isCube: boolean;
  7103. is3D: boolean;
  7104. url: string;
  7105. samplingMode: number;
  7106. generateMipMaps: boolean;
  7107. samples: number;
  7108. type: number;
  7109. format: number;
  7110. onLoadedObservable: Observable<InternalTexture>;
  7111. width: number;
  7112. height: number;
  7113. depth: number;
  7114. baseWidth: number;
  7115. baseHeight: number;
  7116. baseDepth: number;
  7117. invertY: boolean;
  7118. _initialSlot: number;
  7119. _designatedSlot: number;
  7120. _dataSource: number;
  7121. _buffer: Nullable<ArrayBuffer | HTMLImageElement>;
  7122. _bufferView: Nullable<ArrayBufferView>;
  7123. _bufferViewArray: Nullable<ArrayBufferView[]>;
  7124. _size: number;
  7125. _extension: string;
  7126. _files: Nullable<string[]>;
  7127. _workingCanvas: HTMLCanvasElement;
  7128. _workingContext: CanvasRenderingContext2D;
  7129. _framebuffer: Nullable<WebGLFramebuffer>;
  7130. _depthStencilBuffer: Nullable<WebGLRenderbuffer>;
  7131. _MSAAFramebuffer: Nullable<WebGLFramebuffer>;
  7132. _MSAARenderBuffer: Nullable<WebGLRenderbuffer>;
  7133. _attachments: Nullable<number[]>;
  7134. _cachedCoordinatesMode: Nullable<number>;
  7135. _cachedWrapU: Nullable<number>;
  7136. _cachedWrapV: Nullable<number>;
  7137. _cachedWrapR: Nullable<number>;
  7138. _cachedAnisotropicFilteringLevel: Nullable<number>;
  7139. _isDisabled: boolean;
  7140. _compression: Nullable<string>;
  7141. _generateStencilBuffer: boolean;
  7142. _generateDepthBuffer: boolean;
  7143. _sphericalPolynomial: Nullable<SphericalPolynomial>;
  7144. _lodGenerationScale: number;
  7145. _lodGenerationOffset: number;
  7146. _lodTextureHigh: BaseTexture;
  7147. _lodTextureMid: BaseTexture;
  7148. _lodTextureLow: BaseTexture;
  7149. _webGLTexture: Nullable<WebGLTexture>;
  7150. _references: number;
  7151. private _engine;
  7152. readonly dataSource: number;
  7153. constructor(engine: Engine, dataSource: number);
  7154. incrementReferences(): void;
  7155. updateSize(width: int, height: int, depth?: int): void;
  7156. _rebuild(): void;
  7157. private _swapAndDie(target);
  7158. dispose(): void;
  7159. }
  7160. }
  7161. declare module 'babylonjs/core' {
  7162. class BaseTexture {
  7163. static DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number;
  7164. name: string;
  7165. private _hasAlpha;
  7166. hasAlpha: boolean;
  7167. getAlphaFromRGB: boolean;
  7168. level: number;
  7169. coordinatesIndex: number;
  7170. private _coordinatesMode;
  7171. coordinatesMode: number;
  7172. wrapU: number;
  7173. wrapV: number;
  7174. wrapR: number;
  7175. anisotropicFilteringLevel: number;
  7176. isCube: boolean;
  7177. is3D: boolean;
  7178. gammaSpace: boolean;
  7179. invertZ: boolean;
  7180. lodLevelInAlpha: boolean;
  7181. lodGenerationOffset: number;
  7182. lodGenerationScale: number;
  7183. isRenderTarget: boolean;
  7184. readonly uid: string;
  7185. toString(): string;
  7186. getClassName(): string;
  7187. animations: Animation[];
  7188. /**
  7189. * An event triggered when the texture is disposed.
  7190. * @type {BABYLON.Observable}
  7191. */
  7192. onDisposeObservable: Observable<BaseTexture>;
  7193. private _onDisposeObserver;
  7194. onDispose: () => void;
  7195. delayLoadState: number;
  7196. private _scene;
  7197. _texture: Nullable<InternalTexture>;
  7198. private _uid;
  7199. readonly isBlocking: boolean;
  7200. constructor(scene: Nullable<Scene>);
  7201. getScene(): Nullable<Scene>;
  7202. getTextureMatrix(): Matrix;
  7203. getReflectionTextureMatrix(): Matrix;
  7204. getInternalTexture(): Nullable<InternalTexture>;
  7205. isReadyOrNotBlocking(): boolean;
  7206. isReady(): boolean;
  7207. getSize(): ISize;
  7208. getBaseSize(): ISize;
  7209. scale(ratio: number): void;
  7210. readonly canRescale: boolean;
  7211. _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number): Nullable<InternalTexture>;
  7212. _rebuild(): void;
  7213. delayLoad(): void;
  7214. clone(): Nullable<BaseTexture>;
  7215. readonly textureType: number;
  7216. readonly textureFormat: number;
  7217. readPixels(faceIndex?: number): Nullable<ArrayBufferView>;
  7218. releaseInternalTexture(): void;
  7219. sphericalPolynomial: Nullable<SphericalPolynomial>;
  7220. readonly _lodTextureHigh: Nullable<BaseTexture>;
  7221. readonly _lodTextureMid: Nullable<BaseTexture>;
  7222. readonly _lodTextureLow: Nullable<BaseTexture>;
  7223. dispose(): void;
  7224. serialize(): any;
  7225. static WhenAllReady(textures: BaseTexture[], callback: () => void): void;
  7226. }
  7227. }
  7228. declare module 'babylonjs/core' {
  7229. class Texture extends BaseTexture {
  7230. static NEAREST_SAMPLINGMODE: number;
  7231. static NEAREST_NEAREST_MIPLINEAR: number;
  7232. static BILINEAR_SAMPLINGMODE: number;
  7233. static LINEAR_LINEAR_MIPNEAREST: number;
  7234. static TRILINEAR_SAMPLINGMODE: number;
  7235. static LINEAR_LINEAR_MIPLINEAR: number;
  7236. static NEAREST_NEAREST_MIPNEAREST: number;
  7237. static NEAREST_LINEAR_MIPNEAREST: number;
  7238. static NEAREST_LINEAR_MIPLINEAR: number;
  7239. static NEAREST_LINEAR: number;
  7240. static NEAREST_NEAREST: number;
  7241. static LINEAR_NEAREST_MIPNEAREST: number;
  7242. static LINEAR_NEAREST_MIPLINEAR: number;
  7243. static LINEAR_LINEAR: number;
  7244. static LINEAR_NEAREST: number;
  7245. static EXPLICIT_MODE: number;
  7246. static SPHERICAL_MODE: number;
  7247. static PLANAR_MODE: number;
  7248. static CUBIC_MODE: number;
  7249. static PROJECTION_MODE: number;
  7250. static SKYBOX_MODE: number;
  7251. static INVCUBIC_MODE: number;
  7252. static EQUIRECTANGULAR_MODE: number;
  7253. static FIXED_EQUIRECTANGULAR_MODE: number;
  7254. static FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number;
  7255. static CLAMP_ADDRESSMODE: number;
  7256. static WRAP_ADDRESSMODE: number;
  7257. static MIRROR_ADDRESSMODE: number;
  7258. url: Nullable<string>;
  7259. uOffset: number;
  7260. vOffset: number;
  7261. uScale: number;
  7262. vScale: number;
  7263. uAng: number;
  7264. vAng: number;
  7265. wAng: number;
  7266. readonly noMipmap: boolean;
  7267. private _noMipmap;
  7268. _invertY: boolean;
  7269. private _rowGenerationMatrix;
  7270. private _cachedTextureMatrix;
  7271. private _projectionModeMatrix;
  7272. private _t0;
  7273. private _t1;
  7274. private _t2;
  7275. private _cachedUOffset;
  7276. private _cachedVOffset;
  7277. private _cachedUScale;
  7278. private _cachedVScale;
  7279. private _cachedUAng;
  7280. private _cachedVAng;
  7281. private _cachedWAng;
  7282. private _cachedProjectionMatrixId;
  7283. private _cachedCoordinatesMode;
  7284. _samplingMode: number;
  7285. private _buffer;
  7286. private _deleteBuffer;
  7287. protected _format: Nullable<number>;
  7288. private _delayedOnLoad;
  7289. private _delayedOnError;
  7290. private _onLoadObservable;
  7291. protected _isBlocking: boolean;
  7292. isBlocking: boolean;
  7293. readonly samplingMode: number;
  7294. constructor(url: Nullable<string>, scene: Nullable<Scene>, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, buffer?: any, deleteBuffer?: boolean, format?: number);
  7295. updateURL(url: string): void;
  7296. delayLoad(): void;
  7297. updateSamplingMode(samplingMode: number): void;
  7298. private _prepareRowForTextureGeneration(x, y, z, t);
  7299. getTextureMatrix(): Matrix;
  7300. getReflectionTextureMatrix(): Matrix;
  7301. clone(): Texture;
  7302. readonly onLoadObservable: Observable<Texture>;
  7303. serialize(): any;
  7304. getClassName(): string;
  7305. dispose(): void;
  7306. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<() => void>, format?: number): Texture;
  7307. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<BaseTexture>;
  7308. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number): Texture;
  7309. }
  7310. }
  7311. declare module 'babylonjs/core' {
  7312. class _InstancesBatch {
  7313. mustReturn: boolean;
  7314. visibleInstances: Nullable<InstancedMesh[]>[];
  7315. renderSelf: boolean[];
  7316. }
  7317. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  7318. static _FRONTSIDE: number;
  7319. static _BACKSIDE: number;
  7320. static _DOUBLESIDE: number;
  7321. static _DEFAULTSIDE: number;
  7322. static _NO_CAP: number;
  7323. static _CAP_START: number;
  7324. static _CAP_END: number;
  7325. static _CAP_ALL: number;
  7326. /**
  7327. * Mesh side orientation : usually the external or front surface
  7328. */
  7329. static readonly FRONTSIDE: number;
  7330. /**
  7331. * Mesh side orientation : usually the internal or back surface
  7332. */
  7333. static readonly BACKSIDE: number;
  7334. /**
  7335. * Mesh side orientation : both internal and external or front and back surfaces
  7336. */
  7337. static readonly DOUBLESIDE: number;
  7338. /**
  7339. * Mesh side orientation : by default, `FRONTSIDE`
  7340. */
  7341. static readonly DEFAULTSIDE: number;
  7342. /**
  7343. * Mesh cap setting : no cap
  7344. */
  7345. static readonly NO_CAP: number;
  7346. /**
  7347. * Mesh cap setting : one cap at the beginning of the mesh
  7348. */
  7349. static readonly CAP_START: number;
  7350. /**
  7351. * Mesh cap setting : one cap at the end of the mesh
  7352. */
  7353. static readonly CAP_END: number;
  7354. /**
  7355. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  7356. */
  7357. static readonly CAP_ALL: number;
  7358. /**
  7359. * An event triggered before rendering the mesh
  7360. * @type {BABYLON.Observable}
  7361. */
  7362. onBeforeRenderObservable: Observable<Mesh>;
  7363. /**
  7364. * An event triggered after rendering the mesh
  7365. * @type {BABYLON.Observable}
  7366. */
  7367. onAfterRenderObservable: Observable<Mesh>;
  7368. /**
  7369. * An event triggered before drawing the mesh
  7370. * @type {BABYLON.Observable}
  7371. */
  7372. onBeforeDrawObservable: Observable<Mesh>;
  7373. private _onBeforeDrawObserver;
  7374. onBeforeDraw: () => void;
  7375. delayLoadState: number;
  7376. instances: InstancedMesh[];
  7377. delayLoadingFile: string;
  7378. _binaryInfo: any;
  7379. private _LODLevels;
  7380. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  7381. private _morphTargetManager;
  7382. morphTargetManager: Nullable<MorphTargetManager>;
  7383. _geometry: Nullable<Geometry>;
  7384. _delayInfo: Array<string>;
  7385. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  7386. _visibleInstances: any;
  7387. private _renderIdForInstances;
  7388. private _batchCache;
  7389. private _instancesBufferSize;
  7390. private _instancesBuffer;
  7391. private _instancesData;
  7392. private _overridenInstanceCount;
  7393. private _effectiveMaterial;
  7394. _shouldGenerateFlatShading: boolean;
  7395. private _preActivateId;
  7396. _originalBuilderSideOrientation: number;
  7397. overrideMaterialSideOrientation: Nullable<number>;
  7398. private _areNormalsFrozen;
  7399. private _sourcePositions;
  7400. private _sourceNormals;
  7401. private _source;
  7402. readonly source: Nullable<Mesh>;
  7403. isUnIndexed: boolean;
  7404. /**
  7405. * @constructor
  7406. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  7407. * @param {Scene} scene The scene to add this mesh to.
  7408. * @param {Node} parent The parent of this mesh, if it has one
  7409. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  7410. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  7411. * When false, achieved by calling a clone(), also passing False.
  7412. * This will make creation of children, recursive.
  7413. * @param {boolean} clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
  7414. */
  7415. constructor(name: string, scene?: Nullable<Scene>, parent?: Nullable<Node>, source?: Nullable<Mesh>, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  7416. /**
  7417. * Returns the string "Mesh".
  7418. */
  7419. getClassName(): string;
  7420. /**
  7421. * Returns a string.
  7422. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  7423. */
  7424. toString(fullDetails?: boolean): string;
  7425. /**
  7426. * True if the mesh has some Levels Of Details (LOD).
  7427. * Returns a boolean.
  7428. */
  7429. readonly hasLODLevels: boolean;
  7430. private _sortLODLevels();
  7431. /**
  7432. * Add a mesh as LOD level triggered at the given distance.
  7433. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  7434. * @param {number} distance The distance from the center of the object to show this level
  7435. * @param {Mesh} mesh The mesh to be added as LOD level
  7436. * @return {Mesh} This mesh (for chaining)
  7437. */
  7438. addLODLevel(distance: number, mesh: Mesh): Mesh;
  7439. /**
  7440. * Returns the LOD level mesh at the passed distance or null if not found.
  7441. * It is related to the method `addLODLevel(distance, mesh)`.
  7442. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  7443. * Returns an object Mesh or `null`.
  7444. */
  7445. getLODLevelAtDistance(distance: number): Nullable<Mesh>;
  7446. /**
  7447. * Remove a mesh from the LOD array
  7448. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  7449. * @param {Mesh} mesh The mesh to be removed.
  7450. * @return {Mesh} This mesh (for chaining)
  7451. */
  7452. removeLODLevel(mesh: Mesh): Mesh;
  7453. /**
  7454. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  7455. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  7456. */
  7457. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  7458. /**
  7459. * Returns the mesh internal Geometry object.
  7460. */
  7461. readonly geometry: Nullable<Geometry>;
  7462. /**
  7463. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  7464. */
  7465. getTotalVertices(): number;
  7466. /**
  7467. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  7468. * 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.
  7469. * You can force the copy with forceCopy === true
  7470. * Returns null if the mesh has no geometry or no vertex buffer.
  7471. * Possible `kind` values :
  7472. * - BABYLON.VertexBuffer.PositionKind
  7473. * - BABYLON.VertexBuffer.UVKind
  7474. * - BABYLON.VertexBuffer.UV2Kind
  7475. * - BABYLON.VertexBuffer.UV3Kind
  7476. * - BABYLON.VertexBuffer.UV4Kind
  7477. * - BABYLON.VertexBuffer.UV5Kind
  7478. * - BABYLON.VertexBuffer.UV6Kind
  7479. * - BABYLON.VertexBuffer.ColorKind
  7480. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7481. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7482. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7483. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7484. */
  7485. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  7486. /**
  7487. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  7488. * Returns `null` if the mesh has no geometry.
  7489. * Possible `kind` values :
  7490. * - BABYLON.VertexBuffer.PositionKind
  7491. * - BABYLON.VertexBuffer.UVKind
  7492. * - BABYLON.VertexBuffer.UV2Kind
  7493. * - BABYLON.VertexBuffer.UV3Kind
  7494. * - BABYLON.VertexBuffer.UV4Kind
  7495. * - BABYLON.VertexBuffer.UV5Kind
  7496. * - BABYLON.VertexBuffer.UV6Kind
  7497. * - BABYLON.VertexBuffer.ColorKind
  7498. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7499. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7500. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7501. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7502. */
  7503. getVertexBuffer(kind: string): Nullable<VertexBuffer>;
  7504. /**
  7505. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  7506. * Possible `kind` values :
  7507. * - BABYLON.VertexBuffer.PositionKind
  7508. * - BABYLON.VertexBuffer.UVKind
  7509. * - BABYLON.VertexBuffer.UV2Kind
  7510. * - BABYLON.VertexBuffer.UV3Kind
  7511. * - BABYLON.VertexBuffer.UV4Kind
  7512. * - BABYLON.VertexBuffer.UV5Kind
  7513. * - BABYLON.VertexBuffer.UV6Kind
  7514. * - BABYLON.VertexBuffer.ColorKind
  7515. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7516. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7517. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7518. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7519. */
  7520. isVerticesDataPresent(kind: string): boolean;
  7521. /**
  7522. * Returns a boolean defining if the vertex data for the requested `kind` is updatable.
  7523. * Possible `kind` values :
  7524. * - BABYLON.VertexBuffer.PositionKind
  7525. * - BABYLON.VertexBuffer.UVKind
  7526. * - BABYLON.VertexBuffer.UV2Kind
  7527. * - BABYLON.VertexBuffer.UV3Kind
  7528. * - BABYLON.VertexBuffer.UV4Kind
  7529. * - BABYLON.VertexBuffer.UV5Kind
  7530. * - BABYLON.VertexBuffer.UV6Kind
  7531. * - BABYLON.VertexBuffer.ColorKind
  7532. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7533. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7534. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7535. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7536. */
  7537. isVertexBufferUpdatable(kind: string): boolean;
  7538. /**
  7539. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  7540. * Possible `kind` values :
  7541. * - BABYLON.VertexBuffer.PositionKind
  7542. * - BABYLON.VertexBuffer.UVKind
  7543. * - BABYLON.VertexBuffer.UV2Kind
  7544. * - BABYLON.VertexBuffer.UV3Kind
  7545. * - BABYLON.VertexBuffer.UV4Kind
  7546. * - BABYLON.VertexBuffer.UV5Kind
  7547. * - BABYLON.VertexBuffer.UV6Kind
  7548. * - BABYLON.VertexBuffer.ColorKind
  7549. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7550. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7551. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7552. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7553. */
  7554. getVerticesDataKinds(): string[];
  7555. /**
  7556. * Returns a positive integer : the total number of indices in this mesh geometry.
  7557. * Returns zero if the mesh has no geometry.
  7558. */
  7559. getTotalIndices(): number;
  7560. /**
  7561. * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
  7562. * 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.
  7563. * Returns an empty array if the mesh has no geometry.
  7564. */
  7565. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  7566. readonly isBlocked: boolean;
  7567. /**
  7568. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  7569. */
  7570. isReady(): boolean;
  7571. /**
  7572. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  7573. * This property is pertinent only for updatable parametric shapes.
  7574. */
  7575. readonly areNormalsFrozen: boolean;
  7576. /**
  7577. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  7578. * It has no effect at all on other shapes.
  7579. * It prevents the mesh normals from being recomputed on next `positions` array update.
  7580. * Returns the Mesh.
  7581. */
  7582. freezeNormals(): Mesh;
  7583. /**
  7584. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  7585. * It has no effect at all on other shapes.
  7586. * It reactivates the mesh normals computation if it was previously frozen.
  7587. * Returns the Mesh.
  7588. */
  7589. unfreezeNormals(): Mesh;
  7590. /**
  7591. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  7592. */
  7593. overridenInstanceCount: number;
  7594. _preActivate(): Mesh;
  7595. _preActivateForIntermediateRendering(renderId: number): Mesh;
  7596. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): Mesh;
  7597. /**
  7598. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  7599. * This means the mesh underlying bounding box and sphere are recomputed.
  7600. * Returns the Mesh.
  7601. */
  7602. refreshBoundingInfo(): Mesh;
  7603. _refreshBoundingInfo(applySkeleton: boolean): Mesh;
  7604. private _getPositionData(applySkeleton);
  7605. _createGlobalSubMesh(force: boolean): Nullable<SubMesh>;
  7606. subdivide(count: number): void;
  7607. /**
  7608. * Sets the vertex data of the mesh geometry for the requested `kind`.
  7609. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  7610. * The `data` are either a numeric array either a Float32Array.
  7611. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  7612. * 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).
  7613. * Note that a new underlying VertexBuffer object is created each call.
  7614. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  7615. *
  7616. * Possible `kind` values :
  7617. * - BABYLON.VertexBuffer.PositionKind
  7618. * - BABYLON.VertexBuffer.UVKind
  7619. * - BABYLON.VertexBuffer.UV2Kind
  7620. * - BABYLON.VertexBuffer.UV3Kind
  7621. * - BABYLON.VertexBuffer.UV4Kind
  7622. * - BABYLON.VertexBuffer.UV5Kind
  7623. * - BABYLON.VertexBuffer.UV6Kind
  7624. * - BABYLON.VertexBuffer.ColorKind
  7625. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7626. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7627. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7628. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7629. *
  7630. * Returns the Mesh.
  7631. */
  7632. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): Mesh;
  7633. markVerticesDataAsUpdatable(kind: string, updatable?: boolean): void;
  7634. /**
  7635. * Sets the mesh VertexBuffer.
  7636. * Returns the Mesh.
  7637. */
  7638. setVerticesBuffer(buffer: VertexBuffer): Mesh;
  7639. /**
  7640. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  7641. * If the mesh has no geometry, it is simply returned as it is.
  7642. * The `data` are either a numeric array either a Float32Array.
  7643. * No new underlying VertexBuffer object is created.
  7644. * 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.
  7645. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  7646. *
  7647. * Possible `kind` values :
  7648. * - BABYLON.VertexBuffer.PositionKind
  7649. * - BABYLON.VertexBuffer.UVKind
  7650. * - BABYLON.VertexBuffer.UV2Kind
  7651. * - BABYLON.VertexBuffer.UV3Kind
  7652. * - BABYLON.VertexBuffer.UV4Kind
  7653. * - BABYLON.VertexBuffer.UV5Kind
  7654. * - BABYLON.VertexBuffer.UV6Kind
  7655. * - BABYLON.VertexBuffer.ColorKind
  7656. * - BABYLON.VertexBuffer.MatricesIndicesKind
  7657. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  7658. * - BABYLON.VertexBuffer.MatricesWeightsKind
  7659. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  7660. *
  7661. * Returns the Mesh.
  7662. */
  7663. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): Mesh;
  7664. /**
  7665. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  7666. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  7667. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  7668. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  7669. * Returns the Mesh.
  7670. */
  7671. updateMeshPositions(positionFunction: (data: FloatArray) => void, computeNormals?: boolean): Mesh;
  7672. /**
  7673. * Creates a un-shared specific occurence of the geometry for the mesh.
  7674. * Returns the Mesh.
  7675. */
  7676. makeGeometryUnique(): Mesh;
  7677. /**
  7678. * Sets the mesh indices.
  7679. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
  7680. * Type is Uint16Array by default unless the mesh has more than 65536 vertices.
  7681. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  7682. * This method creates a new index buffer each call.
  7683. * Returns the Mesh.
  7684. */
  7685. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>, updatable?: boolean): Mesh;
  7686. /**
  7687. * Update the current index buffer
  7688. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)
  7689. * Returns the Mesh.
  7690. */
  7691. updateIndices(indices: IndicesArray, offset?: number): Mesh;
  7692. /**
  7693. * Invert the geometry to move from a right handed system to a left handed one.
  7694. * Returns the Mesh.
  7695. */
  7696. toLeftHanded(): Mesh;
  7697. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): Mesh;
  7698. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number, alternate?: boolean): Mesh;
  7699. /**
  7700. * Registers for this mesh a javascript function called just before the rendering process.
  7701. * This function is passed the current mesh.
  7702. * Return the Mesh.
  7703. */
  7704. registerBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  7705. /**
  7706. * Disposes a previously registered javascript function called before the rendering.
  7707. * This function is passed the current mesh.
  7708. * Returns the Mesh.
  7709. */
  7710. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  7711. /**
  7712. * Registers for this mesh a javascript function called just after the rendering is complete.
  7713. * This function is passed the current mesh.
  7714. * Returns the Mesh.
  7715. */
  7716. registerAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  7717. /**
  7718. * Disposes a previously registered javascript function called after the rendering.
  7719. * This function is passed the current mesh.
  7720. * Return the Mesh.
  7721. */
  7722. unregisterAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  7723. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  7724. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): Mesh;
  7725. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix, effectiveMaterial?: Material) => void, effectiveMaterial?: Material): Mesh;
  7726. /**
  7727. * Triggers the draw call for the mesh.
  7728. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  7729. * Returns the Mesh.
  7730. */
  7731. render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh;
  7732. private _onBeforeDraw(isInstance, world, effectiveMaterial?);
  7733. /**
  7734. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  7735. */
  7736. getEmittedParticleSystems(): IParticleSystem[];
  7737. /**
  7738. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  7739. */
  7740. getHierarchyEmittedParticleSystems(): IParticleSystem[];
  7741. _checkDelayState(): Mesh;
  7742. private _queueLoad(scene);
  7743. /**
  7744. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  7745. */
  7746. isInFrustum(frustumPlanes: Plane[]): boolean;
  7747. /**
  7748. * Sets the mesh material by the material or multiMaterial `id` property.
  7749. * The material `id` is a string identifying the material or the multiMaterial.
  7750. * This method returns the Mesh.
  7751. */
  7752. setMaterialByID(id: string): Mesh;
  7753. /**
  7754. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  7755. */
  7756. getAnimatables(): IAnimatable[];
  7757. /**
  7758. * Modifies the mesh geometry according to the passed transformation matrix.
  7759. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  7760. * The mesh normals are modified accordingly the same transformation.
  7761. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  7762. * Note that, under the hood, this method sets a new VertexBuffer each call.
  7763. * Returns the Mesh.
  7764. */
  7765. bakeTransformIntoVertices(transform: Matrix): Mesh;
  7766. /**
  7767. * Modifies the mesh geometry according to its own current World Matrix.
  7768. * The mesh World Matrix is then reset.
  7769. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  7770. * tuto : tuto : http://doc.babylonjs.com/resources/baking_transformations
  7771. * Note that, under the hood, this method sets a new VertexBuffer each call.
  7772. * Returns the Mesh.
  7773. */
  7774. bakeCurrentTransformIntoVertices(): Mesh;
  7775. readonly _positions: Nullable<Vector3[]>;
  7776. _resetPointsArrayCache(): Mesh;
  7777. _generatePointsArray(): boolean;
  7778. /**
  7779. * Returns a new Mesh object generated from the current mesh properties.
  7780. * This method must not get confused with createInstance().
  7781. * The parameter `name` is a string, the name given to the new mesh.
  7782. * The optional parameter `newParent` can be any Node object (default `null`).
  7783. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  7784. * 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.
  7785. */
  7786. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  7787. /**
  7788. * Disposes the Mesh.
  7789. * By default, all the mesh children are also disposed unless the parameter `doNotRecurse` is set to `true`.
  7790. * Returns nothing.
  7791. */
  7792. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  7793. /**
  7794. * Modifies the mesh geometry according to a displacement map.
  7795. * 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.
  7796. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  7797. * This method returns nothing.
  7798. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  7799. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  7800. * 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.
  7801. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  7802. * The parameter `uvScale` is an optional vector2 used to scale UV.
  7803. *
  7804. * Returns the Mesh.
  7805. */
  7806. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  7807. /**
  7808. * Modifies the mesh geometry according to a displacementMap buffer.
  7809. * 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.
  7810. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  7811. * This method returns nothing.
  7812. * 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.
  7813. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  7814. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  7815. * The parameter `uvOffset` is an optional vector2 used to offset UV.
  7816. * The parameter `uvScale` is an optional vector2 used to scale UV.
  7817. *
  7818. * Returns the Mesh.
  7819. */
  7820. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2): Mesh;
  7821. /**
  7822. * Modify the mesh to get a flat shading rendering.
  7823. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  7824. * This method returns the Mesh.
  7825. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  7826. */
  7827. convertToFlatShadedMesh(): Mesh;
  7828. /**
  7829. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  7830. * In other words, more vertices, no more indices and a single bigger VBO.
  7831. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  7832. * Returns the Mesh.
  7833. */
  7834. convertToUnIndexedMesh(): Mesh;
  7835. /**
  7836. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  7837. * This method returns the Mesh.
  7838. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  7839. */
  7840. flipFaces(flipNormals?: boolean): Mesh;
  7841. /**
  7842. * Creates a new InstancedMesh object from the mesh model.
  7843. * An instance shares the same properties and the same material than its model.
  7844. * Only these properties of each instance can then be set individually :
  7845. * - position
  7846. * - rotation
  7847. * - rotationQuaternion
  7848. * - setPivotMatrix
  7849. * - scaling
  7850. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  7851. * Warning : this method is not supported for Line mesh and LineSystem
  7852. */
  7853. createInstance(name: string): InstancedMesh;
  7854. /**
  7855. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  7856. * After this call, all the mesh instances have the same submeshes than the current mesh.
  7857. * This method returns the Mesh.
  7858. */
  7859. synchronizeInstances(): Mesh;
  7860. /**
  7861. * Simplify the mesh according to the given array of settings.
  7862. * Function will return immediately and will simplify async. It returns the Mesh.
  7863. * @param settings a collection of simplification settings.
  7864. * @param parallelProcessing should all levels calculate parallel or one after the other.
  7865. * @param type the type of simplification to run.
  7866. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  7867. */
  7868. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): Mesh;
  7869. /**
  7870. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  7871. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  7872. * This should be used together with the simplification to avoid disappearing triangles.
  7873. * Returns the Mesh.
  7874. * @param successCallback an optional success callback to be called after the optimization finished.
  7875. */
  7876. optimizeIndices(successCallback?: (mesh?: Mesh) => void): Mesh;
  7877. serialize(serializationObject: any): void;
  7878. _syncGeometryWithMorphTargetManager(): void;
  7879. /**
  7880. * Returns a new Mesh object parsed from the source provided.
  7881. * The parameter `parsedMesh` is the source.
  7882. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  7883. */
  7884. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  7885. /**
  7886. * Creates a ribbon mesh.
  7887. * Please consider using the same method from the MeshBuilder class instead.
  7888. * 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.
  7889. *
  7890. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  7891. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  7892. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  7893. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  7894. * 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.
  7895. * 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.
  7896. * 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
  7897. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7898. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7899. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7900. */
  7901. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean | undefined, closePath: boolean, offset: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  7902. /**
  7903. * Creates a plane polygonal mesh. By default, this is a disc.
  7904. * Please consider using the same method from the MeshBuilder class instead.
  7905. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  7906. * 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.
  7907. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7908. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7909. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7910. */
  7911. static CreateDisc(name: string, radius: number, tessellation: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  7912. /**
  7913. * Creates a box mesh.
  7914. * Please consider using the same method from the MeshBuilder class instead.
  7915. * The parameter `size` sets the size (float) of each box side (default 1).
  7916. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7917. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7918. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7919. */
  7920. static CreateBox(name: string, size: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  7921. /**
  7922. * Creates a sphere mesh.
  7923. * Please consider using the same method from the MeshBuilder class instead.
  7924. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  7925. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  7926. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7927. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7928. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7929. */
  7930. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  7931. /**
  7932. * Creates a cylinder or a cone mesh.
  7933. * Please consider using the same method from the MeshBuilder class instead.
  7934. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  7935. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  7936. * 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.
  7937. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  7938. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  7939. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7940. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7941. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7942. */
  7943. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh;
  7944. /**
  7945. * Creates a torus mesh.
  7946. * Please consider using the same method from the MeshBuilder class instead.
  7947. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  7948. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  7949. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  7950. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7951. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7952. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7953. */
  7954. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  7955. /**
  7956. * Creates a torus knot mesh.
  7957. * Please consider using the same method from the MeshBuilder class instead.
  7958. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  7959. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  7960. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  7961. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  7962. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7963. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7964. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7965. */
  7966. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  7967. /**
  7968. * Creates a line mesh.
  7969. * Please consider using the same method from the MeshBuilder class instead.
  7970. * 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.
  7971. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7972. * The parameter `points` is an array successive Vector3.
  7973. * 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
  7974. * When updating an instance, remember that only point positions can change, not the number of points.
  7975. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7976. */
  7977. static CreateLines(name: string, points: Vector3[], scene?: Nullable<Scene>, updatable?: boolean, instance?: Nullable<LinesMesh>): LinesMesh;
  7978. /**
  7979. * Creates a dashed line mesh.
  7980. * Please consider using the same method from the MeshBuilder class instead.
  7981. * 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.
  7982. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7983. * The parameter `points` is an array successive Vector3.
  7984. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  7985. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  7986. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  7987. * 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
  7988. * When updating an instance, remember that only point positions can change, not the number of points.
  7989. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7990. */
  7991. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene?: Nullable<Scene>, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  7992. /**
  7993. * Creates a polygon mesh.
  7994. * Please consider using the same method from the MeshBuilder class instead.
  7995. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  7996. * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.
  7997. * You can set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7998. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7999. * Remember you can only change the shape positions, not their number when updating a polygon.
  8000. */
  8001. static CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  8002. /**
  8003. * Creates an extruded polygon mesh, with depth in the Y direction.
  8004. * Please consider using the same method from the MeshBuilder class instead.
  8005. */
  8006. static ExtrudePolygon(name: string, shape: Vector3[], depth: number, scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number): Mesh;
  8007. /**
  8008. * Creates an extruded shape mesh.
  8009. * 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.
  8010. * Please consider using the same method from the MeshBuilder class instead.
  8011. *
  8012. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  8013. * 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
  8014. * extruded along the Z axis.
  8015. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  8016. * 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.
  8017. * The parameter `scale` (float, default 1) is the value to scale the shape.
  8018. * 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
  8019. * 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
  8020. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  8021. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8022. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8023. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8024. */
  8025. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene?: Nullable<Scene>, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  8026. /**
  8027. * Creates an custom extruded shape mesh.
  8028. * 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.
  8029. * Please consider using the same method from the MeshBuilder class instead.
  8030. *
  8031. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  8032. * 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
  8033. * extruded along the Z axis.
  8034. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  8035. * 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
  8036. * and the distance of this point from the begining of the path :
  8037. * ```javascript
  8038. * var rotationFunction = function(i, distance) {
  8039. * // do things
  8040. * return rotationValue; }
  8041. * ```
  8042. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  8043. * 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
  8044. * and the distance of this point from the begining of the path :
  8045. * ```javascript
  8046. * var scaleFunction = function(i, distance) {
  8047. * // do things
  8048. * return scaleValue;}
  8049. * ```
  8050. * It must returns a float value that will be the scale value applied to the shape on each path point.
  8051. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  8052. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  8053. * 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
  8054. * 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
  8055. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  8056. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8057. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8058. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8059. */
  8060. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: Function, rotationFunction: Function, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  8061. /**
  8062. * Creates lathe mesh.
  8063. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  8064. * Please consider using the same method from the MeshBuilder class instead.
  8065. * 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
  8066. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  8067. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  8068. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  8069. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8070. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8071. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8072. */
  8073. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  8074. /**
  8075. * Creates a plane mesh.
  8076. * Please consider using the same method from the MeshBuilder class instead.
  8077. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  8078. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8079. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8080. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8081. */
  8082. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  8083. /**
  8084. * Creates a ground mesh.
  8085. * Please consider using the same method from the MeshBuilder class instead.
  8086. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  8087. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  8088. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8089. */
  8090. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;
  8091. /**
  8092. * Creates a tiled ground mesh.
  8093. * Please consider using the same method from the MeshBuilder class instead.
  8094. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  8095. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  8096. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  8097. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  8098. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  8099. * numbers of subdivisions on the ground width and height of each tile.
  8100. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8101. */
  8102. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  8103. w: number;
  8104. h: number;
  8105. }, precision: {
  8106. w: number;
  8107. h: number;
  8108. }, scene: Scene, updatable?: boolean): Mesh;
  8109. /**
  8110. * Creates a ground mesh from a height map.
  8111. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  8112. * Please consider using the same method from the MeshBuilder class instead.
  8113. * The parameter `url` sets the URL of the height map image resource.
  8114. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  8115. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  8116. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  8117. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  8118. * 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).
  8119. * This function is passed the newly built mesh :
  8120. * ```javascript
  8121. * function(mesh) { // do things
  8122. * return; }
  8123. * ```
  8124. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8125. */
  8126. 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;
  8127. /**
  8128. * Creates a tube mesh.
  8129. * 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.
  8130. * Please consider using the same method from the MeshBuilder class instead.
  8131. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  8132. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  8133. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  8134. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  8135. * 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.
  8136. * It must return a radius value (positive float) :
  8137. * ```javascript
  8138. * var radiusFunction = function(i, distance) {
  8139. * // do things
  8140. * return radius; }
  8141. * ```
  8142. * 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
  8143. * 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
  8144. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8145. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8146. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8147. */
  8148. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  8149. (i: number, distance: number): number;
  8150. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  8151. /**
  8152. * Creates a polyhedron mesh.
  8153. * Please consider using the same method from the MeshBuilder class instead.
  8154. * 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
  8155. * to choose the wanted type.
  8156. * The parameter `size` (positive float, default 1) sets the polygon size.
  8157. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  8158. * 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`.
  8159. * 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
  8160. * 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)`).
  8161. * 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
  8162. * 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.
  8163. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8164. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8165. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8166. */
  8167. static CreatePolyhedron(name: string, options: {
  8168. type?: number;
  8169. size?: number;
  8170. sizeX?: number;
  8171. sizeY?: number;
  8172. sizeZ?: number;
  8173. custom?: any;
  8174. faceUV?: Vector4[];
  8175. faceColors?: Color4[];
  8176. updatable?: boolean;
  8177. sideOrientation?: number;
  8178. }, scene: Scene): Mesh;
  8179. /**
  8180. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  8181. * Please consider using the same method from the MeshBuilder class instead.
  8182. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  8183. * 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`).
  8184. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  8185. * 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.
  8186. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  8187. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  8188. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  8189. */
  8190. static CreateIcoSphere(name: string, options: {
  8191. radius?: number;
  8192. flat?: boolean;
  8193. subdivisions?: number;
  8194. sideOrientation?: number;
  8195. updatable?: boolean;
  8196. }, scene: Scene): Mesh;
  8197. /**
  8198. * Creates a decal mesh.
  8199. * Please consider using the same method from the MeshBuilder class instead.
  8200. * 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.
  8201. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  8202. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  8203. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  8204. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  8205. */
  8206. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  8207. /**
  8208. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  8209. */
  8210. setPositionsForCPUSkinning(): Float32Array;
  8211. /**
  8212. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  8213. */
  8214. setNormalsForCPUSkinning(): Float32Array;
  8215. /**
  8216. * Updates the vertex buffer by applying transformation from the bones.
  8217. * Returns the Mesh.
  8218. *
  8219. * @param {skeleton} skeleton to apply
  8220. */
  8221. applySkeleton(skeleton: Skeleton): Mesh;
  8222. /**
  8223. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  8224. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  8225. */
  8226. static MinMax(meshes: AbstractMesh[]): {
  8227. min: Vector3;
  8228. max: Vector3;
  8229. };
  8230. /**
  8231. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  8232. */
  8233. static Center(meshesOrMinMaxVector: {
  8234. min: Vector3;
  8235. max: Vector3;
  8236. } | AbstractMesh[]): Vector3;
  8237. /**
  8238. * Merge the array of meshes into a single mesh for performance reasons.
  8239. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  8240. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  8241. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  8242. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  8243. * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
  8244. */
  8245. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean): Nullable<Mesh>;
  8246. }
  8247. }
  8248. declare module 'babylonjs/core' {
  8249. class BaseSubMesh {
  8250. _materialDefines: Nullable<MaterialDefines>;
  8251. _materialEffect: Nullable<Effect>;
  8252. readonly effect: Nullable<Effect>;
  8253. setEffect(effect: Nullable<Effect>, defines?: Nullable<MaterialDefines>): void;
  8254. }
  8255. class SubMesh extends BaseSubMesh implements ICullable {
  8256. materialIndex: number;
  8257. verticesStart: number;
  8258. verticesCount: number;
  8259. indexStart: number;
  8260. indexCount: number;
  8261. linesIndexCount: number;
  8262. private _mesh;
  8263. private _renderingMesh;
  8264. private _boundingInfo;
  8265. private _linesIndexBuffer;
  8266. _lastColliderWorldVertices: Nullable<Vector3[]>;
  8267. _trianglePlanes: Plane[];
  8268. _lastColliderTransformMatrix: Matrix;
  8269. _renderId: number;
  8270. _alphaIndex: number;
  8271. _distanceToCamera: number;
  8272. _id: number;
  8273. private _currentMaterial;
  8274. static AddToMesh(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean): SubMesh;
  8275. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  8276. readonly IsGlobal: boolean;
  8277. /**
  8278. * Returns the submesh BoudingInfo object.
  8279. */
  8280. getBoundingInfo(): BoundingInfo;
  8281. /**
  8282. * Sets the submesh BoundingInfo.
  8283. * Return the SubMesh.
  8284. */
  8285. setBoundingInfo(boundingInfo: BoundingInfo): SubMesh;
  8286. /**
  8287. * Returns the mesh of the current submesh.
  8288. */
  8289. getMesh(): AbstractMesh;
  8290. /**
  8291. * Returns the rendering mesh of the submesh.
  8292. */
  8293. getRenderingMesh(): Mesh;
  8294. /**
  8295. * Returns the submesh material.
  8296. */
  8297. getMaterial(): Nullable<Material>;
  8298. /**
  8299. * Sets a new updated BoundingInfo object to the submesh.
  8300. * Returns the SubMesh.
  8301. */
  8302. refreshBoundingInfo(): SubMesh;
  8303. _checkCollision(collider: Collider): boolean;
  8304. /**
  8305. * Updates the submesh BoundingInfo.
  8306. * Returns the Submesh.
  8307. */
  8308. updateBoundingInfo(world: Matrix): SubMesh;
  8309. /**
  8310. * True is the submesh bounding box intersects the frustum defined by the passed array of planes.
  8311. * Boolean returned.
  8312. */
  8313. isInFrustum(frustumPlanes: Plane[]): boolean;
  8314. /**
  8315. * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes.
  8316. * Boolean returned.
  8317. */
  8318. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  8319. /**
  8320. * Renders the submesh.
  8321. * Returns it.
  8322. */
  8323. render(enableAlphaMode: boolean): SubMesh;
  8324. /**
  8325. * Returns a new Index Buffer.
  8326. * Type returned : WebGLBuffer.
  8327. */
  8328. getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer;
  8329. /**
  8330. * True is the passed Ray intersects the submesh bounding box.
  8331. * Boolean returned.
  8332. */
  8333. canIntersects(ray: Ray): boolean;
  8334. /**
  8335. * Returns an object IntersectionInfo.
  8336. */
  8337. intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean): Nullable<IntersectionInfo>;
  8338. _rebuild(): void;
  8339. /**
  8340. * Creates a new Submesh from the passed Mesh.
  8341. */
  8342. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  8343. /**
  8344. * Disposes the Submesh.
  8345. * Returns nothing.
  8346. */
  8347. dispose(): void;
  8348. /**
  8349. * Creates a new Submesh from the passed parameters :
  8350. * - materialIndex (integer) : the index of the main mesh material.
  8351. * - startIndex (integer) : the index where to start the copy in the mesh indices array.
  8352. * - indexCount (integer) : the number of indices to copy then from the startIndex.
  8353. * - mesh (Mesh) : the main mesh to create the submesh from.
  8354. * - renderingMesh (optional Mesh) : rendering mesh.
  8355. */
  8356. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  8357. }
  8358. }
  8359. declare module 'babylonjs/core' {
  8360. class MaterialDefines {
  8361. private _keys;
  8362. private _isDirty;
  8363. _renderId: number;
  8364. _areLightsDirty: boolean;
  8365. _areAttributesDirty: boolean;
  8366. _areTexturesDirty: boolean;
  8367. _areFresnelDirty: boolean;
  8368. _areMiscDirty: boolean;
  8369. _areImageProcessingDirty: boolean;
  8370. _normals: boolean;
  8371. _uvs: boolean;
  8372. _needNormals: boolean;
  8373. _needUVs: boolean;
  8374. readonly isDirty: boolean;
  8375. markAsProcessed(): void;
  8376. markAsUnprocessed(): void;
  8377. markAllAsDirty(): void;
  8378. markAsImageProcessingDirty(): void;
  8379. markAsLightDirty(): void;
  8380. markAsAttributesDirty(): void;
  8381. markAsTexturesDirty(): void;
  8382. markAsFresnelDirty(): void;
  8383. markAsMiscDirty(): void;
  8384. rebuild(): void;
  8385. isEqual(other: MaterialDefines): boolean;
  8386. cloneTo(other: MaterialDefines): void;
  8387. reset(): void;
  8388. toString(): string;
  8389. }
  8390. class Material implements IAnimatable {
  8391. private static _TriangleFillMode;
  8392. private static _WireFrameFillMode;
  8393. private static _PointFillMode;
  8394. private static _PointListDrawMode;
  8395. private static _LineListDrawMode;
  8396. private static _LineLoopDrawMode;
  8397. private static _LineStripDrawMode;
  8398. private static _TriangleStripDrawMode;
  8399. private static _TriangleFanDrawMode;
  8400. static readonly TriangleFillMode: number;
  8401. static readonly WireFrameFillMode: number;
  8402. static readonly PointFillMode: number;
  8403. static readonly PointListDrawMode: number;
  8404. static readonly LineListDrawMode: number;
  8405. static readonly LineLoopDrawMode: number;
  8406. static readonly LineStripDrawMode: number;
  8407. static readonly TriangleStripDrawMode: number;
  8408. static readonly TriangleFanDrawMode: number;
  8409. private static _ClockWiseSideOrientation;
  8410. private static _CounterClockWiseSideOrientation;
  8411. static readonly ClockWiseSideOrientation: number;
  8412. static readonly CounterClockWiseSideOrientation: number;
  8413. private static _TextureDirtyFlag;
  8414. private static _LightDirtyFlag;
  8415. private static _FresnelDirtyFlag;
  8416. private static _AttributesDirtyFlag;
  8417. private static _MiscDirtyFlag;
  8418. static readonly TextureDirtyFlag: number;
  8419. static readonly LightDirtyFlag: number;
  8420. static readonly FresnelDirtyFlag: number;
  8421. static readonly AttributesDirtyFlag: number;
  8422. static readonly MiscDirtyFlag: number;
  8423. id: string;
  8424. name: string;
  8425. checkReadyOnEveryCall: boolean;
  8426. checkReadyOnlyOnce: boolean;
  8427. state: string;
  8428. alpha: number;
  8429. protected _backFaceCulling: boolean;
  8430. backFaceCulling: boolean;
  8431. sideOrientation: number;
  8432. onCompiled: (effect: Effect) => void;
  8433. onError: (effect: Effect, errors: string) => void;
  8434. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  8435. doNotSerialize: boolean;
  8436. storeEffectOnSubMeshes: boolean;
  8437. animations: Array<Animation>;
  8438. /**
  8439. * An event triggered when the material is disposed.
  8440. * @type {BABYLON.Observable}
  8441. */
  8442. onDisposeObservable: Observable<Material>;
  8443. private _onDisposeObserver;
  8444. onDispose: () => void;
  8445. /**
  8446. * An event triggered when the material is bound.
  8447. * @type {BABYLON.Observable}
  8448. */
  8449. onBindObservable: Observable<AbstractMesh>;
  8450. private _onBindObserver;
  8451. onBind: (Mesh: AbstractMesh) => void;
  8452. /**
  8453. * An event triggered when the material is unbound.
  8454. * @type {BABYLON.Observable}
  8455. */
  8456. onUnBindObservable: Observable<Material>;
  8457. private _alphaMode;
  8458. alphaMode: number;
  8459. private _needDepthPrePass;
  8460. needDepthPrePass: boolean;
  8461. disableDepthWrite: boolean;
  8462. forceDepthWrite: boolean;
  8463. separateCullingPass: boolean;
  8464. private _fogEnabled;
  8465. fogEnabled: boolean;
  8466. pointSize: number;
  8467. zOffset: number;
  8468. wireframe: boolean;
  8469. pointsCloud: boolean;
  8470. fillMode: number;
  8471. _effect: Nullable<Effect>;
  8472. _wasPreviouslyReady: boolean;
  8473. private _useUBO;
  8474. private _scene;
  8475. private _fillMode;
  8476. private _cachedDepthWriteState;
  8477. protected _uniformBuffer: UniformBuffer;
  8478. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  8479. /**
  8480. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  8481. * subclasses should override adding information pertainent to themselves
  8482. */
  8483. toString(fullDetails?: boolean): string;
  8484. /**
  8485. * Child classes can use it to update shaders
  8486. */
  8487. getClassName(): string;
  8488. readonly isFrozen: boolean;
  8489. freeze(): void;
  8490. unfreeze(): void;
  8491. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  8492. isReadyForSubMesh(mesh: AbstractMesh, subMesh: BaseSubMesh, useInstances?: boolean): boolean;
  8493. getEffect(): Nullable<Effect>;
  8494. getScene(): Scene;
  8495. needAlphaBlending(): boolean;
  8496. needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
  8497. needAlphaTesting(): boolean;
  8498. getAlphaTestTexture(): Nullable<BaseTexture>;
  8499. markDirty(): void;
  8500. _preBind(effect?: Effect, overrideOrientation?: Nullable<number>): boolean;
  8501. bind(world: Matrix, mesh?: Mesh): void;
  8502. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  8503. bindOnlyWorldMatrix(world: Matrix): void;
  8504. bindSceneUniformBuffer(effect: Effect, sceneUbo: UniformBuffer): void;
  8505. bindView(effect: Effect): void;
  8506. bindViewProjection(effect: Effect): void;
  8507. protected _afterBind(mesh?: Mesh): void;
  8508. unbind(): void;
  8509. getActiveTextures(): BaseTexture[];
  8510. hasTexture(texture: BaseTexture): boolean;
  8511. clone(name: string): Nullable<Material>;
  8512. getBindedMeshes(): AbstractMesh[];
  8513. /**
  8514. * Force shader compilation including textures ready check
  8515. */
  8516. forceCompilation(mesh: AbstractMesh, onCompiled?: (material: Material) => void, options?: Partial<{
  8517. alphaTest: Nullable<boolean>;
  8518. clipPlane: boolean;
  8519. }>): void;
  8520. markAsDirty(flag: number): void;
  8521. protected _markAllSubMeshesAsDirty(func: (defines: MaterialDefines) => void): void;
  8522. protected _markAllSubMeshesAsImageProcessingDirty(): void;
  8523. protected _markAllSubMeshesAsTexturesDirty(): void;
  8524. protected _markAllSubMeshesAsFresnelDirty(): void;
  8525. protected _markAllSubMeshesAsLightsDirty(): void;
  8526. protected _markAllSubMeshesAsAttributesDirty(): void;
  8527. protected _markAllSubMeshesAsMiscDirty(): void;
  8528. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  8529. serialize(): any;
  8530. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  8531. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  8532. }
  8533. }
  8534. declare module 'babylonjs/core' {
  8535. class UniformBuffer {
  8536. private _engine;
  8537. private _buffer;
  8538. private _data;
  8539. private _bufferData;
  8540. private _dynamic?;
  8541. private _uniformLocations;
  8542. private _uniformSizes;
  8543. private _uniformLocationPointer;
  8544. private _needSync;
  8545. private _noUBO;
  8546. private _currentEffect;
  8547. private static _MAX_UNIFORM_SIZE;
  8548. private static _tempBuffer;
  8549. /**
  8550. * Wrapper for updateUniform.
  8551. * @method updateMatrix3x3
  8552. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8553. * @param {Float32Array} matrix
  8554. */
  8555. updateMatrix3x3: (name: string, matrix: Float32Array) => void;
  8556. /**
  8557. * Wrapper for updateUniform.
  8558. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8559. * @param {Float32Array} matrix
  8560. */
  8561. updateMatrix2x2: (name: string, matrix: Float32Array) => void;
  8562. /**
  8563. * Wrapper for updateUniform.
  8564. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8565. * @param {number} x
  8566. */
  8567. updateFloat: (name: string, x: number) => void;
  8568. /**
  8569. * Wrapper for updateUniform.
  8570. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8571. * @param {number} x
  8572. * @param {number} y
  8573. * @param {string} [suffix] Suffix to add to the uniform name.
  8574. */
  8575. updateFloat2: (name: string, x: number, y: number, suffix?: string) => void;
  8576. /**
  8577. * Wrapper for updateUniform.
  8578. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8579. * @param {number} x
  8580. * @param {number} y
  8581. * @param {number} z
  8582. * @param {string} [suffix] Suffix to add to the uniform name.
  8583. */
  8584. updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;
  8585. /**
  8586. * Wrapper for updateUniform.
  8587. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8588. * @param {number} x
  8589. * @param {number} y
  8590. * @param {number} z
  8591. * @param {number} w
  8592. * @param {string} [suffix] Suffix to add to the uniform name.
  8593. */
  8594. updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;
  8595. /**
  8596. * Wrapper for updateUniform.
  8597. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8598. * @param {Matrix} A 4x4 matrix.
  8599. */
  8600. updateMatrix: (name: string, mat: Matrix) => void;
  8601. /**
  8602. * Wrapper for updateUniform.
  8603. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8604. * @param {Vector3} vector
  8605. */
  8606. updateVector3: (name: string, vector: Vector3) => void;
  8607. /**
  8608. * Wrapper for updateUniform.
  8609. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8610. * @param {Vector4} vector
  8611. */
  8612. updateVector4: (name: string, vector: Vector4) => void;
  8613. /**
  8614. * Wrapper for updateUniform.
  8615. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8616. * @param {Color3} color
  8617. * @param {string} [suffix] Suffix to add to the uniform name.
  8618. */
  8619. updateColor3: (name: string, color: Color3, suffix?: string) => void;
  8620. /**
  8621. * Wrapper for updateUniform.
  8622. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8623. * @param {Color3} color
  8624. * @param {number} alpha
  8625. * @param {string} [suffix] Suffix to add to the uniform name.
  8626. */
  8627. updateColor4: (name: string, color: Color3, alpha: number, suffix?: string) => void;
  8628. /**
  8629. * Uniform buffer objects.
  8630. *
  8631. * Handles blocks of uniform on the GPU.
  8632. *
  8633. * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
  8634. *
  8635. * For more information, please refer to :
  8636. * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object
  8637. */
  8638. constructor(engine: Engine, data?: number[], dynamic?: boolean);
  8639. /**
  8640. * Indicates if the buffer is using the WebGL2 UBO implementation,
  8641. * or just falling back on setUniformXXX calls.
  8642. */
  8643. readonly useUbo: boolean;
  8644. /**
  8645. * Indicates if the WebGL underlying uniform buffer is in sync
  8646. * with the javascript cache data.
  8647. */
  8648. readonly isSync: boolean;
  8649. /**
  8650. * Indicates if the WebGL underlying uniform buffer is dynamic.
  8651. * Also, a dynamic UniformBuffer will disable cache verification and always
  8652. * update the underlying WebGL uniform buffer to the GPU.
  8653. */
  8654. isDynamic(): boolean;
  8655. /**
  8656. * The data cache on JS side.
  8657. */
  8658. getData(): Float32Array;
  8659. /**
  8660. * The underlying WebGL Uniform buffer.
  8661. */
  8662. getBuffer(): Nullable<WebGLBuffer>;
  8663. /**
  8664. * std140 layout specifies how to align data within an UBO structure.
  8665. * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159
  8666. * for specs.
  8667. */
  8668. private _fillAlignment(size);
  8669. /**
  8670. * Adds an uniform in the buffer.
  8671. * Warning : the subsequents calls of this function must be in the same order as declared in the shader
  8672. * for the layout to be correct !
  8673. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8674. * @param {number|number[]} size Data size, or data directly.
  8675. */
  8676. addUniform(name: string, size: number | number[]): void;
  8677. /**
  8678. * Wrapper for addUniform.
  8679. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8680. * @param {Matrix} mat A 4x4 matrix.
  8681. */
  8682. addMatrix(name: string, mat: Matrix): void;
  8683. /**
  8684. * Wrapper for addUniform.
  8685. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8686. * @param {number} x
  8687. * @param {number} y
  8688. */
  8689. addFloat2(name: string, x: number, y: number): void;
  8690. /**
  8691. * Wrapper for addUniform.
  8692. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8693. * @param {number} x
  8694. * @param {number} y
  8695. * @param {number} z
  8696. */
  8697. addFloat3(name: string, x: number, y: number, z: number): void;
  8698. /**
  8699. * Wrapper for addUniform.
  8700. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8701. * @param {Color3} color
  8702. */
  8703. addColor3(name: string, color: Color3): void;
  8704. /**
  8705. * Wrapper for addUniform.
  8706. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8707. * @param {Color3} color
  8708. * @param {number} alpha
  8709. */
  8710. addColor4(name: string, color: Color3, alpha: number): void;
  8711. /**
  8712. * Wrapper for addUniform.
  8713. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8714. * @param {Vector3} vector
  8715. */
  8716. addVector3(name: string, vector: Vector3): void;
  8717. /**
  8718. * Wrapper for addUniform.
  8719. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8720. */
  8721. addMatrix3x3(name: string): void;
  8722. /**
  8723. * Wrapper for addUniform.
  8724. * @param {string} name Name of the uniform, as used in the uniform block in the shader.
  8725. */
  8726. addMatrix2x2(name: string): void;
  8727. /**
  8728. * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.
  8729. */
  8730. create(): void;
  8731. _rebuild(): void;
  8732. /**
  8733. * Updates the WebGL Uniform Buffer on the GPU.
  8734. * If the `dynamic` flag is set to true, no cache comparison is done.
  8735. * Otherwise, the buffer will be updated only if the cache differs.
  8736. */
  8737. update(): void;
  8738. /**
  8739. * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.
  8740. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  8741. * @param {number[]|Float32Array} data Flattened data
  8742. * @param {number} size Size of the data.
  8743. */
  8744. updateUniform(uniformName: string, data: FloatArray, size: number): void;
  8745. private _updateMatrix3x3ForUniform(name, matrix);
  8746. private _updateMatrix3x3ForEffect(name, matrix);
  8747. private _updateMatrix2x2ForEffect(name, matrix);
  8748. private _updateMatrix2x2ForUniform(name, matrix);
  8749. private _updateFloatForEffect(name, x);
  8750. private _updateFloatForUniform(name, x);
  8751. private _updateFloat2ForEffect(name, x, y, suffix?);
  8752. private _updateFloat2ForUniform(name, x, y, suffix?);
  8753. private _updateFloat3ForEffect(name, x, y, z, suffix?);
  8754. private _updateFloat3ForUniform(name, x, y, z, suffix?);
  8755. private _updateFloat4ForEffect(name, x, y, z, w, suffix?);
  8756. private _updateFloat4ForUniform(name, x, y, z, w, suffix?);
  8757. private _updateMatrixForEffect(name, mat);
  8758. private _updateMatrixForUniform(name, mat);
  8759. private _updateVector3ForEffect(name, vector);
  8760. private _updateVector3ForUniform(name, vector);
  8761. private _updateVector4ForEffect(name, vector);
  8762. private _updateVector4ForUniform(name, vector);
  8763. private _updateColor3ForEffect(name, color, suffix?);
  8764. private _updateColor3ForUniform(name, color, suffix?);
  8765. private _updateColor4ForEffect(name, color, alpha, suffix?);
  8766. private _updateColor4ForUniform(name, color, alpha, suffix?);
  8767. /**
  8768. * Sets a sampler uniform on the effect.
  8769. * @param {string} name Name of the sampler.
  8770. * @param {Texture} texture
  8771. */
  8772. setTexture(name: string, texture: Nullable<BaseTexture>): void;
  8773. /**
  8774. * Directly updates the value of the uniform in the cache AND on the GPU.
  8775. * @param {string} uniformName Name of the uniform, as used in the uniform block in the shader.
  8776. * @param {number[]|Float32Array} data Flattened data
  8777. */
  8778. updateUniformDirectly(uniformName: string, data: FloatArray): void;
  8779. /**
  8780. * Binds this uniform buffer to an effect.
  8781. * @param {Effect} effect
  8782. * @param {string} name Name of the uniform block in the shader.
  8783. */
  8784. bindToEffect(effect: Effect, name: string): void;
  8785. /**
  8786. * Disposes the uniform buffer.
  8787. */
  8788. dispose(): void;
  8789. }
  8790. }
  8791. declare module 'babylonjs/core' {
  8792. interface IGetSetVerticesData {
  8793. isVerticesDataPresent(kind: string): boolean;
  8794. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  8795. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  8796. setVerticesData(kind: string, data: FloatArray, updatable: boolean): void;
  8797. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): void;
  8798. setIndices(indices: IndicesArray, totalVertices: Nullable<number>, updatable?: boolean): void;
  8799. }
  8800. class VertexData {
  8801. positions: Nullable<FloatArray>;
  8802. normals: Nullable<FloatArray>;
  8803. tangents: Nullable<FloatArray>;
  8804. uvs: Nullable<FloatArray>;
  8805. uvs2: Nullable<FloatArray>;
  8806. uvs3: Nullable<FloatArray>;
  8807. uvs4: Nullable<FloatArray>;
  8808. uvs5: Nullable<FloatArray>;
  8809. uvs6: Nullable<FloatArray>;
  8810. colors: Nullable<FloatArray>;
  8811. matricesIndices: Nullable<FloatArray>;
  8812. matricesWeights: Nullable<FloatArray>;
  8813. matricesIndicesExtra: Nullable<FloatArray>;
  8814. matricesWeightsExtra: Nullable<FloatArray>;
  8815. indices: Nullable<IndicesArray>;
  8816. set(data: FloatArray, kind: string): void;
  8817. /**
  8818. * Associates the vertexData to the passed Mesh.
  8819. * Sets it as updatable or not (default `false`).
  8820. * Returns the VertexData.
  8821. */
  8822. applyToMesh(mesh: Mesh, updatable?: boolean): VertexData;
  8823. /**
  8824. * Associates the vertexData to the passed Geometry.
  8825. * Sets it as updatable or not (default `false`).
  8826. * Returns the VertexData.
  8827. */
  8828. applyToGeometry(geometry: Geometry, updatable?: boolean): VertexData;
  8829. /**
  8830. * Updates the associated mesh.
  8831. * Returns the VertexData.
  8832. */
  8833. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  8834. /**
  8835. * Updates the associated geometry.
  8836. * Returns the VertexData.
  8837. */
  8838. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): VertexData;
  8839. private _applyTo(meshOrGeometry, updatable?);
  8840. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  8841. /**
  8842. * Transforms each position and each normal of the vertexData according to the passed Matrix.
  8843. * Returns the VertexData.
  8844. */
  8845. transform(matrix: Matrix): VertexData;
  8846. /**
  8847. * Merges the passed VertexData into the current one.
  8848. * Returns the modified VertexData.
  8849. */
  8850. merge(other: VertexData, options?: {
  8851. tangentLength?: number;
  8852. }): VertexData;
  8853. private _mergeElement(source, other, length?, defaultValue?);
  8854. /**
  8855. * Serializes the VertexData.
  8856. * Returns a serialized object.
  8857. */
  8858. serialize(): any;
  8859. /**
  8860. * Returns the object VertexData associated to the passed mesh.
  8861. */
  8862. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  8863. /**
  8864. * Returns the object VertexData associated to the passed geometry.
  8865. */
  8866. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean, forceCopy?: boolean): VertexData;
  8867. private static _ExtractFrom(meshOrGeometry, copyWhenShared?, forceCopy?);
  8868. /**
  8869. * Creates the vertexData of the Ribbon.
  8870. */
  8871. static CreateRibbon(options: {
  8872. pathArray: Vector3[][];
  8873. closeArray?: boolean;
  8874. closePath?: boolean;
  8875. offset?: number;
  8876. sideOrientation?: number;
  8877. frontUVs?: Vector4;
  8878. backUVs?: Vector4;
  8879. invertUV?: boolean;
  8880. uvs?: Vector2[];
  8881. colors?: Color4[];
  8882. }): VertexData;
  8883. /**
  8884. * Creates the VertexData of the Box.
  8885. */
  8886. static CreateBox(options: {
  8887. size?: number;
  8888. width?: number;
  8889. height?: number;
  8890. depth?: number;
  8891. faceUV?: Vector4[];
  8892. faceColors?: Color4[];
  8893. sideOrientation?: number;
  8894. frontUVs?: Vector4;
  8895. backUVs?: Vector4;
  8896. }): VertexData;
  8897. /**
  8898. * Creates the VertexData of the Sphere.
  8899. */
  8900. static CreateSphere(options: {
  8901. segments?: number;
  8902. diameter?: number;
  8903. diameterX?: number;
  8904. diameterY?: number;
  8905. diameterZ?: number;
  8906. arc?: number;
  8907. slice?: number;
  8908. sideOrientation?: number;
  8909. frontUVs?: Vector4;
  8910. backUVs?: Vector4;
  8911. }): VertexData;
  8912. /**
  8913. * Creates the VertexData of the Cylinder or Cone.
  8914. */
  8915. static CreateCylinder(options: {
  8916. height?: number;
  8917. diameterTop?: number;
  8918. diameterBottom?: number;
  8919. diameter?: number;
  8920. tessellation?: number;
  8921. subdivisions?: number;
  8922. arc?: number;
  8923. faceColors?: Color4[];
  8924. faceUV?: Vector4[];
  8925. hasRings?: boolean;
  8926. enclose?: boolean;
  8927. sideOrientation?: number;
  8928. frontUVs?: Vector4;
  8929. backUVs?: Vector4;
  8930. }): VertexData;
  8931. /**
  8932. * Creates the VertexData of the Torus.
  8933. */
  8934. static CreateTorus(options: {
  8935. diameter?: number;
  8936. thickness?: number;
  8937. tessellation?: number;
  8938. sideOrientation?: number;
  8939. frontUVs?: Vector4;
  8940. backUVs?: Vector4;
  8941. }): VertexData;
  8942. /**
  8943. * Creates the VertexData of the LineSystem.
  8944. */
  8945. static CreateLineSystem(options: {
  8946. lines: Vector3[][];
  8947. colors?: Nullable<Color4[][]>;
  8948. }): VertexData;
  8949. /**
  8950. * Create the VertexData of the DashedLines.
  8951. */
  8952. static CreateDashedLines(options: {
  8953. points: Vector3[];
  8954. dashSize?: number;
  8955. gapSize?: number;
  8956. dashNb?: number;
  8957. }): VertexData;
  8958. /**
  8959. * Creates the VertexData of the Ground.
  8960. */
  8961. static CreateGround(options: {
  8962. width?: number;
  8963. height?: number;
  8964. subdivisions?: number;
  8965. subdivisionsX?: number;
  8966. subdivisionsY?: number;
  8967. }): VertexData;
  8968. /**
  8969. * Creates the VertexData of the TiledGround.
  8970. */
  8971. static CreateTiledGround(options: {
  8972. xmin: number;
  8973. zmin: number;
  8974. xmax: number;
  8975. zmax: number;
  8976. subdivisions?: {
  8977. w: number;
  8978. h: number;
  8979. };
  8980. precision?: {
  8981. w: number;
  8982. h: number;
  8983. };
  8984. }): VertexData;
  8985. /**
  8986. * Creates the VertexData of the Ground designed from a heightmap.
  8987. */
  8988. static CreateGroundFromHeightMap(options: {
  8989. width: number;
  8990. height: number;
  8991. subdivisions: number;
  8992. minHeight: number;
  8993. maxHeight: number;
  8994. colorFilter: Color3;
  8995. buffer: Uint8Array;
  8996. bufferWidth: number;
  8997. bufferHeight: number;
  8998. }): VertexData;
  8999. /**
  9000. * Creates the VertexData of the Plane.
  9001. */
  9002. static CreatePlane(options: {
  9003. size?: number;
  9004. width?: number;
  9005. height?: number;
  9006. sideOrientation?: number;
  9007. frontUVs?: Vector4;
  9008. backUVs?: Vector4;
  9009. }): VertexData;
  9010. /**
  9011. * Creates the VertexData of the Disc or regular Polygon.
  9012. */
  9013. static CreateDisc(options: {
  9014. radius?: number;
  9015. tessellation?: number;
  9016. arc?: number;
  9017. sideOrientation?: number;
  9018. frontUVs?: Vector4;
  9019. backUVs?: Vector4;
  9020. }): VertexData;
  9021. /**
  9022. * Re-creates the VertexData of the Polygon for sideOrientation.
  9023. */
  9024. static CreatePolygon(polygon: Mesh, sideOrientation: number, fUV?: Vector4[], fColors?: Color4[], frontUVs?: Vector4, backUVs?: Vector4): VertexData;
  9025. /**
  9026. * Creates the VertexData of the IcoSphere.
  9027. */
  9028. static CreateIcoSphere(options: {
  9029. radius?: number;
  9030. radiusX?: number;
  9031. radiusY?: number;
  9032. radiusZ?: number;
  9033. flat?: boolean;
  9034. subdivisions?: number;
  9035. sideOrientation?: number;
  9036. frontUVs?: Vector4;
  9037. backUVs?: Vector4;
  9038. }): VertexData;
  9039. /**
  9040. * Creates the VertexData of the Polyhedron.
  9041. */
  9042. static CreatePolyhedron(options: {
  9043. type?: number;
  9044. size?: number;
  9045. sizeX?: number;
  9046. sizeY?: number;
  9047. sizeZ?: number;
  9048. custom?: any;
  9049. faceUV?: Vector4[];
  9050. faceColors?: Color4[];
  9051. flat?: boolean;
  9052. sideOrientation?: number;
  9053. frontUVs?: Vector4;
  9054. backUVs?: Vector4;
  9055. }): VertexData;
  9056. /**
  9057. * Creates the VertexData of the Torus Knot.
  9058. */
  9059. static CreateTorusKnot(options: {
  9060. radius?: number;
  9061. tube?: number;
  9062. radialSegments?: number;
  9063. tubularSegments?: number;
  9064. p?: number;
  9065. q?: number;
  9066. sideOrientation?: number;
  9067. frontUVs?: Vector4;
  9068. backUVs?: Vector4;
  9069. }): VertexData;
  9070. /**
  9071. * @param {any} - positions (number[] or Float32Array)
  9072. * @param {any} - indices (number[] or Uint16Array)
  9073. * @param {any} - normals (number[] or Float32Array)
  9074. * options (optional) :
  9075. * facetPositions : optional array of facet positions (vector3)
  9076. * facetNormals : optional array of facet normals (vector3)
  9077. * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation
  9078. * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation
  9079. * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation
  9080. * bbSize : optional bounding box size data, required for facetPartitioning computation
  9081. * bInfo : optional bounding info, required for facetPartitioning computation
  9082. * useRightHandedSystem: optional boolean to for right handed system computation
  9083. * depthSort : optional boolean to enable the facet depth sort computation
  9084. * distanceTo : optional Vector3 to compute the facet depth from this location
  9085. * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location
  9086. */
  9087. static ComputeNormals(positions: any, indices: any, normals: any, options?: {
  9088. facetNormals?: any;
  9089. facetPositions?: any;
  9090. facetPartitioning?: any;
  9091. ratio?: number;
  9092. bInfo?: any;
  9093. bbSize?: Vector3;
  9094. subDiv?: any;
  9095. useRightHandedSystem?: boolean;
  9096. depthSort?: boolean;
  9097. distanceTo?: Vector3;
  9098. depthSortedFacets?: any;
  9099. }): void;
  9100. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs, frontUVs?, backUVs?);
  9101. /**
  9102. * Creates a new VertexData from the imported parameters.
  9103. */
  9104. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  9105. }
  9106. }
  9107. declare module 'babylonjs/core' {
  9108. class Geometry implements IGetSetVerticesData {
  9109. id: string;
  9110. delayLoadState: number;
  9111. delayLoadingFile: Nullable<string>;
  9112. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  9113. private _scene;
  9114. private _engine;
  9115. private _meshes;
  9116. private _totalVertices;
  9117. private _indices;
  9118. private _vertexBuffers;
  9119. private _isDisposed;
  9120. private _extend;
  9121. private _boundingBias;
  9122. _delayInfo: Array<string>;
  9123. private _indexBuffer;
  9124. private _indexBufferIsUpdatable;
  9125. _boundingInfo: Nullable<BoundingInfo>;
  9126. _delayLoadingFunction: Nullable<(any: any, geometry: Geometry) => void>;
  9127. _softwareSkinningRenderId: number;
  9128. private _vertexArrayObjects;
  9129. private _updatable;
  9130. _positions: Nullable<Vector3[]>;
  9131. /**
  9132. * 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
  9133. * @returns The Bias Vector
  9134. */
  9135. boundingBias: Vector2;
  9136. static CreateGeometryForMesh(mesh: Mesh): Geometry;
  9137. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Nullable<Mesh>);
  9138. readonly extend: {
  9139. minimum: Vector3;
  9140. maximum: Vector3;
  9141. };
  9142. getScene(): Scene;
  9143. getEngine(): Engine;
  9144. isReady(): boolean;
  9145. readonly doNotSerialize: boolean;
  9146. _rebuild(): void;
  9147. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  9148. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): void;
  9149. removeVerticesData(kind: string): void;
  9150. setVerticesBuffer(buffer: VertexBuffer): void;
  9151. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  9152. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean): void;
  9153. private updateBoundingInfo(updateExtends, data);
  9154. _bind(effect: Nullable<Effect>, indexToBind?: Nullable<WebGLBuffer>): void;
  9155. getTotalVertices(): number;
  9156. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
  9157. /**
  9158. * Returns a boolean defining if the vertex data for the requested `kind` is updatable.
  9159. * Possible `kind` values :
  9160. * - BABYLON.VertexBuffer.PositionKind
  9161. * - BABYLON.VertexBuffer.UVKind
  9162. * - BABYLON.VertexBuffer.UV2Kind
  9163. * - BABYLON.VertexBuffer.UV3Kind
  9164. * - BABYLON.VertexBuffer.UV4Kind
  9165. * - BABYLON.VertexBuffer.UV5Kind
  9166. * - BABYLON.VertexBuffer.UV6Kind
  9167. * - BABYLON.VertexBuffer.ColorKind
  9168. * - BABYLON.VertexBuffer.MatricesIndicesKind
  9169. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  9170. * - BABYLON.VertexBuffer.MatricesWeightsKind
  9171. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  9172. */
  9173. isVertexBufferUpdatable(kind: string): boolean;
  9174. getVertexBuffer(kind: string): Nullable<VertexBuffer>;
  9175. getVertexBuffers(): Nullable<{
  9176. [key: string]: VertexBuffer;
  9177. }>;
  9178. isVerticesDataPresent(kind: string): boolean;
  9179. getVerticesDataKinds(): string[];
  9180. updateIndices(indices: IndicesArray, offset?: number): void;
  9181. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>, updatable?: boolean): void;
  9182. getTotalIndices(): number;
  9183. getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
  9184. getIndexBuffer(): Nullable<WebGLBuffer>;
  9185. _releaseVertexArrayObject(effect?: Nullable<Effect>): void;
  9186. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  9187. applyToMesh(mesh: Mesh): void;
  9188. private updateExtend(data?, stride?);
  9189. private _applyToMesh(mesh);
  9190. private notifyUpdate(kind?);
  9191. load(scene: Scene, onLoaded?: () => void): void;
  9192. private _queueLoad(scene, onLoaded?);
  9193. /**
  9194. * Invert the geometry to move from a right handed system to a left handed one.
  9195. */
  9196. toLeftHanded(): void;
  9197. _resetPointsArrayCache(): void;
  9198. _generatePointsArray(): boolean;
  9199. isDisposed(): boolean;
  9200. private _disposeVertexArrayObjects();
  9201. dispose(): void;
  9202. copy(id: string): Geometry;
  9203. serialize(): any;
  9204. private toNumberArray(origin);
  9205. serializeVerticeData(): any;
  9206. static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry>;
  9207. /**
  9208. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  9209. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  9210. * Be aware Math.random() could cause collisions, but:
  9211. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  9212. */
  9213. static RandomId(): string;
  9214. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  9215. private static _CleanMatricesWeights(parsedGeometry, mesh);
  9216. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry>;
  9217. }
  9218. class _PrimitiveGeometry extends Geometry {
  9219. private _canBeRegenerated;
  9220. private _beingRegenerated;
  9221. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9222. canBeRegenerated(): boolean;
  9223. regenerate(): void;
  9224. asNewGeometry(id: string): Geometry;
  9225. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  9226. setVerticesData(kind: string, data: FloatArray, updatable?: boolean): void;
  9227. _regenerateVertexData(): VertexData;
  9228. copy(id: string): Geometry;
  9229. serialize(): any;
  9230. }
  9231. class RibbonGeometry extends _PrimitiveGeometry {
  9232. pathArray: Vector3[][];
  9233. closeArray: boolean;
  9234. closePath: boolean;
  9235. offset: number;
  9236. side: number;
  9237. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  9238. _regenerateVertexData(): VertexData;
  9239. copy(id: string): Geometry;
  9240. }
  9241. class BoxGeometry extends _PrimitiveGeometry {
  9242. size: number;
  9243. side: number;
  9244. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9245. _regenerateVertexData(): VertexData;
  9246. copy(id: string): Geometry;
  9247. serialize(): any;
  9248. static Parse(parsedBox: any, scene: Scene): Nullable<BoxGeometry>;
  9249. }
  9250. class SphereGeometry extends _PrimitiveGeometry {
  9251. segments: number;
  9252. diameter: number;
  9253. side: number;
  9254. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9255. _regenerateVertexData(): VertexData;
  9256. copy(id: string): Geometry;
  9257. serialize(): any;
  9258. static Parse(parsedSphere: any, scene: Scene): Nullable<SphereGeometry>;
  9259. }
  9260. class DiscGeometry extends _PrimitiveGeometry {
  9261. radius: number;
  9262. tessellation: number;
  9263. side: number;
  9264. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9265. _regenerateVertexData(): VertexData;
  9266. copy(id: string): Geometry;
  9267. }
  9268. class CylinderGeometry extends _PrimitiveGeometry {
  9269. height: number;
  9270. diameterTop: number;
  9271. diameterBottom: number;
  9272. tessellation: number;
  9273. subdivisions: number;
  9274. side: number;
  9275. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9276. _regenerateVertexData(): VertexData;
  9277. copy(id: string): Geometry;
  9278. serialize(): any;
  9279. static Parse(parsedCylinder: any, scene: Scene): Nullable<CylinderGeometry>;
  9280. }
  9281. class TorusGeometry extends _PrimitiveGeometry {
  9282. diameter: number;
  9283. thickness: number;
  9284. tessellation: number;
  9285. side: number;
  9286. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9287. _regenerateVertexData(): VertexData;
  9288. copy(id: string): Geometry;
  9289. serialize(): any;
  9290. static Parse(parsedTorus: any, scene: Scene): Nullable<TorusGeometry>;
  9291. }
  9292. class GroundGeometry extends _PrimitiveGeometry {
  9293. width: number;
  9294. height: number;
  9295. subdivisions: number;
  9296. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9297. _regenerateVertexData(): VertexData;
  9298. copy(id: string): Geometry;
  9299. serialize(): any;
  9300. static Parse(parsedGround: any, scene: Scene): Nullable<GroundGeometry>;
  9301. }
  9302. class TiledGroundGeometry extends _PrimitiveGeometry {
  9303. xmin: number;
  9304. zmin: number;
  9305. xmax: number;
  9306. zmax: number;
  9307. subdivisions: {
  9308. w: number;
  9309. h: number;
  9310. };
  9311. precision: {
  9312. w: number;
  9313. h: number;
  9314. };
  9315. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  9316. w: number;
  9317. h: number;
  9318. }, precision: {
  9319. w: number;
  9320. h: number;
  9321. }, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>);
  9322. _regenerateVertexData(): VertexData;
  9323. copy(id: string): Geometry;
  9324. }
  9325. class PlaneGeometry extends _PrimitiveGeometry {
  9326. size: number;
  9327. side: number;
  9328. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9329. _regenerateVertexData(): VertexData;
  9330. copy(id: string): Geometry;
  9331. serialize(): any;
  9332. static Parse(parsedPlane: any, scene: Scene): Nullable<PlaneGeometry>;
  9333. }
  9334. class TorusKnotGeometry extends _PrimitiveGeometry {
  9335. radius: number;
  9336. tube: number;
  9337. radialSegments: number;
  9338. tubularSegments: number;
  9339. p: number;
  9340. q: number;
  9341. side: number;
  9342. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number);
  9343. _regenerateVertexData(): VertexData;
  9344. copy(id: string): Geometry;
  9345. serialize(): any;
  9346. static Parse(parsedTorusKnot: any, scene: Scene): Nullable<TorusKnotGeometry>;
  9347. }
  9348. }
  9349. declare module 'babylonjs/core' {
  9350. class PostProcessManager {
  9351. private _scene;
  9352. private _indexBuffer;
  9353. private _vertexBuffers;
  9354. constructor(scene: Scene);
  9355. private _prepareBuffers();
  9356. private _buildIndexBuffer();
  9357. _rebuild(): void;
  9358. _prepareFrame(sourceTexture?: Nullable<InternalTexture>, postProcesses?: Nullable<PostProcess[]>): boolean;
  9359. directRender(postProcesses: PostProcess[], targetTexture?: Nullable<InternalTexture>, forceFullscreenViewport?: boolean): void;
  9360. _finalizeFrame(doNotPresent?: boolean, targetTexture?: InternalTexture, faceIndex?: number, postProcesses?: PostProcess[], forceFullscreenViewport?: boolean): void;
  9361. dispose(): void;
  9362. }
  9363. }
  9364. declare module 'babylonjs/core' {
  9365. /**
  9366. * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window
  9367. */
  9368. class PerformanceMonitor {
  9369. private _enabled;
  9370. private _rollingFrameTime;
  9371. private _lastFrameTimeMs;
  9372. /**
  9373. * constructor
  9374. * @param frameSampleSize The number of samples required to saturate the sliding window
  9375. */
  9376. constructor(frameSampleSize?: number);
  9377. /**
  9378. * Samples current frame
  9379. * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames
  9380. */
  9381. sampleFrame(timeMs?: number): void;
  9382. /**
  9383. * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
  9384. * @return Average frame time in milliseconds
  9385. */
  9386. readonly averageFrameTime: number;
  9387. /**
  9388. * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
  9389. * @return Frame time variance in milliseconds squared
  9390. */
  9391. readonly averageFrameTimeVariance: number;
  9392. /**
  9393. * Returns the frame time of the most recent frame
  9394. * @return Frame time in milliseconds
  9395. */
  9396. readonly instantaneousFrameTime: number;
  9397. /**
  9398. * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
  9399. * @return Framerate in frames per second
  9400. */
  9401. readonly averageFPS: number;
  9402. /**
  9403. * Returns the average framerate in frames per second using the most recent frame time
  9404. * @return Framerate in frames per second
  9405. */
  9406. readonly instantaneousFPS: number;
  9407. /**
  9408. * Returns true if enough samples have been taken to completely fill the sliding window
  9409. * @return true if saturated
  9410. */
  9411. readonly isSaturated: boolean;
  9412. /**
  9413. * Enables contributions to the sliding window sample set
  9414. */
  9415. enable(): void;
  9416. /**
  9417. * Disables contributions to the sliding window sample set
  9418. * Samples will not be interpolated over the disabled period
  9419. */
  9420. disable(): void;
  9421. /**
  9422. * Returns true if sampling is enabled
  9423. * @return true if enabled
  9424. */
  9425. readonly isEnabled: boolean;
  9426. /**
  9427. * Resets performance monitor
  9428. */
  9429. reset(): void;
  9430. }
  9431. /**
  9432. * RollingAverage
  9433. *
  9434. * Utility to efficiently compute the rolling average and variance over a sliding window of samples
  9435. */
  9436. class RollingAverage {
  9437. /**
  9438. * Current average
  9439. */
  9440. average: number;
  9441. /**
  9442. * Current variance
  9443. */
  9444. variance: number;
  9445. protected _samples: Array<number>;
  9446. protected _sampleCount: number;
  9447. protected _pos: number;
  9448. protected _m2: number;
  9449. /**
  9450. * constructor
  9451. * @param length The number of samples required to saturate the sliding window
  9452. */
  9453. constructor(length: number);
  9454. /**
  9455. * Adds a sample to the sample set
  9456. * @param v The sample value
  9457. */
  9458. add(v: number): void;
  9459. /**
  9460. * Returns previously added values or null if outside of history or outside the sliding window domain
  9461. * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that
  9462. * @return Value previously recorded with add() or null if outside of range
  9463. */
  9464. history(i: number): number;
  9465. /**
  9466. * Returns true if enough samples have been taken to completely fill the sliding window
  9467. * @return true if sample-set saturated
  9468. */
  9469. isSaturated(): boolean;
  9470. /**
  9471. * Resets the rolling average (equivalent to 0 samples taken so far)
  9472. */
  9473. reset(): void;
  9474. /**
  9475. * Wraps a value around the sample range boundaries
  9476. * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.
  9477. * @return Wrapped position in sample range
  9478. */
  9479. protected _wrapPosition(i: number): number;
  9480. }
  9481. }
  9482. declare module 'babylonjs/core' {
  9483. /**
  9484. * Interface to follow in your material defines to integrate easily the
  9485. * Image proccessing functions.
  9486. */
  9487. interface IImageProcessingConfigurationDefines {
  9488. IMAGEPROCESSING: boolean;
  9489. VIGNETTE: boolean;
  9490. VIGNETTEBLENDMODEMULTIPLY: boolean;
  9491. VIGNETTEBLENDMODEOPAQUE: boolean;
  9492. TONEMAPPING: boolean;
  9493. CONTRAST: boolean;
  9494. EXPOSURE: boolean;
  9495. COLORCURVES: boolean;
  9496. COLORGRADING: boolean;
  9497. COLORGRADING3D: boolean;
  9498. SAMPLER3DGREENDEPTH: boolean;
  9499. SAMPLER3DBGRMAP: boolean;
  9500. IMAGEPROCESSINGPOSTPROCESS: boolean;
  9501. }
  9502. /**
  9503. * This groups together the common properties used for image processing either in direct forward pass
  9504. * or through post processing effect depending on the use of the image processing pipeline in your scene
  9505. * or not.
  9506. */
  9507. class ImageProcessingConfiguration {
  9508. /**
  9509. * Color curves setup used in the effect if colorCurvesEnabled is set to true
  9510. */
  9511. colorCurves: Nullable<ColorCurves>;
  9512. private _colorCurvesEnabled;
  9513. /**
  9514. * Gets wether the color curves effect is enabled.
  9515. */
  9516. /**
  9517. * Sets wether the color curves effect is enabled.
  9518. */
  9519. colorCurvesEnabled: boolean;
  9520. /**
  9521. * Color grading LUT texture used in the effect if colorGradingEnabled is set to true
  9522. */
  9523. colorGradingTexture: Nullable<BaseTexture>;
  9524. private _colorGradingEnabled;
  9525. /**
  9526. * Gets wether the color grading effect is enabled.
  9527. */
  9528. /**
  9529. * Sets wether the color grading effect is enabled.
  9530. */
  9531. colorGradingEnabled: boolean;
  9532. private _colorGradingWithGreenDepth;
  9533. /**
  9534. * Gets wether the color grading effect is using a green depth for the 3d Texture.
  9535. */
  9536. /**
  9537. * Sets wether the color grading effect is using a green depth for the 3d Texture.
  9538. */
  9539. colorGradingWithGreenDepth: boolean;
  9540. private _colorGradingBGR;
  9541. /**
  9542. * Gets wether the color grading texture contains BGR values.
  9543. */
  9544. /**
  9545. * Sets wether the color grading texture contains BGR values.
  9546. */
  9547. colorGradingBGR: boolean;
  9548. _exposure: number;
  9549. /**
  9550. * Gets the Exposure used in the effect.
  9551. */
  9552. /**
  9553. * Sets the Exposure used in the effect.
  9554. */
  9555. exposure: number;
  9556. private _toneMappingEnabled;
  9557. /**
  9558. * Gets wether the tone mapping effect is enabled.
  9559. */
  9560. /**
  9561. * Sets wether the tone mapping effect is enabled.
  9562. */
  9563. toneMappingEnabled: boolean;
  9564. protected _contrast: number;
  9565. /**
  9566. * Gets the contrast used in the effect.
  9567. */
  9568. /**
  9569. * Sets the contrast used in the effect.
  9570. */
  9571. contrast: number;
  9572. /**
  9573. * Vignette stretch size.
  9574. */
  9575. vignetteStretch: number;
  9576. /**
  9577. * Vignette centre X Offset.
  9578. */
  9579. vignetteCentreX: number;
  9580. /**
  9581. * Vignette centre Y Offset.
  9582. */
  9583. vignetteCentreY: number;
  9584. /**
  9585. * Vignette weight or intensity of the vignette effect.
  9586. */
  9587. vignetteWeight: number;
  9588. /**
  9589. * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
  9590. * if vignetteEnabled is set to true.
  9591. */
  9592. vignetteColor: Color4;
  9593. /**
  9594. * Camera field of view used by the Vignette effect.
  9595. */
  9596. vignetteCameraFov: number;
  9597. private _vignetteBlendMode;
  9598. /**
  9599. * Gets the vignette blend mode allowing different kind of effect.
  9600. */
  9601. /**
  9602. * Sets the vignette blend mode allowing different kind of effect.
  9603. */
  9604. vignetteBlendMode: number;
  9605. private _vignetteEnabled;
  9606. /**
  9607. * Gets wether the vignette effect is enabled.
  9608. */
  9609. /**
  9610. * Sets wether the vignette effect is enabled.
  9611. */
  9612. vignetteEnabled: boolean;
  9613. private _applyByPostProcess;
  9614. /**
  9615. * Gets wether the image processing is applied through a post process or not.
  9616. */
  9617. /**
  9618. * Sets wether the image processing is applied through a post process or not.
  9619. */
  9620. applyByPostProcess: boolean;
  9621. private _isEnabled;
  9622. /**
  9623. * Gets wether the image processing is enabled or not.
  9624. */
  9625. /**
  9626. * Sets wether the image processing is enabled or not.
  9627. */
  9628. isEnabled: boolean;
  9629. /**
  9630. * An event triggered when the configuration changes and requires Shader to Update some parameters.
  9631. * @type {BABYLON.Observable}
  9632. */
  9633. onUpdateParameters: Observable<ImageProcessingConfiguration>;
  9634. /**
  9635. * Method called each time the image processing information changes requires to recompile the effect.
  9636. */
  9637. protected _updateParameters(): void;
  9638. getClassName(): string;
  9639. /**
  9640. * Prepare the list of uniforms associated with the Image Processing effects.
  9641. * @param uniformsList The list of uniforms used in the effect
  9642. * @param defines the list of defines currently in use
  9643. */
  9644. static PrepareUniforms(uniforms: string[], defines: IImageProcessingConfigurationDefines): void;
  9645. /**
  9646. * Prepare the list of samplers associated with the Image Processing effects.
  9647. * @param uniformsList The list of uniforms used in the effect
  9648. * @param defines the list of defines currently in use
  9649. */
  9650. static PrepareSamplers(samplersList: string[], defines: IImageProcessingConfigurationDefines): void;
  9651. /**
  9652. * Prepare the list of defines associated to the shader.
  9653. * @param defines the list of defines to complete
  9654. */
  9655. prepareDefines(defines: IImageProcessingConfigurationDefines, forPostProcess?: boolean): void;
  9656. /**
  9657. * Returns true if all the image processing information are ready.
  9658. */
  9659. isReady(): boolean;
  9660. /**
  9661. * Binds the image processing to the shader.
  9662. * @param effect The effect to bind to
  9663. */
  9664. bind(effect: Effect, aspectRatio?: number): void;
  9665. /**
  9666. * Clones the current image processing instance.
  9667. * @return The cloned image processing
  9668. */
  9669. clone(): ImageProcessingConfiguration;
  9670. /**
  9671. * Serializes the current image processing instance to a json representation.
  9672. * @return a JSON representation
  9673. */
  9674. serialize(): any;
  9675. /**
  9676. * Parses the image processing from a json representation.
  9677. * @param source the JSON source to parse
  9678. * @return The parsed image processing
  9679. */
  9680. static Parse(source: any): ImageProcessingConfiguration;
  9681. private static _VIGNETTEMODE_MULTIPLY;
  9682. private static _VIGNETTEMODE_OPAQUE;
  9683. /**
  9684. * Used to apply the vignette as a mix with the pixel color.
  9685. */
  9686. static readonly VIGNETTEMODE_MULTIPLY: number;
  9687. /**
  9688. * Used to apply the vignette as a replacement of the pixel color.
  9689. */
  9690. static readonly VIGNETTEMODE_OPAQUE: number;
  9691. }
  9692. }
  9693. declare module 'babylonjs/core' {
  9694. /**
  9695. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  9696. * It can help converting any input color in a desired output one. This can then be used to create effects
  9697. * from sepia, black and white to sixties or futuristic rendering...
  9698. *
  9699. * The only supported format is currently 3dl.
  9700. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  9701. */
  9702. class ColorGradingTexture extends BaseTexture {
  9703. /**
  9704. * The current texture matrix. (will always be identity in color grading texture)
  9705. */
  9706. private _textureMatrix;
  9707. /**
  9708. * The texture URL.
  9709. */
  9710. url: string;
  9711. /**
  9712. * Empty line regex stored for GC.
  9713. */
  9714. private static _noneEmptyLineRegex;
  9715. private _engine;
  9716. /**
  9717. * Instantiates a ColorGradingTexture from the following parameters.
  9718. *
  9719. * @param url The location of the color gradind data (currently only supporting 3dl)
  9720. * @param scene The scene the texture will be used in
  9721. */
  9722. constructor(url: string, scene: Scene);
  9723. /**
  9724. * Returns the texture matrix used in most of the material.
  9725. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  9726. */
  9727. getTextureMatrix(): Matrix;
  9728. /**
  9729. * Occurs when the file being loaded is a .3dl LUT file.
  9730. */
  9731. private load3dlTexture();
  9732. /**
  9733. * Starts the loading process of the texture.
  9734. */
  9735. private loadTexture();
  9736. /**
  9737. * Clones the color gradind texture.
  9738. */
  9739. clone(): ColorGradingTexture;
  9740. /**
  9741. * Called during delayed load for textures.
  9742. */
  9743. delayLoad(): void;
  9744. /**
  9745. * Parses a color grading texture serialized by Babylon.
  9746. * @param parsedTexture The texture information being parsedTexture
  9747. * @param scene The scene to load the texture in
  9748. * @param rootUrl The root url of the data assets to load
  9749. * @return A color gradind texture
  9750. */
  9751. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<ColorGradingTexture>;
  9752. /**
  9753. * Serializes the LUT texture to json format.
  9754. */
  9755. serialize(): any;
  9756. }
  9757. }
  9758. declare module 'babylonjs/core' {
  9759. /**
  9760. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  9761. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  9762. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  9763. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  9764. */
  9765. class ColorCurves {
  9766. private _dirty;
  9767. private _tempColor;
  9768. private _globalCurve;
  9769. private _highlightsCurve;
  9770. private _midtonesCurve;
  9771. private _shadowsCurve;
  9772. private _positiveCurve;
  9773. private _negativeCurve;
  9774. private _globalHue;
  9775. private _globalDensity;
  9776. private _globalSaturation;
  9777. private _globalExposure;
  9778. /**
  9779. * Gets the global Hue value.
  9780. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9781. */
  9782. /**
  9783. * Sets the global Hue value.
  9784. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9785. */
  9786. globalHue: number;
  9787. /**
  9788. * Gets the global Density value.
  9789. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9790. * Values less than zero provide a filter of opposite hue.
  9791. */
  9792. /**
  9793. * Sets the global Density value.
  9794. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9795. * Values less than zero provide a filter of opposite hue.
  9796. */
  9797. globalDensity: number;
  9798. /**
  9799. * Gets the global Saturation value.
  9800. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9801. */
  9802. /**
  9803. * Sets the global Saturation value.
  9804. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9805. */
  9806. globalSaturation: number;
  9807. private _highlightsHue;
  9808. private _highlightsDensity;
  9809. private _highlightsSaturation;
  9810. private _highlightsExposure;
  9811. /**
  9812. * Gets the highlights Hue value.
  9813. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9814. */
  9815. /**
  9816. * Sets the highlights Hue value.
  9817. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9818. */
  9819. highlightsHue: number;
  9820. /**
  9821. * Gets the highlights Density value.
  9822. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9823. * Values less than zero provide a filter of opposite hue.
  9824. */
  9825. /**
  9826. * Sets the highlights Density value.
  9827. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9828. * Values less than zero provide a filter of opposite hue.
  9829. */
  9830. highlightsDensity: number;
  9831. /**
  9832. * Gets the highlights Saturation value.
  9833. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9834. */
  9835. /**
  9836. * Sets the highlights Saturation value.
  9837. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9838. */
  9839. highlightsSaturation: number;
  9840. /**
  9841. * Gets the highlights Exposure value.
  9842. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9843. */
  9844. /**
  9845. * Sets the highlights Exposure value.
  9846. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9847. */
  9848. highlightsExposure: number;
  9849. private _midtonesHue;
  9850. private _midtonesDensity;
  9851. private _midtonesSaturation;
  9852. private _midtonesExposure;
  9853. /**
  9854. * Gets the midtones Hue value.
  9855. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9856. */
  9857. /**
  9858. * Sets the midtones Hue value.
  9859. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9860. */
  9861. midtonesHue: number;
  9862. /**
  9863. * Gets the midtones Density value.
  9864. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9865. * Values less than zero provide a filter of opposite hue.
  9866. */
  9867. /**
  9868. * Sets the midtones Density value.
  9869. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9870. * Values less than zero provide a filter of opposite hue.
  9871. */
  9872. midtonesDensity: number;
  9873. /**
  9874. * Gets the midtones Saturation value.
  9875. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9876. */
  9877. /**
  9878. * Sets the midtones Saturation value.
  9879. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9880. */
  9881. midtonesSaturation: number;
  9882. /**
  9883. * Gets the midtones Exposure value.
  9884. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9885. */
  9886. /**
  9887. * Sets the midtones Exposure value.
  9888. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9889. */
  9890. midtonesExposure: number;
  9891. private _shadowsHue;
  9892. private _shadowsDensity;
  9893. private _shadowsSaturation;
  9894. private _shadowsExposure;
  9895. /**
  9896. * Gets the shadows Hue value.
  9897. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9898. */
  9899. /**
  9900. * Sets the shadows Hue value.
  9901. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  9902. */
  9903. shadowsHue: number;
  9904. /**
  9905. * Gets the shadows Density value.
  9906. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9907. * Values less than zero provide a filter of opposite hue.
  9908. */
  9909. /**
  9910. * Sets the shadows Density value.
  9911. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  9912. * Values less than zero provide a filter of opposite hue.
  9913. */
  9914. shadowsDensity: number;
  9915. /**
  9916. * Gets the shadows Saturation value.
  9917. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9918. */
  9919. /**
  9920. * Sets the shadows Saturation value.
  9921. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  9922. */
  9923. shadowsSaturation: number;
  9924. /**
  9925. * Gets the shadows Exposure value.
  9926. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9927. */
  9928. /**
  9929. * Sets the shadows Exposure value.
  9930. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  9931. */
  9932. shadowsExposure: number;
  9933. getClassName(): string;
  9934. /**
  9935. * Binds the color curves to the shader.
  9936. * @param colorCurves The color curve to bind
  9937. * @param effect The effect to bind to
  9938. */
  9939. static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform?: string, neutralUniform?: string, negativeUniform?: string): void;
  9940. /**
  9941. * Prepare the list of uniforms associated with the ColorCurves effects.
  9942. * @param uniformsList The list of uniforms used in the effect
  9943. */
  9944. static PrepareUniforms(uniformsList: string[]): void;
  9945. /**
  9946. * Returns color grading data based on a hue, density, saturation and exposure value.
  9947. * @param filterHue The hue of the color filter.
  9948. * @param filterDensity The density of the color filter.
  9949. * @param saturation The saturation.
  9950. * @param exposure The exposure.
  9951. * @param result The result data container.
  9952. */
  9953. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  9954. /**
  9955. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  9956. * @param value The input slider value in range [-100,100].
  9957. * @returns Adjusted value.
  9958. */
  9959. private static applyColorGradingSliderNonlinear(value);
  9960. /**
  9961. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  9962. * @param hue The hue (H) input.
  9963. * @param saturation The saturation (S) input.
  9964. * @param brightness The brightness (B) input.
  9965. * @result An RGBA color represented as Vector4.
  9966. */
  9967. private static fromHSBToRef(hue, saturation, brightness, result);
  9968. /**
  9969. * Returns a value clamped between min and max
  9970. * @param value The value to clamp
  9971. * @param min The minimum of value
  9972. * @param max The maximum of value
  9973. * @returns The clamped value.
  9974. */
  9975. private static clamp(value, min, max);
  9976. /**
  9977. * Clones the current color curve instance.
  9978. * @return The cloned curves
  9979. */
  9980. clone(): ColorCurves;
  9981. /**
  9982. * Serializes the current color curve instance to a json representation.
  9983. * @return a JSON representation
  9984. */
  9985. serialize(): any;
  9986. /**
  9987. * Parses the color curve from a json representation.
  9988. * @param source the JSON source to parse
  9989. * @return The parsed curves
  9990. */
  9991. static Parse(source: any): ColorCurves;
  9992. }
  9993. }
  9994. declare module 'babylonjs/core' {
  9995. interface Behavior<T extends Node> {
  9996. name: string;
  9997. init(): void;
  9998. attach(node: T): void;
  9999. detach(): void;
  10000. }
  10001. }
  10002. declare module 'babylonjs/core' {
  10003. class MaterialHelper {
  10004. static BindEyePosition(effect: Effect, scene: Scene): void;
  10005. static PrepareDefinesForMergedUV(texture: BaseTexture, defines: any, key: string): void;
  10006. static BindTextureMatrix(texture: BaseTexture, uniformBuffer: UniformBuffer, key: string): void;
  10007. static PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene, useLogarithmicDepth: boolean, pointsCloud: boolean, fogEnabled: boolean, defines: any): void;
  10008. static PrepareDefinesForFrameBoundValues(scene: Scene, engine: Engine, defines: any, useInstances: boolean, forceAlphaTest?: boolean): void;
  10009. static PrepareDefinesForAttributes(mesh: AbstractMesh, defines: any, useVertexColor: boolean, useBones: boolean, useMorphTargets?: boolean, useVertexAlpha?: boolean): boolean;
  10010. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: any, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean;
  10011. static PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | EffectCreationOptions, samplersList?: string[], defines?: any, maxSimultaneousLights?: number): void;
  10012. static HandleFallbacksForShadows(defines: any, fallbacks: EffectFallbacks, maxSimultaneousLights?: number, rank?: number): number;
  10013. static PrepareAttributesForMorphTargets(attribs: string[], mesh: AbstractMesh, defines: any): void;
  10014. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: any, fallbacks: EffectFallbacks): void;
  10015. static PrepareAttributesForInstances(attribs: string[], defines: any): void;
  10016. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: string, effect: Effect): void;
  10017. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  10018. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: any, maxSimultaneousLights?: number, usePhysicalLightFalloff?: boolean): void;
  10019. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  10020. static BindBonesParameters(mesh?: AbstractMesh, effect?: Effect): void;
  10021. static BindMorphTargetParameters(abstractMesh: AbstractMesh, effect: Effect): void;
  10022. static BindLogDepth(defines: any, effect: Effect, scene: Scene): void;
  10023. static BindClipPlane(effect: Effect, scene: Scene): void;
  10024. }
  10025. }
  10026. declare module 'babylonjs/core' {
  10027. class PushMaterial extends Material {
  10028. protected _activeEffect: Effect;
  10029. constructor(name: string, scene: Scene);
  10030. getEffect(): Effect;
  10031. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  10032. bindOnlyWorldMatrix(world: Matrix): void;
  10033. bind(world: Matrix, mesh?: Mesh): void;
  10034. protected _afterBind(mesh: Mesh, effect?: Nullable<Effect>): void;
  10035. protected _mustRebind(scene: Scene, effect: Effect, visibility?: number): boolean;
  10036. }
  10037. }
  10038. declare module 'babylonjs/core' {
  10039. class StandardMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {
  10040. MAINUV1: boolean;
  10041. MAINUV2: boolean;
  10042. DIFFUSE: boolean;
  10043. DIFFUSEDIRECTUV: number;
  10044. AMBIENT: boolean;
  10045. AMBIENTDIRECTUV: number;
  10046. OPACITY: boolean;
  10047. OPACITYDIRECTUV: number;
  10048. OPACITYRGB: boolean;
  10049. REFLECTION: boolean;
  10050. EMISSIVE: boolean;
  10051. EMISSIVEDIRECTUV: number;
  10052. SPECULAR: boolean;
  10053. SPECULARDIRECTUV: number;
  10054. BUMP: boolean;
  10055. BUMPDIRECTUV: number;
  10056. PARALLAX: boolean;
  10057. PARALLAXOCCLUSION: boolean;
  10058. SPECULAROVERALPHA: boolean;
  10059. CLIPPLANE: boolean;
  10060. ALPHATEST: boolean;
  10061. DEPTHPREPASS: boolean;
  10062. ALPHAFROMDIFFUSE: boolean;
  10063. POINTSIZE: boolean;
  10064. FOG: boolean;
  10065. SPECULARTERM: boolean;
  10066. DIFFUSEFRESNEL: boolean;
  10067. OPACITYFRESNEL: boolean;
  10068. REFLECTIONFRESNEL: boolean;
  10069. REFRACTIONFRESNEL: boolean;
  10070. EMISSIVEFRESNEL: boolean;
  10071. FRESNEL: boolean;
  10072. NORMAL: boolean;
  10073. UV1: boolean;
  10074. UV2: boolean;
  10075. VERTEXCOLOR: boolean;
  10076. VERTEXALPHA: boolean;
  10077. NUM_BONE_INFLUENCERS: number;
  10078. BonesPerMesh: number;
  10079. INSTANCES: boolean;
  10080. GLOSSINESS: boolean;
  10081. ROUGHNESS: boolean;
  10082. EMISSIVEASILLUMINATION: boolean;
  10083. LINKEMISSIVEWITHDIFFUSE: boolean;
  10084. REFLECTIONFRESNELFROMSPECULAR: boolean;
  10085. LIGHTMAP: boolean;
  10086. LIGHTMAPDIRECTUV: number;
  10087. USELIGHTMAPASSHADOWMAP: boolean;
  10088. REFLECTIONMAP_3D: boolean;
  10089. REFLECTIONMAP_SPHERICAL: boolean;
  10090. REFLECTIONMAP_PLANAR: boolean;
  10091. REFLECTIONMAP_CUBIC: boolean;
  10092. REFLECTIONMAP_PROJECTION: boolean;
  10093. REFLECTIONMAP_SKYBOX: boolean;
  10094. REFLECTIONMAP_EXPLICIT: boolean;
  10095. REFLECTIONMAP_EQUIRECTANGULAR: boolean;
  10096. REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
  10097. REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
  10098. INVERTCUBICMAP: boolean;
  10099. LOGARITHMICDEPTH: boolean;
  10100. REFRACTION: boolean;
  10101. REFRACTIONMAP_3D: boolean;
  10102. REFLECTIONOVERALPHA: boolean;
  10103. TWOSIDEDLIGHTING: boolean;
  10104. SHADOWFLOAT: boolean;
  10105. MORPHTARGETS: boolean;
  10106. MORPHTARGETS_NORMAL: boolean;
  10107. MORPHTARGETS_TANGENT: boolean;
  10108. NUM_MORPH_INFLUENCERS: number;
  10109. NONUNIFORMSCALING: boolean;
  10110. PREMULTIPLYALPHA: boolean;
  10111. IMAGEPROCESSING: boolean;
  10112. VIGNETTE: boolean;
  10113. VIGNETTEBLENDMODEMULTIPLY: boolean;
  10114. VIGNETTEBLENDMODEOPAQUE: boolean;
  10115. TONEMAPPING: boolean;
  10116. CONTRAST: boolean;
  10117. COLORCURVES: boolean;
  10118. COLORGRADING: boolean;
  10119. COLORGRADING3D: boolean;
  10120. SAMPLER3DGREENDEPTH: boolean;
  10121. SAMPLER3DBGRMAP: boolean;
  10122. IMAGEPROCESSINGPOSTPROCESS: boolean;
  10123. EXPOSURE: boolean;
  10124. constructor();
  10125. setReflectionMode(modeToEnable: string): void;
  10126. }
  10127. class StandardMaterial extends PushMaterial {
  10128. private _diffuseTexture;
  10129. diffuseTexture: Nullable<BaseTexture>;
  10130. private _ambientTexture;
  10131. ambientTexture: Nullable<BaseTexture>;
  10132. private _opacityTexture;
  10133. opacityTexture: Nullable<BaseTexture>;
  10134. private _reflectionTexture;
  10135. reflectionTexture: Nullable<BaseTexture>;
  10136. private _emissiveTexture;
  10137. emissiveTexture: Nullable<BaseTexture>;
  10138. private _specularTexture;
  10139. specularTexture: Nullable<BaseTexture>;
  10140. private _bumpTexture;
  10141. bumpTexture: Nullable<BaseTexture>;
  10142. private _lightmapTexture;
  10143. lightmapTexture: Nullable<BaseTexture>;
  10144. private _refractionTexture;
  10145. refractionTexture: Nullable<BaseTexture>;
  10146. ambientColor: Color3;
  10147. diffuseColor: Color3;
  10148. specularColor: Color3;
  10149. emissiveColor: Color3;
  10150. specularPower: number;
  10151. private _useAlphaFromDiffuseTexture;
  10152. useAlphaFromDiffuseTexture: boolean;
  10153. private _useEmissiveAsIllumination;
  10154. useEmissiveAsIllumination: boolean;
  10155. private _linkEmissiveWithDiffuse;
  10156. linkEmissiveWithDiffuse: boolean;
  10157. private _useSpecularOverAlpha;
  10158. useSpecularOverAlpha: boolean;
  10159. private _useReflectionOverAlpha;
  10160. useReflectionOverAlpha: boolean;
  10161. private _disableLighting;
  10162. disableLighting: boolean;
  10163. private _useParallax;
  10164. useParallax: boolean;
  10165. private _useParallaxOcclusion;
  10166. useParallaxOcclusion: boolean;
  10167. parallaxScaleBias: number;
  10168. private _roughness;
  10169. roughness: number;
  10170. indexOfRefraction: number;
  10171. invertRefractionY: boolean;
  10172. private _useLightmapAsShadowmap;
  10173. useLightmapAsShadowmap: boolean;
  10174. private _diffuseFresnelParameters;
  10175. diffuseFresnelParameters: FresnelParameters;
  10176. private _opacityFresnelParameters;
  10177. opacityFresnelParameters: FresnelParameters;
  10178. private _reflectionFresnelParameters;
  10179. reflectionFresnelParameters: FresnelParameters;
  10180. private _refractionFresnelParameters;
  10181. refractionFresnelParameters: FresnelParameters;
  10182. private _emissiveFresnelParameters;
  10183. emissiveFresnelParameters: FresnelParameters;
  10184. private _useReflectionFresnelFromSpecular;
  10185. useReflectionFresnelFromSpecular: boolean;
  10186. private _useGlossinessFromSpecularMapAlpha;
  10187. useGlossinessFromSpecularMapAlpha: boolean;
  10188. private _maxSimultaneousLights;
  10189. maxSimultaneousLights: number;
  10190. /**
  10191. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  10192. */
  10193. private _invertNormalMapX;
  10194. invertNormalMapX: boolean;
  10195. /**
  10196. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  10197. */
  10198. private _invertNormalMapY;
  10199. invertNormalMapY: boolean;
  10200. /**
  10201. * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
  10202. */
  10203. private _twoSidedLighting;
  10204. twoSidedLighting: boolean;
  10205. /**
  10206. * Default configuration related to image processing available in the standard Material.
  10207. */
  10208. protected _imageProcessingConfiguration: ImageProcessingConfiguration;
  10209. /**
  10210. * Gets the image processing configuration used either in this material.
  10211. */
  10212. /**
  10213. * Sets the Default image processing configuration used either in the this material.
  10214. *
  10215. * If sets to null, the scene one is in use.
  10216. */
  10217. imageProcessingConfiguration: ImageProcessingConfiguration;
  10218. /**
  10219. * Keep track of the image processing observer to allow dispose and replace.
  10220. */
  10221. private _imageProcessingObserver;
  10222. /**
  10223. * Attaches a new image processing configuration to the Standard Material.
  10224. * @param configuration
  10225. */
  10226. protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
  10227. /**
  10228. * Gets wether the color curves effect is enabled.
  10229. */
  10230. /**
  10231. * Sets wether the color curves effect is enabled.
  10232. */
  10233. cameraColorCurvesEnabled: boolean;
  10234. /**
  10235. * Gets wether the color grading effect is enabled.
  10236. */
  10237. /**
  10238. * Gets wether the color grading effect is enabled.
  10239. */
  10240. cameraColorGradingEnabled: boolean;
  10241. /**
  10242. * Gets wether tonemapping is enabled or not.
  10243. */
  10244. /**
  10245. * Sets wether tonemapping is enabled or not
  10246. */
  10247. cameraToneMappingEnabled: boolean;
  10248. /**
  10249. * The camera exposure used on this material.
  10250. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  10251. * This corresponds to a photographic exposure.
  10252. */
  10253. /**
  10254. * The camera exposure used on this material.
  10255. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  10256. * This corresponds to a photographic exposure.
  10257. */
  10258. cameraExposure: number;
  10259. /**
  10260. * Gets The camera contrast used on this material.
  10261. */
  10262. /**
  10263. * Sets The camera contrast used on this material.
  10264. */
  10265. cameraContrast: number;
  10266. /**
  10267. * Gets the Color Grading 2D Lookup Texture.
  10268. */
  10269. /**
  10270. * Sets the Color Grading 2D Lookup Texture.
  10271. */
  10272. cameraColorGradingTexture: Nullable<BaseTexture>;
  10273. /**
  10274. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  10275. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  10276. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  10277. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  10278. */
  10279. /**
  10280. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  10281. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  10282. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  10283. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  10284. */
  10285. cameraColorCurves: Nullable<ColorCurves>;
  10286. customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines) => string;
  10287. protected _renderTargets: SmartArray<RenderTargetTexture>;
  10288. protected _worldViewProjectionMatrix: Matrix;
  10289. protected _globalAmbientColor: Color3;
  10290. protected _useLogarithmicDepth: boolean;
  10291. constructor(name: string, scene: Scene);
  10292. getClassName(): string;
  10293. useLogarithmicDepth: boolean;
  10294. needAlphaBlending(): boolean;
  10295. needAlphaTesting(): boolean;
  10296. protected _shouldUseAlphaFromDiffuseTexture(): boolean;
  10297. getAlphaTestTexture(): Nullable<BaseTexture>;
  10298. /**
  10299. * Child classes can use it to update shaders
  10300. */
  10301. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  10302. buildUniformLayout(): void;
  10303. unbind(): void;
  10304. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  10305. getAnimatables(): IAnimatable[];
  10306. getActiveTextures(): BaseTexture[];
  10307. hasTexture(texture: BaseTexture): boolean;
  10308. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  10309. clone(name: string): StandardMaterial;
  10310. serialize(): any;
  10311. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  10312. static _DiffuseTextureEnabled: boolean;
  10313. static DiffuseTextureEnabled: boolean;
  10314. static _AmbientTextureEnabled: boolean;
  10315. static AmbientTextureEnabled: boolean;
  10316. static _OpacityTextureEnabled: boolean;
  10317. static OpacityTextureEnabled: boolean;
  10318. static _ReflectionTextureEnabled: boolean;
  10319. static ReflectionTextureEnabled: boolean;
  10320. static _EmissiveTextureEnabled: boolean;
  10321. static EmissiveTextureEnabled: boolean;
  10322. static _SpecularTextureEnabled: boolean;
  10323. static SpecularTextureEnabled: boolean;
  10324. static _BumpTextureEnabled: boolean;
  10325. static BumpTextureEnabled: boolean;
  10326. static _LightmapTextureEnabled: boolean;
  10327. static LightmapTextureEnabled: boolean;
  10328. static _RefractionTextureEnabled: boolean;
  10329. static RefractionTextureEnabled: boolean;
  10330. static _ColorGradingTextureEnabled: boolean;
  10331. static ColorGradingTextureEnabled: boolean;
  10332. static _FresnelEnabled: boolean;
  10333. static FresnelEnabled: boolean;
  10334. }
  10335. }
  10336. import {EngineInstrumentation,SceneInstrumentation,_TimeToken} from 'babylonjs/instrumentation';
  10337. import {Particle,IParticleSystem,ParticleSystem,BoxParticleEmitter,ConeParticleEmitter,SphereParticleEmitter,SphereDirectedParticleEmitter,IParticleEmitterType} from 'babylonjs/particles';
  10338. import {GPUParticleSystem} from 'babylonjs/gpuParticles';
  10339. import {FramingBehavior,BouncingBehavior,AutoRotationBehavior} from 'babylonjs/cameraBehaviors';
  10340. import {NullEngineOptions,NullEngine} from 'babylonjs/nullEngine';
  10341. import {TextureTools} from 'babylonjs/textureTools';
  10342. import {SolidParticle,ModelShape,DepthSortedParticle,SolidParticleSystem} from 'babylonjs/solidParticles';
  10343. import {Collider,CollisionWorker,ICollisionCoordinator,SerializedMesh,SerializedSubMesh,SerializedGeometry,BabylonMessage,SerializedColliderToWorker,WorkerTaskType,WorkerReply,CollisionReplyPayload,InitPayload,CollidePayload,UpdatePayload,WorkerReplyType,CollisionCoordinatorWorker,CollisionCoordinatorLegacy} from 'babylonjs/collisions';
  10344. import {IntersectionInfo,PickingInfo,Ray} from 'babylonjs/picking';
  10345. import {SpriteManager,Sprite} from 'babylonjs/sprites';
  10346. import {AnimationRange,AnimationEvent,PathCursor,Animation,TargetedAnimation,AnimationGroup,RuntimeAnimation,Animatable,IEasingFunction,EasingFunction,CircleEase,BackEase,BounceEase,CubicEase,ElasticEase,ExponentialEase,PowerEase,QuadraticEase,QuarticEase,QuinticEase,SineEase,BezierCurveEase} from 'babylonjs/animations';
  10347. import {Condition,ValueCondition,PredicateCondition,StateCondition,Action,ActionEvent,ActionManager,InterpolateValueAction,SwitchBooleanAction,SetStateAction,SetValueAction,IncrementValueAction,PlayAnimationAction,StopAnimationAction,DoNothingAction,CombineAction,ExecuteCodeAction,SetParentAction,PlaySoundAction,StopSoundAction} from 'babylonjs/actions';
  10348. import {GroundMesh,InstancedMesh,LinesMesh} from 'babylonjs/additionalMeshes';
  10349. import {ShaderMaterial} from 'babylonjs/shaderMaterial';
  10350. import {MeshBuilder} from 'babylonjs/meshBuilder';
  10351. import {PBRBaseMaterial,PBRBaseSimpleMaterial,PBRMaterial,PBRMetallicRoughnessMaterial,PBRSpecularGlossinessMaterial} from 'babylonjs/pbrMaterial';
  10352. import {CameraInputTypes,ICameraInput,CameraInputsMap,CameraInputsManager,TargetCamera} from 'babylonjs/targetCamera';
  10353. import {ArcRotateCameraKeyboardMoveInput,ArcRotateCameraMouseWheelInput,ArcRotateCameraPointersInput,ArcRotateCameraInputsManager,ArcRotateCamera} from 'babylonjs/arcRotateCamera';
  10354. import {FreeCameraMouseInput,FreeCameraKeyboardMoveInput,FreeCameraInputsManager,FreeCamera} from 'babylonjs/freeCamera';
  10355. import {HemisphericLight} from 'babylonjs/hemisphericLight';
  10356. import {IShadowLight,ShadowLight,PointLight} from 'babylonjs/pointLight';
  10357. import {DirectionalLight} from 'babylonjs/directionalLight';
  10358. import {SpotLight} from 'babylonjs/spotLight';
  10359. import {CubeTexture,RenderTargetTexture,IMultiRenderTargetOptions,MultiRenderTarget,MirrorTexture,RefractionTexture,DynamicTexture,VideoTexture,RawTexture} from 'babylonjs/additionalTextures';
  10360. import {AudioEngine,Sound,SoundTrack,Analyser} from 'babylonjs/audio';
  10361. import {ILoadingScreen,DefaultLoadingScreen,SceneLoaderProgressEvent,ISceneLoaderPluginExtensions,ISceneLoaderPluginFactory,ISceneLoaderPlugin,ISceneLoaderPluginAsync,SceneLoader,FilesInput} from 'babylonjs/loader';
  10362. import {IShadowGenerator,ShadowGenerator} from 'babylonjs/shadows';
  10363. import {StringDictionary} from 'babylonjs/stringDictionary';
  10364. import {Tags,AndOrNotEvaluator} from 'babylonjs/userData';
  10365. import {FresnelParameters} from 'babylonjs/fresnel';
  10366. import {MultiMaterial} from 'babylonjs/multiMaterial';
  10367. import {Database} from 'babylonjs/offline';
  10368. import {FreeCameraTouchInput,TouchCamera} from 'babylonjs/touchCamera';
  10369. import {ProceduralTexture,CustomProceduralTexture} from 'babylonjs/procedural';
  10370. import {FreeCameraGamepadInput,ArcRotateCameraGamepadInput,GamepadManager,StickValues,GamepadButtonChanges,Gamepad,GenericPad,Xbox360Button,Xbox360Dpad,Xbox360Pad,PoseEnabledControllerType,MutableGamepadButton,ExtendedGamepadButton,PoseEnabledControllerHelper,PoseEnabledController,WebVRController,OculusTouchController,ViveController,GenericController,WindowsMotionController} from 'babylonjs/gamepad';
  10371. import {FollowCamera,ArcFollowCamera,UniversalCamera,GamepadCamera} from 'babylonjs/additionalCameras';
  10372. import {DepthRenderer} from 'babylonjs/depthRenderer';
  10373. import {GeometryBufferRenderer} from 'babylonjs/geometryBufferRenderer';
  10374. import {PostProcessOptions,PostProcess,PassPostProcess} from 'babylonjs/postProcesses';
  10375. import {BlurPostProcess} from 'babylonjs/additionalPostProcess_blur';
  10376. import {FxaaPostProcess} from 'babylonjs/additionalPostProcess_fxaa';
  10377. import {HighlightsPostProcess} from 'babylonjs/additionalPostProcess_highlights';
  10378. import {RefractionPostProcess,BlackAndWhitePostProcess,ConvolutionPostProcess,FilterPostProcess,VolumetricLightScatteringPostProcess,ColorCorrectionPostProcess,TonemappingOperator,TonemapPostProcess,DisplayPassPostProcess,ImageProcessingPostProcess} from 'babylonjs/additionalPostProcesses';
  10379. import {PostProcessRenderPipelineManager,PostProcessRenderPass,PostProcessRenderEffect,PostProcessRenderPipeline} from 'babylonjs/renderingPipeline';
  10380. import {SSAORenderingPipeline,SSAO2RenderingPipeline,LensRenderingPipeline,StandardRenderingPipeline} from 'babylonjs/additionalRenderingPipeline';
  10381. import {DefaultRenderingPipeline} from 'babylonjs/defaultRenderingPipeline';
  10382. import {Bone,BoneIKController,BoneLookController,Skeleton} from 'babylonjs/bones';
  10383. import {SphericalPolynomial,SphericalHarmonics,CubeMapToSphericalPolynomialTools,CubeMapInfo,PanoramaToCubeMapTools,HDRInfo,HDRTools,HDRCubeTexture} from 'babylonjs/hdr';
  10384. import {CSG} from 'babylonjs/csg';
  10385. import {Polygon,PolygonMeshBuilder} from 'babylonjs/polygonMesh';
  10386. import {LensFlare,LensFlareSystem} from 'babylonjs/lensFlares';
  10387. import {PhysicsJointData,PhysicsJoint,DistanceJoint,MotorEnabledJoint,HingeJoint,Hinge2Joint,IMotorEnabledJoint,DistanceJointData,SpringJointData,PhysicsImpostorParameters,IPhysicsEnabledObject,PhysicsImpostor,PhysicsImpostorJoint,PhysicsEngine,IPhysicsEnginePlugin,PhysicsHelper,PhysicsRadialExplosionEvent,PhysicsGravitationalFieldEvent,PhysicsUpdraftEvent,PhysicsVortexEvent,PhysicsRadialImpulseFalloff,PhysicsUpdraftMode,PhysicsForceAndContactPoint,PhysicsRadialExplosionEventData,PhysicsGravitationalFieldEventData,PhysicsUpdraftEventData,PhysicsVortexEventData,CannonJSPlugin,OimoJSPlugin} from 'babylonjs/physics';
  10388. import {TGATools,DDSInfo,DDSTools,KhronosTextureContainer} from 'babylonjs/textureFormats';
  10389. import {Debug,RayHelper,DebugLayer,BoundingBoxRenderer} from 'babylonjs/debug';
  10390. import {MorphTarget,MorphTargetManager} from 'babylonjs/morphTargets';
  10391. import {IOctreeContainer,Octree,OctreeBlock} from 'babylonjs/octrees';
  10392. import {SIMDHelper} from 'babylonjs/simd';
  10393. import {VRDistortionCorrectionPostProcess,AnaglyphPostProcess,StereoscopicInterlacePostProcess,FreeCameraDeviceOrientationInput,ArcRotateCameraVRDeviceOrientationInput,VRCameraMetrics,DevicePose,PoseControlled,WebVROptions,WebVRFreeCamera,DeviceOrientationCamera,VRDeviceOrientationFreeCamera,VRDeviceOrientationGamepadCamera,VRDeviceOrientationArcRotateCamera,AnaglyphFreeCamera,AnaglyphArcRotateCamera,AnaglyphGamepadCamera,AnaglyphUniversalCamera,StereoscopicFreeCamera,StereoscopicArcRotateCamera,StereoscopicGamepadCamera,StereoscopicUniversalCamera,VRTeleportationOptions,VRExperienceHelperOptions,VRExperienceHelper} from 'babylonjs/vr';
  10394. import {JoystickAxis,VirtualJoystick,VirtualJoysticksCamera,FreeCameraVirtualJoystickInput} from 'babylonjs/virtualJoystick';
  10395. import {ISimplifier,ISimplificationSettings,SimplificationSettings,ISimplificationTask,SimplificationQueue,SimplificationType,DecimationTriangle,DecimationVertex,QuadraticMatrix,Reference,QuadraticErrorSimplification,MeshLODLevel,SceneOptimization,TextureOptimization,HardwareScalingOptimization,ShadowsOptimization,PostProcessesOptimization,LensFlaresOptimization,ParticlesOptimization,RenderTargetsOptimization,MergeMeshesOptimization,SceneOptimizerOptions,SceneOptimizer} from 'babylonjs/optimizations';
  10396. import {OutlineRenderer,EdgesRenderer,IHighlightLayerOptions,HighlightLayer} from 'babylonjs/highlights';
  10397. import {SceneSerializer} from 'babylonjs/serialization';
  10398. import {AssetTaskState,AbstractAssetTask,IAssetsProgressEvent,AssetsProgressEvent,MeshAssetTask,TextFileAssetTask,BinaryFileAssetTask,ImageAssetTask,ITextureAssetTask,TextureAssetTask,CubeTextureAssetTask,HDRCubeTextureAssetTask,AssetsManager} from 'babylonjs/assetsManager';
  10399. import {ReflectionProbe} from 'babylonjs/probes';
  10400. import {BackgroundMaterial} from 'babylonjs/backgroundMaterial';
  10401. import {Layer} from 'babylonjs/layer';
  10402. import {IEnvironmentHelperOptions,EnvironmentHelper} from 'babylonjs/environmentHelper';