babylon.d.ts 572 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539
  1. declare module BABYLON {
  2. class InstancingAttributeInfo {
  3. /**
  4. * Index/offset of the attribute in the vertex shader
  5. */
  6. index: number;
  7. /**
  8. * size of the attribute, 1, 2, 3 or 4
  9. */
  10. attributeSize: number;
  11. /**
  12. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  13. * default is FLOAT
  14. */
  15. attribyteType: number;
  16. /**
  17. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  18. */
  19. normalized: boolean;
  20. /**
  21. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  22. */
  23. offset: number;
  24. /**
  25. * Name of the GLSL attribute, for debugging purpose only
  26. */
  27. attributeName: string;
  28. }
  29. class EngineCapabilities {
  30. maxTexturesImageUnits: number;
  31. maxTextureSize: number;
  32. maxCubemapTextureSize: number;
  33. maxRenderTextureSize: number;
  34. maxVertexAttribs: number;
  35. standardDerivatives: boolean;
  36. s3tc: WEBGL_compressed_texture_s3tc;
  37. textureFloat: boolean;
  38. textureAnisotropicFilterExtension: EXT_texture_filter_anisotropic;
  39. maxAnisotropy: number;
  40. instancedArrays: ANGLE_instanced_arrays;
  41. uintIndices: boolean;
  42. highPrecisionShaderSupported: boolean;
  43. fragmentDepthSupported: boolean;
  44. textureFloatLinearFiltering: boolean;
  45. textureFloatRender: boolean;
  46. textureHalfFloat: boolean;
  47. textureHalfFloatLinearFiltering: boolean;
  48. textureHalfFloatRender: boolean;
  49. textureLOD: boolean;
  50. drawBuffersExtension: any;
  51. }
  52. interface EngineOptions extends WebGLContextAttributes {
  53. limitDeviceRatio?: number;
  54. autoEnableWebVR?: boolean;
  55. }
  56. /**
  57. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  58. */
  59. class Engine {
  60. private static _ALPHA_DISABLE;
  61. private static _ALPHA_ADD;
  62. private static _ALPHA_COMBINE;
  63. private static _ALPHA_SUBTRACT;
  64. private static _ALPHA_MULTIPLY;
  65. private static _ALPHA_MAXIMIZED;
  66. private static _ALPHA_ONEONE;
  67. private static _DELAYLOADSTATE_NONE;
  68. private static _DELAYLOADSTATE_LOADED;
  69. private static _DELAYLOADSTATE_LOADING;
  70. private static _DELAYLOADSTATE_NOTLOADED;
  71. private static _TEXTUREFORMAT_ALPHA;
  72. private static _TEXTUREFORMAT_LUMINANCE;
  73. private static _TEXTUREFORMAT_LUMINANCE_ALPHA;
  74. private static _TEXTUREFORMAT_RGB;
  75. private static _TEXTUREFORMAT_RGBA;
  76. private static _TEXTURETYPE_UNSIGNED_INT;
  77. private static _TEXTURETYPE_FLOAT;
  78. private static _TEXTURETYPE_HALF_FLOAT;
  79. private static _NEVER;
  80. private static _ALWAYS;
  81. private static _LESS;
  82. private static _EQUAL;
  83. private static _LEQUAL;
  84. private static _GREATER;
  85. private static _GEQUAL;
  86. private static _NOTEQUAL;
  87. static NEVER: number;
  88. static ALWAYS: number;
  89. static LESS: number;
  90. static EQUAL: number;
  91. static LEQUAL: number;
  92. static GREATER: number;
  93. static GEQUAL: number;
  94. static NOTEQUAL: number;
  95. private static _KEEP;
  96. private static _REPLACE;
  97. private static _INCR;
  98. private static _DECR;
  99. private static _INVERT;
  100. private static _INCR_WRAP;
  101. private static _DECR_WRAP;
  102. static KEEP: number;
  103. static REPLACE: number;
  104. static INCR: number;
  105. static DECR: number;
  106. static INVERT: number;
  107. static INCR_WRAP: number;
  108. static DECR_WRAP: number;
  109. static ALPHA_DISABLE: number;
  110. static ALPHA_ONEONE: number;
  111. static ALPHA_ADD: number;
  112. static ALPHA_COMBINE: number;
  113. static ALPHA_SUBTRACT: number;
  114. static ALPHA_MULTIPLY: number;
  115. static ALPHA_MAXIMIZED: number;
  116. static DELAYLOADSTATE_NONE: number;
  117. static DELAYLOADSTATE_LOADED: number;
  118. static DELAYLOADSTATE_LOADING: number;
  119. static DELAYLOADSTATE_NOTLOADED: number;
  120. static TEXTUREFORMAT_ALPHA: number;
  121. static TEXTUREFORMAT_LUMINANCE: number;
  122. static TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  123. static TEXTUREFORMAT_RGB: number;
  124. static TEXTUREFORMAT_RGBA: number;
  125. static TEXTURETYPE_UNSIGNED_INT: number;
  126. static TEXTURETYPE_FLOAT: number;
  127. static TEXTURETYPE_HALF_FLOAT: number;
  128. static Version: string;
  129. static CollisionsEpsilon: number;
  130. static CodeRepository: string;
  131. static ShadersRepository: string;
  132. isFullscreen: boolean;
  133. isPointerLock: boolean;
  134. cullBackFaces: boolean;
  135. renderEvenInBackground: boolean;
  136. enableOfflineSupport: boolean;
  137. scenes: Scene[];
  138. vrDisplaysPromise: any;
  139. private _vrDisplays;
  140. private _vrDisplayEnabled;
  141. private _oldSize;
  142. private _oldHardwareScaleFactor;
  143. private _vrAnimationFrameHandler;
  144. _gl: WebGLRenderingContext;
  145. private _renderingCanvas;
  146. private _windowIsBackground;
  147. private _webGLVersion;
  148. private _badOS;
  149. static audioEngine: AudioEngine;
  150. private _onBlur;
  151. private _onFocus;
  152. private _onFullscreenChange;
  153. private _onPointerLockChange;
  154. private _hardwareScalingLevel;
  155. private _caps;
  156. private _pointerLockRequested;
  157. private _alphaTest;
  158. private _isStencilEnable;
  159. private _loadingScreen;
  160. _drawCalls: PerfCounter;
  161. private _glVersion;
  162. private _glRenderer;
  163. private _glVendor;
  164. private _videoTextureSupported;
  165. private _renderingQueueLaunched;
  166. private _activeRenderLoops;
  167. private fpsRange;
  168. private previousFramesDuration;
  169. private fps;
  170. private deltaTime;
  171. private _depthCullingState;
  172. private _stencilState;
  173. private _alphaState;
  174. private _alphaMode;
  175. private _loadedTexturesCache;
  176. private _maxTextureChannels;
  177. private _activeTexture;
  178. private _activeTexturesCache;
  179. private _currentEffect;
  180. private _currentProgram;
  181. private _compiledEffects;
  182. private _vertexAttribArraysEnabled;
  183. private _cachedViewport;
  184. private _cachedVertexBuffers;
  185. private _cachedIndexBuffer;
  186. private _cachedEffectForVertexBuffers;
  187. private _currentRenderTarget;
  188. private _uintIndicesCurrentlySet;
  189. private _currentBoundBuffer;
  190. private _currentFramebuffer;
  191. private _currentBufferPointers;
  192. private _currentInstanceLocations;
  193. private _currentInstanceBuffers;
  194. private _textureUnits;
  195. private _workingCanvas;
  196. private _workingContext;
  197. private _externalData;
  198. private _bindedRenderFunction;
  199. /**
  200. * @constructor
  201. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  202. * @param {boolean} [antialias] - enable antialias
  203. * @param options - further options to be sent to the getContext function
  204. */
  205. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  206. webGLVersion: string;
  207. /**
  208. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  209. */
  210. isStencilEnable: boolean;
  211. private _prepareWorkingCanvas();
  212. resetTextureCache(): void;
  213. getGlInfo(): {
  214. vendor: string;
  215. renderer: string;
  216. version: string;
  217. };
  218. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  219. getRenderWidth(useScreen?: boolean): number;
  220. getRenderHeight(useScreen?: boolean): number;
  221. getRenderingCanvas(): HTMLCanvasElement;
  222. getRenderingCanvasClientRect(): ClientRect;
  223. setHardwareScalingLevel(level: number): void;
  224. getHardwareScalingLevel(): number;
  225. getLoadedTexturesCache(): WebGLTexture[];
  226. getCaps(): EngineCapabilities;
  227. drawCalls: number;
  228. drawCallsPerfCounter: PerfCounter;
  229. getDepthFunction(): number;
  230. setDepthFunction(depthFunc: number): void;
  231. setDepthFunctionToGreater(): void;
  232. setDepthFunctionToGreaterOrEqual(): void;
  233. setDepthFunctionToLess(): void;
  234. setDepthFunctionToLessOrEqual(): void;
  235. getStencilBuffer(): boolean;
  236. setStencilBuffer(enable: boolean): void;
  237. getStencilMask(): number;
  238. setStencilMask(mask: number): void;
  239. getStencilFunction(): number;
  240. getStencilFunctionReference(): number;
  241. getStencilFunctionMask(): number;
  242. setStencilFunction(stencilFunc: number): void;
  243. setStencilFunctionReference(reference: number): void;
  244. setStencilFunctionMask(mask: number): void;
  245. getStencilOperationFail(): number;
  246. getStencilOperationDepthFail(): number;
  247. getStencilOperationPass(): number;
  248. setStencilOperationFail(operation: number): void;
  249. setStencilOperationDepthFail(operation: number): void;
  250. setStencilOperationPass(operation: number): void;
  251. /**
  252. * stop executing a render loop function and remove it from the execution array
  253. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  254. */
  255. stopRenderLoop(renderFunction?: () => void): void;
  256. _renderLoop(): void;
  257. /**
  258. * Register and execute a render loop. The engine can have more than one render function.
  259. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  260. * @example
  261. * engine.runRenderLoop(function () {
  262. * scene.render()
  263. * })
  264. */
  265. runRenderLoop(renderFunction: () => void): void;
  266. /**
  267. * Toggle full screen mode.
  268. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  269. * @param {any} options - an options object to be sent to the requestFullscreen function
  270. */
  271. switchFullscreen(requestPointerLock: boolean): void;
  272. clear(color: any, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  273. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  274. /**
  275. * Set the WebGL's viewport
  276. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  277. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  278. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  279. */
  280. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  281. /**
  282. * Directly set the WebGL Viewport
  283. * The x, y, width & height are directly passed to the WebGL call
  284. * @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.
  285. */
  286. setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
  287. beginFrame(): void;
  288. endFrame(): void;
  289. /**
  290. * resize the view according to the canvas' size.
  291. * @example
  292. * window.addEventListener("resize", function () {
  293. * engine.resize();
  294. * });
  295. */
  296. resize(): void;
  297. /**
  298. * force a specific size of the canvas
  299. * @param {number} width - the new canvas' width
  300. * @param {number} height - the new canvas' height
  301. */
  302. setSize(width: number, height: number): void;
  303. initWebVR(): void;
  304. enableVR(vrDevice: any): void;
  305. disableVR(): void;
  306. private _onVRFullScreenTriggered;
  307. private _getVRDisplays();
  308. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  309. private bindUnboundFramebuffer(framebuffer);
  310. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
  311. generateMipMapsForCubemap(texture: WebGLTexture): void;
  312. flushFramebuffer(): void;
  313. restoreDefaultFramebuffer(): void;
  314. private _resetVertexBufferBinding();
  315. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  316. createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  317. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
  318. private _resetIndexBufferBinding();
  319. createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer;
  320. bindArrayBuffer(buffer: WebGLBuffer): void;
  321. private bindIndexBuffer(buffer);
  322. private bindBuffer(buffer, target);
  323. updateArrayBuffer(data: Float32Array): void;
  324. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  325. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  326. bindBuffers(vertexBuffers: {
  327. [key: string]: VertexBuffer;
  328. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  329. unbindInstanceAttributes(): void;
  330. _releaseBuffer(buffer: WebGLBuffer): boolean;
  331. createInstancesBuffer(capacity: number): WebGLBuffer;
  332. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  333. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  334. applyStates(): void;
  335. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  336. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  337. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  338. _releaseEffect(effect: Effect): void;
  339. createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
  340. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  341. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
  342. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  343. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  344. enableEffect(effect: Effect): void;
  345. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  346. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  347. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  348. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  349. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  350. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  351. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  352. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  353. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  354. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  355. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  356. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  357. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  358. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  359. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  360. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  361. setFloat(uniform: WebGLUniformLocation, value: number): void;
  362. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  363. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  364. setBool(uniform: WebGLUniformLocation, bool: number): void;
  365. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  366. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  367. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  368. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  369. setDepthBuffer(enable: boolean): void;
  370. getDepthWrite(): boolean;
  371. setDepthWrite(enable: boolean): void;
  372. setColorWrite(enable: boolean): void;
  373. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  374. getAlphaMode(): number;
  375. setAlphaTesting(enable: boolean): void;
  376. getAlphaTesting(): boolean;
  377. wipeCaches(): void;
  378. setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  379. createTexture(urlOrList: string | Array<string>, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
  380. private _getInternalFormat(format);
  381. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  382. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  383. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  384. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  385. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean): void;
  386. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  387. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  388. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  389. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void): WebGLTexture;
  390. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  391. createRawCubeTexture(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][])): WebGLTexture;
  392. _releaseTexture(texture: WebGLTexture): void;
  393. private setProgram(program);
  394. bindSamplers(effect: Effect): void;
  395. private activateTexture(texture);
  396. _bindTextureDirectly(target: number, texture: WebGLTexture): void;
  397. _bindTexture(channel: number, texture: WebGLTexture): void;
  398. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  399. unbindAllTextures(): void;
  400. setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
  401. private _setTexture(channel, texture);
  402. setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
  403. _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  404. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  405. /**
  406. * Add an externaly attached data from its key.
  407. * This method call will fail and return false, if such key already exists.
  408. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  409. * @param key the unique key that identifies the data
  410. * @param data the data object to associate to the key for this Engine instance
  411. * @return true if no such key were already present and the data was added successfully, false otherwise
  412. */
  413. addExternalData<T>(key: string, data: T): boolean;
  414. /**
  415. * Get an externaly attached data from its key
  416. * @param key the unique key that identifies the data
  417. * @return the associated data, if present (can be null), or undefined if not present
  418. */
  419. getExternalData<T>(key: string): T;
  420. /**
  421. * Get an externaly attached data from its key, create it using a factory if it's not already present
  422. * @param key the unique key that identifies the data
  423. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  424. * @return the associated data, can be null if the factory returned null.
  425. */
  426. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  427. /**
  428. * Remove an externaly attached data from the Engine instance
  429. * @param key the unique key that identifies the data
  430. * @return true if the data was successfully removed, false if it doesn't exist
  431. */
  432. removeExternalData(key: any): boolean;
  433. releaseInternalTexture(texture: WebGLTexture): void;
  434. unbindAllAttributes(): void;
  435. dispose(): void;
  436. displayLoadingUI(): void;
  437. hideLoadingUI(): void;
  438. loadingScreen: ILoadingScreen;
  439. loadingUIText: string;
  440. loadingUIBackgroundColor: string;
  441. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  442. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  443. getFps(): number;
  444. getDeltaTime(): number;
  445. private _measureFps();
  446. private _canRenderToFloatTexture();
  447. private _canRenderToHalfFloatTexture();
  448. private _canRenderToTextureOfType(format, extension);
  449. static isSupported(): boolean;
  450. }
  451. }
  452. interface Window {
  453. mozIndexedDB(func: any): any;
  454. webkitIndexedDB(func: any): any;
  455. msIndexedDB: IDBFactory;
  456. IDBTransaction(func: any): any;
  457. webkitIDBTransaction(func: any): any;
  458. msIDBTransaction(func: any): any;
  459. IDBKeyRange(func: any): any;
  460. webkitIDBKeyRange(func: any): any;
  461. msIDBKeyRange(func: any): any;
  462. webkitURL: HTMLURL;
  463. webkitRequestAnimationFrame(func: any): any;
  464. mozRequestAnimationFrame(func: any): any;
  465. oRequestAnimationFrame(func: any): any;
  466. WebGLRenderingContext: WebGLRenderingContext;
  467. MSGesture: MSGesture;
  468. CANNON: any;
  469. SIMD: any;
  470. AudioContext: AudioContext;
  471. webkitAudioContext: AudioContext;
  472. PointerEvent: any;
  473. Math: Math;
  474. Uint8Array: Uint8ArrayConstructor;
  475. Float32Array: Float32ArrayConstructor;
  476. }
  477. interface AudioContext extends EventTarget {
  478. decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: any): void;
  479. }
  480. interface HTMLURL {
  481. createObjectURL(param1: any, param2?: any): any;
  482. }
  483. interface Document {
  484. exitFullscreen(): void;
  485. webkitCancelFullScreen(): void;
  486. mozCancelFullScreen(): void;
  487. msCancelFullScreen(): void;
  488. mozFullScreen: boolean;
  489. msIsFullScreen: boolean;
  490. fullscreen: boolean;
  491. mozPointerLockElement: HTMLElement;
  492. msPointerLockElement: HTMLElement;
  493. webkitPointerLockElement: HTMLElement;
  494. }
  495. interface HTMLCanvasElement {
  496. requestPointerLock(): void;
  497. msRequestPointerLock?(): void;
  498. mozRequestPointerLock?(): void;
  499. webkitRequestPointerLock?(): void;
  500. }
  501. interface CanvasRenderingContext2D {
  502. imageSmoothingEnabled: boolean;
  503. mozImageSmoothingEnabled: boolean;
  504. oImageSmoothingEnabled: boolean;
  505. webkitImageSmoothingEnabled: boolean;
  506. }
  507. interface WebGLTexture {
  508. isReady: boolean;
  509. isCube: boolean;
  510. url: string;
  511. noMipmap: boolean;
  512. samplingMode: number;
  513. references: number;
  514. generateMipMaps: boolean;
  515. type: number;
  516. onLoadedCallbacks: Array<Function>;
  517. _size: number;
  518. _baseWidth: number;
  519. _baseHeight: number;
  520. _width: number;
  521. _height: number;
  522. _workingCanvas: HTMLCanvasElement;
  523. _workingContext: CanvasRenderingContext2D;
  524. _framebuffer: WebGLFramebuffer;
  525. _depthBuffer: WebGLRenderbuffer;
  526. _cachedCoordinatesMode: number;
  527. _cachedWrapU: number;
  528. _cachedWrapV: number;
  529. _isDisabled: boolean;
  530. }
  531. interface WebGLBuffer {
  532. references: number;
  533. capacity: number;
  534. is32Bits: boolean;
  535. }
  536. interface MouseEvent {
  537. mozMovementX: number;
  538. mozMovementY: number;
  539. webkitMovementX: number;
  540. webkitMovementY: number;
  541. msMovementX: number;
  542. msMovementY: number;
  543. }
  544. interface MSStyleCSSProperties {
  545. webkitTransform: string;
  546. webkitTransition: string;
  547. }
  548. interface Navigator {
  549. getVRDisplays: () => any;
  550. mozGetVRDevices: (any: any) => any;
  551. isCocoonJS: boolean;
  552. }
  553. interface Screen {
  554. orientation: string;
  555. mozOrientation: string;
  556. }
  557. interface HTMLMediaElement {
  558. crossOrigin: string;
  559. }
  560. interface Math {
  561. fround(x: number): number;
  562. imul(a: number, b: number): number;
  563. }
  564. interface SIMDglobal {
  565. SIMD: SIMD;
  566. Math: Math;
  567. Uint8Array: Uint8ArrayConstructor;
  568. Float32Array: Float32ArrayConstructor;
  569. }
  570. interface SIMD {
  571. Float32x4: SIMD.Float32x4Constructor;
  572. Int32x4: SIMD.Int32x4Constructor;
  573. Int16x8: SIMD.Int16x8Constructor;
  574. Int8x16: SIMD.Int8x16Constructor;
  575. Uint32x4: SIMD.Uint32x4Constructor;
  576. Uint16x8: SIMD.Uint16x8Constructor;
  577. Uint8x16: SIMD.Uint8x16Constructor;
  578. Bool32x4: SIMD.Bool32x4Constructor;
  579. Bool16x8: SIMD.Bool16x8Constructor;
  580. Bool8x16: SIMD.Bool8x16Constructor;
  581. }
  582. declare namespace SIMD {
  583. interface Float32x4 {
  584. constructor: Float32x4Constructor;
  585. valueOf(): Float32x4;
  586. toLocaleString(): string;
  587. toString(): string;
  588. }
  589. interface Float32x4Constructor {
  590. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  591. prototype: Float32x4;
  592. extractLane(simd: SIMD.Float32x4, lane: number): number;
  593. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  594. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  595. check(a: SIMD.Float32x4): SIMD.Float32x4;
  596. splat(n: number): SIMD.Float32x4;
  597. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  598. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  599. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  600. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  601. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  602. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  603. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  604. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  605. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  606. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  607. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  608. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  609. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  610. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  611. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  612. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  613. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  614. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  615. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  616. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  617. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  618. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  619. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  620. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  621. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  622. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  623. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  624. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  625. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  626. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  627. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  628. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  629. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  630. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  631. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  632. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  633. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  634. }
  635. interface Int32x4 {
  636. constructor: Int32x4Constructor;
  637. valueOf(): Int32x4;
  638. toLocaleString(): string;
  639. toString(): string;
  640. }
  641. interface Int32x4Constructor {
  642. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  643. prototype: Int32x4;
  644. extractLane(simd: SIMD.Int32x4, lane: number): number;
  645. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  646. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  647. check(a: SIMD.Int32x4): SIMD.Int32x4;
  648. splat(n: number): SIMD.Int32x4;
  649. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  650. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  651. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  652. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  653. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  654. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  655. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  656. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  657. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  658. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  659. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  660. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  661. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  662. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  663. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  664. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  665. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  666. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  667. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  668. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  669. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  670. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  671. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  672. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  673. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  674. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  675. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  676. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  677. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  678. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  679. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  680. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  681. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  682. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  683. }
  684. interface Int16x8 {
  685. constructor: Int16x8Constructor;
  686. valueOf(): Int16x8;
  687. toLocaleString(): string;
  688. toString(): string;
  689. }
  690. interface Int16x8Constructor {
  691. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  692. prototype: Int16x8;
  693. extractLane(simd: SIMD.Int16x8, lane: number): number;
  694. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  695. 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;
  696. check(a: SIMD.Int16x8): SIMD.Int16x8;
  697. splat(n: number): SIMD.Int16x8;
  698. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  699. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  700. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  701. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  702. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  703. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  704. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  705. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  706. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  707. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  708. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  709. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  710. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  711. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  712. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  713. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  714. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  715. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  716. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  717. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  718. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  719. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  720. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  721. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  722. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  723. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  724. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  725. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  726. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  727. }
  728. interface Int8x16 {
  729. constructor: Int8x16Constructor;
  730. valueOf(): Int8x16;
  731. toLocaleString(): string;
  732. toString(): string;
  733. }
  734. interface Int8x16Constructor {
  735. (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;
  736. prototype: Int8x16;
  737. extractLane(simd: SIMD.Int8x16, lane: number): number;
  738. 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;
  739. 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;
  740. check(a: SIMD.Int8x16): SIMD.Int8x16;
  741. splat(n: number): SIMD.Int8x16;
  742. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  743. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  744. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  745. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  746. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  747. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  748. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  749. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  750. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  751. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  752. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  753. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  754. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  755. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  756. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  757. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  758. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  759. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  760. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  761. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  762. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  763. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  764. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  765. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  766. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  767. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  768. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  769. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  770. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  771. }
  772. interface Uint32x4 {
  773. constructor: Uint32x4Constructor;
  774. valueOf(): Uint32x4;
  775. toLocaleString(): string;
  776. toString(): string;
  777. }
  778. interface Uint32x4Constructor {
  779. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  780. prototype: Uint32x4;
  781. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  782. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  783. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  784. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  785. splat(n: number): SIMD.Uint32x4;
  786. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  787. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  788. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  789. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  790. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  791. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  792. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  793. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  794. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  795. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  796. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  797. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  798. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  799. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  800. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  801. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  802. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  803. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  804. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  805. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  806. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  807. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  808. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  809. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  810. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  811. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  812. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  813. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  814. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  815. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  816. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  817. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  818. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  819. }
  820. interface Uint16x8 {
  821. constructor: Uint16x8Constructor;
  822. valueOf(): Uint16x8;
  823. toLocaleString(): string;
  824. toString(): string;
  825. }
  826. interface Uint16x8Constructor {
  827. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  828. prototype: Uint16x8;
  829. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  830. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  831. 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;
  832. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  833. splat(n: number): SIMD.Uint16x8;
  834. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  835. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  836. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  837. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  838. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  839. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  840. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  841. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  842. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  843. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  844. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  845. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  846. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  847. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  848. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  849. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  850. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  851. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  852. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  853. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  854. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  855. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  856. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  857. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  858. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  859. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  860. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  861. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  862. }
  863. interface Uint8x16 {
  864. constructor: Uint8x16Constructor;
  865. valueOf(): Uint8x16;
  866. toLocaleString(): string;
  867. toString(): string;
  868. }
  869. interface Uint8x16Constructor {
  870. (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;
  871. prototype: Uint8x16;
  872. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  873. 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;
  874. 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;
  875. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  876. splat(n: number): SIMD.Uint8x16;
  877. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  878. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  879. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  880. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  881. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  882. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  883. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  884. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  885. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  886. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  887. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  888. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  889. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  890. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  891. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  892. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  893. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  894. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  895. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  896. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  897. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  898. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  899. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  900. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  901. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  902. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  903. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  904. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  905. }
  906. interface Bool32x4 {
  907. constructor: Bool32x4Constructor;
  908. valueOf(): Bool32x4;
  909. toLocaleString(): string;
  910. toString(): string;
  911. }
  912. interface Bool32x4Constructor {
  913. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  914. prototype: Bool32x4;
  915. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  916. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  917. splat(n: boolean): SIMD.Bool32x4;
  918. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  919. allTrue(a: SIMD.Bool32x4): boolean;
  920. anyTrue(a: SIMD.Bool32x4): boolean;
  921. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  922. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  923. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  924. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  925. }
  926. interface Bool16x8 {
  927. constructor: Bool16x8Constructor;
  928. valueOf(): Bool16x8;
  929. toLocaleString(): string;
  930. toString(): string;
  931. }
  932. interface Bool16x8Constructor {
  933. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  934. prototype: Bool16x8;
  935. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  936. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  937. splat(n: boolean): SIMD.Bool16x8;
  938. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  939. allTrue(a: SIMD.Bool16x8): boolean;
  940. anyTrue(a: SIMD.Bool16x8): boolean;
  941. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  942. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  943. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  944. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  945. }
  946. interface Bool8x16 {
  947. constructor: Bool8x16Constructor;
  948. valueOf(): Bool8x16;
  949. toLocaleString(): string;
  950. toString(): string;
  951. }
  952. interface Bool8x16Constructor {
  953. (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;
  954. prototype: Bool8x16;
  955. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  956. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  957. splat(n: boolean): SIMD.Bool8x16;
  958. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  959. allTrue(a: SIMD.Bool8x16): boolean;
  960. anyTrue(a: SIMD.Bool8x16): boolean;
  961. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  962. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  963. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  964. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  965. }
  966. }
  967. declare module BABYLON {
  968. /**
  969. * Node is the basic class for all scene objects (Mesh, Light Camera).
  970. */
  971. class Node {
  972. name: string;
  973. id: string;
  974. uniqueId: number;
  975. state: string;
  976. metadata: any;
  977. animations: Animation[];
  978. private _ranges;
  979. onReady: (node: Node) => void;
  980. private _childrenFlag;
  981. private _isEnabled;
  982. private _isReady;
  983. _currentRenderId: number;
  984. private _parentRenderId;
  985. _waitingParentId: string;
  986. private _scene;
  987. _cache: any;
  988. private _parentNode;
  989. private _children;
  990. parent: Node;
  991. /**
  992. * @constructor
  993. * @param {string} name - the name and id to be given to this node
  994. * @param {BABYLON.Scene} the scene this node will be added to
  995. */
  996. constructor(name: string, scene: Scene);
  997. getScene(): Scene;
  998. getEngine(): Engine;
  999. getWorldMatrix(): Matrix;
  1000. _initCache(): void;
  1001. updateCache(force?: boolean): void;
  1002. _updateCache(ignoreParentClass?: boolean): void;
  1003. _isSynchronized(): boolean;
  1004. _markSyncedWithParent(): void;
  1005. isSynchronizedWithParent(): boolean;
  1006. isSynchronized(updateCache?: boolean): boolean;
  1007. hasNewParent(update?: boolean): boolean;
  1008. /**
  1009. * Is this node ready to be used/rendered
  1010. * @return {boolean} is it ready
  1011. */
  1012. isReady(): boolean;
  1013. /**
  1014. * Is this node enabled.
  1015. * If the node has a parent and is enabled, the parent will be inspected as well.
  1016. * @return {boolean} whether this node (and its parent) is enabled.
  1017. * @see setEnabled
  1018. */
  1019. isEnabled(): boolean;
  1020. /**
  1021. * Set the enabled state of this node.
  1022. * @param {boolean} value - the new enabled state
  1023. * @see isEnabled
  1024. */
  1025. setEnabled(value: boolean): void;
  1026. /**
  1027. * Is this node a descendant of the given node.
  1028. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  1029. * @param {BABYLON.Node} ancestor - The parent node to inspect
  1030. * @see parent
  1031. */
  1032. isDescendantOf(ancestor: Node): boolean;
  1033. /**
  1034. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  1035. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  1036. * @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.
  1037. * @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.
  1038. */
  1039. _getDescendants(results: Node[], directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): void;
  1040. /**
  1041. * Will return all nodes that have this node as ascendant.
  1042. * @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.
  1043. * @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.
  1044. * @return {BABYLON.Node[]} all children nodes of all types.
  1045. */
  1046. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  1047. /**
  1048. * @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.
  1049. * @Deprecated, legacy support.
  1050. * use getDecendants instead.
  1051. */
  1052. getChildren(predicate?: (node: Node) => boolean): Node[];
  1053. /**
  1054. * Get all child-meshes of this node.
  1055. */
  1056. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  1057. _setReady(state: boolean): void;
  1058. getAnimationByName(name: string): Animation;
  1059. createAnimationRange(name: string, from: number, to: number): void;
  1060. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  1061. getAnimationRange(name: string): AnimationRange;
  1062. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  1063. serializeAnimationRanges(): any;
  1064. dispose(): void;
  1065. getDirection(localAxis: BABYLON.Vector3): BABYLON.Vector3;
  1066. getDirectionToRef(localAxis: BABYLON.Vector3, result: BABYLON.Vector3): void;
  1067. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  1068. }
  1069. }
  1070. declare module BABYLON {
  1071. interface IDisposable {
  1072. dispose(): void;
  1073. }
  1074. class PointerEventTypes {
  1075. static _POINTERDOWN: number;
  1076. static _POINTERUP: number;
  1077. static _POINTERMOVE: number;
  1078. static _POINTERWHEEL: number;
  1079. static _POINTERPICK: number;
  1080. static POINTERDOWN: number;
  1081. static POINTERUP: number;
  1082. static POINTERMOVE: number;
  1083. static POINTERWHEEL: number;
  1084. static POINTERPICK: number;
  1085. }
  1086. class PointerInfoBase {
  1087. type: number;
  1088. event: PointerEvent | MouseWheelEvent;
  1089. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  1090. }
  1091. /**
  1092. * This class is used to store pointer related info for the onPrePointerObservable event.
  1093. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  1094. */
  1095. class PointerInfoPre extends PointerInfoBase {
  1096. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
  1097. localPosition: Vector2;
  1098. skipOnPointerObservable: boolean;
  1099. }
  1100. /**
  1101. * This type contains all the data related to a pointer event in Babylon.js.
  1102. * 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.
  1103. */
  1104. class PointerInfo extends PointerInfoBase {
  1105. pickInfo: PickingInfo;
  1106. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  1107. }
  1108. /**
  1109. * This class is used by the onRenderingGroupObservable
  1110. */
  1111. class RenderingGroupInfo {
  1112. /**
  1113. * The Scene that being rendered
  1114. */
  1115. scene: Scene;
  1116. /**
  1117. * The camera currently used for the rendering pass
  1118. */
  1119. camera: Camera;
  1120. /**
  1121. * The ID of the renderingGroup being processed
  1122. */
  1123. renderingGroupId: number;
  1124. /**
  1125. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  1126. */
  1127. renderStage: number;
  1128. /**
  1129. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  1130. * This stage will be fired no matter what
  1131. */
  1132. static STAGE_PRECLEAR: number;
  1133. /**
  1134. * Called before opaque object are rendered.
  1135. * This stage will be fired only if there's 3D Opaque content to render
  1136. */
  1137. static STAGE_PREOPAQUE: number;
  1138. /**
  1139. * Called after the opaque objects are rendered and before the transparent ones
  1140. * This stage will be fired only if there's 3D transparent content to render
  1141. */
  1142. static STAGE_PRETRANSPARENT: number;
  1143. /**
  1144. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  1145. * This stage will be fired no matter what
  1146. */
  1147. static STAGE_POSTTRANSPARENT: number;
  1148. }
  1149. /**
  1150. * Represents a scene to be rendered by the engine.
  1151. * @see http://doc.babylonjs.com/page.php?p=21911
  1152. */
  1153. class Scene implements IAnimatable {
  1154. private static _FOGMODE_NONE;
  1155. private static _FOGMODE_EXP;
  1156. private static _FOGMODE_EXP2;
  1157. private static _FOGMODE_LINEAR;
  1158. static MinDeltaTime: number;
  1159. static MaxDeltaTime: number;
  1160. static FOGMODE_NONE: number;
  1161. static FOGMODE_EXP: number;
  1162. static FOGMODE_EXP2: number;
  1163. static FOGMODE_LINEAR: number;
  1164. autoClear: boolean;
  1165. clearColor: any;
  1166. ambientColor: Color3;
  1167. forceWireframe: boolean;
  1168. forcePointsCloud: boolean;
  1169. forceShowBoundingBoxes: boolean;
  1170. clipPlane: Plane;
  1171. animationsEnabled: boolean;
  1172. constantlyUpdateMeshUnderPointer: boolean;
  1173. useRightHandedSystem: boolean;
  1174. hoverCursor: string;
  1175. metadata: any;
  1176. /**
  1177. * An event triggered when the scene is disposed.
  1178. * @type {BABYLON.Observable}
  1179. */
  1180. onDisposeObservable: Observable<Scene>;
  1181. private _onDisposeObserver;
  1182. onDispose: () => void;
  1183. /**
  1184. * An event triggered before rendering the scene
  1185. * @type {BABYLON.Observable}
  1186. */
  1187. onBeforeRenderObservable: Observable<Scene>;
  1188. private _onBeforeRenderObserver;
  1189. beforeRender: () => void;
  1190. /**
  1191. * An event triggered after rendering the scene
  1192. * @type {BABYLON.Observable}
  1193. */
  1194. onAfterRenderObservable: Observable<Scene>;
  1195. private _onAfterRenderObserver;
  1196. afterRender: () => void;
  1197. /**
  1198. * An event triggered when the scene is ready
  1199. * @type {BABYLON.Observable}
  1200. */
  1201. onReadyObservable: Observable<Scene>;
  1202. /**
  1203. * An event triggered before rendering a camera
  1204. * @type {BABYLON.Observable}
  1205. */
  1206. onBeforeCameraRenderObservable: Observable<Camera>;
  1207. private _onBeforeCameraRenderObserver;
  1208. beforeCameraRender: () => void;
  1209. /**
  1210. * An event triggered after rendering a camera
  1211. * @type {BABYLON.Observable}
  1212. */
  1213. onAfterCameraRenderObservable: Observable<Camera>;
  1214. private _onAfterCameraRenderObserver;
  1215. afterCameraRender: () => void;
  1216. /**
  1217. * An event triggered when a camera is created
  1218. * @type {BABYLON.Observable}
  1219. */
  1220. onNewCameraAddedObservable: Observable<Camera>;
  1221. /**
  1222. * An event triggered when a camera is removed
  1223. * @type {BABYLON.Observable}
  1224. */
  1225. onCameraRemovedObservable: Observable<Camera>;
  1226. /**
  1227. * An event triggered when a light is created
  1228. * @type {BABYLON.Observable}
  1229. */
  1230. onNewLightAddedObservable: Observable<Light>;
  1231. /**
  1232. * An event triggered when a light is removed
  1233. * @type {BABYLON.Observable}
  1234. */
  1235. onLightRemovedObservable: Observable<Light>;
  1236. /**
  1237. * An event triggered when a geometry is created
  1238. * @type {BABYLON.Observable}
  1239. */
  1240. onNewGeometryAddedObservable: Observable<Geometry>;
  1241. /**
  1242. * An event triggered when a geometry is removed
  1243. * @type {BABYLON.Observable}
  1244. */
  1245. onGeometryRemovedObservable: Observable<Geometry>;
  1246. /**
  1247. * An event triggered when a mesh is created
  1248. * @type {BABYLON.Observable}
  1249. */
  1250. onNewMeshAddedObservable: Observable<AbstractMesh>;
  1251. /**
  1252. * An event triggered when a mesh is removed
  1253. * @type {BABYLON.Observable}
  1254. */
  1255. onMeshRemovedObservable: Observable<AbstractMesh>;
  1256. /**
  1257. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  1258. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  1259. * 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)
  1260. */
  1261. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  1262. animations: Animation[];
  1263. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  1264. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  1265. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  1266. private _onPointerMove;
  1267. private _onPointerDown;
  1268. private _onPointerUp;
  1269. /**
  1270. * @deprecated Use onPointerObservable instead
  1271. */
  1272. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1273. /**
  1274. * @deprecated Use onPointerObservable instead
  1275. */
  1276. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1277. /**
  1278. * @deprecated Use onPointerObservable instead
  1279. */
  1280. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1281. /**
  1282. * @deprecated Use onPointerObservable instead
  1283. */
  1284. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1285. /**
  1286. * This observable event is triggered when any mouse event registered during Scene.attach() is called BEFORE the 3D engine to process anything (mesh/sprite picking for instance).
  1287. * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
  1288. */
  1289. onPrePointerObservable: Observable<PointerInfoPre>;
  1290. /**
  1291. * Observable event triggered each time an input event is received from the rendering canvas
  1292. */
  1293. onPointerObservable: Observable<PointerInfo>;
  1294. unTranslatedPointer: Vector2;
  1295. cameraToUseForPointers: Camera;
  1296. private _pointerX;
  1297. private _pointerY;
  1298. private _unTranslatedPointerX;
  1299. private _unTranslatedPointerY;
  1300. private _startingPointerPosition;
  1301. private _startingPointerTime;
  1302. _mirroredCameraPosition: Vector3;
  1303. private _onKeyDown;
  1304. private _onKeyUp;
  1305. /**
  1306. * is fog enabled on this scene.
  1307. * @type {boolean}
  1308. */
  1309. fogEnabled: boolean;
  1310. fogMode: number;
  1311. fogColor: Color3;
  1312. fogDensity: number;
  1313. fogStart: number;
  1314. fogEnd: number;
  1315. /**
  1316. * is shadow enabled on this scene.
  1317. * @type {boolean}
  1318. */
  1319. shadowsEnabled: boolean;
  1320. /**
  1321. * is light enabled on this scene.
  1322. * @type {boolean}
  1323. */
  1324. lightsEnabled: boolean;
  1325. /**
  1326. * All of the lights added to this scene.
  1327. * @see BABYLON.Light
  1328. * @type {BABYLON.Light[]}
  1329. */
  1330. lights: Light[];
  1331. /**
  1332. * All of the cameras added to this scene.
  1333. * @see BABYLON.Camera
  1334. * @type {BABYLON.Camera[]}
  1335. */
  1336. cameras: Camera[];
  1337. activeCameras: Camera[];
  1338. activeCamera: Camera;
  1339. /**
  1340. * All of the (abstract) meshes added to this scene.
  1341. * @see BABYLON.AbstractMesh
  1342. * @type {BABYLON.AbstractMesh[]}
  1343. */
  1344. meshes: AbstractMesh[];
  1345. private _geometries;
  1346. materials: Material[];
  1347. multiMaterials: MultiMaterial[];
  1348. private _defaultMaterial;
  1349. defaultMaterial: StandardMaterial;
  1350. texturesEnabled: boolean;
  1351. textures: BaseTexture[];
  1352. particlesEnabled: boolean;
  1353. particleSystems: ParticleSystem[];
  1354. spritesEnabled: boolean;
  1355. spriteManagers: SpriteManager[];
  1356. layers: Layer[];
  1357. highlightLayers: HighlightLayer[];
  1358. skeletonsEnabled: boolean;
  1359. skeletons: Skeleton[];
  1360. lensFlaresEnabled: boolean;
  1361. lensFlareSystems: LensFlareSystem[];
  1362. collisionsEnabled: boolean;
  1363. private _workerCollisions;
  1364. collisionCoordinator: ICollisionCoordinator;
  1365. gravity: Vector3;
  1366. postProcessesEnabled: boolean;
  1367. postProcessManager: PostProcessManager;
  1368. postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1369. renderTargetsEnabled: boolean;
  1370. dumpNextRenderTargets: boolean;
  1371. customRenderTargets: RenderTargetTexture[];
  1372. useDelayedTextureLoading: boolean;
  1373. importedMeshesFiles: String[];
  1374. probesEnabled: boolean;
  1375. reflectionProbes: ReflectionProbe[];
  1376. database: any;
  1377. /**
  1378. * This scene's action manager
  1379. * @type {BABYLON.ActionManager}
  1380. */
  1381. actionManager: ActionManager;
  1382. _actionManagers: ActionManager[];
  1383. private _meshesForIntersections;
  1384. proceduralTexturesEnabled: boolean;
  1385. _proceduralTextures: ProceduralTexture[];
  1386. mainSoundTrack: SoundTrack;
  1387. soundTracks: SoundTrack[];
  1388. private _audioEnabled;
  1389. private _headphone;
  1390. simplificationQueue: SimplificationQueue;
  1391. private _engine;
  1392. private _totalMeshesCounter;
  1393. private _totalLightsCounter;
  1394. private _totalMaterialsCounter;
  1395. private _totalTexturesCounter;
  1396. private _totalVertices;
  1397. _activeIndices: PerfCounter;
  1398. _activeParticles: PerfCounter;
  1399. private _lastFrameDuration;
  1400. private _evaluateActiveMeshesDuration;
  1401. private _renderTargetsDuration;
  1402. _particlesDuration: PerfCounter;
  1403. private _renderDuration;
  1404. _spritesDuration: PerfCounter;
  1405. _activeBones: PerfCounter;
  1406. private _animationRatio;
  1407. private _animationStartDate;
  1408. _cachedMaterial: Material;
  1409. private _renderId;
  1410. private _executeWhenReadyTimeoutId;
  1411. private _intermediateRendering;
  1412. _toBeDisposed: SmartArray<IDisposable>;
  1413. private _pendingData;
  1414. private _activeMeshes;
  1415. private _processedMaterials;
  1416. private _renderTargets;
  1417. _activeParticleSystems: SmartArray<ParticleSystem>;
  1418. private _activeSkeletons;
  1419. private _softwareSkinnedMeshes;
  1420. private _renderingManager;
  1421. private _physicsEngine;
  1422. _activeAnimatables: Animatable[];
  1423. private _transformMatrix;
  1424. private _pickWithRayInverseMatrix;
  1425. private _edgesRenderers;
  1426. private _boundingBoxRenderer;
  1427. private _outlineRenderer;
  1428. private _viewMatrix;
  1429. private _projectionMatrix;
  1430. private _frustumPlanes;
  1431. private _selectionOctree;
  1432. private _pointerOverMesh;
  1433. private _pointerOverSprite;
  1434. private _debugLayer;
  1435. private _depthRenderer;
  1436. private _uniqueIdCounter;
  1437. private _pickedDownMesh;
  1438. private _pickedDownSprite;
  1439. private _externalData;
  1440. private _uid;
  1441. /**
  1442. * @constructor
  1443. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1444. */
  1445. constructor(engine: Engine);
  1446. debugLayer: DebugLayer;
  1447. workerCollisions: boolean;
  1448. SelectionOctree: Octree<AbstractMesh>;
  1449. /**
  1450. * The mesh that is currently under the pointer.
  1451. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1452. */
  1453. meshUnderPointer: AbstractMesh;
  1454. /**
  1455. * Current on-screen X position of the pointer
  1456. * @return {number} X position of the pointer
  1457. */
  1458. pointerX: number;
  1459. /**
  1460. * Current on-screen Y position of the pointer
  1461. * @return {number} Y position of the pointer
  1462. */
  1463. pointerY: number;
  1464. getCachedMaterial(): Material;
  1465. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1466. getOutlineRenderer(): OutlineRenderer;
  1467. getEngine(): Engine;
  1468. getTotalVertices(): number;
  1469. totalVerticesPerfCounter: PerfCounter;
  1470. getActiveIndices(): number;
  1471. totalActiveIndicesPerfCounter: PerfCounter;
  1472. getActiveParticles(): number;
  1473. activeParticlesPerfCounter: PerfCounter;
  1474. getActiveBones(): number;
  1475. activeBonesPerfCounter: PerfCounter;
  1476. getLastFrameDuration(): number;
  1477. lastFramePerfCounter: PerfCounter;
  1478. getEvaluateActiveMeshesDuration(): number;
  1479. evaluateActiveMeshesDurationPerfCounter: PerfCounter;
  1480. getActiveMeshes(): SmartArray<Mesh>;
  1481. getRenderTargetsDuration(): number;
  1482. getRenderDuration(): number;
  1483. renderDurationPerfCounter: PerfCounter;
  1484. getParticlesDuration(): number;
  1485. particlesDurationPerfCounter: PerfCounter;
  1486. getSpritesDuration(): number;
  1487. spriteDuractionPerfCounter: PerfCounter;
  1488. getAnimationRatio(): number;
  1489. getRenderId(): number;
  1490. incrementRenderId(): void;
  1491. private _updatePointerPosition(evt);
  1492. /**
  1493. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1494. * @param attachUp defines if you want to attach events to pointerup
  1495. * @param attachDown defines if you want to attach events to pointerdown
  1496. * @param attachMove defines if you want to attach events to pointermove
  1497. */
  1498. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1499. detachControl(): void;
  1500. isReady(): boolean;
  1501. resetCachedMaterial(): void;
  1502. registerBeforeRender(func: () => void): void;
  1503. unregisterBeforeRender(func: () => void): void;
  1504. registerAfterRender(func: () => void): void;
  1505. unregisterAfterRender(func: () => void): void;
  1506. _addPendingData(data: any): void;
  1507. _removePendingData(data: any): void;
  1508. getWaitingItemsCount(): number;
  1509. /**
  1510. * Registers a function to be executed when the scene is ready.
  1511. * @param {Function} func - the function to be executed.
  1512. */
  1513. executeWhenReady(func: () => void): void;
  1514. _checkIsReady(): void;
  1515. /**
  1516. * Will start the animation sequence of a given target
  1517. * @param target - the target
  1518. * @param {number} from - from which frame should animation start
  1519. * @param {number} to - till which frame should animation run.
  1520. * @param {boolean} [loop] - should the animation loop
  1521. * @param {number} [speedRatio] - the speed in which to run the animation
  1522. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1523. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1524. * @return {BABYLON.Animatable} the animatable object created for this animation
  1525. * @see BABYLON.Animatable
  1526. * @see http://doc.babylonjs.com/page.php?p=22081
  1527. */
  1528. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1529. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1530. getAnimatableByTarget(target: any): Animatable;
  1531. Animatables: Animatable[];
  1532. /**
  1533. * Will stop the animation of the given target
  1534. * @param target - the target
  1535. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1536. * @see beginAnimation
  1537. */
  1538. stopAnimation(target: any, animationName?: string): void;
  1539. private _animate();
  1540. getViewMatrix(): Matrix;
  1541. getProjectionMatrix(): Matrix;
  1542. getTransformMatrix(): Matrix;
  1543. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1544. addMesh(newMesh: AbstractMesh): void;
  1545. removeMesh(toRemove: AbstractMesh): number;
  1546. removeSkeleton(toRemove: Skeleton): number;
  1547. removeLight(toRemove: Light): number;
  1548. removeCamera(toRemove: Camera): number;
  1549. addLight(newLight: Light): void;
  1550. addCamera(newCamera: Camera): void;
  1551. /**
  1552. * Switch active camera
  1553. * @param {Camera} newCamera - new active camera
  1554. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1555. */
  1556. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1557. /**
  1558. * sets the active camera of the scene using its ID
  1559. * @param {string} id - the camera's ID
  1560. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1561. * @see activeCamera
  1562. */
  1563. setActiveCameraByID(id: string): Camera;
  1564. /**
  1565. * sets the active camera of the scene using its name
  1566. * @param {string} name - the camera's name
  1567. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1568. * @see activeCamera
  1569. */
  1570. setActiveCameraByName(name: string): Camera;
  1571. /**
  1572. * get a material using its id
  1573. * @param {string} the material's ID
  1574. * @return {BABYLON.Material|null} the material or null if none found.
  1575. */
  1576. getMaterialByID(id: string): Material;
  1577. /**
  1578. * get a material using its name
  1579. * @param {string} the material's name
  1580. * @return {BABYLON.Material|null} the material or null if none found.
  1581. */
  1582. getMaterialByName(name: string): Material;
  1583. getLensFlareSystemByName(name: string): LensFlareSystem;
  1584. getLensFlareSystemByID(id: string): LensFlareSystem;
  1585. getCameraByID(id: string): Camera;
  1586. getCameraByUniqueID(uniqueId: number): Camera;
  1587. /**
  1588. * get a camera using its name
  1589. * @param {string} the camera's name
  1590. * @return {BABYLON.Camera|null} the camera or null if none found.
  1591. */
  1592. getCameraByName(name: string): Camera;
  1593. /**
  1594. * get a bone using its id
  1595. * @param {string} the bone's id
  1596. * @return {BABYLON.Bone|null} the bone or null if not found
  1597. */
  1598. getBoneByID(id: string): Bone;
  1599. /**
  1600. * get a bone using its id
  1601. * @param {string} the bone's name
  1602. * @return {BABYLON.Bone|null} the bone or null if not found
  1603. */
  1604. getBoneByName(name: string): Bone;
  1605. /**
  1606. * get a light node using its name
  1607. * @param {string} the light's name
  1608. * @return {BABYLON.Light|null} the light or null if none found.
  1609. */
  1610. getLightByName(name: string): Light;
  1611. /**
  1612. * get a light node using its ID
  1613. * @param {string} the light's id
  1614. * @return {BABYLON.Light|null} the light or null if none found.
  1615. */
  1616. getLightByID(id: string): Light;
  1617. /**
  1618. * get a light node using its scene-generated unique ID
  1619. * @param {number} the light's unique id
  1620. * @return {BABYLON.Light|null} the light or null if none found.
  1621. */
  1622. getLightByUniqueID(uniqueId: number): Light;
  1623. /**
  1624. * get a particle system by id
  1625. * @param id {number} the particle system id
  1626. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  1627. */
  1628. getParticleSystemByID(id: string): ParticleSystem;
  1629. /**
  1630. * get a geometry using its ID
  1631. * @param {string} the geometry's id
  1632. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1633. */
  1634. getGeometryByID(id: string): Geometry;
  1635. /**
  1636. * add a new geometry to this scene.
  1637. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1638. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1639. * @return {boolean} was the geometry added or not
  1640. */
  1641. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1642. /**
  1643. * Removes an existing geometry
  1644. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1645. * @return {boolean} was the geometry removed or not
  1646. */
  1647. removeGeometry(geometry: Geometry): boolean;
  1648. getGeometries(): Geometry[];
  1649. /**
  1650. * Get the first added mesh found of a given ID
  1651. * @param {string} id - the id to search for
  1652. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1653. */
  1654. getMeshByID(id: string): AbstractMesh;
  1655. getMeshesByID(id: string): Array<AbstractMesh>;
  1656. /**
  1657. * Get a mesh with its auto-generated unique id
  1658. * @param {number} uniqueId - the unique id to search for
  1659. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1660. */
  1661. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  1662. /**
  1663. * Get a the last added mesh found of a given ID
  1664. * @param {string} id - the id to search for
  1665. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1666. */
  1667. getLastMeshByID(id: string): AbstractMesh;
  1668. /**
  1669. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1670. * @param {string} id - the id to search for
  1671. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1672. */
  1673. getLastEntryByID(id: string): Node;
  1674. getNodeByID(id: string): Node;
  1675. getNodeByName(name: string): Node;
  1676. getMeshByName(name: string): AbstractMesh;
  1677. getSoundByName(name: string): Sound;
  1678. getLastSkeletonByID(id: string): Skeleton;
  1679. getSkeletonById(id: string): Skeleton;
  1680. getSkeletonByName(name: string): Skeleton;
  1681. isActiveMesh(mesh: Mesh): boolean;
  1682. /**
  1683. * Return a unique id as a string which can serve as an identifier for the scene
  1684. */
  1685. uid: string;
  1686. /**
  1687. * Add an externaly attached data from its key.
  1688. * This method call will fail and return false, if such key already exists.
  1689. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1690. * @param key the unique key that identifies the data
  1691. * @param data the data object to associate to the key for this Engine instance
  1692. * @return true if no such key were already present and the data was added successfully, false otherwise
  1693. */
  1694. addExternalData<T>(key: string, data: T): boolean;
  1695. /**
  1696. * Get an externaly attached data from its key
  1697. * @param key the unique key that identifies the data
  1698. * @return the associated data, if present (can be null), or undefined if not present
  1699. */
  1700. getExternalData<T>(key: string): T;
  1701. /**
  1702. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1703. * @param key the unique key that identifies the data
  1704. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1705. * @return the associated data, can be null if the factory returned null.
  1706. */
  1707. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1708. /**
  1709. * Remove an externaly attached data from the Engine instance
  1710. * @param key the unique key that identifies the data
  1711. * @return true if the data was successfully removed, false if it doesn't exist
  1712. */
  1713. removeExternalData(key: any): boolean;
  1714. private _evaluateSubMesh(subMesh, mesh);
  1715. _isInIntermediateRendering(): boolean;
  1716. private _evaluateActiveMeshes();
  1717. private _activeMesh(sourceMesh, mesh);
  1718. updateTransformMatrix(force?: boolean): void;
  1719. private _renderForCamera(camera);
  1720. private _processSubCameras(camera);
  1721. private _checkIntersections();
  1722. render(): void;
  1723. private _updateAudioParameters();
  1724. audioEnabled: boolean;
  1725. private _disableAudio();
  1726. private _enableAudio();
  1727. headphone: boolean;
  1728. private _switchAudioModeForHeadphones();
  1729. private _switchAudioModeForNormalSpeakers();
  1730. enableDepthRenderer(): DepthRenderer;
  1731. disableDepthRenderer(): void;
  1732. freezeMaterials(): void;
  1733. unfreezeMaterials(): void;
  1734. dispose(): void;
  1735. disposeSounds(): void;
  1736. getWorldExtends(): {
  1737. min: Vector3;
  1738. max: Vector3;
  1739. };
  1740. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1741. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1742. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1743. private _internalPick(rayFunction, predicate, fastCheck?);
  1744. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  1745. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1746. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1747. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1748. setPointerOverMesh(mesh: AbstractMesh): void;
  1749. getPointerOverMesh(): AbstractMesh;
  1750. setPointerOverSprite(sprite: Sprite): void;
  1751. getPointerOverSprite(): Sprite;
  1752. getPhysicsEngine(): PhysicsEngine;
  1753. /**
  1754. * Enables physics to the current scene
  1755. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1756. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1757. * @return {boolean} was the physics engine initialized
  1758. */
  1759. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1760. disablePhysicsEngine(): void;
  1761. isPhysicsEnabled(): boolean;
  1762. /**
  1763. *
  1764. * Sets the gravity of the physics engine (and NOT of the scene)
  1765. * @param {BABYLON.Vector3} [gravity] - the new gravity to be used
  1766. */
  1767. setGravity(gravity: Vector3): void;
  1768. /**
  1769. * Legacy support, using the new API
  1770. * @Deprecated
  1771. */
  1772. createCompoundImpostor(parts: any, options: PhysicsImpostorParameters): any;
  1773. deleteCompoundImpostor(compound: any): void;
  1774. createDefaultCameraOrLight(): void;
  1775. private _getByTags(list, tagsQuery, forEach?);
  1776. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1777. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1778. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1779. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1780. /**
  1781. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1782. * This allowed control for front to back rendering or reversly depending of the special needs.
  1783. *
  1784. * @param renderingGroupId The rendering group id corresponding to its index
  1785. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1786. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1787. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1788. */
  1789. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  1790. /**
  1791. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1792. *
  1793. * @param renderingGroupId The rendering group id corresponding to its index
  1794. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1795. */
  1796. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  1797. }
  1798. }
  1799. declare module BABYLON {
  1800. class Action {
  1801. triggerOptions: any;
  1802. trigger: number;
  1803. _actionManager: ActionManager;
  1804. private _nextActiveAction;
  1805. private _child;
  1806. private _condition;
  1807. private _triggerParameter;
  1808. constructor(triggerOptions: any, condition?: Condition);
  1809. _prepare(): void;
  1810. getTriggerParameter(): any;
  1811. _executeCurrent(evt: ActionEvent): void;
  1812. execute(evt: ActionEvent): void;
  1813. skipToNextActiveAction(): void;
  1814. then(action: Action): Action;
  1815. _getProperty(propertyPath: string): string;
  1816. _getEffectiveTarget(target: any, propertyPath: string): any;
  1817. serialize(parent: any): any;
  1818. protected _serialize(serializedAction: any, parent?: any): any;
  1819. static _SerializeValueAsString: (value: any) => string;
  1820. static _GetTargetProperty: (target: Scene | Node) => {
  1821. name: string;
  1822. targetType: string;
  1823. value: string;
  1824. };
  1825. }
  1826. }
  1827. declare module BABYLON {
  1828. /**
  1829. * ActionEvent is the event beint sent when an action is triggered.
  1830. */
  1831. class ActionEvent {
  1832. source: any;
  1833. pointerX: number;
  1834. pointerY: number;
  1835. meshUnderPointer: AbstractMesh;
  1836. sourceEvent: any;
  1837. additionalData: any;
  1838. /**
  1839. * @constructor
  1840. * @param source The mesh or sprite that triggered the action.
  1841. * @param pointerX The X mouse cursor position at the time of the event
  1842. * @param pointerY The Y mouse cursor position at the time of the event
  1843. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1844. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1845. */
  1846. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  1847. /**
  1848. * Helper function to auto-create an ActionEvent from a source mesh.
  1849. * @param source The source mesh that triggered the event
  1850. * @param evt {Event} The original (browser) event
  1851. */
  1852. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1853. /**
  1854. * Helper function to auto-create an ActionEvent from a source mesh.
  1855. * @param source The source sprite that triggered the event
  1856. * @param scene Scene associated with the sprite
  1857. * @param evt {Event} The original (browser) event
  1858. */
  1859. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1860. /**
  1861. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1862. * @param scene the scene where the event occurred
  1863. * @param evt {Event} The original (browser) event
  1864. */
  1865. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1866. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  1867. }
  1868. /**
  1869. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1870. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1871. */
  1872. class ActionManager {
  1873. private static _NothingTrigger;
  1874. private static _OnPickTrigger;
  1875. private static _OnLeftPickTrigger;
  1876. private static _OnRightPickTrigger;
  1877. private static _OnCenterPickTrigger;
  1878. private static _OnPickDownTrigger;
  1879. private static _OnPickUpTrigger;
  1880. private static _OnLongPressTrigger;
  1881. private static _OnPointerOverTrigger;
  1882. private static _OnPointerOutTrigger;
  1883. private static _OnEveryFrameTrigger;
  1884. private static _OnIntersectionEnterTrigger;
  1885. private static _OnIntersectionExitTrigger;
  1886. private static _OnKeyDownTrigger;
  1887. private static _OnKeyUpTrigger;
  1888. private static _OnPickOutTrigger;
  1889. static NothingTrigger: number;
  1890. static OnPickTrigger: number;
  1891. static OnLeftPickTrigger: number;
  1892. static OnRightPickTrigger: number;
  1893. static OnCenterPickTrigger: number;
  1894. static OnPickDownTrigger: number;
  1895. static OnPickUpTrigger: number;
  1896. static OnPickOutTrigger: number;
  1897. static OnLongPressTrigger: number;
  1898. static OnPointerOverTrigger: number;
  1899. static OnPointerOutTrigger: number;
  1900. static OnEveryFrameTrigger: number;
  1901. static OnIntersectionEnterTrigger: number;
  1902. static OnIntersectionExitTrigger: number;
  1903. static OnKeyDownTrigger: number;
  1904. static OnKeyUpTrigger: number;
  1905. static DragMovementThreshold: number;
  1906. static LongPressDelay: number;
  1907. actions: Action[];
  1908. hoverCursor: string;
  1909. private _scene;
  1910. constructor(scene: Scene);
  1911. dispose(): void;
  1912. getScene(): Scene;
  1913. /**
  1914. * Does this action manager handles actions of any of the given triggers
  1915. * @param {number[]} triggers - the triggers to be tested
  1916. * @return {boolean} whether one (or more) of the triggers is handeled
  1917. */
  1918. hasSpecificTriggers(triggers: number[]): boolean;
  1919. /**
  1920. * Does this action manager handles actions of a given trigger
  1921. * @param {number} trigger - the trigger to be tested
  1922. * @return {boolean} whether the trigger is handeled
  1923. */
  1924. hasSpecificTrigger(trigger: number): boolean;
  1925. /**
  1926. * Does this action manager has pointer triggers
  1927. * @return {boolean} whether or not it has pointer triggers
  1928. */
  1929. hasPointerTriggers: boolean;
  1930. /**
  1931. * Does this action manager has pick triggers
  1932. * @return {boolean} whether or not it has pick triggers
  1933. */
  1934. hasPickTriggers: boolean;
  1935. /**
  1936. * Registers an action to this action manager
  1937. * @param {BABYLON.Action} action - the action to be registered
  1938. * @return {BABYLON.Action} the action amended (prepared) after registration
  1939. */
  1940. registerAction(action: Action): Action;
  1941. /**
  1942. * Process a specific trigger
  1943. * @param {number} trigger - the trigger to process
  1944. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1945. */
  1946. processTrigger(trigger: number, evt: ActionEvent): void;
  1947. _getEffectiveTarget(target: any, propertyPath: string): any;
  1948. _getProperty(propertyPath: string): string;
  1949. serialize(name: string): any;
  1950. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  1951. static GetTriggerName(trigger: number): string;
  1952. }
  1953. }
  1954. declare module BABYLON {
  1955. class Condition {
  1956. _actionManager: ActionManager;
  1957. _evaluationId: number;
  1958. _currentResult: boolean;
  1959. constructor(actionManager: ActionManager);
  1960. isValid(): boolean;
  1961. _getProperty(propertyPath: string): string;
  1962. _getEffectiveTarget(target: any, propertyPath: string): any;
  1963. serialize(): any;
  1964. protected _serialize(serializedCondition: any): any;
  1965. }
  1966. class ValueCondition extends Condition {
  1967. propertyPath: string;
  1968. value: any;
  1969. operator: number;
  1970. private static _IsEqual;
  1971. private static _IsDifferent;
  1972. private static _IsGreater;
  1973. private static _IsLesser;
  1974. static IsEqual: number;
  1975. static IsDifferent: number;
  1976. static IsGreater: number;
  1977. static IsLesser: number;
  1978. _actionManager: ActionManager;
  1979. private _target;
  1980. private _effectiveTarget;
  1981. private _property;
  1982. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1983. isValid(): boolean;
  1984. serialize(): any;
  1985. static GetOperatorName(operator: number): string;
  1986. }
  1987. class PredicateCondition extends Condition {
  1988. predicate: () => boolean;
  1989. _actionManager: ActionManager;
  1990. constructor(actionManager: ActionManager, predicate: () => boolean);
  1991. isValid(): boolean;
  1992. }
  1993. class StateCondition extends Condition {
  1994. value: string;
  1995. _actionManager: ActionManager;
  1996. private _target;
  1997. constructor(actionManager: ActionManager, target: any, value: string);
  1998. isValid(): boolean;
  1999. serialize(): any;
  2000. }
  2001. }
  2002. declare module BABYLON {
  2003. class SwitchBooleanAction extends Action {
  2004. propertyPath: string;
  2005. private _target;
  2006. private _effectiveTarget;
  2007. private _property;
  2008. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  2009. _prepare(): void;
  2010. execute(): void;
  2011. serialize(parent: any): any;
  2012. }
  2013. class SetStateAction extends Action {
  2014. value: string;
  2015. private _target;
  2016. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  2017. execute(): void;
  2018. serialize(parent: any): any;
  2019. }
  2020. class SetValueAction extends Action {
  2021. propertyPath: string;
  2022. value: any;
  2023. private _target;
  2024. private _effectiveTarget;
  2025. private _property;
  2026. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  2027. _prepare(): void;
  2028. execute(): void;
  2029. serialize(parent: any): any;
  2030. }
  2031. class IncrementValueAction extends Action {
  2032. propertyPath: string;
  2033. value: any;
  2034. private _target;
  2035. private _effectiveTarget;
  2036. private _property;
  2037. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  2038. _prepare(): void;
  2039. execute(): void;
  2040. serialize(parent: any): any;
  2041. }
  2042. class PlayAnimationAction extends Action {
  2043. from: number;
  2044. to: number;
  2045. loop: boolean;
  2046. private _target;
  2047. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  2048. _prepare(): void;
  2049. execute(): void;
  2050. serialize(parent: any): any;
  2051. }
  2052. class StopAnimationAction extends Action {
  2053. private _target;
  2054. constructor(triggerOptions: any, target: any, condition?: Condition);
  2055. _prepare(): void;
  2056. execute(): void;
  2057. serialize(parent: any): any;
  2058. }
  2059. class DoNothingAction extends Action {
  2060. constructor(triggerOptions?: any, condition?: Condition);
  2061. execute(): void;
  2062. serialize(parent: any): any;
  2063. }
  2064. class CombineAction extends Action {
  2065. children: Action[];
  2066. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  2067. _prepare(): void;
  2068. execute(evt: ActionEvent): void;
  2069. serialize(parent: any): any;
  2070. }
  2071. class ExecuteCodeAction extends Action {
  2072. func: (evt: ActionEvent) => void;
  2073. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  2074. execute(evt: ActionEvent): void;
  2075. }
  2076. class SetParentAction extends Action {
  2077. private _parent;
  2078. private _target;
  2079. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  2080. _prepare(): void;
  2081. execute(): void;
  2082. serialize(parent: any): any;
  2083. }
  2084. class PlaySoundAction extends Action {
  2085. private _sound;
  2086. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2087. _prepare(): void;
  2088. execute(): void;
  2089. serialize(parent: any): any;
  2090. }
  2091. class StopSoundAction extends Action {
  2092. private _sound;
  2093. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2094. _prepare(): void;
  2095. execute(): void;
  2096. serialize(parent: any): any;
  2097. }
  2098. }
  2099. declare module BABYLON {
  2100. class InterpolateValueAction extends Action {
  2101. propertyPath: string;
  2102. value: any;
  2103. duration: number;
  2104. stopOtherAnimations: boolean;
  2105. onInterpolationDone: () => void;
  2106. private _target;
  2107. private _effectiveTarget;
  2108. private _property;
  2109. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  2110. _prepare(): void;
  2111. execute(): void;
  2112. serialize(parent: any): any;
  2113. }
  2114. }
  2115. declare module BABYLON {
  2116. class Animatable {
  2117. target: any;
  2118. fromFrame: number;
  2119. toFrame: number;
  2120. loopAnimation: boolean;
  2121. speedRatio: number;
  2122. onAnimationEnd: any;
  2123. private _localDelayOffset;
  2124. private _pausedDelay;
  2125. private _animations;
  2126. private _paused;
  2127. private _scene;
  2128. animationStarted: boolean;
  2129. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  2130. getAnimations(): Animation[];
  2131. appendAnimations(target: any, animations: Animation[]): void;
  2132. getAnimationByTargetProperty(property: string): Animation;
  2133. reset(): void;
  2134. enableBlending(blendingSpeed: number): void;
  2135. disableBlending(): void;
  2136. goToFrame(frame: number): void;
  2137. pause(): void;
  2138. restart(): void;
  2139. stop(animationName?: string): void;
  2140. _animate(delay: number): boolean;
  2141. }
  2142. }
  2143. declare module BABYLON {
  2144. class AnimationRange {
  2145. name: string;
  2146. from: number;
  2147. to: number;
  2148. constructor(name: string, from: number, to: number);
  2149. clone(): AnimationRange;
  2150. }
  2151. /**
  2152. * Composed of a frame, and an action function
  2153. */
  2154. class AnimationEvent {
  2155. frame: number;
  2156. action: () => void;
  2157. onlyOnce: boolean;
  2158. isDone: boolean;
  2159. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  2160. }
  2161. class PathCursor {
  2162. private path;
  2163. private _onchange;
  2164. value: number;
  2165. animations: Animation[];
  2166. constructor(path: Path2);
  2167. getPoint(): Vector3;
  2168. moveAhead(step?: number): PathCursor;
  2169. moveBack(step?: number): PathCursor;
  2170. move(step: number): PathCursor;
  2171. private ensureLimits();
  2172. private markAsDirty(propertyName);
  2173. private raiseOnChange();
  2174. onchange(f: (cursor: PathCursor) => void): PathCursor;
  2175. }
  2176. class Animation {
  2177. name: string;
  2178. targetProperty: string;
  2179. framePerSecond: number;
  2180. dataType: number;
  2181. loopMode: number;
  2182. enableBlending: boolean;
  2183. private _keys;
  2184. private _offsetsCache;
  2185. private _highLimitsCache;
  2186. private _stopped;
  2187. _target: any;
  2188. private _blendingFactor;
  2189. private _easingFunction;
  2190. private _events;
  2191. targetPropertyPath: string[];
  2192. currentFrame: number;
  2193. allowMatricesInterpolation: boolean;
  2194. blendingSpeed: number;
  2195. private _originalBlendValue;
  2196. private _ranges;
  2197. static _PrepareAnimation(name: string, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animation;
  2198. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2199. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2200. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  2201. /**
  2202. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2203. */
  2204. toString(fullDetails?: boolean): string;
  2205. /**
  2206. * Add an event to this animation.
  2207. */
  2208. addEvent(event: AnimationEvent): void;
  2209. /**
  2210. * Remove all events found at the given frame
  2211. * @param frame
  2212. */
  2213. removeEvents(frame: number): void;
  2214. createRange(name: string, from: number, to: number): void;
  2215. deleteRange(name: string, deleteFrames?: boolean): void;
  2216. getRange(name: string): AnimationRange;
  2217. reset(): void;
  2218. isStopped(): boolean;
  2219. getKeys(): Array<{
  2220. frame: number;
  2221. value: any;
  2222. }>;
  2223. getHighestFrame(): number;
  2224. getEasingFunction(): IEasingFunction;
  2225. setEasingFunction(easingFunction: EasingFunction): void;
  2226. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  2227. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  2228. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  2229. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  2230. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  2231. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  2232. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  2233. clone(): Animation;
  2234. setKeys(values: Array<{
  2235. frame: number;
  2236. value: any;
  2237. }>): void;
  2238. private _getKeyValue(value);
  2239. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  2240. setValue(currentValue: any, blend?: boolean): void;
  2241. goToFrame(frame: number): void;
  2242. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  2243. serialize(): any;
  2244. private static _ANIMATIONTYPE_FLOAT;
  2245. private static _ANIMATIONTYPE_VECTOR3;
  2246. private static _ANIMATIONTYPE_QUATERNION;
  2247. private static _ANIMATIONTYPE_MATRIX;
  2248. private static _ANIMATIONTYPE_COLOR3;
  2249. private static _ANIMATIONTYPE_VECTOR2;
  2250. private static _ANIMATIONTYPE_SIZE;
  2251. private static _ANIMATIONLOOPMODE_RELATIVE;
  2252. private static _ANIMATIONLOOPMODE_CYCLE;
  2253. private static _ANIMATIONLOOPMODE_CONSTANT;
  2254. static ANIMATIONTYPE_FLOAT: number;
  2255. static ANIMATIONTYPE_VECTOR3: number;
  2256. static ANIMATIONTYPE_VECTOR2: number;
  2257. static ANIMATIONTYPE_SIZE: number;
  2258. static ANIMATIONTYPE_QUATERNION: number;
  2259. static ANIMATIONTYPE_MATRIX: number;
  2260. static ANIMATIONTYPE_COLOR3: number;
  2261. static ANIMATIONLOOPMODE_RELATIVE: number;
  2262. static ANIMATIONLOOPMODE_CYCLE: number;
  2263. static ANIMATIONLOOPMODE_CONSTANT: number;
  2264. static Parse(parsedAnimation: any): Animation;
  2265. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  2266. }
  2267. }
  2268. declare module BABYLON {
  2269. interface IEasingFunction {
  2270. ease(gradient: number): number;
  2271. }
  2272. class EasingFunction implements IEasingFunction {
  2273. private static _EASINGMODE_EASEIN;
  2274. private static _EASINGMODE_EASEOUT;
  2275. private static _EASINGMODE_EASEINOUT;
  2276. static EASINGMODE_EASEIN: number;
  2277. static EASINGMODE_EASEOUT: number;
  2278. static EASINGMODE_EASEINOUT: number;
  2279. private _easingMode;
  2280. setEasingMode(easingMode: number): void;
  2281. getEasingMode(): number;
  2282. easeInCore(gradient: number): number;
  2283. ease(gradient: number): number;
  2284. }
  2285. class CircleEase extends EasingFunction implements IEasingFunction {
  2286. easeInCore(gradient: number): number;
  2287. }
  2288. class BackEase extends EasingFunction implements IEasingFunction {
  2289. amplitude: number;
  2290. constructor(amplitude?: number);
  2291. easeInCore(gradient: number): number;
  2292. }
  2293. class BounceEase extends EasingFunction implements IEasingFunction {
  2294. bounces: number;
  2295. bounciness: number;
  2296. constructor(bounces?: number, bounciness?: number);
  2297. easeInCore(gradient: number): number;
  2298. }
  2299. class CubicEase extends EasingFunction implements IEasingFunction {
  2300. easeInCore(gradient: number): number;
  2301. }
  2302. class ElasticEase extends EasingFunction implements IEasingFunction {
  2303. oscillations: number;
  2304. springiness: number;
  2305. constructor(oscillations?: number, springiness?: number);
  2306. easeInCore(gradient: number): number;
  2307. }
  2308. class ExponentialEase extends EasingFunction implements IEasingFunction {
  2309. exponent: number;
  2310. constructor(exponent?: number);
  2311. easeInCore(gradient: number): number;
  2312. }
  2313. class PowerEase extends EasingFunction implements IEasingFunction {
  2314. power: number;
  2315. constructor(power?: number);
  2316. easeInCore(gradient: number): number;
  2317. }
  2318. class QuadraticEase extends EasingFunction implements IEasingFunction {
  2319. easeInCore(gradient: number): number;
  2320. }
  2321. class QuarticEase extends EasingFunction implements IEasingFunction {
  2322. easeInCore(gradient: number): number;
  2323. }
  2324. class QuinticEase extends EasingFunction implements IEasingFunction {
  2325. easeInCore(gradient: number): number;
  2326. }
  2327. class SineEase extends EasingFunction implements IEasingFunction {
  2328. easeInCore(gradient: number): number;
  2329. }
  2330. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  2331. x1: number;
  2332. y1: number;
  2333. x2: number;
  2334. y2: number;
  2335. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  2336. easeInCore(gradient: number): number;
  2337. }
  2338. }
  2339. declare module BABYLON {
  2340. class Analyser {
  2341. SMOOTHING: number;
  2342. FFT_SIZE: number;
  2343. BARGRAPHAMPLITUDE: number;
  2344. DEBUGCANVASPOS: {
  2345. x: number;
  2346. y: number;
  2347. };
  2348. DEBUGCANVASSIZE: {
  2349. width: number;
  2350. height: number;
  2351. };
  2352. private _byteFreqs;
  2353. private _byteTime;
  2354. private _floatFreqs;
  2355. private _webAudioAnalyser;
  2356. private _debugCanvas;
  2357. private _debugCanvasContext;
  2358. private _scene;
  2359. private _registerFunc;
  2360. private _audioEngine;
  2361. constructor(scene: Scene);
  2362. getFrequencyBinCount(): number;
  2363. getByteFrequencyData(): Uint8Array;
  2364. getByteTimeDomainData(): Uint8Array;
  2365. getFloatFrequencyData(): Uint8Array;
  2366. drawDebugCanvas(): void;
  2367. stopDebugCanvas(): void;
  2368. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  2369. dispose(): void;
  2370. }
  2371. }
  2372. declare module BABYLON {
  2373. class AudioEngine {
  2374. private _audioContext;
  2375. private _audioContextInitialized;
  2376. canUseWebAudio: boolean;
  2377. masterGain: GainNode;
  2378. private _connectedAnalyser;
  2379. WarnedWebAudioUnsupported: boolean;
  2380. unlocked: boolean;
  2381. onAudioUnlocked: () => any;
  2382. isMP3supported: boolean;
  2383. isOGGsupported: boolean;
  2384. audioContext: AudioContext;
  2385. constructor();
  2386. private _unlockiOSaudio();
  2387. private _initializeAudioContext();
  2388. dispose(): void;
  2389. getGlobalVolume(): number;
  2390. setGlobalVolume(newVolume: number): void;
  2391. connectToAnalyser(analyser: Analyser): void;
  2392. }
  2393. }
  2394. declare module BABYLON {
  2395. class Sound {
  2396. name: string;
  2397. autoplay: boolean;
  2398. loop: boolean;
  2399. useCustomAttenuation: boolean;
  2400. soundTrackId: number;
  2401. spatialSound: boolean;
  2402. refDistance: number;
  2403. rolloffFactor: number;
  2404. maxDistance: number;
  2405. distanceModel: string;
  2406. private _panningModel;
  2407. onended: () => any;
  2408. private _playbackRate;
  2409. private _streaming;
  2410. private _startTime;
  2411. private _startOffset;
  2412. private _position;
  2413. private _localDirection;
  2414. private _volume;
  2415. private _isLoaded;
  2416. private _isReadyToPlay;
  2417. isPlaying: boolean;
  2418. isPaused: boolean;
  2419. private _isDirectional;
  2420. private _readyToPlayCallback;
  2421. private _audioBuffer;
  2422. private _soundSource;
  2423. private _streamingSource;
  2424. private _soundPanner;
  2425. private _soundGain;
  2426. private _inputAudioNode;
  2427. private _ouputAudioNode;
  2428. private _coneInnerAngle;
  2429. private _coneOuterAngle;
  2430. private _coneOuterGain;
  2431. private _scene;
  2432. private _connectedMesh;
  2433. private _customAttenuationFunction;
  2434. private _registerFunc;
  2435. private _isOutputConnected;
  2436. private _htmlAudioElement;
  2437. private _urlType;
  2438. /**
  2439. * Create a sound and attach it to a scene
  2440. * @param name Name of your sound
  2441. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  2442. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  2443. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  2444. */
  2445. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  2446. dispose(): void;
  2447. private _soundLoaded(audioData);
  2448. setAudioBuffer(audioBuffer: AudioBuffer): void;
  2449. updateOptions(options: any): void;
  2450. private _createSpatialParameters();
  2451. private _updateSpatialParameters();
  2452. switchPanningModelToHRTF(): void;
  2453. switchPanningModelToEqualPower(): void;
  2454. private _switchPanningModel();
  2455. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  2456. /**
  2457. * Transform this sound into a directional source
  2458. * @param coneInnerAngle Size of the inner cone in degree
  2459. * @param coneOuterAngle Size of the outer cone in degree
  2460. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  2461. */
  2462. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  2463. setPosition(newPosition: Vector3): void;
  2464. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  2465. private _updateDirection();
  2466. updateDistanceFromListener(): void;
  2467. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  2468. /**
  2469. * Play the sound
  2470. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  2471. * @param offset (optional) Start the sound setting it at a specific time
  2472. */
  2473. play(time?: number, offset?: number): void;
  2474. private _onended();
  2475. /**
  2476. * Stop the sound
  2477. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  2478. */
  2479. stop(time?: number): void;
  2480. pause(): void;
  2481. setVolume(newVolume: number, time?: number): void;
  2482. setPlaybackRate(newPlaybackRate: number): void;
  2483. getVolume(): number;
  2484. attachToMesh(meshToConnectTo: AbstractMesh): void;
  2485. detachFromMesh(): void;
  2486. private _onRegisterAfterWorldMatrixUpdate(connectedMesh);
  2487. clone(): Sound;
  2488. getAudioBuffer(): AudioBuffer;
  2489. serialize(): any;
  2490. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  2491. }
  2492. }
  2493. declare module BABYLON {
  2494. class SoundTrack {
  2495. private _outputAudioNode;
  2496. private _inputAudioNode;
  2497. private _trackConvolver;
  2498. private _scene;
  2499. id: number;
  2500. soundCollection: Array<Sound>;
  2501. private _isMainTrack;
  2502. private _connectedAnalyser;
  2503. private _options;
  2504. private _isInitialized;
  2505. constructor(scene: Scene, options?: any);
  2506. private _initializeSoundTrackAudioGraph();
  2507. dispose(): void;
  2508. AddSound(sound: Sound): void;
  2509. RemoveSound(sound: Sound): void;
  2510. setVolume(newVolume: number): void;
  2511. switchPanningModelToHRTF(): void;
  2512. switchPanningModelToEqualPower(): void;
  2513. connectToAnalyser(analyser: Analyser): void;
  2514. }
  2515. }
  2516. declare module BABYLON {
  2517. class Bone extends Node {
  2518. name: string;
  2519. children: Bone[];
  2520. animations: Animation[];
  2521. length: number;
  2522. private _skeleton;
  2523. _matrix: Matrix;
  2524. private _restPose;
  2525. private _baseMatrix;
  2526. private _worldTransform;
  2527. private _absoluteTransform;
  2528. private _invertedAbsoluteTransform;
  2529. private _parent;
  2530. private _scaleMatrix;
  2531. private _scaleVector;
  2532. private _negateScaleChildren;
  2533. private _scalingDeterminant;
  2534. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
  2535. getParent(): Bone;
  2536. getLocalMatrix(): Matrix;
  2537. getBaseMatrix(): Matrix;
  2538. getRestPose(): Matrix;
  2539. returnToRest(): void;
  2540. getWorldMatrix(): Matrix;
  2541. getInvertedAbsoluteTransform(): Matrix;
  2542. getAbsoluteTransform(): Matrix;
  2543. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  2544. _updateDifferenceMatrix(rootMatrix?: Matrix): void;
  2545. markAsDirty(): void;
  2546. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
  2547. translate(vec: Vector3): void;
  2548. setPosition(position: Vector3): void;
  2549. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  2550. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2551. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2552. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  2553. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  2554. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  2555. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  2556. private _rotateWithMatrix(rmat, space?, mesh?);
  2557. private _getNegativeRotationToRef(rotMatInv, space?, mesh?);
  2558. getScale(): Vector3;
  2559. getScaleToRef(result: Vector3): void;
  2560. getAbsolutePosition(mesh?: AbstractMesh): Vector3;
  2561. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  2562. computeAbsoluteTransforms(): void;
  2563. private _syncScaleVector;
  2564. getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
  2565. getDirectionToRef(localAxis: Vector3, result: Vector3, mesh?: AbstractMesh): void;
  2566. getRotation(mesh: AbstractMesh): Quaternion;
  2567. getRotationToRef(mesh: AbstractMesh, result: Quaternion): void;
  2568. }
  2569. }
  2570. declare module BABYLON {
  2571. class BoneIKController {
  2572. target: AbstractMesh;
  2573. poleTarget: AbstractMesh;
  2574. poleAngle: number;
  2575. mesh: AbstractMesh;
  2576. private _bone1;
  2577. private _bone2;
  2578. private _bone1Length;
  2579. private _bone2Length;
  2580. private _maxAngle;
  2581. private _maxReach;
  2582. private _tmpVec1;
  2583. private _tmpVec2;
  2584. private _tmpVec3;
  2585. private _tmpVec4;
  2586. private _tmpVec5;
  2587. private _tmpMat1;
  2588. private _tmpMat2;
  2589. private _rightHandedSystem;
  2590. maxAngle: number;
  2591. constructor(mesh: AbstractMesh, bone: Bone, target: AbstractMesh, poleTarget: AbstractMesh, poleAngle?: number);
  2592. private _setMaxAngle(ang);
  2593. update(): void;
  2594. }
  2595. }
  2596. declare module BABYLON {
  2597. class BoneLookController {
  2598. target: Vector3;
  2599. mesh: AbstractMesh;
  2600. bone: Bone;
  2601. upAxis: Vector3;
  2602. adjustYaw: number;
  2603. adjustPitch: number;
  2604. adjustRoll: number;
  2605. private _tmpVec1;
  2606. private _tmpVec2;
  2607. private _tmpVec3;
  2608. private _tmpVec4;
  2609. private _tmpMat1;
  2610. private _tmpMat2;
  2611. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, adjustYaw?: number, adjustPitch?: number, adjustRoll?: number);
  2612. update(): void;
  2613. }
  2614. }
  2615. declare module BABYLON {
  2616. class Skeleton {
  2617. name: string;
  2618. id: string;
  2619. bones: Bone[];
  2620. dimensionsAtRest: Vector3;
  2621. needInitialSkinMatrix: boolean;
  2622. private _scene;
  2623. private _isDirty;
  2624. private _transformMatrices;
  2625. private _meshesWithPoseMatrix;
  2626. private _animatables;
  2627. private _identity;
  2628. private _ranges;
  2629. private _lastAbsoluteTransformsUpdateId;
  2630. constructor(name: string, id: string, scene: Scene);
  2631. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  2632. getScene(): Scene;
  2633. /**
  2634. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2635. */
  2636. toString(fullDetails?: boolean): string;
  2637. /**
  2638. * Get bone's index searching by name
  2639. * @param {string} name is bone's name to search for
  2640. * @return {number} Indice of the bone. Returns -1 if not found
  2641. */
  2642. getBoneIndexByName(name: string): number;
  2643. createAnimationRange(name: string, from: number, to: number): void;
  2644. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  2645. getAnimationRange(name: string): AnimationRange;
  2646. /**
  2647. * Returns as an Array, all AnimationRanges defined on this skeleton
  2648. */
  2649. getAnimationRanges(): AnimationRange[];
  2650. /**
  2651. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  2652. */
  2653. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  2654. returnToRest(): void;
  2655. private _getHighestAnimationFrame();
  2656. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  2657. _markAsDirty(): void;
  2658. _registerMeshWithPoseMatrix(mesh: AbstractMesh): void;
  2659. _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void;
  2660. _computeTransformMatrices(targetMatrix: Float32Array, initialSkinMatrix: Matrix): void;
  2661. prepare(): void;
  2662. getAnimatables(): IAnimatable[];
  2663. clone(name: string, id: string): Skeleton;
  2664. enableBlending(blendingSpeed?: number): void;
  2665. dispose(): void;
  2666. serialize(): any;
  2667. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  2668. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  2669. getPoseMatrix(): Matrix;
  2670. }
  2671. }
  2672. declare module BABYLON {
  2673. class ArcRotateCamera extends TargetCamera {
  2674. alpha: number;
  2675. beta: number;
  2676. radius: number;
  2677. target: Vector3;
  2678. inertialAlphaOffset: number;
  2679. inertialBetaOffset: number;
  2680. inertialRadiusOffset: number;
  2681. lowerAlphaLimit: any;
  2682. upperAlphaLimit: any;
  2683. lowerBetaLimit: number;
  2684. upperBetaLimit: number;
  2685. lowerRadiusLimit: any;
  2686. upperRadiusLimit: any;
  2687. inertialPanningX: number;
  2688. inertialPanningY: number;
  2689. angularSensibilityX: number;
  2690. angularSensibilityY: number;
  2691. pinchPrecision: number;
  2692. panningSensibility: number;
  2693. keysUp: number[];
  2694. keysDown: number[];
  2695. keysLeft: number[];
  2696. keysRight: number[];
  2697. wheelPrecision: number;
  2698. zoomOnFactor: number;
  2699. targetScreenOffset: Vector2;
  2700. allowUpsideDown: boolean;
  2701. _viewMatrix: Matrix;
  2702. _useCtrlForPanning: boolean;
  2703. _panningMouseButton: number;
  2704. inputs: ArcRotateCameraInputsManager;
  2705. _reset: () => void;
  2706. panningAxis: Vector3;
  2707. private _localDirection;
  2708. private _transformedDirection;
  2709. onCollide: (collidedMesh: AbstractMesh) => void;
  2710. checkCollisions: boolean;
  2711. collisionRadius: Vector3;
  2712. private _collider;
  2713. private _previousPosition;
  2714. private _collisionVelocity;
  2715. private _newPosition;
  2716. private _previousAlpha;
  2717. private _previousBeta;
  2718. private _previousRadius;
  2719. private _collisionTriggered;
  2720. private _targetBoundingCenter;
  2721. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  2722. _initCache(): void;
  2723. _updateCache(ignoreParentClass?: boolean): void;
  2724. private _getTargetPosition();
  2725. _isSynchronizedViewMatrix(): boolean;
  2726. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  2727. detachControl(element: HTMLElement): void;
  2728. _checkInputs(): void;
  2729. private _checkLimits();
  2730. rebuildAnglesAndRadius(): void;
  2731. setPosition(position: Vector3): void;
  2732. setTarget(target: Vector3, toBoundingCenter?: boolean): void;
  2733. _getViewMatrix(): Matrix;
  2734. private _onCollisionPositionChange;
  2735. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  2736. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  2737. /**
  2738. * @override
  2739. * Override Camera.createRigCamera
  2740. */
  2741. createRigCamera(name: string, cameraIndex: number): Camera;
  2742. /**
  2743. * @override
  2744. * Override Camera._updateRigCameras
  2745. */
  2746. _updateRigCameras(): void;
  2747. dispose(): void;
  2748. getTypeName(): string;
  2749. }
  2750. }
  2751. declare module BABYLON {
  2752. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  2753. constructor(camera: ArcRotateCamera);
  2754. addMouseWheel(): ArcRotateCameraInputsManager;
  2755. addPointers(): ArcRotateCameraInputsManager;
  2756. addKeyboard(): ArcRotateCameraInputsManager;
  2757. addGamepad(): ArcRotateCameraInputsManager;
  2758. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  2759. }
  2760. }
  2761. declare module BABYLON {
  2762. class Camera extends Node {
  2763. inputs: CameraInputsManager<Camera>;
  2764. private static _PERSPECTIVE_CAMERA;
  2765. private static _ORTHOGRAPHIC_CAMERA;
  2766. private static _FOVMODE_VERTICAL_FIXED;
  2767. private static _FOVMODE_HORIZONTAL_FIXED;
  2768. private static _RIG_MODE_NONE;
  2769. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  2770. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  2771. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  2772. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  2773. private static _RIG_MODE_VR;
  2774. private static _RIG_MODE_WEBVR;
  2775. static PERSPECTIVE_CAMERA: number;
  2776. static ORTHOGRAPHIC_CAMERA: number;
  2777. static FOVMODE_VERTICAL_FIXED: number;
  2778. static FOVMODE_HORIZONTAL_FIXED: number;
  2779. static RIG_MODE_NONE: number;
  2780. static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  2781. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  2782. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  2783. static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  2784. static RIG_MODE_VR: number;
  2785. static RIG_MODE_WEBVR: number;
  2786. static ForceAttachControlToAlwaysPreventDefault: boolean;
  2787. position: Vector3;
  2788. upVector: Vector3;
  2789. orthoLeft: any;
  2790. orthoRight: any;
  2791. orthoBottom: any;
  2792. orthoTop: any;
  2793. fov: number;
  2794. minZ: number;
  2795. maxZ: number;
  2796. inertia: number;
  2797. mode: number;
  2798. isIntermediate: boolean;
  2799. viewport: Viewport;
  2800. layerMask: number;
  2801. fovMode: number;
  2802. cameraRigMode: number;
  2803. interaxialDistance: number;
  2804. isStereoscopicSideBySide: boolean;
  2805. _cameraRigParams: any;
  2806. _rigCameras: Camera[];
  2807. _rigPostProcess: PostProcess;
  2808. private _computedViewMatrix;
  2809. _projectionMatrix: Matrix;
  2810. private _doNotComputeProjectionMatrix;
  2811. private _worldMatrix;
  2812. _postProcesses: PostProcess[];
  2813. private _transformMatrix;
  2814. private _webvrViewMatrix;
  2815. _activeMeshes: SmartArray<Mesh>;
  2816. private _globalPosition;
  2817. private _frustumPlanes;
  2818. private _refreshFrustumPlanes;
  2819. constructor(name: string, position: Vector3, scene: Scene);
  2820. /**
  2821. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2822. */
  2823. toString(fullDetails?: boolean): string;
  2824. globalPosition: Vector3;
  2825. getActiveMeshes(): SmartArray<Mesh>;
  2826. isActiveMesh(mesh: Mesh): boolean;
  2827. _initCache(): void;
  2828. _updateCache(ignoreParentClass?: boolean): void;
  2829. _updateFromScene(): void;
  2830. _isSynchronized(): boolean;
  2831. _isSynchronizedViewMatrix(): boolean;
  2832. _isSynchronizedProjectionMatrix(): boolean;
  2833. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2834. detachControl(element: HTMLElement): void;
  2835. update(): void;
  2836. _checkInputs(): void;
  2837. private _cascadePostProcessesToRigCams();
  2838. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  2839. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  2840. getWorldMatrix(): Matrix;
  2841. _getViewMatrix(): Matrix;
  2842. getViewMatrix(force?: boolean): Matrix;
  2843. _computeViewMatrix(force?: boolean): Matrix;
  2844. freezeProjectionMatrix(projection?: Matrix): void;
  2845. unfreezeProjectionMatrix(): void;
  2846. getProjectionMatrix(force?: boolean): Matrix;
  2847. getTranformationMatrix(): Matrix;
  2848. private updateFrustumPlanes();
  2849. isInFrustum(target: ICullable): boolean;
  2850. isCompletelyInFrustum(target: ICullable): boolean;
  2851. dispose(): void;
  2852. setCameraRigMode(mode: number, rigParams: any): void;
  2853. private _getVRProjectionMatrix();
  2854. private _getWebVRProjectionMatrix();
  2855. private _getWebVRViewMatrix();
  2856. setCameraRigParameter(name: string, value: any): void;
  2857. /**
  2858. * needs to be overridden by children so sub has required properties to be copied
  2859. */
  2860. createRigCamera(name: string, cameraIndex: number): Camera;
  2861. /**
  2862. * May need to be overridden by children
  2863. */
  2864. _updateRigCameras(): void;
  2865. _setupInputs(): void;
  2866. serialize(): any;
  2867. getTypeName(): string;
  2868. clone(name: string): Camera;
  2869. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  2870. static Parse(parsedCamera: any, scene: Scene): Camera;
  2871. }
  2872. }
  2873. declare module BABYLON {
  2874. var CameraInputTypes: {};
  2875. interface ICameraInput<TCamera extends BABYLON.Camera> {
  2876. camera: TCamera;
  2877. getTypeName(): string;
  2878. getSimpleName(): string;
  2879. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  2880. detachControl: (element: HTMLElement) => void;
  2881. checkInputs?: () => void;
  2882. }
  2883. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  2884. [name: string]: ICameraInput<TCamera>;
  2885. [idx: number]: ICameraInput<TCamera>;
  2886. }
  2887. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  2888. attached: CameraInputsMap<TCamera>;
  2889. attachedElement: HTMLElement;
  2890. noPreventDefault: boolean;
  2891. camera: TCamera;
  2892. checkInputs: () => void;
  2893. constructor(camera: TCamera);
  2894. add(input: ICameraInput<TCamera>): void;
  2895. remove(inputToRemove: ICameraInput<TCamera>): void;
  2896. removeByType(inputType: string): void;
  2897. private _addCheckInputs(fn);
  2898. attachInput(input: ICameraInput<TCamera>): void;
  2899. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  2900. detachElement(element: HTMLElement): void;
  2901. rebuildInputCheck(): void;
  2902. clear(): void;
  2903. serialize(serializedCamera: any): void;
  2904. parse(parsedCamera: any): void;
  2905. }
  2906. }
  2907. declare module BABYLON {
  2908. class DeviceOrientationCamera extends FreeCamera {
  2909. private _initialQuaternion;
  2910. private _quaternionCache;
  2911. constructor(name: string, position: Vector3, scene: Scene);
  2912. getTypeName(): string;
  2913. _checkInputs(): void;
  2914. resetToCurrentRotation(axis?: Axis): void;
  2915. }
  2916. }
  2917. declare module BABYLON {
  2918. class FollowCamera extends TargetCamera {
  2919. radius: number;
  2920. rotationOffset: number;
  2921. heightOffset: number;
  2922. cameraAcceleration: number;
  2923. maxCameraSpeed: number;
  2924. target: AbstractMesh;
  2925. constructor(name: string, position: Vector3, scene: Scene, target?: AbstractMesh);
  2926. private getRadians(degrees);
  2927. private follow(cameraTarget);
  2928. _checkInputs(): void;
  2929. getTypeName(): string;
  2930. }
  2931. class ArcFollowCamera extends TargetCamera {
  2932. alpha: number;
  2933. beta: number;
  2934. radius: number;
  2935. target: AbstractMesh;
  2936. private _cartesianCoordinates;
  2937. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  2938. private follow();
  2939. _checkInputs(): void;
  2940. getTypeName(): string;
  2941. }
  2942. }
  2943. declare module BABYLON {
  2944. class FreeCamera extends TargetCamera {
  2945. ellipsoid: Vector3;
  2946. checkCollisions: boolean;
  2947. applyGravity: boolean;
  2948. inputs: FreeCameraInputsManager;
  2949. angularSensibility: number;
  2950. keysUp: number[];
  2951. keysDown: number[];
  2952. keysLeft: number[];
  2953. keysRight: number[];
  2954. onCollide: (collidedMesh: AbstractMesh) => void;
  2955. private _collider;
  2956. private _needMoveForGravity;
  2957. private _oldPosition;
  2958. private _diffPosition;
  2959. private _newPosition;
  2960. _localDirection: Vector3;
  2961. _transformedDirection: Vector3;
  2962. constructor(name: string, position: Vector3, scene: Scene);
  2963. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2964. detachControl(element: HTMLElement): void;
  2965. _collideWithWorld(velocity: Vector3): void;
  2966. private _onCollisionPositionChange;
  2967. _checkInputs(): void;
  2968. _decideIfNeedsToMove(): boolean;
  2969. _updatePosition(): void;
  2970. dispose(): void;
  2971. getTypeName(): string;
  2972. }
  2973. }
  2974. declare module BABYLON {
  2975. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  2976. constructor(camera: FreeCamera);
  2977. addKeyboard(): FreeCameraInputsManager;
  2978. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  2979. addGamepad(): FreeCameraInputsManager;
  2980. addDeviceOrientation(): FreeCameraInputsManager;
  2981. addTouch(): FreeCameraInputsManager;
  2982. addVirtualJoystick(): FreeCameraInputsManager;
  2983. }
  2984. }
  2985. declare module BABYLON {
  2986. class GamepadCamera extends UniversalCamera {
  2987. gamepadAngularSensibility: number;
  2988. gamepadMoveSensibility: number;
  2989. constructor(name: string, position: Vector3, scene: Scene);
  2990. getTypeName(): string;
  2991. }
  2992. }
  2993. declare module BABYLON {
  2994. class AnaglyphFreeCamera extends FreeCamera {
  2995. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  2996. getTypeName(): string;
  2997. }
  2998. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  2999. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  3000. getTypeName(): string;
  3001. }
  3002. class AnaglyphGamepadCamera extends GamepadCamera {
  3003. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3004. getTypeName(): string;
  3005. }
  3006. class AnaglyphUniversalCamera extends UniversalCamera {
  3007. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3008. getTypeName(): string;
  3009. }
  3010. class StereoscopicFreeCamera extends FreeCamera {
  3011. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3012. getTypeName(): string;
  3013. }
  3014. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  3015. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3016. getTypeName(): string;
  3017. }
  3018. class StereoscopicGamepadCamera extends GamepadCamera {
  3019. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3020. getTypeName(): string;
  3021. }
  3022. class StereoscopicUniversalCamera extends UniversalCamera {
  3023. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3024. getTypeName(): string;
  3025. }
  3026. }
  3027. declare module BABYLON {
  3028. class TargetCamera extends Camera {
  3029. cameraDirection: Vector3;
  3030. cameraRotation: Vector2;
  3031. rotation: Vector3;
  3032. rotationQuaternion: Quaternion;
  3033. speed: number;
  3034. noRotationConstraint: boolean;
  3035. lockedTarget: any;
  3036. _currentTarget: Vector3;
  3037. _viewMatrix: Matrix;
  3038. _camMatrix: Matrix;
  3039. _cameraTransformMatrix: Matrix;
  3040. _cameraRotationMatrix: Matrix;
  3041. private _rigCamTransformMatrix;
  3042. _referencePoint: Vector3;
  3043. private _defaultUpVector;
  3044. _transformedReferencePoint: Vector3;
  3045. _lookAtTemp: Matrix;
  3046. _tempMatrix: Matrix;
  3047. _reset: () => void;
  3048. constructor(name: string, position: Vector3, scene: Scene);
  3049. getFrontPosition(distance: number): Vector3;
  3050. _getLockedTargetPosition(): Vector3;
  3051. _initCache(): void;
  3052. _updateCache(ignoreParentClass?: boolean): void;
  3053. _isSynchronizedViewMatrix(): boolean;
  3054. _computeLocalCameraSpeed(): number;
  3055. setTarget(target: Vector3): void;
  3056. getTarget(): Vector3;
  3057. _decideIfNeedsToMove(): boolean;
  3058. _updatePosition(): void;
  3059. _checkInputs(): void;
  3060. private _updateCameraRotationMatrix();
  3061. _getViewMatrix(): Matrix;
  3062. /**
  3063. * @override
  3064. * Override Camera.createRigCamera
  3065. */
  3066. createRigCamera(name: string, cameraIndex: number): Camera;
  3067. /**
  3068. * @override
  3069. * Override Camera._updateRigCameras
  3070. */
  3071. _updateRigCameras(): void;
  3072. private _getRigCamPosition(halfSpace, result);
  3073. getTypeName(): string;
  3074. }
  3075. }
  3076. declare module BABYLON {
  3077. class TouchCamera extends FreeCamera {
  3078. touchAngularSensibility: number;
  3079. touchMoveSensibility: number;
  3080. constructor(name: string, position: Vector3, scene: Scene);
  3081. getTypeName(): string;
  3082. _setupInputs(): void;
  3083. }
  3084. }
  3085. declare module BABYLON {
  3086. class UniversalCamera extends TouchCamera {
  3087. gamepadAngularSensibility: number;
  3088. gamepadMoveSensibility: number;
  3089. constructor(name: string, position: Vector3, scene: Scene);
  3090. getTypeName(): string;
  3091. }
  3092. }
  3093. declare module BABYLON {
  3094. class VirtualJoysticksCamera extends FreeCamera {
  3095. constructor(name: string, position: Vector3, scene: Scene);
  3096. }
  3097. }
  3098. declare module BABYLON {
  3099. class Collider {
  3100. radius: Vector3;
  3101. retry: number;
  3102. velocity: Vector3;
  3103. basePoint: Vector3;
  3104. epsilon: number;
  3105. collisionFound: boolean;
  3106. velocityWorldLength: number;
  3107. basePointWorld: Vector3;
  3108. velocityWorld: Vector3;
  3109. normalizedVelocity: Vector3;
  3110. initialVelocity: Vector3;
  3111. initialPosition: Vector3;
  3112. nearestDistance: number;
  3113. intersectionPoint: Vector3;
  3114. collidedMesh: AbstractMesh;
  3115. private _collisionPoint;
  3116. private _planeIntersectionPoint;
  3117. private _tempVector;
  3118. private _tempVector2;
  3119. private _tempVector3;
  3120. private _tempVector4;
  3121. private _edge;
  3122. private _baseToVertex;
  3123. private _destinationPoint;
  3124. private _slidePlaneNormal;
  3125. private _displacementVector;
  3126. _initialize(source: Vector3, dir: Vector3, e: number): void;
  3127. _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  3128. _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  3129. _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
  3130. _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: number[] | Int32Array, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
  3131. _getResponse(pos: Vector3, vel: Vector3): void;
  3132. }
  3133. }
  3134. declare module BABYLON {
  3135. var CollisionWorker: string;
  3136. interface ICollisionCoordinator {
  3137. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3138. init(scene: Scene): void;
  3139. destroy(): void;
  3140. onMeshAdded(mesh: AbstractMesh): any;
  3141. onMeshUpdated(mesh: AbstractMesh): any;
  3142. onMeshRemoved(mesh: AbstractMesh): any;
  3143. onGeometryAdded(geometry: Geometry): any;
  3144. onGeometryUpdated(geometry: Geometry): any;
  3145. onGeometryDeleted(geometry: Geometry): any;
  3146. }
  3147. interface SerializedMesh {
  3148. id: string;
  3149. name: string;
  3150. uniqueId: number;
  3151. geometryId: string;
  3152. sphereCenter: Array<number>;
  3153. sphereRadius: number;
  3154. boxMinimum: Array<number>;
  3155. boxMaximum: Array<number>;
  3156. worldMatrixFromCache: any;
  3157. subMeshes: Array<SerializedSubMesh>;
  3158. checkCollisions: boolean;
  3159. }
  3160. interface SerializedSubMesh {
  3161. position: number;
  3162. verticesStart: number;
  3163. verticesCount: number;
  3164. indexStart: number;
  3165. indexCount: number;
  3166. hasMaterial: boolean;
  3167. sphereCenter: Array<number>;
  3168. sphereRadius: number;
  3169. boxMinimum: Array<number>;
  3170. boxMaximum: Array<number>;
  3171. }
  3172. interface SerializedGeometry {
  3173. id: string;
  3174. positions: Float32Array;
  3175. indices: Int32Array;
  3176. normals: Float32Array;
  3177. }
  3178. interface BabylonMessage {
  3179. taskType: WorkerTaskType;
  3180. payload: InitPayload | CollidePayload | UpdatePayload;
  3181. }
  3182. interface SerializedColliderToWorker {
  3183. position: Array<number>;
  3184. velocity: Array<number>;
  3185. radius: Array<number>;
  3186. }
  3187. enum WorkerTaskType {
  3188. INIT = 0,
  3189. UPDATE = 1,
  3190. COLLIDE = 2,
  3191. }
  3192. interface WorkerReply {
  3193. error: WorkerReplyType;
  3194. taskType: WorkerTaskType;
  3195. payload?: any;
  3196. }
  3197. interface CollisionReplyPayload {
  3198. newPosition: Array<number>;
  3199. collisionId: number;
  3200. collidedMeshUniqueId: number;
  3201. }
  3202. interface InitPayload {
  3203. }
  3204. interface CollidePayload {
  3205. collisionId: number;
  3206. collider: SerializedColliderToWorker;
  3207. maximumRetry: number;
  3208. excludedMeshUniqueId?: number;
  3209. }
  3210. interface UpdatePayload {
  3211. updatedMeshes: {
  3212. [n: number]: SerializedMesh;
  3213. };
  3214. updatedGeometries: {
  3215. [s: string]: SerializedGeometry;
  3216. };
  3217. removedMeshes: Array<number>;
  3218. removedGeometries: Array<string>;
  3219. }
  3220. enum WorkerReplyType {
  3221. SUCCESS = 0,
  3222. UNKNOWN_ERROR = 1,
  3223. }
  3224. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  3225. private _scene;
  3226. private _scaledPosition;
  3227. private _scaledVelocity;
  3228. private _collisionsCallbackArray;
  3229. private _init;
  3230. private _runningUpdated;
  3231. private _runningCollisionTask;
  3232. private _worker;
  3233. private _addUpdateMeshesList;
  3234. private _addUpdateGeometriesList;
  3235. private _toRemoveMeshesArray;
  3236. private _toRemoveGeometryArray;
  3237. constructor();
  3238. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  3239. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  3240. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3241. init(scene: Scene): void;
  3242. destroy(): void;
  3243. onMeshAdded(mesh: AbstractMesh): void;
  3244. onMeshUpdated: (mesh: AbstractMesh) => void;
  3245. onMeshRemoved(mesh: AbstractMesh): void;
  3246. onGeometryAdded(geometry: Geometry): void;
  3247. onGeometryUpdated: (geometry: Geometry) => void;
  3248. onGeometryDeleted(geometry: Geometry): void;
  3249. private _afterRender;
  3250. private _onMessageFromWorker;
  3251. }
  3252. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  3253. private _scene;
  3254. private _scaledPosition;
  3255. private _scaledVelocity;
  3256. private _finalPosition;
  3257. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  3258. init(scene: Scene): void;
  3259. destroy(): void;
  3260. onMeshAdded(mesh: AbstractMesh): void;
  3261. onMeshUpdated(mesh: AbstractMesh): void;
  3262. onMeshRemoved(mesh: AbstractMesh): void;
  3263. onGeometryAdded(geometry: Geometry): void;
  3264. onGeometryUpdated(geometry: Geometry): void;
  3265. onGeometryDeleted(geometry: Geometry): void;
  3266. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  3267. }
  3268. }
  3269. declare module BABYLON {
  3270. var WorkerIncluded: boolean;
  3271. class CollisionCache {
  3272. private _meshes;
  3273. private _geometries;
  3274. getMeshes(): {
  3275. [n: number]: SerializedMesh;
  3276. };
  3277. getGeometries(): {
  3278. [s: number]: SerializedGeometry;
  3279. };
  3280. getMesh(id: any): SerializedMesh;
  3281. addMesh(mesh: SerializedMesh): void;
  3282. removeMesh(uniqueId: number): void;
  3283. getGeometry(id: string): SerializedGeometry;
  3284. addGeometry(geometry: SerializedGeometry): void;
  3285. removeGeometry(id: string): void;
  3286. }
  3287. class CollideWorker {
  3288. collider: Collider;
  3289. private _collisionCache;
  3290. private finalPosition;
  3291. private collisionsScalingMatrix;
  3292. private collisionTranformationMatrix;
  3293. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  3294. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  3295. private checkCollision(mesh);
  3296. private processCollisionsForSubMeshes(transformMatrix, mesh);
  3297. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  3298. private checkSubmeshCollision(subMesh);
  3299. }
  3300. interface ICollisionDetector {
  3301. onInit(payload: InitPayload): void;
  3302. onUpdate(payload: UpdatePayload): void;
  3303. onCollision(payload: CollidePayload): void;
  3304. }
  3305. class CollisionDetectorTransferable implements ICollisionDetector {
  3306. private _collisionCache;
  3307. onInit(payload: InitPayload): void;
  3308. onUpdate(payload: UpdatePayload): void;
  3309. onCollision(payload: CollidePayload): void;
  3310. }
  3311. }
  3312. declare module BABYLON {
  3313. class IntersectionInfo {
  3314. bu: number;
  3315. bv: number;
  3316. distance: number;
  3317. faceId: number;
  3318. subMeshId: number;
  3319. constructor(bu: number, bv: number, distance: number);
  3320. }
  3321. class PickingInfo {
  3322. hit: boolean;
  3323. distance: number;
  3324. pickedPoint: Vector3;
  3325. pickedMesh: AbstractMesh;
  3326. bu: number;
  3327. bv: number;
  3328. faceId: number;
  3329. subMeshId: number;
  3330. pickedSprite: Sprite;
  3331. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  3332. getTextureCoordinates(): Vector2;
  3333. }
  3334. }
  3335. declare module BABYLON {
  3336. class BoundingBox implements ICullable {
  3337. minimum: Vector3;
  3338. maximum: Vector3;
  3339. vectors: Vector3[];
  3340. center: Vector3;
  3341. extendSize: Vector3;
  3342. directions: Vector3[];
  3343. vectorsWorld: Vector3[];
  3344. minimumWorld: Vector3;
  3345. maximumWorld: Vector3;
  3346. private _worldMatrix;
  3347. constructor(minimum: Vector3, maximum: Vector3);
  3348. getWorldMatrix(): Matrix;
  3349. setWorldMatrix(matrix: Matrix): BoundingBox;
  3350. _update(world: Matrix): void;
  3351. isInFrustum(frustumPlanes: Plane[]): boolean;
  3352. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3353. intersectsPoint(point: Vector3): boolean;
  3354. intersectsSphere(sphere: BoundingSphere): boolean;
  3355. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  3356. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  3357. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  3358. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3359. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  3360. }
  3361. }
  3362. declare module BABYLON {
  3363. interface ICullable {
  3364. isInFrustum(frustumPlanes: Plane[]): boolean;
  3365. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3366. }
  3367. class BoundingInfo implements ICullable {
  3368. minimum: Vector3;
  3369. maximum: Vector3;
  3370. boundingBox: BoundingBox;
  3371. boundingSphere: BoundingSphere;
  3372. private _isLocked;
  3373. constructor(minimum: Vector3, maximum: Vector3);
  3374. isLocked: boolean;
  3375. update(world: Matrix): void;
  3376. isInFrustum(frustumPlanes: Plane[]): boolean;
  3377. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  3378. _checkCollision(collider: Collider): boolean;
  3379. intersectsPoint(point: Vector3): boolean;
  3380. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  3381. }
  3382. }
  3383. declare module BABYLON {
  3384. class BoundingSphere {
  3385. minimum: Vector3;
  3386. maximum: Vector3;
  3387. center: Vector3;
  3388. radius: number;
  3389. centerWorld: Vector3;
  3390. radiusWorld: number;
  3391. private _tempRadiusVector;
  3392. constructor(minimum: Vector3, maximum: Vector3);
  3393. _update(world: Matrix): void;
  3394. isInFrustum(frustumPlanes: Plane[]): boolean;
  3395. intersectsPoint(point: Vector3): boolean;
  3396. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  3397. }
  3398. }
  3399. declare module BABYLON {
  3400. class Ray {
  3401. origin: Vector3;
  3402. direction: Vector3;
  3403. length: number;
  3404. private _edge1;
  3405. private _edge2;
  3406. private _pvec;
  3407. private _tvec;
  3408. private _qvec;
  3409. constructor(origin: Vector3, direction: Vector3, length?: number);
  3410. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  3411. intersectsBox(box: BoundingBox): boolean;
  3412. intersectsSphere(sphere: BoundingSphere): boolean;
  3413. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  3414. intersectsPlane(plane: Plane): number;
  3415. private static smallnum;
  3416. private static rayl;
  3417. /**
  3418. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  3419. * @param sega the first point of the segment to test the intersection against
  3420. * @param segb the second point of the segment to test the intersection against
  3421. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  3422. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  3423. */
  3424. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  3425. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  3426. /**
  3427. * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
  3428. * transformed to the given world matrix.
  3429. * @param origin The origin point
  3430. * @param end The end point
  3431. * @param world a matrix to transform the ray to. Default is the identity matrix.
  3432. */
  3433. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  3434. static Transform(ray: Ray, matrix: Matrix): Ray;
  3435. }
  3436. }
  3437. declare module BABYLON {
  3438. class DebugLayer {
  3439. private _scene;
  3440. private _camera;
  3441. private _transformationMatrix;
  3442. private _enabled;
  3443. private _labelsEnabled;
  3444. private _displayStatistics;
  3445. private _displayTree;
  3446. private _displayLogs;
  3447. private _globalDiv;
  3448. private _statsDiv;
  3449. private _statsSubsetDiv;
  3450. private _optionsDiv;
  3451. private _optionsSubsetDiv;
  3452. private _logDiv;
  3453. private _logSubsetDiv;
  3454. private _treeDiv;
  3455. private _treeSubsetDiv;
  3456. private _drawingCanvas;
  3457. private _drawingContext;
  3458. private _rootElement;
  3459. private _skeletonViewers;
  3460. _syncPositions: () => void;
  3461. private _syncData;
  3462. private _syncUI;
  3463. private _onCanvasClick;
  3464. private _clickPosition;
  3465. private _ratio;
  3466. private _identityMatrix;
  3467. private _showUI;
  3468. private _needToRefreshMeshesTree;
  3469. shouldDisplayLabel: (node: Node) => boolean;
  3470. shouldDisplayAxis: (mesh: Mesh) => boolean;
  3471. axisRatio: number;
  3472. accentColor: string;
  3473. customStatsFunction: () => string;
  3474. constructor(scene: Scene);
  3475. private _refreshMeshesTreeContent();
  3476. private _renderSingleAxis(zero, unit, unitText, label, color);
  3477. private _renderAxis(projectedPosition, mesh, globalViewport);
  3478. private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle);
  3479. private _isClickInsideRect(x, y, width, height);
  3480. isVisible(): boolean;
  3481. hide(): void;
  3482. private _clearSkeletonViewers();
  3483. show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void;
  3484. private _clearLabels();
  3485. private _generateheader(root, text);
  3486. private _generateTexBox(root, title, color);
  3487. private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?);
  3488. private _generateCheckBox(root, title, initialState, task, tag?);
  3489. private _generateButton(root, title, task, tag?);
  3490. private _generateRadio(root, title, name, initialState, task, tag?);
  3491. private _generateDOMelements();
  3492. private _displayStats();
  3493. }
  3494. }
  3495. declare module BABYLON.Debug {
  3496. /**
  3497. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  3498. */
  3499. class SkeletonViewer {
  3500. skeleton: Skeleton;
  3501. mesh: AbstractMesh;
  3502. autoUpdateBonesMatrices: boolean;
  3503. renderingGroupId: number;
  3504. color: Color3;
  3505. private _scene;
  3506. private _debugLines;
  3507. private _debugMesh;
  3508. private _isEnabled;
  3509. private _renderFunction;
  3510. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  3511. isEnabled: boolean;
  3512. private _getBonePosition(position, bone, meshMat, x?, y?, z?);
  3513. private _getLinesForBonesWithLength(bones, meshMat);
  3514. private _getLinesForBonesNoLength(bones, meshMat);
  3515. update(): void;
  3516. dispose(): void;
  3517. }
  3518. }
  3519. declare module BABYLON {
  3520. /**
  3521. * Highlight layer options. This helps customizing the behaviour
  3522. * of the highlight layer.
  3523. */
  3524. interface IHighlightLayerOptions {
  3525. /**
  3526. * Multiplication factor apply to the canvas size to compute the render target size
  3527. * used to generated the glowing objects (the smaller the faster).
  3528. */
  3529. mainTextureRatio?: number;
  3530. /**
  3531. * Enforces a fixed size texture to ensure resize independant blur.
  3532. */
  3533. mainTextureFixedSize?: number;
  3534. /**
  3535. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  3536. * of the picture to blur (the smaller the faster).
  3537. */
  3538. blurTextureSizeRatio?: number;
  3539. /**
  3540. * How big in texel of the blur texture is the vertical blur.
  3541. */
  3542. blurVerticalSize?: number;
  3543. /**
  3544. * How big in texel of the blur texture is the horizontal blur.
  3545. */
  3546. blurHorizontalSize?: number;
  3547. /**
  3548. * Alpha blending mode used to apply the blur. Default is combine.
  3549. */
  3550. alphaBlendingMode?: number;
  3551. /**
  3552. * The camera attached to the layer.
  3553. */
  3554. camera?: Camera;
  3555. }
  3556. /**
  3557. * The highlight layer Helps adding a glow effect around a mesh.
  3558. *
  3559. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  3560. * glowy meshes to your scene.
  3561. *
  3562. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  3563. */
  3564. class HighlightLayer {
  3565. /**
  3566. * The neutral color used during the preparation of the glow effect.
  3567. * This is black by default as the blend operation is a blend operation.
  3568. */
  3569. static neutralColor: Color4;
  3570. /**
  3571. * Stencil value used for glowing meshes.
  3572. */
  3573. static glowingMeshStencilReference: number;
  3574. /**
  3575. * Stencil value used for the other meshes in the scene.
  3576. */
  3577. static normalMeshStencilReference: number;
  3578. private _scene;
  3579. private _engine;
  3580. private _options;
  3581. private _vertexBuffers;
  3582. private _indexBuffer;
  3583. private _downSamplePostprocess;
  3584. private _horizontalBlurPostprocess;
  3585. private _verticalBlurPostprocess;
  3586. private _cachedDefines;
  3587. private _glowMapGenerationEffect;
  3588. private _glowMapMergeEffect;
  3589. private _blurTexture;
  3590. private _mainTexture;
  3591. private _mainTextureDesiredSize;
  3592. private _meshes;
  3593. private _maxSize;
  3594. private _shouldRender;
  3595. private _instanceGlowingMeshStencilReference;
  3596. private _excludedMeshes;
  3597. /**
  3598. * Specifies whether or not the inner glow is ACTIVE in the layer.
  3599. */
  3600. innerGlow: boolean;
  3601. /**
  3602. * Specifies whether or not the outer glow is ACTIVE in the layer.
  3603. */
  3604. outerGlow: boolean;
  3605. /**
  3606. * Specifies wether the highlight layer is enabled or not.
  3607. */
  3608. isEnabled: boolean;
  3609. /**
  3610. * Gets the horizontal size of the blur.
  3611. */
  3612. /**
  3613. * Specifies the horizontal size of the blur.
  3614. */
  3615. blurHorizontalSize: number;
  3616. /**
  3617. * Gets the vertical size of the blur.
  3618. */
  3619. /**
  3620. * Specifies the vertical size of the blur.
  3621. */
  3622. blurVerticalSize: number;
  3623. /**
  3624. * Gets the camera attached to the layer.
  3625. */
  3626. camera: Camera;
  3627. /**
  3628. * An event triggered when the highlight layer has been disposed.
  3629. * @type {BABYLON.Observable}
  3630. */
  3631. onDisposeObservable: Observable<HighlightLayer>;
  3632. /**
  3633. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  3634. * @type {BABYLON.Observable}
  3635. */
  3636. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  3637. /**
  3638. * An event triggered when the highlight layer is being blurred.
  3639. * @type {BABYLON.Observable}
  3640. */
  3641. onBeforeBlurObservable: Observable<HighlightLayer>;
  3642. /**
  3643. * An event triggered when the highlight layer has been blurred.
  3644. * @type {BABYLON.Observable}
  3645. */
  3646. onAfterBlurObservable: Observable<HighlightLayer>;
  3647. /**
  3648. * An event triggered when the glowing blurred texture is being merged in the scene.
  3649. * @type {BABYLON.Observable}
  3650. */
  3651. onBeforeComposeObservable: Observable<HighlightLayer>;
  3652. /**
  3653. * An event triggered when the glowing blurred texture has been merged in the scene.
  3654. * @type {BABYLON.Observable}
  3655. */
  3656. onAfterComposeObservable: Observable<HighlightLayer>;
  3657. /**
  3658. * An event triggered when the highlight layer changes its size.
  3659. * @type {BABYLON.Observable}
  3660. */
  3661. onSizeChangedObservable: Observable<HighlightLayer>;
  3662. /**
  3663. * Instantiates a new highlight Layer and references it to the scene..
  3664. * @param name The name of the layer
  3665. * @param scene The scene to use the layer in
  3666. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  3667. */
  3668. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  3669. /**
  3670. * Creates the render target textures and post processes used in the highlight layer.
  3671. */
  3672. private createTextureAndPostProcesses();
  3673. /**
  3674. * Checks for the readiness of the element composing the layer.
  3675. * @param subMesh the mesh to check for
  3676. * @param useInstances specify wether or not to use instances to render the mesh
  3677. * @param emissiveTexture the associated emissive texture used to generate the glow
  3678. * @return true if ready otherwise, false
  3679. */
  3680. private isReady(subMesh, useInstances, emissiveTexture);
  3681. /**
  3682. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  3683. */
  3684. render(): void;
  3685. /**
  3686. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  3687. * @param mesh The mesh to exclude from the highlight layer
  3688. */
  3689. addExcludedMesh(mesh: Mesh): void;
  3690. /**
  3691. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  3692. * @param mesh The mesh to highlight
  3693. */
  3694. removeExcludedMesh(mesh: Mesh): void;
  3695. /**
  3696. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  3697. * @param mesh The mesh to highlight
  3698. * @param color The color of the highlight
  3699. * @param glowEmissiveOnly Extract the glow from the emissive texture
  3700. */
  3701. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  3702. /**
  3703. * Remove a mesh from the highlight layer in order to make it stop glowing.
  3704. * @param mesh The mesh to highlight
  3705. */
  3706. removeMesh(mesh: Mesh): void;
  3707. /**
  3708. * Returns true if the layer contains information to display, otherwise false.
  3709. */
  3710. shouldRender(): boolean;
  3711. /**
  3712. * Sets the main texture desired size which is the closest power of two
  3713. * of the engine canvas size.
  3714. */
  3715. private setMainTextureSize();
  3716. /**
  3717. * Force the stencil to the normal expected value for none glowing parts
  3718. */
  3719. private defaultStencilReference(mesh);
  3720. /**
  3721. * Dispose only the render target textures and post process.
  3722. */
  3723. private disposeTextureAndPostProcesses();
  3724. /**
  3725. * Dispose the highlight layer and free resources.
  3726. */
  3727. dispose(): void;
  3728. }
  3729. }
  3730. declare module BABYLON {
  3731. class Layer {
  3732. name: string;
  3733. texture: Texture;
  3734. isBackground: boolean;
  3735. color: Color4;
  3736. scale: Vector2;
  3737. offset: Vector2;
  3738. alphaBlendingMode: number;
  3739. alphaTest: boolean;
  3740. private _scene;
  3741. private _vertexBuffers;
  3742. private _indexBuffer;
  3743. private _effect;
  3744. private _alphaTestEffect;
  3745. /**
  3746. * An event triggered when the layer is disposed.
  3747. * @type {BABYLON.Observable}
  3748. */
  3749. onDisposeObservable: Observable<Layer>;
  3750. private _onDisposeObserver;
  3751. onDispose: () => void;
  3752. /**
  3753. * An event triggered before rendering the scene
  3754. * @type {BABYLON.Observable}
  3755. */
  3756. onBeforeRenderObservable: Observable<Layer>;
  3757. private _onBeforeRenderObserver;
  3758. onBeforeRender: () => void;
  3759. /**
  3760. * An event triggered after rendering the scene
  3761. * @type {BABYLON.Observable}
  3762. */
  3763. onAfterRenderObservable: Observable<Layer>;
  3764. private _onAfterRenderObserver;
  3765. onAfterRender: () => void;
  3766. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  3767. render(): void;
  3768. dispose(): void;
  3769. }
  3770. }
  3771. declare module BABYLON {
  3772. class LensFlare {
  3773. size: number;
  3774. position: number;
  3775. color: Color3;
  3776. texture: Texture;
  3777. alphaMode: number;
  3778. private _system;
  3779. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  3780. dispose: () => void;
  3781. }
  3782. }
  3783. declare module BABYLON {
  3784. class LensFlareSystem {
  3785. name: string;
  3786. lensFlares: LensFlare[];
  3787. borderLimit: number;
  3788. viewportBorder: number;
  3789. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  3790. layerMask: number;
  3791. id: string;
  3792. private _scene;
  3793. private _emitter;
  3794. private _vertexBuffers;
  3795. private _indexBuffer;
  3796. private _effect;
  3797. private _positionX;
  3798. private _positionY;
  3799. private _isEnabled;
  3800. constructor(name: string, emitter: any, scene: Scene);
  3801. isEnabled: boolean;
  3802. getScene(): Scene;
  3803. getEmitter(): any;
  3804. setEmitter(newEmitter: any): void;
  3805. getEmitterPosition(): Vector3;
  3806. computeEffectivePosition(globalViewport: Viewport): boolean;
  3807. _isVisible(): boolean;
  3808. render(): boolean;
  3809. dispose(): void;
  3810. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  3811. serialize(): any;
  3812. }
  3813. }
  3814. declare module BABYLON {
  3815. class DirectionalLight extends Light implements IShadowLight {
  3816. position: Vector3;
  3817. direction: Vector3;
  3818. private _transformedDirection;
  3819. transformedPosition: Vector3;
  3820. private _worldMatrix;
  3821. shadowOrthoScale: number;
  3822. autoUpdateExtends: boolean;
  3823. private _orthoLeft;
  3824. private _orthoRight;
  3825. private _orthoTop;
  3826. private _orthoBottom;
  3827. constructor(name: string, direction: Vector3, scene: Scene);
  3828. getAbsolutePosition(): Vector3;
  3829. setDirectionToTarget(target: Vector3): Vector3;
  3830. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3831. supportsVSM(): boolean;
  3832. needRefreshPerFrame(): boolean;
  3833. needCube(): boolean;
  3834. getShadowDirection(faceIndex?: number): Vector3;
  3835. computeTransformedPosition(): boolean;
  3836. transferToEffect(effect: Effect, directionUniformName: string): void;
  3837. _getWorldMatrix(): Matrix;
  3838. getTypeID(): number;
  3839. }
  3840. }
  3841. declare module BABYLON {
  3842. class HemisphericLight extends Light {
  3843. groundColor: Color3;
  3844. direction: Vector3;
  3845. private _worldMatrix;
  3846. constructor(name: string, direction: Vector3, scene: Scene);
  3847. setDirectionToTarget(target: Vector3): Vector3;
  3848. getShadowGenerator(): ShadowGenerator;
  3849. transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  3850. _getWorldMatrix(): Matrix;
  3851. getTypeID(): number;
  3852. }
  3853. }
  3854. declare module BABYLON {
  3855. interface IShadowLight {
  3856. id: string;
  3857. position: Vector3;
  3858. transformedPosition: Vector3;
  3859. name: string;
  3860. computeTransformedPosition(): boolean;
  3861. getScene(): Scene;
  3862. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3863. supportsVSM(): boolean;
  3864. needRefreshPerFrame(): boolean;
  3865. needCube(): boolean;
  3866. getShadowDirection(faceIndex?: number): Vector3;
  3867. _shadowGenerator: IShadowGenerator;
  3868. }
  3869. class Light extends Node {
  3870. private static _LIGHTMAP_DEFAULT;
  3871. private static _LIGHTMAP_SPECULAR;
  3872. private static _LIGHTMAP_SHADOWSONLY;
  3873. /**
  3874. * If every light affecting the material is in this lightmapMode,
  3875. * material.lightmapTexture adds or multiplies
  3876. * (depends on material.useLightmapAsShadowmap)
  3877. * after every other light calculations.
  3878. */
  3879. static LIGHTMAP_DEFAULT: number;
  3880. /**
  3881. * material.lightmapTexture as only diffuse lighting from this light
  3882. * adds pnly specular lighting from this light
  3883. * adds dynamic shadows
  3884. */
  3885. static LIGHTMAP_SPECULAR: number;
  3886. /**
  3887. * material.lightmapTexture as only lighting
  3888. * no light calculation from this light
  3889. * only adds dynamic shadows from this light
  3890. */
  3891. static LIGHTMAP_SHADOWSONLY: number;
  3892. diffuse: Color3;
  3893. specular: Color3;
  3894. intensity: number;
  3895. range: number;
  3896. includeOnlyWithLayerMask: number;
  3897. includedOnlyMeshes: AbstractMesh[];
  3898. excludedMeshes: AbstractMesh[];
  3899. excludeWithLayerMask: number;
  3900. lightmapMode: number;
  3901. radius: number;
  3902. _shadowGenerator: IShadowGenerator;
  3903. private _parentedWorldMatrix;
  3904. _excludedMeshesIds: string[];
  3905. _includedOnlyMeshesIds: string[];
  3906. constructor(name: string, scene: Scene);
  3907. /**
  3908. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3909. */
  3910. toString(fullDetails?: boolean): string;
  3911. getShadowGenerator(): IShadowGenerator;
  3912. getAbsolutePosition(): Vector3;
  3913. transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  3914. _getWorldMatrix(): Matrix;
  3915. canAffectMesh(mesh: AbstractMesh): boolean;
  3916. getWorldMatrix(): Matrix;
  3917. dispose(): void;
  3918. getTypeID(): number;
  3919. clone(name: string): Light;
  3920. serialize(): any;
  3921. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  3922. static Parse(parsedLight: any, scene: Scene): Light;
  3923. }
  3924. }
  3925. declare module BABYLON {
  3926. class PointLight extends Light implements IShadowLight {
  3927. private _worldMatrix;
  3928. transformedPosition: Vector3;
  3929. position: Vector3;
  3930. constructor(name: string, position: Vector3, scene: Scene);
  3931. getAbsolutePosition(): Vector3;
  3932. computeTransformedPosition(): boolean;
  3933. transferToEffect(effect: Effect, positionUniformName: string): void;
  3934. needCube(): boolean;
  3935. supportsVSM(): boolean;
  3936. needRefreshPerFrame(): boolean;
  3937. getShadowDirection(faceIndex?: number): Vector3;
  3938. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3939. _getWorldMatrix(): Matrix;
  3940. getTypeID(): number;
  3941. }
  3942. }
  3943. declare module BABYLON {
  3944. class SpotLight extends Light implements IShadowLight {
  3945. position: Vector3;
  3946. direction: Vector3;
  3947. angle: number;
  3948. exponent: number;
  3949. transformedPosition: Vector3;
  3950. private _transformedDirection;
  3951. private _worldMatrix;
  3952. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  3953. getAbsolutePosition(): Vector3;
  3954. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3955. needCube(): boolean;
  3956. supportsVSM(): boolean;
  3957. needRefreshPerFrame(): boolean;
  3958. getShadowDirection(faceIndex?: number): Vector3;
  3959. setDirectionToTarget(target: Vector3): Vector3;
  3960. computeTransformedPosition(): boolean;
  3961. transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  3962. _getWorldMatrix(): Matrix;
  3963. getTypeID(): number;
  3964. }
  3965. }
  3966. declare module BABYLON {
  3967. interface ISceneLoaderPluginExtensions {
  3968. [extension: string]: {
  3969. isBinary: boolean;
  3970. };
  3971. }
  3972. interface ISceneLoaderPlugin {
  3973. extensions: string | ISceneLoaderPluginExtensions;
  3974. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  3975. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  3976. }
  3977. interface ISceneLoaderPluginAsync {
  3978. extensions: string | ISceneLoaderPluginExtensions;
  3979. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror?: () => void) => void;
  3980. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => boolean;
  3981. }
  3982. class SceneLoader {
  3983. private static _ForceFullSceneLoadingForIncremental;
  3984. private static _ShowLoadingScreen;
  3985. static NO_LOGGING: number;
  3986. static MINIMAL_LOGGING: number;
  3987. static SUMMARY_LOGGING: number;
  3988. static DETAILED_LOGGING: number;
  3989. private static _loggingLevel;
  3990. static ForceFullSceneLoadingForIncremental: boolean;
  3991. static ShowLoadingScreen: boolean;
  3992. static loggingLevel: number;
  3993. private static _registeredPlugins;
  3994. private static _getDefaultPlugin();
  3995. private static _getPluginForExtension(extension);
  3996. private static _getPluginForFilename(sceneFilename);
  3997. private static _getDirectLoad(sceneFilename);
  3998. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  3999. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  4000. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void;
  4001. /**
  4002. * Load a scene
  4003. * @param rootUrl a string that defines the root url for scene and resources
  4004. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  4005. * @param engine is the instance of BABYLON.Engine to use to create the scene
  4006. */
  4007. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  4008. /**
  4009. * Append a scene
  4010. * @param rootUrl a string that defines the root url for scene and resources
  4011. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  4012. * @param scene is the instance of BABYLON.Scene to append to
  4013. */
  4014. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  4015. }
  4016. }
  4017. declare module BABYLON {
  4018. /**
  4019. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4020. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4021. * 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;
  4022. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4023. */
  4024. class ColorCurves {
  4025. private _dirty;
  4026. private _tempColor;
  4027. private _globalCurve;
  4028. private _highlightsCurve;
  4029. private _midtonesCurve;
  4030. private _shadowsCurve;
  4031. private _positiveCurve;
  4032. private _negativeCurve;
  4033. private _globalHue;
  4034. private _globalDensity;
  4035. private _globalSaturation;
  4036. private _globalExposure;
  4037. /**
  4038. * Gets the global Hue value.
  4039. * 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).
  4040. */
  4041. /**
  4042. * Sets the global Hue value.
  4043. * 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).
  4044. */
  4045. GlobalHue: number;
  4046. /**
  4047. * Gets the global Density value.
  4048. * 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.
  4049. * Values less than zero provide a filter of opposite hue.
  4050. */
  4051. /**
  4052. * Sets the global Density value.
  4053. * 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.
  4054. * Values less than zero provide a filter of opposite hue.
  4055. */
  4056. GlobalDensity: number;
  4057. /**
  4058. * Gets the global Saturation value.
  4059. * 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.
  4060. */
  4061. /**
  4062. * Sets the global Saturation value.
  4063. * 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.
  4064. */
  4065. GlobalSaturation: number;
  4066. private _highlightsHue;
  4067. private _highlightsDensity;
  4068. private _highlightsSaturation;
  4069. private _highlightsExposure;
  4070. /**
  4071. * Gets the highlights Hue value.
  4072. * 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).
  4073. */
  4074. /**
  4075. * Sets the highlights Hue value.
  4076. * 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).
  4077. */
  4078. HighlightsHue: number;
  4079. /**
  4080. * Gets the highlights Density value.
  4081. * 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.
  4082. * Values less than zero provide a filter of opposite hue.
  4083. */
  4084. /**
  4085. * Sets the highlights Density value.
  4086. * 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.
  4087. * Values less than zero provide a filter of opposite hue.
  4088. */
  4089. HighlightsDensity: number;
  4090. /**
  4091. * Gets the highlights Saturation value.
  4092. * 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.
  4093. */
  4094. /**
  4095. * Sets the highlights Saturation value.
  4096. * 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.
  4097. */
  4098. HighlightsSaturation: number;
  4099. /**
  4100. * Gets the highlights Exposure value.
  4101. * 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.
  4102. */
  4103. /**
  4104. * Sets the highlights Exposure value.
  4105. * 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.
  4106. */
  4107. HighlightsExposure: number;
  4108. private _midtonesHue;
  4109. private _midtonesDensity;
  4110. private _midtonesSaturation;
  4111. private _midtonesExposure;
  4112. /**
  4113. * Gets the midtones Hue value.
  4114. * 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).
  4115. */
  4116. /**
  4117. * Sets the midtones Hue value.
  4118. * 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).
  4119. */
  4120. MidtonesHue: number;
  4121. /**
  4122. * Gets the midtones Density value.
  4123. * 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.
  4124. * Values less than zero provide a filter of opposite hue.
  4125. */
  4126. /**
  4127. * Sets the midtones Density value.
  4128. * 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.
  4129. * Values less than zero provide a filter of opposite hue.
  4130. */
  4131. MidtonesDensity: number;
  4132. /**
  4133. * Gets the midtones Saturation value.
  4134. * 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.
  4135. */
  4136. /**
  4137. * Sets the midtones Saturation value.
  4138. * 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.
  4139. */
  4140. MidtonesSaturation: number;
  4141. /**
  4142. * Gets the midtones Exposure value.
  4143. * 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.
  4144. */
  4145. /**
  4146. * Sets the midtones Exposure value.
  4147. * 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.
  4148. */
  4149. MidtonesExposure: number;
  4150. private _shadowsHue;
  4151. private _shadowsDensity;
  4152. private _shadowsSaturation;
  4153. private _shadowsExposure;
  4154. /**
  4155. * Gets the shadows Hue value.
  4156. * 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).
  4157. */
  4158. /**
  4159. * Sets the shadows Hue value.
  4160. * 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).
  4161. */
  4162. ShadowsHue: number;
  4163. /**
  4164. * Gets the shadows Density value.
  4165. * 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.
  4166. * Values less than zero provide a filter of opposite hue.
  4167. */
  4168. /**
  4169. * Sets the shadows Density value.
  4170. * 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.
  4171. * Values less than zero provide a filter of opposite hue.
  4172. */
  4173. ShadowsDensity: number;
  4174. /**
  4175. * Gets the shadows Saturation value.
  4176. * 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.
  4177. */
  4178. /**
  4179. * Sets the shadows Saturation value.
  4180. * 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.
  4181. */
  4182. ShadowsSaturation: number;
  4183. /**
  4184. * Gets the shadows Exposure value.
  4185. * 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.
  4186. */
  4187. /**
  4188. * Sets the shadows Exposure value.
  4189. * 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.
  4190. */
  4191. ShadowsExposure: number;
  4192. /**
  4193. * Binds the color curves to the shader.
  4194. * @param colorCurves The color curve to bind
  4195. * @param effect The effect to bind to
  4196. */
  4197. static Bind(colorCurves: ColorCurves, effect: Effect): void;
  4198. /**
  4199. * Prepare the list of uniforms associated with the ColorCurves effects.
  4200. * @param uniformsList The list of uniforms used in the effect
  4201. */
  4202. static PrepareUniforms(uniformsList: string[]): void;
  4203. /**
  4204. * Returns color grading data based on a hue, density, saturation and exposure value.
  4205. * @param filterHue The hue of the color filter.
  4206. * @param filterDensity The density of the color filter.
  4207. * @param saturation The saturation.
  4208. * @param exposure The exposure.
  4209. * @param result The result data container.
  4210. */
  4211. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  4212. /**
  4213. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  4214. * @param value The input slider value in range [-100,100].
  4215. * @returns Adjusted value.
  4216. */
  4217. private static applyColorGradingSliderNonlinear(value);
  4218. /**
  4219. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  4220. * @param hue The hue (H) input.
  4221. * @param saturation The saturation (S) input.
  4222. * @param brightness The brightness (B) input.
  4223. * @result An RGBA color represented as Vector4.
  4224. */
  4225. private static fromHSBToRef(hue, saturation, brightness, result);
  4226. /**
  4227. * Returns a value clamped between min and max
  4228. * @param value The value to clamp
  4229. * @param min The minimum of value
  4230. * @param max The maximum of value
  4231. * @returns The clamped value.
  4232. */
  4233. private static clamp(value, min, max);
  4234. /**
  4235. * Clones the current color curve instance.
  4236. * @return The cloned curves
  4237. */
  4238. clone(): ColorCurves;
  4239. /**
  4240. * Serializes the current color curve instance to a json representation.
  4241. * @return a JSON representation
  4242. */
  4243. serialize(): any;
  4244. /**
  4245. * Parses the color curve from a json representation.
  4246. * @param source the JSON source to parse
  4247. * @return The parsed curves
  4248. */
  4249. static Parse(source: any): ColorCurves;
  4250. }
  4251. }
  4252. declare module BABYLON {
  4253. class EffectFallbacks {
  4254. private _defines;
  4255. private _currentRank;
  4256. private _maxRank;
  4257. private _mesh;
  4258. private _meshRank;
  4259. addFallback(rank: number, define: string): void;
  4260. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  4261. isMoreFallbacks: boolean;
  4262. reduce(currentDefines: string): string;
  4263. }
  4264. class Effect {
  4265. name: any;
  4266. defines: string;
  4267. onCompiled: (effect: Effect) => void;
  4268. onError: (effect: Effect, errors: string) => void;
  4269. onBind: (effect: Effect) => void;
  4270. private _engine;
  4271. private _uniformsNames;
  4272. private _samplers;
  4273. private _isReady;
  4274. private _compilationError;
  4275. private _attributesNames;
  4276. private _attributes;
  4277. private _uniforms;
  4278. _key: string;
  4279. private _indexParameters;
  4280. private _program;
  4281. private _valueCache;
  4282. constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any);
  4283. isReady(): boolean;
  4284. getProgram(): WebGLProgram;
  4285. getAttributesNames(): string[];
  4286. getAttributeLocation(index: number): number;
  4287. getAttributeLocationByName(name: string): number;
  4288. getAttributesCount(): number;
  4289. getUniformIndex(uniformName: string): number;
  4290. getUniform(uniformName: string): WebGLUniformLocation;
  4291. getSamplers(): string[];
  4292. getCompilationError(): string;
  4293. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  4294. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  4295. private _dumpShadersName();
  4296. private _processIncludes(sourceCode, callback);
  4297. private _processPrecision(source);
  4298. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  4299. isSupported: boolean;
  4300. _bindTexture(channel: string, texture: WebGLTexture): void;
  4301. setTexture(channel: string, texture: BaseTexture): void;
  4302. setTextureArray(channel: string, textures: BaseTexture[]): void;
  4303. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  4304. _cacheMatrix(uniformName: string, matrix: Matrix): boolean;
  4305. _cacheFloat2(uniformName: string, x: number, y: number): boolean;
  4306. _cacheFloat3(uniformName: string, x: number, y: number, z: number): boolean;
  4307. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): boolean;
  4308. setIntArray(uniformName: string, array: Int32Array): Effect;
  4309. setIntArray2(uniformName: string, array: Int32Array): Effect;
  4310. setIntArray3(uniformName: string, array: Int32Array): Effect;
  4311. setIntArray4(uniformName: string, array: Int32Array): Effect;
  4312. setFloatArray(uniformName: string, array: Float32Array): Effect;
  4313. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  4314. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  4315. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  4316. setArray(uniformName: string, array: number[]): Effect;
  4317. setArray2(uniformName: string, array: number[]): Effect;
  4318. setArray3(uniformName: string, array: number[]): Effect;
  4319. setArray4(uniformName: string, array: number[]): Effect;
  4320. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  4321. setMatrix(uniformName: string, matrix: Matrix): Effect;
  4322. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  4323. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  4324. setFloat(uniformName: string, value: number): Effect;
  4325. setBool(uniformName: string, bool: boolean): Effect;
  4326. setVector2(uniformName: string, vector2: Vector2): Effect;
  4327. setFloat2(uniformName: string, x: number, y: number): Effect;
  4328. setVector3(uniformName: string, vector3: Vector3): Effect;
  4329. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  4330. setVector4(uniformName: string, vector4: Vector4): Effect;
  4331. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  4332. setColor3(uniformName: string, color3: Color3): Effect;
  4333. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  4334. static ShadersStore: {};
  4335. static IncludesShadersStore: {};
  4336. }
  4337. }
  4338. declare module BABYLON {
  4339. class FresnelParameters {
  4340. isEnabled: boolean;
  4341. leftColor: Color3;
  4342. rightColor: Color3;
  4343. bias: number;
  4344. power: number;
  4345. clone(): FresnelParameters;
  4346. serialize(): any;
  4347. static Parse(parsedFresnelParameters: any): FresnelParameters;
  4348. }
  4349. }
  4350. declare module BABYLON {
  4351. class MaterialDefines {
  4352. _keys: string[];
  4353. rebuild(): void;
  4354. isEqual(other: MaterialDefines): boolean;
  4355. cloneTo(other: MaterialDefines): void;
  4356. reset(): void;
  4357. toString(): string;
  4358. }
  4359. class Material {
  4360. name: string;
  4361. private static _TriangleFillMode;
  4362. private static _WireFrameFillMode;
  4363. private static _PointFillMode;
  4364. static TriangleFillMode: number;
  4365. static WireFrameFillMode: number;
  4366. static PointFillMode: number;
  4367. private static _ClockWiseSideOrientation;
  4368. private static _CounterClockWiseSideOrientation;
  4369. static ClockWiseSideOrientation: number;
  4370. static CounterClockWiseSideOrientation: number;
  4371. id: string;
  4372. checkReadyOnEveryCall: boolean;
  4373. checkReadyOnlyOnce: boolean;
  4374. state: string;
  4375. alpha: number;
  4376. backFaceCulling: boolean;
  4377. sideOrientation: number;
  4378. onCompiled: (effect: Effect) => void;
  4379. onError: (effect: Effect, errors: string) => void;
  4380. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  4381. /**
  4382. * An event triggered when the material is disposed.
  4383. * @type {BABYLON.Observable}
  4384. */
  4385. onDisposeObservable: Observable<Material>;
  4386. private _onDisposeObserver;
  4387. onDispose: () => void;
  4388. /**
  4389. * An event triggered when the material is bound.
  4390. * @type {BABYLON.Observable}
  4391. */
  4392. onBindObservable: Observable<AbstractMesh>;
  4393. private _onBindObserver;
  4394. onBind: (Mesh: AbstractMesh) => void;
  4395. /**
  4396. * An event triggered when the material is unbound.
  4397. * @type {BABYLON.Observable}
  4398. */
  4399. onUnBindObservable: Observable<Material>;
  4400. alphaMode: number;
  4401. disableDepthWrite: boolean;
  4402. fogEnabled: boolean;
  4403. pointSize: number;
  4404. zOffset: number;
  4405. wireframe: boolean;
  4406. pointsCloud: boolean;
  4407. fillMode: number;
  4408. _effect: Effect;
  4409. _wasPreviouslyReady: boolean;
  4410. private _scene;
  4411. private _fillMode;
  4412. private _cachedDepthWriteState;
  4413. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  4414. /**
  4415. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4416. * subclasses should override adding information pertainent to themselves
  4417. */
  4418. toString(fullDetails?: boolean): string;
  4419. isFrozen: boolean;
  4420. freeze(): void;
  4421. unfreeze(): void;
  4422. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4423. getEffect(): Effect;
  4424. getScene(): Scene;
  4425. needAlphaBlending(): boolean;
  4426. needAlphaTesting(): boolean;
  4427. getAlphaTestTexture(): BaseTexture;
  4428. markDirty(): void;
  4429. _preBind(): void;
  4430. bind(world: Matrix, mesh?: Mesh): void;
  4431. bindOnlyWorldMatrix(world: Matrix): void;
  4432. unbind(): void;
  4433. clone(name: string): Material;
  4434. getBindedMeshes(): AbstractMesh[];
  4435. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4436. serialize(): any;
  4437. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  4438. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  4439. }
  4440. }
  4441. declare module BABYLON {
  4442. class MaterialHelper {
  4443. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, maxSimultaneousLights?: number): boolean;
  4444. static PrepareUniformsAndSamplersList(uniformsList: string[], samplersList: string[], defines: MaterialDefines, maxSimultaneousLights?: number): void;
  4445. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  4446. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  4447. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  4448. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: number, effect: Effect, depthValuesAlreadySet: boolean): boolean;
  4449. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  4450. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  4451. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  4452. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  4453. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  4454. static BindClipPlane(effect: Effect, scene: Scene): void;
  4455. }
  4456. }
  4457. declare module BABYLON {
  4458. class MultiMaterial extends Material {
  4459. subMaterials: Material[];
  4460. constructor(name: string, scene: Scene);
  4461. getSubMaterial(index: any): Material;
  4462. isReady(mesh?: AbstractMesh): boolean;
  4463. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  4464. serialize(): any;
  4465. }
  4466. }
  4467. declare module BABYLON {
  4468. /**
  4469. * The Physically based material of BJS.
  4470. *
  4471. * This offers the main features of a standard PBR material.
  4472. * For more information, please refer to the documentation :
  4473. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  4474. */
  4475. class PBRMaterial extends BABYLON.Material {
  4476. /**
  4477. * Intensity of the direct lights e.g. the four lights available in your scene.
  4478. * This impacts both the direct diffuse and specular highlights.
  4479. */
  4480. directIntensity: number;
  4481. /**
  4482. * Intensity of the emissive part of the material.
  4483. * This helps controlling the emissive effect without modifying the emissive color.
  4484. */
  4485. emissiveIntensity: number;
  4486. /**
  4487. * Intensity of the environment e.g. how much the environment will light the object
  4488. * either through harmonics for rough material or through the refelction for shiny ones.
  4489. */
  4490. environmentIntensity: number;
  4491. /**
  4492. * This is a special control allowing the reduction of the specular highlights coming from the
  4493. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  4494. */
  4495. specularIntensity: number;
  4496. private _lightingInfos;
  4497. /**
  4498. * Debug Control allowing disabling the bump map on this material.
  4499. */
  4500. disableBumpMap: boolean;
  4501. /**
  4502. * Debug Control helping enforcing or dropping the darkness of shadows.
  4503. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  4504. */
  4505. overloadedShadowIntensity: number;
  4506. /**
  4507. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  4508. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  4509. */
  4510. overloadedShadeIntensity: number;
  4511. private _overloadedShadowInfos;
  4512. /**
  4513. * The camera exposure used on this material.
  4514. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  4515. * This corresponds to a photographic exposure.
  4516. */
  4517. cameraExposure: number;
  4518. /**
  4519. * The camera contrast used on this material.
  4520. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  4521. */
  4522. cameraContrast: number;
  4523. /**
  4524. * Color Grading 2D Lookup Texture.
  4525. * This allows special effects like sepia, black and white to sixties rendering style.
  4526. */
  4527. cameraColorGradingTexture: BaseTexture;
  4528. /**
  4529. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4530. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4531. * 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;
  4532. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4533. */
  4534. cameraColorCurves: ColorCurves;
  4535. private _cameraInfos;
  4536. private _microsurfaceTextureLods;
  4537. /**
  4538. * Debug Control allowing to overload the ambient color.
  4539. * This as to be use with the overloadedAmbientIntensity parameter.
  4540. */
  4541. overloadedAmbient: Color3;
  4542. /**
  4543. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  4544. */
  4545. overloadedAmbientIntensity: number;
  4546. /**
  4547. * Debug Control allowing to overload the albedo color.
  4548. * This as to be use with the overloadedAlbedoIntensity parameter.
  4549. */
  4550. overloadedAlbedo: Color3;
  4551. /**
  4552. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  4553. */
  4554. overloadedAlbedoIntensity: number;
  4555. /**
  4556. * Debug Control allowing to overload the reflectivity color.
  4557. * This as to be use with the overloadedReflectivityIntensity parameter.
  4558. */
  4559. overloadedReflectivity: Color3;
  4560. /**
  4561. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  4562. */
  4563. overloadedReflectivityIntensity: number;
  4564. /**
  4565. * Debug Control allowing to overload the emissive color.
  4566. * This as to be use with the overloadedEmissiveIntensity parameter.
  4567. */
  4568. overloadedEmissive: Color3;
  4569. /**
  4570. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  4571. */
  4572. overloadedEmissiveIntensity: number;
  4573. private _overloadedIntensity;
  4574. /**
  4575. * Debug Control allowing to overload the reflection color.
  4576. * This as to be use with the overloadedReflectionIntensity parameter.
  4577. */
  4578. overloadedReflection: Color3;
  4579. /**
  4580. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  4581. */
  4582. overloadedReflectionIntensity: number;
  4583. /**
  4584. * Debug Control allowing to overload the microsurface.
  4585. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  4586. */
  4587. overloadedMicroSurface: number;
  4588. /**
  4589. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  4590. */
  4591. overloadedMicroSurfaceIntensity: number;
  4592. private _overloadedMicroSurface;
  4593. /**
  4594. * AKA Diffuse Texture in standard nomenclature.
  4595. */
  4596. albedoTexture: BaseTexture;
  4597. /**
  4598. * AKA Occlusion Texture in other nomenclature.
  4599. */
  4600. ambientTexture: BaseTexture;
  4601. /**
  4602. * AKA Occlusion Texture Intensity in other nomenclature.
  4603. */
  4604. ambientTextureStrength: number;
  4605. opacityTexture: BaseTexture;
  4606. reflectionTexture: BaseTexture;
  4607. emissiveTexture: BaseTexture;
  4608. /**
  4609. * AKA Specular texture in other nomenclature.
  4610. */
  4611. reflectivityTexture: BaseTexture;
  4612. bumpTexture: BaseTexture;
  4613. lightmapTexture: BaseTexture;
  4614. refractionTexture: BaseTexture;
  4615. ambientColor: Color3;
  4616. /**
  4617. * AKA Diffuse Color in other nomenclature.
  4618. */
  4619. albedoColor: Color3;
  4620. /**
  4621. * AKA Specular Color in other nomenclature.
  4622. */
  4623. reflectivityColor: Color3;
  4624. reflectionColor: Color3;
  4625. emissiveColor: Color3;
  4626. /**
  4627. * AKA Glossiness in other nomenclature.
  4628. */
  4629. microSurface: number;
  4630. /**
  4631. * source material index of refraction (IOR)' / 'destination material IOR.
  4632. */
  4633. indexOfRefraction: number;
  4634. /**
  4635. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  4636. */
  4637. invertRefractionY: boolean;
  4638. opacityFresnelParameters: FresnelParameters;
  4639. emissiveFresnelParameters: FresnelParameters;
  4640. /**
  4641. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  4642. * Materials half opaque for instance using refraction could benefit from this control.
  4643. */
  4644. linkRefractionWithTransparency: boolean;
  4645. /**
  4646. * The emissive and albedo are linked to never be more than one (Energy conservation).
  4647. */
  4648. linkEmissiveWithAlbedo: boolean;
  4649. useLightmapAsShadowmap: boolean;
  4650. /**
  4651. * In this mode, the emissive informtaion will always be added to the lighting once.
  4652. * A light for instance can be thought as emissive.
  4653. */
  4654. useEmissiveAsIllumination: boolean;
  4655. /**
  4656. * Secifies that the alpha is coming form the albedo channel alpha channel.
  4657. */
  4658. useAlphaFromAlbedoTexture: boolean;
  4659. /**
  4660. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  4661. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  4662. */
  4663. useSpecularOverAlpha: boolean;
  4664. /**
  4665. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  4666. */
  4667. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  4668. /**
  4669. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  4670. * The material will try to infer what glossiness each pixel should be.
  4671. */
  4672. useAutoMicroSurfaceFromReflectivityMap: boolean;
  4673. /**
  4674. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  4675. * the creation of the material.
  4676. */
  4677. useScalarInLinearSpace: boolean;
  4678. /**
  4679. * BJS is using an harcoded light falloff based on a manually sets up range.
  4680. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  4681. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  4682. */
  4683. usePhysicalLightFalloff: boolean;
  4684. /**
  4685. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  4686. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  4687. */
  4688. useRadianceOverAlpha: boolean;
  4689. /**
  4690. * Allows using the bump map in parallax mode.
  4691. */
  4692. useParallax: boolean;
  4693. /**
  4694. * Allows using the bump map in parallax occlusion mode.
  4695. */
  4696. useParallaxOcclusion: boolean;
  4697. /**
  4698. * Controls the scale bias of the parallax mode.
  4699. */
  4700. parallaxScaleBias: number;
  4701. /**
  4702. * If sets to true, disables all the lights affecting the material.
  4703. */
  4704. disableLighting: boolean;
  4705. /**
  4706. * Number of Simultaneous lights allowed on the material.
  4707. */
  4708. maxSimultaneousLights: number;
  4709. /**
  4710. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4711. */
  4712. invertNormalMapX: boolean;
  4713. /**
  4714. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4715. */
  4716. invertNormalMapY: boolean;
  4717. private _renderTargets;
  4718. private _worldViewProjectionMatrix;
  4719. private _globalAmbientColor;
  4720. private _tempColor;
  4721. private _renderId;
  4722. private _defines;
  4723. private _cachedDefines;
  4724. private _useLogarithmicDepth;
  4725. /**
  4726. * Instantiates a new PBRMaterial instance.
  4727. *
  4728. * @param name The material name
  4729. * @param scene The scene the material will be use in.
  4730. */
  4731. constructor(name: string, scene: Scene);
  4732. useLogarithmicDepth: boolean;
  4733. needAlphaBlending(): boolean;
  4734. needAlphaTesting(): boolean;
  4735. private _shouldUseAlphaFromAlbedoTexture();
  4736. getAlphaTestTexture(): BaseTexture;
  4737. private _checkCache(scene, mesh?, useInstances?);
  4738. private convertColorToLinearSpaceToRef(color, ref);
  4739. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  4740. private static _scaledAlbedo;
  4741. private static _scaledReflectivity;
  4742. private static _scaledEmissive;
  4743. private static _scaledReflection;
  4744. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  4745. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4746. unbind(): void;
  4747. bindOnlyWorldMatrix(world: Matrix): void;
  4748. private _myScene;
  4749. private _myShadowGenerator;
  4750. bind(world: Matrix, mesh?: Mesh): void;
  4751. getAnimatables(): IAnimatable[];
  4752. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4753. clone(name: string): PBRMaterial;
  4754. serialize(): any;
  4755. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  4756. }
  4757. }
  4758. declare module BABYLON {
  4759. class ShaderMaterial extends Material {
  4760. private _shaderPath;
  4761. private _options;
  4762. private _textures;
  4763. private _textureArrays;
  4764. private _floats;
  4765. private _floatsArrays;
  4766. private _colors3;
  4767. private _colors4;
  4768. private _vectors2;
  4769. private _vectors3;
  4770. private _vectors4;
  4771. private _matrices;
  4772. private _matrices3x3;
  4773. private _matrices2x2;
  4774. private _vectors3Arrays;
  4775. private _cachedWorldViewMatrix;
  4776. private _renderId;
  4777. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  4778. needAlphaBlending(): boolean;
  4779. needAlphaTesting(): boolean;
  4780. private _checkUniform(uniformName);
  4781. setTexture(name: string, texture: Texture): ShaderMaterial;
  4782. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  4783. setFloat(name: string, value: number): ShaderMaterial;
  4784. setFloats(name: string, value: number[]): ShaderMaterial;
  4785. setColor3(name: string, value: Color3): ShaderMaterial;
  4786. setColor4(name: string, value: Color4): ShaderMaterial;
  4787. setVector2(name: string, value: Vector2): ShaderMaterial;
  4788. setVector3(name: string, value: Vector3): ShaderMaterial;
  4789. setVector4(name: string, value: Vector4): ShaderMaterial;
  4790. setMatrix(name: string, value: Matrix): ShaderMaterial;
  4791. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  4792. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  4793. setArray3(name: string, value: number[]): ShaderMaterial;
  4794. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4795. bindOnlyWorldMatrix(world: Matrix): void;
  4796. bind(world: Matrix, mesh?: Mesh): void;
  4797. clone(name: string): ShaderMaterial;
  4798. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4799. serialize(): any;
  4800. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  4801. }
  4802. }
  4803. declare module BABYLON {
  4804. class StandardMaterial extends Material {
  4805. diffuseTexture: BaseTexture;
  4806. ambientTexture: BaseTexture;
  4807. opacityTexture: BaseTexture;
  4808. reflectionTexture: BaseTexture;
  4809. emissiveTexture: BaseTexture;
  4810. specularTexture: BaseTexture;
  4811. bumpTexture: BaseTexture;
  4812. lightmapTexture: BaseTexture;
  4813. refractionTexture: BaseTexture;
  4814. ambientColor: Color3;
  4815. diffuseColor: Color3;
  4816. specularColor: Color3;
  4817. emissiveColor: Color3;
  4818. specularPower: number;
  4819. useAlphaFromDiffuseTexture: boolean;
  4820. useEmissiveAsIllumination: boolean;
  4821. linkEmissiveWithDiffuse: boolean;
  4822. useReflectionFresnelFromSpecular: boolean;
  4823. useSpecularOverAlpha: boolean;
  4824. useReflectionOverAlpha: boolean;
  4825. disableLighting: boolean;
  4826. useParallax: boolean;
  4827. useParallaxOcclusion: boolean;
  4828. parallaxScaleBias: number;
  4829. roughness: number;
  4830. indexOfRefraction: number;
  4831. invertRefractionY: boolean;
  4832. useLightmapAsShadowmap: boolean;
  4833. diffuseFresnelParameters: FresnelParameters;
  4834. opacityFresnelParameters: FresnelParameters;
  4835. reflectionFresnelParameters: FresnelParameters;
  4836. refractionFresnelParameters: FresnelParameters;
  4837. emissiveFresnelParameters: FresnelParameters;
  4838. useGlossinessFromSpecularMapAlpha: boolean;
  4839. maxSimultaneousLights: number;
  4840. /**
  4841. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4842. */
  4843. invertNormalMapX: boolean;
  4844. /**
  4845. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4846. */
  4847. invertNormalMapY: boolean;
  4848. /**
  4849. * Color Grading 2D Lookup Texture.
  4850. * This allows special effects like sepia, black and white to sixties rendering style.
  4851. */
  4852. cameraColorGradingTexture: BaseTexture;
  4853. /**
  4854. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4855. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4856. * 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;
  4857. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4858. */
  4859. cameraColorCurves: ColorCurves;
  4860. private _renderTargets;
  4861. private _worldViewProjectionMatrix;
  4862. private _globalAmbientColor;
  4863. private _renderId;
  4864. private _defines;
  4865. private _cachedDefines;
  4866. private _useLogarithmicDepth;
  4867. constructor(name: string, scene: Scene);
  4868. useLogarithmicDepth: boolean;
  4869. needAlphaBlending(): boolean;
  4870. needAlphaTesting(): boolean;
  4871. private _shouldUseAlphaFromDiffuseTexture();
  4872. getAlphaTestTexture(): BaseTexture;
  4873. private _checkCache(scene, mesh?, useInstances?);
  4874. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4875. unbind(): void;
  4876. bindOnlyWorldMatrix(world: Matrix): void;
  4877. bind(world: Matrix, mesh?: Mesh): void;
  4878. getAnimatables(): IAnimatable[];
  4879. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4880. clone(name: string): StandardMaterial;
  4881. serialize(): any;
  4882. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  4883. static DiffuseTextureEnabled: boolean;
  4884. static AmbientTextureEnabled: boolean;
  4885. static OpacityTextureEnabled: boolean;
  4886. static ReflectionTextureEnabled: boolean;
  4887. static EmissiveTextureEnabled: boolean;
  4888. static SpecularTextureEnabled: boolean;
  4889. static BumpTextureEnabled: boolean;
  4890. static FresnelEnabled: boolean;
  4891. static LightmapTextureEnabled: boolean;
  4892. static RefractionTextureEnabled: boolean;
  4893. static ColorGradingTextureEnabled: boolean;
  4894. }
  4895. }
  4896. declare module BABYLON {
  4897. class SIMDHelper {
  4898. private static _isEnabled;
  4899. static IsEnabled: boolean;
  4900. static DisableSIMD(): void;
  4901. static EnableSIMD(): void;
  4902. }
  4903. }
  4904. declare module BABYLON {
  4905. const ToGammaSpace: number;
  4906. const ToLinearSpace: number;
  4907. const Epsilon: number;
  4908. class MathTools {
  4909. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  4910. static ToHex(i: number): string;
  4911. static Sign(value: number): number;
  4912. static Clamp(value: number, min?: number, max?: number): number;
  4913. }
  4914. class Color3 {
  4915. r: number;
  4916. g: number;
  4917. b: number;
  4918. constructor(r?: number, g?: number, b?: number);
  4919. toString(): string;
  4920. getClassName(): string;
  4921. getHashCode(): number;
  4922. toArray(array: number[], index?: number): Color3;
  4923. toColor4(alpha?: number): Color4;
  4924. asArray(): number[];
  4925. toLuminance(): number;
  4926. multiply(otherColor: Color3): Color3;
  4927. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  4928. equals(otherColor: Color3): boolean;
  4929. equalsFloats(r: number, g: number, b: number): boolean;
  4930. scale(scale: number): Color3;
  4931. scaleToRef(scale: number, result: Color3): Color3;
  4932. add(otherColor: Color3): Color3;
  4933. addToRef(otherColor: Color3, result: Color3): Color3;
  4934. subtract(otherColor: Color3): Color3;
  4935. subtractToRef(otherColor: Color3, result: Color3): Color3;
  4936. clone(): Color3;
  4937. copyFrom(source: Color3): Color3;
  4938. copyFromFloats(r: number, g: number, b: number): Color3;
  4939. toHexString(): string;
  4940. toLinearSpace(): Color3;
  4941. toLinearSpaceToRef(convertedColor: Color3): Color3;
  4942. toGammaSpace(): Color3;
  4943. toGammaSpaceToRef(convertedColor: Color3): Color3;
  4944. static FromHexString(hex: string): Color3;
  4945. static FromArray(array: number[], offset?: number): Color3;
  4946. static FromInts(r: number, g: number, b: number): Color3;
  4947. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  4948. static Red(): Color3;
  4949. static Green(): Color3;
  4950. static Blue(): Color3;
  4951. static Black(): Color3;
  4952. static White(): Color3;
  4953. static Purple(): Color3;
  4954. static Magenta(): Color3;
  4955. static Yellow(): Color3;
  4956. static Gray(): Color3;
  4957. }
  4958. class Color4 {
  4959. r: number;
  4960. g: number;
  4961. b: number;
  4962. a: number;
  4963. constructor(r: number, g: number, b: number, a: number);
  4964. addInPlace(right: any): Color4;
  4965. asArray(): number[];
  4966. toArray(array: number[], index?: number): Color4;
  4967. add(right: Color4): Color4;
  4968. subtract(right: Color4): Color4;
  4969. subtractToRef(right: Color4, result: Color4): Color4;
  4970. scale(scale: number): Color4;
  4971. scaleToRef(scale: number, result: Color4): Color4;
  4972. /**
  4973. * Multipy an RGBA Color4 value by another and return a new Color4 object
  4974. * @param color The Color4 (RGBA) value to multiply by
  4975. * @returns A new Color4.
  4976. */
  4977. multiply(color: Color4): Color4;
  4978. /**
  4979. * Multipy an RGBA Color4 value by another and push the result in a reference value
  4980. * @param color The Color4 (RGBA) value to multiply by
  4981. * @param result The Color4 (RGBA) to fill the result in
  4982. * @returns the result Color4.
  4983. */
  4984. multiplyToRef(color: Color4, result: Color4): Color4;
  4985. toString(): string;
  4986. getClassName(): string;
  4987. getHashCode(): number;
  4988. clone(): Color4;
  4989. copyFrom(source: Color4): Color4;
  4990. toHexString(): string;
  4991. static FromHexString(hex: string): Color4;
  4992. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  4993. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  4994. static FromArray(array: number[], offset?: number): Color4;
  4995. static FromInts(r: number, g: number, b: number, a: number): Color4;
  4996. static CheckColors4(colors: number[], count: number): number[];
  4997. }
  4998. class Vector2 {
  4999. x: number;
  5000. y: number;
  5001. constructor(x: number, y: number);
  5002. toString(): string;
  5003. getClassName(): string;
  5004. getHashCode(): number;
  5005. toArray(array: number[] | Float32Array, index?: number): Vector2;
  5006. asArray(): number[];
  5007. copyFrom(source: Vector2): Vector2;
  5008. copyFromFloats(x: number, y: number): Vector2;
  5009. add(otherVector: Vector2): Vector2;
  5010. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  5011. addInPlace(otherVector: Vector2): Vector2;
  5012. addVector3(otherVector: Vector3): Vector2;
  5013. subtract(otherVector: Vector2): Vector2;
  5014. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  5015. subtractInPlace(otherVector: Vector2): Vector2;
  5016. multiplyInPlace(otherVector: Vector2): Vector2;
  5017. multiply(otherVector: Vector2): Vector2;
  5018. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  5019. multiplyByFloats(x: number, y: number): Vector2;
  5020. divide(otherVector: Vector2): Vector2;
  5021. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  5022. negate(): Vector2;
  5023. scaleInPlace(scale: number): Vector2;
  5024. scale(scale: number): Vector2;
  5025. equals(otherVector: Vector2): boolean;
  5026. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  5027. length(): number;
  5028. lengthSquared(): number;
  5029. normalize(): Vector2;
  5030. clone(): Vector2;
  5031. static Zero(): Vector2;
  5032. static FromArray(array: number[] | Float32Array, offset?: number): Vector2;
  5033. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void;
  5034. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  5035. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  5036. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  5037. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  5038. static Dot(left: Vector2, right: Vector2): number;
  5039. static Normalize(vector: Vector2): Vector2;
  5040. static Minimize(left: Vector2, right: Vector2): Vector2;
  5041. static Maximize(left: Vector2, right: Vector2): Vector2;
  5042. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  5043. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  5044. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  5045. static Distance(value1: Vector2, value2: Vector2): number;
  5046. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  5047. static Center(value1: Vector2, value2: Vector2): Vector2;
  5048. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  5049. }
  5050. class Vector3 {
  5051. x: number;
  5052. y: number;
  5053. z: number;
  5054. constructor(x: number, y: number, z: number);
  5055. toString(): string;
  5056. getClassName(): string;
  5057. getHashCode(): number;
  5058. asArray(): number[];
  5059. toArray(array: number[] | Float32Array, index?: number): Vector3;
  5060. toQuaternion(): Quaternion;
  5061. addInPlace(otherVector: Vector3): Vector3;
  5062. add(otherVector: Vector3): Vector3;
  5063. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  5064. subtractInPlace(otherVector: Vector3): Vector3;
  5065. subtract(otherVector: Vector3): Vector3;
  5066. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  5067. subtractFromFloats(x: number, y: number, z: number): Vector3;
  5068. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  5069. negate(): Vector3;
  5070. scaleInPlace(scale: number): Vector3;
  5071. scale(scale: number): Vector3;
  5072. scaleToRef(scale: number, result: Vector3): void;
  5073. equals(otherVector: Vector3): boolean;
  5074. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  5075. equalsToFloats(x: number, y: number, z: number): boolean;
  5076. multiplyInPlace(otherVector: Vector3): Vector3;
  5077. multiply(otherVector: Vector3): Vector3;
  5078. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  5079. multiplyByFloats(x: number, y: number, z: number): Vector3;
  5080. divide(otherVector: Vector3): Vector3;
  5081. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  5082. MinimizeInPlace(other: Vector3): Vector3;
  5083. MaximizeInPlace(other: Vector3): Vector3;
  5084. length(): number;
  5085. lengthSquared(): number;
  5086. normalize(): Vector3;
  5087. clone(): Vector3;
  5088. copyFrom(source: Vector3): Vector3;
  5089. copyFromFloats(x: number, y: number, z: number): Vector3;
  5090. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  5091. static FromArray(array: number[] | Float32Array, offset?: number): Vector3;
  5092. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  5093. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void;
  5094. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  5095. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  5096. static Zero(): Vector3;
  5097. static Up(): Vector3;
  5098. static Forward(): Vector3;
  5099. static Right(): Vector3;
  5100. static Left(): Vector3;
  5101. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  5102. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  5103. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  5104. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  5105. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  5106. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  5107. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  5108. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  5109. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  5110. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  5111. static Dot(left: Vector3, right: Vector3): number;
  5112. static Cross(left: Vector3, right: Vector3): Vector3;
  5113. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  5114. static Normalize(vector: Vector3): Vector3;
  5115. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  5116. private static _viewportMatrixCache;
  5117. private static _matrixCache;
  5118. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  5119. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  5120. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  5121. static Minimize(left: Vector3, right: Vector3): Vector3;
  5122. static Maximize(left: Vector3, right: Vector3): Vector3;
  5123. static Distance(value1: Vector3, value2: Vector3): number;
  5124. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  5125. static Center(value1: Vector3, value2: Vector3): Vector3;
  5126. /**
  5127. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  5128. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  5129. * to something in order to rotate it from its local system to the given target system.
  5130. */
  5131. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  5132. /**
  5133. * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
  5134. */
  5135. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  5136. }
  5137. class Vector4 {
  5138. x: number;
  5139. y: number;
  5140. z: number;
  5141. w: number;
  5142. constructor(x: number, y: number, z: number, w: number);
  5143. toString(): string;
  5144. getClassName(): string;
  5145. getHashCode(): number;
  5146. asArray(): number[];
  5147. toArray(array: number[], index?: number): Vector4;
  5148. addInPlace(otherVector: Vector4): Vector4;
  5149. add(otherVector: Vector4): Vector4;
  5150. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  5151. subtractInPlace(otherVector: Vector4): Vector4;
  5152. subtract(otherVector: Vector4): Vector4;
  5153. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  5154. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  5155. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  5156. negate(): Vector4;
  5157. scaleInPlace(scale: number): Vector4;
  5158. scale(scale: number): Vector4;
  5159. scaleToRef(scale: number, result: Vector4): void;
  5160. equals(otherVector: Vector4): boolean;
  5161. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  5162. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  5163. multiplyInPlace(otherVector: Vector4): Vector4;
  5164. multiply(otherVector: Vector4): Vector4;
  5165. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  5166. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  5167. divide(otherVector: Vector4): Vector4;
  5168. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  5169. MinimizeInPlace(other: Vector4): Vector4;
  5170. MaximizeInPlace(other: Vector4): Vector4;
  5171. length(): number;
  5172. lengthSquared(): number;
  5173. normalize(): Vector4;
  5174. toVector3(): Vector3;
  5175. clone(): Vector4;
  5176. copyFrom(source: Vector4): Vector4;
  5177. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  5178. static FromArray(array: number[], offset?: number): Vector4;
  5179. static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
  5180. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  5181. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  5182. static Zero(): Vector4;
  5183. static Normalize(vector: Vector4): Vector4;
  5184. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  5185. static Minimize(left: Vector4, right: Vector4): Vector4;
  5186. static Maximize(left: Vector4, right: Vector4): Vector4;
  5187. static Distance(value1: Vector4, value2: Vector4): number;
  5188. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  5189. static Center(value1: Vector4, value2: Vector4): Vector4;
  5190. }
  5191. interface ISize {
  5192. width: number;
  5193. height: number;
  5194. }
  5195. class Size implements ISize {
  5196. width: number;
  5197. height: number;
  5198. constructor(width: number, height: number);
  5199. toString(): string;
  5200. getClassName(): string;
  5201. getHashCode(): number;
  5202. copyFrom(src: Size): void;
  5203. copyFromFloats(width: number, height: number): void;
  5204. multiplyByFloats(w: number, h: number): Size;
  5205. clone(): Size;
  5206. equals(other: Size): boolean;
  5207. surface: number;
  5208. static Zero(): Size;
  5209. add(otherSize: Size): Size;
  5210. substract(otherSize: Size): Size;
  5211. static Lerp(start: Size, end: Size, amount: number): Size;
  5212. }
  5213. class Quaternion {
  5214. x: number;
  5215. y: number;
  5216. z: number;
  5217. w: number;
  5218. constructor(x?: number, y?: number, z?: number, w?: number);
  5219. toString(): string;
  5220. getClassName(): string;
  5221. getHashCode(): number;
  5222. asArray(): number[];
  5223. equals(otherQuaternion: Quaternion): boolean;
  5224. clone(): Quaternion;
  5225. copyFrom(other: Quaternion): Quaternion;
  5226. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  5227. add(other: Quaternion): Quaternion;
  5228. subtract(other: Quaternion): Quaternion;
  5229. scale(value: number): Quaternion;
  5230. multiply(q1: Quaternion): Quaternion;
  5231. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  5232. multiplyInPlace(q1: Quaternion): Quaternion;
  5233. conjugateToRef(ref: Quaternion): Quaternion;
  5234. conjugateInPlace(): Quaternion;
  5235. conjugate(): Quaternion;
  5236. length(): number;
  5237. normalize(): Quaternion;
  5238. toEulerAngles(order?: string): Vector3;
  5239. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  5240. toRotationMatrix(result: Matrix): Quaternion;
  5241. fromRotationMatrix(matrix: Matrix): Quaternion;
  5242. static FromRotationMatrix(matrix: Matrix): Quaternion;
  5243. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  5244. static Inverse(q: Quaternion): Quaternion;
  5245. static Identity(): Quaternion;
  5246. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  5247. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  5248. static FromArray(array: number[], offset?: number): Quaternion;
  5249. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  5250. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  5251. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  5252. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  5253. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  5254. }
  5255. class Matrix {
  5256. private static _tempQuaternion;
  5257. private static _xAxis;
  5258. private static _yAxis;
  5259. private static _zAxis;
  5260. m: Float32Array;
  5261. isIdentity(): boolean;
  5262. determinant(): number;
  5263. toArray(): Float32Array;
  5264. asArray(): Float32Array;
  5265. invert(): Matrix;
  5266. reset(): Matrix;
  5267. add(other: Matrix): Matrix;
  5268. addToRef(other: Matrix, result: Matrix): Matrix;
  5269. addToSelf(other: Matrix): Matrix;
  5270. invertToRef(other: Matrix): Matrix;
  5271. setTranslation(vector3: Vector3): Matrix;
  5272. getTranslation(): Vector3;
  5273. multiply(other: Matrix): Matrix;
  5274. copyFrom(other: Matrix): Matrix;
  5275. copyToArray(array: Float32Array, offset?: number): Matrix;
  5276. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  5277. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  5278. equals(value: Matrix): boolean;
  5279. clone(): Matrix;
  5280. getClassName(): string;
  5281. getHashCode(): number;
  5282. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  5283. static FromArray(array: number[], offset?: number): Matrix;
  5284. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  5285. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  5286. 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;
  5287. getRow(index: number): Vector4;
  5288. setRow(index: number, row: Vector4): Matrix;
  5289. 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;
  5290. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  5291. static Identity(): Matrix;
  5292. static IdentityToRef(result: Matrix): void;
  5293. static Zero(): Matrix;
  5294. static RotationX(angle: number): Matrix;
  5295. static Invert(source: Matrix): Matrix;
  5296. static RotationXToRef(angle: number, result: Matrix): void;
  5297. static RotationY(angle: number): Matrix;
  5298. static RotationYToRef(angle: number, result: Matrix): void;
  5299. static RotationZ(angle: number): Matrix;
  5300. static RotationZToRef(angle: number, result: Matrix): void;
  5301. static RotationAxis(axis: Vector3, angle: number): Matrix;
  5302. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  5303. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  5304. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  5305. static Scaling(x: number, y: number, z: number): Matrix;
  5306. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  5307. static Translation(x: number, y: number, z: number): Matrix;
  5308. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  5309. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  5310. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  5311. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  5312. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  5313. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  5314. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  5315. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  5316. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  5317. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  5318. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  5319. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  5320. static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  5321. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  5322. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  5323. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5324. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  5325. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5326. static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5327. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  5328. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  5329. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  5330. static Transpose(matrix: Matrix): Matrix;
  5331. static Reflection(plane: Plane): Matrix;
  5332. static ReflectionToRef(plane: Plane, result: Matrix): void;
  5333. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, mat: Matrix): void;
  5334. }
  5335. class Plane {
  5336. normal: Vector3;
  5337. d: number;
  5338. constructor(a: number, b: number, c: number, d: number);
  5339. asArray(): number[];
  5340. clone(): Plane;
  5341. getClassName(): string;
  5342. getHashCode(): number;
  5343. normalize(): Plane;
  5344. transform(transformation: Matrix): Plane;
  5345. dotCoordinate(point: any): number;
  5346. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  5347. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  5348. signedDistanceTo(point: Vector3): number;
  5349. static FromArray(array: number[]): Plane;
  5350. static FromPoints(point1: any, point2: any, point3: any): Plane;
  5351. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  5352. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  5353. }
  5354. class Viewport {
  5355. x: number;
  5356. y: number;
  5357. width: number;
  5358. height: number;
  5359. constructor(x: number, y: number, width: number, height: number);
  5360. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  5361. }
  5362. class Frustum {
  5363. static GetPlanes(transform: Matrix): Plane[];
  5364. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  5365. }
  5366. enum Space {
  5367. LOCAL = 0,
  5368. WORLD = 1,
  5369. }
  5370. class Axis {
  5371. static X: Vector3;
  5372. static Y: Vector3;
  5373. static Z: Vector3;
  5374. }
  5375. class BezierCurve {
  5376. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  5377. }
  5378. enum Orientation {
  5379. CW = 0,
  5380. CCW = 1,
  5381. }
  5382. class Angle {
  5383. private _radians;
  5384. constructor(radians: number);
  5385. degrees: () => number;
  5386. radians: () => number;
  5387. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  5388. static FromRadians(radians: number): Angle;
  5389. static FromDegrees(degrees: number): Angle;
  5390. }
  5391. class Arc2 {
  5392. startPoint: Vector2;
  5393. midPoint: Vector2;
  5394. endPoint: Vector2;
  5395. centerPoint: Vector2;
  5396. radius: number;
  5397. angle: Angle;
  5398. startAngle: Angle;
  5399. orientation: Orientation;
  5400. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  5401. }
  5402. class Path2 {
  5403. private _points;
  5404. private _length;
  5405. closed: boolean;
  5406. constructor(x: number, y: number);
  5407. addLineTo(x: number, y: number): Path2;
  5408. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  5409. close(): Path2;
  5410. length(): number;
  5411. getPoints(): Vector2[];
  5412. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  5413. static StartingAt(x: number, y: number): Path2;
  5414. }
  5415. class Path3D {
  5416. path: Vector3[];
  5417. private _curve;
  5418. private _distances;
  5419. private _tangents;
  5420. private _normals;
  5421. private _binormals;
  5422. private _raw;
  5423. /**
  5424. * new Path3D(path, normal, raw)
  5425. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  5426. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  5427. * path : an array of Vector3, the curve axis of the Path3D
  5428. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  5429. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  5430. */
  5431. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  5432. /**
  5433. * Returns the Path3D array of successive Vector3 designing its curve.
  5434. */
  5435. getCurve(): Vector3[];
  5436. /**
  5437. * Returns an array populated with tangent vectors on each Path3D curve point.
  5438. */
  5439. getTangents(): Vector3[];
  5440. /**
  5441. * Returns an array populated with normal vectors on each Path3D curve point.
  5442. */
  5443. getNormals(): Vector3[];
  5444. /**
  5445. * Returns an array populated with binormal vectors on each Path3D curve point.
  5446. */
  5447. getBinormals(): Vector3[];
  5448. /**
  5449. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  5450. */
  5451. getDistances(): number[];
  5452. /**
  5453. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  5454. * Returns the same object updated.
  5455. */
  5456. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  5457. private _compute(firstNormal);
  5458. private _getFirstNonNullVector(index);
  5459. private _getLastNonNullVector(index);
  5460. private _normalVector(v0, vt, va);
  5461. }
  5462. class Curve3 {
  5463. private _points;
  5464. private _length;
  5465. /**
  5466. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  5467. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  5468. * @param v1 (Vector3) the control point
  5469. * @param v2 (Vector3) the end point of the Quadratic Bezier
  5470. * @param nbPoints (integer) the wanted number of points in the curve
  5471. */
  5472. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  5473. /**
  5474. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  5475. * @param v0 (Vector3) the origin point of the Cubic Bezier
  5476. * @param v1 (Vector3) the first control point
  5477. * @param v2 (Vector3) the second control point
  5478. * @param v3 (Vector3) the end point of the Cubic Bezier
  5479. * @param nbPoints (integer) the wanted number of points in the curve
  5480. */
  5481. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  5482. /**
  5483. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  5484. * @param p1 (Vector3) the origin point of the Hermite Spline
  5485. * @param t1 (Vector3) the tangent vector at the origin point
  5486. * @param p2 (Vector3) the end point of the Hermite Spline
  5487. * @param t2 (Vector3) the tangent vector at the end point
  5488. * @param nbPoints (integer) the wanted number of points in the curve
  5489. */
  5490. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  5491. /**
  5492. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  5493. * A Curve3 is designed from a series of successive Vector3.
  5494. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  5495. */
  5496. constructor(points: Vector3[]);
  5497. /**
  5498. * Returns the Curve3 stored array of successive Vector3
  5499. */
  5500. getPoints(): Vector3[];
  5501. /**
  5502. * Returns the computed length (float) of the curve.
  5503. */
  5504. length(): number;
  5505. /**
  5506. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  5507. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  5508. * curveA and curveB keep unchanged.
  5509. */
  5510. continue(curve: Curve3): Curve3;
  5511. private _computeLength(path);
  5512. }
  5513. class SphericalHarmonics {
  5514. L00: Vector3;
  5515. L1_1: Vector3;
  5516. L10: Vector3;
  5517. L11: Vector3;
  5518. L2_2: Vector3;
  5519. L2_1: Vector3;
  5520. L20: Vector3;
  5521. L21: Vector3;
  5522. L22: Vector3;
  5523. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  5524. scale(scale: number): void;
  5525. }
  5526. class SphericalPolynomial {
  5527. x: Vector3;
  5528. y: Vector3;
  5529. z: Vector3;
  5530. xx: Vector3;
  5531. yy: Vector3;
  5532. zz: Vector3;
  5533. xy: Vector3;
  5534. yz: Vector3;
  5535. zx: Vector3;
  5536. addAmbient(color: Color3): void;
  5537. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  5538. }
  5539. class PositionNormalVertex {
  5540. position: Vector3;
  5541. normal: Vector3;
  5542. constructor(position?: Vector3, normal?: Vector3);
  5543. clone(): PositionNormalVertex;
  5544. }
  5545. class PositionNormalTextureVertex {
  5546. position: Vector3;
  5547. normal: Vector3;
  5548. uv: Vector2;
  5549. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  5550. clone(): PositionNormalTextureVertex;
  5551. }
  5552. class Tmp {
  5553. static Color3: Color3[];
  5554. static Vector2: Vector2[];
  5555. static Vector3: Vector3[];
  5556. static Vector4: Vector4[];
  5557. static Quaternion: Quaternion[];
  5558. static Matrix: Matrix[];
  5559. }
  5560. }
  5561. declare module BABYLON {
  5562. class AbstractMesh extends Node implements IDisposable, ICullable {
  5563. private static _BILLBOARDMODE_NONE;
  5564. private static _BILLBOARDMODE_X;
  5565. private static _BILLBOARDMODE_Y;
  5566. private static _BILLBOARDMODE_Z;
  5567. private static _BILLBOARDMODE_ALL;
  5568. static BILLBOARDMODE_NONE: number;
  5569. static BILLBOARDMODE_X: number;
  5570. static BILLBOARDMODE_Y: number;
  5571. static BILLBOARDMODE_Z: number;
  5572. static BILLBOARDMODE_ALL: number;
  5573. /**
  5574. * An event triggered when the mesh is disposed.
  5575. * @type {BABYLON.Observable}
  5576. */
  5577. onDisposeObservable: Observable<AbstractMesh>;
  5578. private _onDisposeObserver;
  5579. onDispose: () => void;
  5580. /**
  5581. * An event triggered when this mesh collides with another one
  5582. * @type {BABYLON.Observable}
  5583. */
  5584. onCollideObservable: Observable<AbstractMesh>;
  5585. private _onCollideObserver;
  5586. onCollide: () => void;
  5587. /**
  5588. * An event triggered when the collision's position changes
  5589. * @type {BABYLON.Observable}
  5590. */
  5591. onCollisionPositionChangeObservable: Observable<Vector3>;
  5592. private _onCollisionPositionChangeObserver;
  5593. onCollisionPositionChange: () => void;
  5594. /**
  5595. * An event triggered after the world matrix is updated
  5596. * @type {BABYLON.Observable}
  5597. */
  5598. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  5599. definedFacingForward: boolean;
  5600. position: Vector3;
  5601. private _rotation;
  5602. _rotationQuaternion: Quaternion;
  5603. private _scaling;
  5604. billboardMode: number;
  5605. visibility: number;
  5606. alphaIndex: number;
  5607. infiniteDistance: boolean;
  5608. isVisible: boolean;
  5609. isPickable: boolean;
  5610. showBoundingBox: boolean;
  5611. showSubMeshesBoundingBox: boolean;
  5612. isBlocker: boolean;
  5613. renderingGroupId: number;
  5614. material: Material;
  5615. receiveShadows: boolean;
  5616. renderOutline: boolean;
  5617. outlineColor: Color3;
  5618. outlineWidth: number;
  5619. renderOverlay: boolean;
  5620. overlayColor: Color3;
  5621. overlayAlpha: number;
  5622. hasVertexAlpha: boolean;
  5623. useVertexColors: boolean;
  5624. applyFog: boolean;
  5625. computeBonesUsingShaders: boolean;
  5626. scalingDeterminant: number;
  5627. numBoneInfluencers: number;
  5628. useOctreeForRenderingSelection: boolean;
  5629. useOctreeForPicking: boolean;
  5630. useOctreeForCollisions: boolean;
  5631. layerMask: number;
  5632. alwaysSelectAsActiveMesh: boolean;
  5633. /**
  5634. * This scene's action manager
  5635. * @type {BABYLON.ActionManager}
  5636. */
  5637. actionManager: ActionManager;
  5638. physicsImpostor: BABYLON.PhysicsImpostor;
  5639. onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void;
  5640. private _checkCollisions;
  5641. ellipsoid: Vector3;
  5642. ellipsoidOffset: Vector3;
  5643. private _collider;
  5644. private _oldPositionForCollisions;
  5645. private _diffPositionForCollisions;
  5646. private _newPositionForCollisions;
  5647. private _meshToBoneReferal;
  5648. edgesWidth: number;
  5649. edgesColor: Color4;
  5650. _edgesRenderer: EdgesRenderer;
  5651. private _localWorld;
  5652. _worldMatrix: Matrix;
  5653. private _rotateYByPI;
  5654. private _absolutePosition;
  5655. private _collisionsTransformMatrix;
  5656. private _collisionsScalingMatrix;
  5657. _positions: Vector3[];
  5658. private _isDirty;
  5659. _masterMesh: AbstractMesh;
  5660. _materialDefines: MaterialDefines;
  5661. _boundingInfo: BoundingInfo;
  5662. private _pivotMatrix;
  5663. _isDisposed: boolean;
  5664. _renderId: number;
  5665. subMeshes: SubMesh[];
  5666. _submeshesOctree: Octree<SubMesh>;
  5667. _intersectionsInProgress: AbstractMesh[];
  5668. private _isWorldMatrixFrozen;
  5669. _unIndexed: boolean;
  5670. _poseMatrix: Matrix;
  5671. _waitingActions: any;
  5672. _waitingFreezeWorldMatrix: boolean;
  5673. private _skeleton;
  5674. _bonesTransformMatrices: Float32Array;
  5675. skeleton: Skeleton;
  5676. constructor(name: string, scene: Scene);
  5677. /**
  5678. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5679. */
  5680. toString(fullDetails?: boolean): string;
  5681. /**
  5682. * Getting the rotation object.
  5683. * If rotation quaternion is set, this vector will (almost always) be the Zero vector!
  5684. */
  5685. rotation: Vector3;
  5686. scaling: Vector3;
  5687. rotationQuaternion: Quaternion;
  5688. updatePoseMatrix(matrix: Matrix): void;
  5689. getPoseMatrix(): Matrix;
  5690. disableEdgesRendering(): void;
  5691. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
  5692. isBlocked: boolean;
  5693. getLOD(camera: Camera): AbstractMesh;
  5694. getTotalVertices(): number;
  5695. getIndices(): number[] | Int32Array;
  5696. getVerticesData(kind: string): number[] | Float32Array;
  5697. isVerticesDataPresent(kind: string): boolean;
  5698. getBoundingInfo(): BoundingInfo;
  5699. setBoundingInfo(boundingInfo: BoundingInfo): void;
  5700. useBones: boolean;
  5701. _preActivate(): void;
  5702. _preActivateForIntermediateRendering(renderId: number): void;
  5703. _activate(renderId: number): void;
  5704. getWorldMatrix(): Matrix;
  5705. worldMatrixFromCache: Matrix;
  5706. absolutePosition: Vector3;
  5707. freezeWorldMatrix(): void;
  5708. unfreezeWorldMatrix(): void;
  5709. isWorldMatrixFrozen: boolean;
  5710. private static _rotationAxisCache;
  5711. rotate(axis: Vector3, amount: number, space?: Space): void;
  5712. translate(axis: Vector3, distance: number, space?: Space): void;
  5713. getAbsolutePosition(): Vector3;
  5714. setAbsolutePosition(absolutePosition: Vector3): void;
  5715. /**
  5716. * Perform relative position change from the point of view of behind the front of the mesh.
  5717. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5718. * Supports definition of mesh facing forward or backward.
  5719. * @param {number} amountRight
  5720. * @param {number} amountUp
  5721. * @param {number} amountForward
  5722. */
  5723. movePOV(amountRight: number, amountUp: number, amountForward: number): void;
  5724. /**
  5725. * Calculate relative position change from the point of view of behind the front of the mesh.
  5726. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5727. * Supports definition of mesh facing forward or backward.
  5728. * @param {number} amountRight
  5729. * @param {number} amountUp
  5730. * @param {number} amountForward
  5731. */
  5732. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  5733. /**
  5734. * Perform relative rotation change from the point of view of behind the front of the mesh.
  5735. * Supports definition of mesh facing forward or backward.
  5736. * @param {number} flipBack
  5737. * @param {number} twirlClockwise
  5738. * @param {number} tiltRight
  5739. */
  5740. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
  5741. /**
  5742. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  5743. * Supports definition of mesh facing forward or backward.
  5744. * @param {number} flipBack
  5745. * @param {number} twirlClockwise
  5746. * @param {number} tiltRight
  5747. */
  5748. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  5749. setPivotMatrix(matrix: Matrix): void;
  5750. getPivotMatrix(): Matrix;
  5751. _isSynchronized(): boolean;
  5752. _initCache(): void;
  5753. markAsDirty(property: string): void;
  5754. _updateBoundingInfo(): void;
  5755. _updateSubMeshesBoundingInfo(matrix: Matrix): void;
  5756. computeWorldMatrix(force?: boolean): Matrix;
  5757. /**
  5758. * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
  5759. * @param func: callback function to add
  5760. */
  5761. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5762. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5763. setPositionWithLocalVector(vector3: Vector3): void;
  5764. getPositionExpressedInLocalSpace(): Vector3;
  5765. locallyTranslate(vector3: Vector3): void;
  5766. private static _lookAtVectorCache;
  5767. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): void;
  5768. attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
  5769. detachFromBone(): void;
  5770. isInFrustum(frustumPlanes: Plane[]): boolean;
  5771. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  5772. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
  5773. intersectsPoint(point: Vector3): boolean;
  5774. /**
  5775. * @Deprecated. Use new PhysicsImpostor instead.
  5776. * */
  5777. setPhysicsState(impostor?: any, options?: PhysicsImpostorParameters): any;
  5778. getPhysicsImpostor(): PhysicsImpostor;
  5779. /**
  5780. * @Deprecated. Use getPhysicsImpostor().getParam("mass");
  5781. */
  5782. getPhysicsMass(): number;
  5783. /**
  5784. * @Deprecated. Use getPhysicsImpostor().getParam("friction");
  5785. */
  5786. getPhysicsFriction(): number;
  5787. /**
  5788. * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
  5789. */
  5790. getPhysicsRestitution(): number;
  5791. getPositionInCameraSpace(camera?: Camera): Vector3;
  5792. getDistanceToCamera(camera?: Camera): number;
  5793. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  5794. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  5795. /**
  5796. * @Deprecated
  5797. */
  5798. updatePhysicsBodyPosition(): void;
  5799. /**
  5800. * @Deprecated
  5801. * Calling this function is not needed anymore.
  5802. * The physics engine takes care of transofmration automatically.
  5803. */
  5804. updatePhysicsBody(): void;
  5805. checkCollisions: boolean;
  5806. moveWithCollisions(velocity: Vector3): void;
  5807. private _onCollisionPositionChange;
  5808. /**
  5809. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  5810. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  5811. */
  5812. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  5813. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void;
  5814. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void;
  5815. _checkCollision(collider: Collider): void;
  5816. _generatePointsArray(): boolean;
  5817. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  5818. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  5819. releaseSubMeshes(): void;
  5820. dispose(doNotRecurse?: boolean): void;
  5821. }
  5822. }
  5823. declare module BABYLON {
  5824. class Buffer {
  5825. private _engine;
  5826. private _buffer;
  5827. private _data;
  5828. private _updatable;
  5829. private _strideSize;
  5830. private _instanced;
  5831. constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  5832. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  5833. isUpdatable(): boolean;
  5834. getData(): number[] | Float32Array;
  5835. getBuffer(): WebGLBuffer;
  5836. getStrideSize(): number;
  5837. getIsInstanced(): boolean;
  5838. create(data?: number[] | Float32Array): void;
  5839. update(data: number[] | Float32Array): void;
  5840. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  5841. dispose(): void;
  5842. }
  5843. }
  5844. declare module BABYLON {
  5845. class CSG {
  5846. private polygons;
  5847. matrix: Matrix;
  5848. position: Vector3;
  5849. rotation: Vector3;
  5850. rotationQuaternion: Quaternion;
  5851. scaling: Vector3;
  5852. static FromMesh(mesh: Mesh): CSG;
  5853. private static FromPolygons(polygons);
  5854. clone(): CSG;
  5855. private toPolygons();
  5856. union(csg: CSG): CSG;
  5857. unionInPlace(csg: CSG): void;
  5858. subtract(csg: CSG): CSG;
  5859. subtractInPlace(csg: CSG): void;
  5860. intersect(csg: CSG): CSG;
  5861. intersectInPlace(csg: CSG): void;
  5862. inverse(): CSG;
  5863. inverseInPlace(): void;
  5864. copyTransformAttributes(csg: CSG): CSG;
  5865. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  5866. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  5867. }
  5868. }
  5869. declare module BABYLON {
  5870. class Geometry implements IGetSetVerticesData {
  5871. id: string;
  5872. delayLoadState: number;
  5873. delayLoadingFile: string;
  5874. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  5875. private _scene;
  5876. private _engine;
  5877. private _meshes;
  5878. private _totalVertices;
  5879. private _indices;
  5880. private _vertexBuffers;
  5881. private _isDisposed;
  5882. private _extend;
  5883. private _boundingBias;
  5884. _delayInfo: any;
  5885. private _indexBuffer;
  5886. _boundingInfo: BoundingInfo;
  5887. _delayLoadingFunction: (any: any, geometry: Geometry) => void;
  5888. _softwareSkinningRenderId: number;
  5889. /**
  5890. * 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
  5891. * @returns The Bias Vector
  5892. */
  5893. boundingBias: Vector2;
  5894. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  5895. extend: {
  5896. minimum: Vector3;
  5897. maximum: Vector3;
  5898. };
  5899. getScene(): Scene;
  5900. getEngine(): Engine;
  5901. isReady(): boolean;
  5902. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5903. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  5904. setVerticesBuffer(buffer: VertexBuffer): void;
  5905. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  5906. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  5907. private updateBoundingInfo(updateExtends, data);
  5908. getTotalVertices(): number;
  5909. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5910. getVertexBuffer(kind: string): VertexBuffer;
  5911. getVertexBuffers(): {
  5912. [key: string]: VertexBuffer;
  5913. };
  5914. isVerticesDataPresent(kind: string): boolean;
  5915. getVerticesDataKinds(): string[];
  5916. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  5917. getTotalIndices(): number;
  5918. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  5919. getIndexBuffer(): WebGLBuffer;
  5920. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  5921. applyToMesh(mesh: Mesh): void;
  5922. private updateExtend(data?, stride?);
  5923. private _applyToMesh(mesh);
  5924. private notifyUpdate(kind?);
  5925. load(scene: Scene, onLoaded?: () => void): void;
  5926. private _queueLoad(scene, onLoaded?);
  5927. /**
  5928. * Invert the geometry to move from a right handed system to a left handed one.
  5929. */
  5930. toLeftHanded(): void;
  5931. isDisposed(): boolean;
  5932. dispose(): void;
  5933. copy(id: string): Geometry;
  5934. serialize(): any;
  5935. serializeVerticeData(): any;
  5936. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  5937. /**
  5938. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  5939. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  5940. * Be aware Math.random() could cause collisions, but:
  5941. * "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"
  5942. */
  5943. static RandomId(): string;
  5944. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  5945. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  5946. }
  5947. module Geometry.Primitives {
  5948. class _Primitive extends Geometry {
  5949. private _canBeRegenerated;
  5950. private _beingRegenerated;
  5951. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  5952. canBeRegenerated(): boolean;
  5953. regenerate(): void;
  5954. asNewGeometry(id: string): Geometry;
  5955. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5956. setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void;
  5957. _regenerateVertexData(): VertexData;
  5958. copy(id: string): Geometry;
  5959. serialize(): any;
  5960. }
  5961. class Ribbon extends _Primitive {
  5962. pathArray: Vector3[][];
  5963. closeArray: boolean;
  5964. closePath: boolean;
  5965. offset: number;
  5966. side: number;
  5967. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5968. _regenerateVertexData(): VertexData;
  5969. copy(id: string): Geometry;
  5970. }
  5971. class Box extends _Primitive {
  5972. size: number;
  5973. side: number;
  5974. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5975. _regenerateVertexData(): VertexData;
  5976. copy(id: string): Geometry;
  5977. serialize(): any;
  5978. static Parse(parsedBox: any, scene: Scene): Box;
  5979. }
  5980. class Sphere extends _Primitive {
  5981. segments: number;
  5982. diameter: number;
  5983. side: number;
  5984. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5985. _regenerateVertexData(): VertexData;
  5986. copy(id: string): Geometry;
  5987. serialize(): any;
  5988. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  5989. }
  5990. class Disc extends _Primitive {
  5991. radius: number;
  5992. tessellation: number;
  5993. side: number;
  5994. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  5995. _regenerateVertexData(): VertexData;
  5996. copy(id: string): Geometry;
  5997. }
  5998. class Cylinder extends _Primitive {
  5999. height: number;
  6000. diameterTop: number;
  6001. diameterBottom: number;
  6002. tessellation: number;
  6003. subdivisions: number;
  6004. side: number;
  6005. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6006. _regenerateVertexData(): VertexData;
  6007. copy(id: string): Geometry;
  6008. serialize(): any;
  6009. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  6010. }
  6011. class Torus extends _Primitive {
  6012. diameter: number;
  6013. thickness: number;
  6014. tessellation: number;
  6015. side: number;
  6016. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6017. _regenerateVertexData(): VertexData;
  6018. copy(id: string): Geometry;
  6019. serialize(): any;
  6020. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  6021. }
  6022. class Ground extends _Primitive {
  6023. width: number;
  6024. height: number;
  6025. subdivisions: number;
  6026. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  6027. _regenerateVertexData(): VertexData;
  6028. copy(id: string): Geometry;
  6029. serialize(): any;
  6030. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  6031. }
  6032. class TiledGround extends _Primitive {
  6033. xmin: number;
  6034. zmin: number;
  6035. xmax: number;
  6036. zmax: number;
  6037. subdivisions: {
  6038. w: number;
  6039. h: number;
  6040. };
  6041. precision: {
  6042. w: number;
  6043. h: number;
  6044. };
  6045. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6046. w: number;
  6047. h: number;
  6048. }, precision: {
  6049. w: number;
  6050. h: number;
  6051. }, canBeRegenerated?: boolean, mesh?: Mesh);
  6052. _regenerateVertexData(): VertexData;
  6053. copy(id: string): Geometry;
  6054. }
  6055. class Plane extends _Primitive {
  6056. size: number;
  6057. side: number;
  6058. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6059. _regenerateVertexData(): VertexData;
  6060. copy(id: string): Geometry;
  6061. serialize(): any;
  6062. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  6063. }
  6064. class TorusKnot extends _Primitive {
  6065. radius: number;
  6066. tube: number;
  6067. radialSegments: number;
  6068. tubularSegments: number;
  6069. p: number;
  6070. q: number;
  6071. side: number;
  6072. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6073. _regenerateVertexData(): VertexData;
  6074. copy(id: string): Geometry;
  6075. serialize(): any;
  6076. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  6077. }
  6078. }
  6079. }
  6080. declare module BABYLON {
  6081. class GroundMesh extends Mesh {
  6082. generateOctree: boolean;
  6083. private _worldInverse;
  6084. private _heightQuads;
  6085. _subdivisionsX: number;
  6086. _subdivisionsY: number;
  6087. _width: number;
  6088. _height: number;
  6089. _minX: number;
  6090. _maxX: number;
  6091. _minZ: number;
  6092. _maxZ: number;
  6093. constructor(name: string, scene: Scene);
  6094. subdivisions: number;
  6095. subdivisionsX: number;
  6096. subdivisionsY: number;
  6097. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  6098. /**
  6099. * Returns a height (y) value in the Worl system :
  6100. * the ground altitude at the coordinates (x, z) expressed in the World system.
  6101. * Returns the ground y position if (x, z) are outside the ground surface.
  6102. * Not pertinent if the ground is rotated.
  6103. */
  6104. getHeightAtCoordinates(x: number, z: number): number;
  6105. /**
  6106. * Returns a normalized vector (Vector3) orthogonal to the ground
  6107. * at the ground coordinates (x, z) expressed in the World system.
  6108. * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface.
  6109. * Not pertinent if the ground is rotated.
  6110. */
  6111. getNormalAtCoordinates(x: number, z: number): Vector3;
  6112. /**
  6113. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  6114. * at the ground coordinates (x, z) expressed in the World system.
  6115. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  6116. * Not pertinent if the ground is rotated.
  6117. */
  6118. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void;
  6119. /**
  6120. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  6121. * if the ground has been updated.
  6122. * This can be used in the render loop
  6123. */
  6124. updateCoordinateHeights(): void;
  6125. private _getFacetAt(x, z);
  6126. private _initHeightQuads();
  6127. private _computeHeightQuads();
  6128. }
  6129. }
  6130. declare module BABYLON {
  6131. /**
  6132. * Creates an instance based on a source mesh.
  6133. */
  6134. class InstancedMesh extends AbstractMesh {
  6135. private _sourceMesh;
  6136. private _currentLOD;
  6137. constructor(name: string, source: Mesh);
  6138. receiveShadows: boolean;
  6139. material: Material;
  6140. visibility: number;
  6141. skeleton: Skeleton;
  6142. renderingGroupId: number;
  6143. getTotalVertices(): number;
  6144. sourceMesh: Mesh;
  6145. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  6146. isVerticesDataPresent(kind: string): boolean;
  6147. getIndices(): number[] | Int32Array;
  6148. _positions: Vector3[];
  6149. refreshBoundingInfo(): void;
  6150. _preActivate(): void;
  6151. _activate(renderId: number): void;
  6152. getLOD(camera: Camera): AbstractMesh;
  6153. _syncSubMeshes(): void;
  6154. _generatePointsArray(): boolean;
  6155. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  6156. dispose(doNotRecurse?: boolean): void;
  6157. }
  6158. }
  6159. declare module BABYLON {
  6160. class LinesMesh extends Mesh {
  6161. color: Color3;
  6162. alpha: number;
  6163. private _positionBuffer;
  6164. /**
  6165. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6166. * This margin is expressed in world space coordinates, so its value may vary.
  6167. * Default value is 0.1
  6168. * @returns the intersection Threshold value.
  6169. */
  6170. /**
  6171. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6172. * This margin is expressed in world space coordinates, so its value may vary.
  6173. * @param value the new threshold to apply
  6174. */
  6175. intersectionThreshold: number;
  6176. private _intersectionThreshold;
  6177. private _colorShader;
  6178. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean);
  6179. material: Material;
  6180. checkCollisions: boolean;
  6181. createInstance(name: string): InstancedMesh;
  6182. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  6183. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  6184. dispose(doNotRecurse?: boolean): void;
  6185. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  6186. }
  6187. }
  6188. declare module BABYLON {
  6189. class _InstancesBatch {
  6190. mustReturn: boolean;
  6191. visibleInstances: InstancedMesh[][];
  6192. renderSelf: boolean[];
  6193. }
  6194. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  6195. static _FRONTSIDE: number;
  6196. static _BACKSIDE: number;
  6197. static _DOUBLESIDE: number;
  6198. static _DEFAULTSIDE: number;
  6199. static _NO_CAP: number;
  6200. static _CAP_START: number;
  6201. static _CAP_END: number;
  6202. static _CAP_ALL: number;
  6203. /**
  6204. * Mesh side orientation : usually the external or front surface
  6205. */
  6206. static FRONTSIDE: number;
  6207. /**
  6208. * Mesh side orientation : usually the internal or back surface
  6209. */
  6210. static BACKSIDE: number;
  6211. /**
  6212. * Mesh side orientation : both internal and external or front and back surfaces
  6213. */
  6214. static DOUBLESIDE: number;
  6215. /**
  6216. * Mesh side orientation : by default, `FRONTSIDE`
  6217. */
  6218. static DEFAULTSIDE: number;
  6219. /**
  6220. * Mesh cap setting : no cap
  6221. */
  6222. static NO_CAP: number;
  6223. /**
  6224. * Mesh cap setting : one cap at the beginning of the mesh
  6225. */
  6226. static CAP_START: number;
  6227. /**
  6228. * Mesh cap setting : one cap at the end of the mesh
  6229. */
  6230. static CAP_END: number;
  6231. /**
  6232. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  6233. */
  6234. static CAP_ALL: number;
  6235. /**
  6236. * An event triggered before rendering the mesh
  6237. * @type {BABYLON.Observable}
  6238. */
  6239. onBeforeRenderObservable: Observable<Mesh>;
  6240. /**
  6241. * An event triggered after rendering the mesh
  6242. * @type {BABYLON.Observable}
  6243. */
  6244. onAfterRenderObservable: Observable<Mesh>;
  6245. /**
  6246. * An event triggered before drawing the mesh
  6247. * @type {BABYLON.Observable}
  6248. */
  6249. onBeforeDrawObservable: Observable<Mesh>;
  6250. private _onBeforeDrawObserver;
  6251. onBeforeDraw: () => void;
  6252. delayLoadState: number;
  6253. instances: InstancedMesh[];
  6254. delayLoadingFile: string;
  6255. _binaryInfo: any;
  6256. private _LODLevels;
  6257. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  6258. _geometry: Geometry;
  6259. _delayInfo: any;
  6260. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  6261. _visibleInstances: any;
  6262. private _renderIdForInstances;
  6263. private _batchCache;
  6264. private _instancesBufferSize;
  6265. private _instancesBuffer;
  6266. private _instancesData;
  6267. private _overridenInstanceCount;
  6268. _shouldGenerateFlatShading: boolean;
  6269. private _preActivateId;
  6270. private _sideOrientation;
  6271. private _areNormalsFrozen;
  6272. private _sourcePositions;
  6273. private _sourceNormals;
  6274. /**
  6275. * @constructor
  6276. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  6277. * @param {Scene} scene The scene to add this mesh to.
  6278. * @param {Node} parent The parent of this mesh, if it has one
  6279. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  6280. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  6281. * When false, achieved by calling a clone(), also passing False.
  6282. * This will make creation of children, recursive.
  6283. */
  6284. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  6285. /**
  6286. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  6287. */
  6288. toString(fullDetails?: boolean): string;
  6289. hasLODLevels: boolean;
  6290. private _sortLODLevels();
  6291. /**
  6292. * Add a mesh as LOD level triggered at the given distance.
  6293. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6294. * @param {number} distance The distance from the center of the object to show this level
  6295. * @param {Mesh} mesh The mesh to be added as LOD level
  6296. * @return {Mesh} This mesh (for chaining)
  6297. */
  6298. addLODLevel(distance: number, mesh: Mesh): Mesh;
  6299. /**
  6300. * Returns the LOD level mesh at the passed distance or null if not found.
  6301. * It is related to the method `addLODLevel(distance, mesh)`.
  6302. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6303. */
  6304. getLODLevelAtDistance(distance: number): Mesh;
  6305. /**
  6306. * Remove a mesh from the LOD array
  6307. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6308. * @param {Mesh} mesh The mesh to be removed.
  6309. * @return {Mesh} This mesh (for chaining)
  6310. */
  6311. removeLODLevel(mesh: Mesh): Mesh;
  6312. /**
  6313. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  6314. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6315. */
  6316. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  6317. /**
  6318. * Returns the mesh internal Geometry object.
  6319. */
  6320. geometry: Geometry;
  6321. /**
  6322. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  6323. */
  6324. getTotalVertices(): number;
  6325. /**
  6326. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  6327. * 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.
  6328. * Returns null if the mesh has no geometry or no vertex buffer.
  6329. * Possible `kind` values :
  6330. * - BABYLON.VertexBuffer.PositionKind
  6331. * - BABYLON.VertexBuffer.UVKind
  6332. * - BABYLON.VertexBuffer.UV2Kind
  6333. * - BABYLON.VertexBuffer.UV3Kind
  6334. * - BABYLON.VertexBuffer.UV4Kind
  6335. * - BABYLON.VertexBuffer.UV5Kind
  6336. * - BABYLON.VertexBuffer.UV6Kind
  6337. * - BABYLON.VertexBuffer.ColorKind
  6338. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6339. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6340. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6341. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6342. */
  6343. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  6344. /**
  6345. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  6346. * Returns `undefined` if the mesh has no geometry.
  6347. * Possible `kind` values :
  6348. * - BABYLON.VertexBuffer.PositionKind
  6349. * - BABYLON.VertexBuffer.UVKind
  6350. * - BABYLON.VertexBuffer.UV2Kind
  6351. * - BABYLON.VertexBuffer.UV3Kind
  6352. * - BABYLON.VertexBuffer.UV4Kind
  6353. * - BABYLON.VertexBuffer.UV5Kind
  6354. * - BABYLON.VertexBuffer.UV6Kind
  6355. * - BABYLON.VertexBuffer.ColorKind
  6356. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6357. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6358. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6359. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6360. */
  6361. getVertexBuffer(kind: any): VertexBuffer;
  6362. /**
  6363. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  6364. * Possible `kind` values :
  6365. * - BABYLON.VertexBuffer.PositionKind
  6366. * - BABYLON.VertexBuffer.UVKind
  6367. * - BABYLON.VertexBuffer.UV2Kind
  6368. * - BABYLON.VertexBuffer.UV3Kind
  6369. * - BABYLON.VertexBuffer.UV4Kind
  6370. * - BABYLON.VertexBuffer.UV5Kind
  6371. * - BABYLON.VertexBuffer.UV6Kind
  6372. * - BABYLON.VertexBuffer.ColorKind
  6373. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6374. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6375. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6376. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6377. */
  6378. isVerticesDataPresent(kind: string): boolean;
  6379. /**
  6380. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  6381. * Possible `kind` values :
  6382. * - BABYLON.VertexBuffer.PositionKind
  6383. * - BABYLON.VertexBuffer.UVKind
  6384. * - BABYLON.VertexBuffer.UV2Kind
  6385. * - BABYLON.VertexBuffer.UV3Kind
  6386. * - BABYLON.VertexBuffer.UV4Kind
  6387. * - BABYLON.VertexBuffer.UV5Kind
  6388. * - BABYLON.VertexBuffer.UV6Kind
  6389. * - BABYLON.VertexBuffer.ColorKind
  6390. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6391. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6392. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6393. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6394. */
  6395. getVerticesDataKinds(): string[];
  6396. /**
  6397. * Returns a positive integer : the total number of indices in this mesh geometry.
  6398. * Returns zero if the mesh has no geometry.
  6399. */
  6400. getTotalIndices(): number;
  6401. /**
  6402. * Returns an array of integers or a Int32Array populated with the mesh indices.
  6403. * 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.
  6404. * Returns an empty array if the mesh has no geometry.
  6405. */
  6406. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  6407. isBlocked: boolean;
  6408. /**
  6409. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  6410. */
  6411. isReady(): boolean;
  6412. /**
  6413. * Boolean : true if the mesh has been disposed.
  6414. */
  6415. isDisposed(): boolean;
  6416. /**
  6417. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  6418. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  6419. */
  6420. sideOrientation: number;
  6421. /**
  6422. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  6423. * This property is pertinent only for updatable parametric shapes.
  6424. */
  6425. areNormalsFrozen: boolean;
  6426. /**
  6427. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6428. * It has no effect at all on other shapes.
  6429. * It prevents the mesh normals from being recomputed on next `positions` array update.
  6430. */
  6431. freezeNormals(): void;
  6432. /**
  6433. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6434. * It has no effect at all on other shapes.
  6435. * It reactivates the mesh normals computation if it was previously frozen.
  6436. */
  6437. unfreezeNormals(): void;
  6438. /**
  6439. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  6440. */
  6441. overridenInstanceCount: number;
  6442. _preActivate(): void;
  6443. _preActivateForIntermediateRendering(renderId: number): void;
  6444. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void;
  6445. /**
  6446. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  6447. * This means the mesh underlying bounding box and sphere are recomputed.
  6448. */
  6449. refreshBoundingInfo(): void;
  6450. _createGlobalSubMesh(): SubMesh;
  6451. subdivide(count: number): void;
  6452. /**
  6453. * Sets the vertex data of the mesh geometry for the requested `kind`.
  6454. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  6455. * The `data` are either a numeric array either a Float32Array.
  6456. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  6457. * 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).
  6458. * Note that a new underlying VertexBuffer object is created each call.
  6459. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  6460. *
  6461. * Possible `kind` values :
  6462. * - BABYLON.VertexBuffer.PositionKind
  6463. * - BABYLON.VertexBuffer.UVKind
  6464. * - BABYLON.VertexBuffer.UV2Kind
  6465. * - BABYLON.VertexBuffer.UV3Kind
  6466. * - BABYLON.VertexBuffer.UV4Kind
  6467. * - BABYLON.VertexBuffer.UV5Kind
  6468. * - BABYLON.VertexBuffer.UV6Kind
  6469. * - BABYLON.VertexBuffer.ColorKind
  6470. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6471. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6472. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6473. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6474. */
  6475. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  6476. setVerticesBuffer(buffer: VertexBuffer): void;
  6477. /**
  6478. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  6479. * If the mesh has no geometry, it is simply returned as it is.
  6480. * The `data` are either a numeric array either a Float32Array.
  6481. * No new underlying VertexBuffer object is created.
  6482. * 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.
  6483. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  6484. *
  6485. * Possible `kind` values :
  6486. * - BABYLON.VertexBuffer.PositionKind
  6487. * - BABYLON.VertexBuffer.UVKind
  6488. * - BABYLON.VertexBuffer.UV2Kind
  6489. * - BABYLON.VertexBuffer.UV3Kind
  6490. * - BABYLON.VertexBuffer.UV4Kind
  6491. * - BABYLON.VertexBuffer.UV5Kind
  6492. * - BABYLON.VertexBuffer.UV6Kind
  6493. * - BABYLON.VertexBuffer.ColorKind
  6494. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6495. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6496. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6497. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6498. */
  6499. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  6500. /**
  6501. * Deprecated since BabylonJS v2.3
  6502. */
  6503. updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
  6504. /**
  6505. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  6506. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  6507. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  6508. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  6509. */
  6510. updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
  6511. makeGeometryUnique(): void;
  6512. /**
  6513. * Sets the mesh indices.
  6514. * Expects an array populated with integers or a Int32Array.
  6515. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  6516. * This method creates a new index buffer each call.
  6517. */
  6518. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  6519. /**
  6520. * Invert the geometry to move from a right handed system to a left handed one.
  6521. */
  6522. toLeftHanded(): void;
  6523. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  6524. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  6525. /**
  6526. * Registers for this mesh a javascript function called just before the rendering process.
  6527. * This function is passed the current mesh and doesn't return anything.
  6528. */
  6529. registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
  6530. /**
  6531. * Disposes a previously registered javascript function called before the rendering.
  6532. * This function is passed the current mesh and doesn't return anything.
  6533. */
  6534. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
  6535. /**
  6536. * Registers for this mesh a javascript function called just after the rendering is complete.
  6537. * This function is passed the current mesh and doesn't return anything.
  6538. */
  6539. registerAfterRender(func: (mesh: AbstractMesh) => void): void;
  6540. /**
  6541. * Disposes a previously registered javascript function called after the rendering.
  6542. * This function is passed the current mesh and doesn't return anything.
  6543. */
  6544. unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
  6545. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  6546. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void;
  6547. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix, effectiveMaterial?: Material) => void, effectiveMaterial?: Material): void;
  6548. /**
  6549. * Triggers the draw call for the mesh.
  6550. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  6551. */
  6552. render(subMesh: SubMesh, enableAlphaMode: boolean): void;
  6553. private _onBeforeDraw(isInstance, world, effectiveMaterial);
  6554. /**
  6555. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  6556. */
  6557. getEmittedParticleSystems(): ParticleSystem[];
  6558. /**
  6559. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  6560. */
  6561. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  6562. _checkDelayState(): void;
  6563. private _queueLoad(mesh, scene);
  6564. /**
  6565. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  6566. */
  6567. isInFrustum(frustumPlanes: Plane[]): boolean;
  6568. /**
  6569. * Sets the mesh material by the material or multiMaterial `id` property.
  6570. * The material `id` is a string identifying the material or the multiMaterial.
  6571. * This method returns nothing.
  6572. */
  6573. setMaterialByID(id: string): void;
  6574. /**
  6575. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  6576. */
  6577. getAnimatables(): IAnimatable[];
  6578. /**
  6579. * Modifies the mesh geometry according to the passed transformation matrix.
  6580. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  6581. * The mesh normals are modified accordingly the same transformation.
  6582. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6583. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6584. */
  6585. bakeTransformIntoVertices(transform: Matrix): void;
  6586. /**
  6587. * Modifies the mesh geometry according to its own current World Matrix.
  6588. * The mesh World Matrix is then reset.
  6589. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  6590. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6591. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6592. */
  6593. bakeCurrentTransformIntoVertices(): void;
  6594. _resetPointsArrayCache(): void;
  6595. _generatePointsArray(): boolean;
  6596. /**
  6597. * Returns a new Mesh object generated from the current mesh properties.
  6598. * This method must not get confused with createInstance().
  6599. * The parameter `name` is a string, the name given to the new mesh.
  6600. * The optional parameter `newParent` can be any Node object (default `null`).
  6601. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  6602. * 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.
  6603. */
  6604. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  6605. /**
  6606. * Disposes the mesh.
  6607. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  6608. */
  6609. dispose(doNotRecurse?: boolean): void;
  6610. /**
  6611. * Modifies the mesh geometry according to a displacement map.
  6612. * 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.
  6613. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6614. * This method returns nothing.
  6615. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  6616. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6617. * 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.
  6618. */
  6619. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
  6620. /**
  6621. * Modifies the mesh geometry according to a displacementMap buffer.
  6622. * 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.
  6623. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6624. * This method returns nothing.
  6625. * 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.
  6626. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  6627. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6628. */
  6629. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  6630. /**
  6631. * Modify the mesh to get a flat shading rendering.
  6632. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  6633. * This method returns nothing.
  6634. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  6635. */
  6636. convertToFlatShadedMesh(): void;
  6637. /**
  6638. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  6639. * In other words, more vertices, no more indices and a single bigger VBO.
  6640. * This method returns nothing.
  6641. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  6642. *
  6643. */
  6644. convertToUnIndexedMesh(): void;
  6645. /**
  6646. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  6647. * This method returns nothing.
  6648. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  6649. */
  6650. flipFaces(flipNormals?: boolean): void;
  6651. /**
  6652. * Creates a new InstancedMesh object from the mesh model.
  6653. * An instance shares the same properties and the same material than its model.
  6654. * Only these properties of each instance can then be set individually :
  6655. * - position
  6656. * - rotation
  6657. * - rotationQuaternion
  6658. * - setPivotMatrix
  6659. * - scaling
  6660. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  6661. * Warning : this method is not supported for Line mesh and LineSystem
  6662. */
  6663. createInstance(name: string): InstancedMesh;
  6664. /**
  6665. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  6666. * After this call, all the mesh instances have the same submeshes than the current mesh.
  6667. * This method returns nothing.
  6668. */
  6669. synchronizeInstances(): void;
  6670. /**
  6671. * Simplify the mesh according to the given array of settings.
  6672. * Function will return immediately and will simplify async. It returns nothing.
  6673. * @param settings a collection of simplification settings.
  6674. * @param parallelProcessing should all levels calculate parallel or one after the other.
  6675. * @param type the type of simplification to run.
  6676. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  6677. */
  6678. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
  6679. /**
  6680. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  6681. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  6682. * This should be used together with the simplification to avoid disappearing triangles.
  6683. * @param successCallback an optional success callback to be called after the optimization finished.
  6684. */
  6685. optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
  6686. /**
  6687. * Returns a new Mesh object what is a deep copy of the passed mesh.
  6688. * The parameter `parsedMesh` is the mesh to be copied.
  6689. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  6690. */
  6691. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  6692. /**
  6693. * Creates a ribbon mesh.
  6694. * Please consider using the same method from the MeshBuilder class instead.
  6695. * 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.
  6696. *
  6697. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  6698. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  6699. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  6700. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  6701. * 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.
  6702. * 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.
  6703. * 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
  6704. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6705. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6706. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6707. */
  6708. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6709. /**
  6710. * Creates a plane polygonal mesh. By default, this is a disc.
  6711. * Please consider using the same method from the MeshBuilder class instead.
  6712. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  6713. * 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.
  6714. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6715. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6716. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6717. */
  6718. static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6719. /**
  6720. * Creates a box mesh.
  6721. * Please consider using the same method from the MeshBuilder class instead.
  6722. * The parameter `size` sets the size (float) of each box side (default 1).
  6723. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6724. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6725. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6726. */
  6727. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6728. /**
  6729. * Creates a sphere mesh.
  6730. * Please consider using the same method from the MeshBuilder class instead.
  6731. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  6732. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  6733. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6734. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6735. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6736. */
  6737. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6738. /**
  6739. * Creates a cylinder or a cone mesh.
  6740. * Please consider using the same method from the MeshBuilder class instead.
  6741. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  6742. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  6743. * 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.
  6744. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  6745. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  6746. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6747. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6748. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6749. */
  6750. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
  6751. /**
  6752. * Creates a torus mesh.
  6753. * Please consider using the same method from the MeshBuilder class instead.
  6754. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  6755. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  6756. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  6757. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6758. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6759. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6760. */
  6761. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6762. /**
  6763. * Creates a torus knot mesh.
  6764. * Please consider using the same method from the MeshBuilder class instead.
  6765. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  6766. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  6767. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  6768. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  6769. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6770. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6771. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6772. */
  6773. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6774. /**
  6775. * Creates a line mesh.
  6776. * Please consider using the same method from the MeshBuilder class instead.
  6777. * 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.
  6778. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6779. * The parameter `points` is an array successive Vector3.
  6780. * 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
  6781. * When updating an instance, remember that only point positions can change, not the number of points.
  6782. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6783. */
  6784. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6785. /**
  6786. * Creates a dashed line mesh.
  6787. * Please consider using the same method from the MeshBuilder class instead.
  6788. * 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.
  6789. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6790. * The parameter `points` is an array successive Vector3.
  6791. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  6792. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  6793. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  6794. * 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
  6795. * When updating an instance, remember that only point positions can change, not the number of points.
  6796. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6797. */
  6798. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6799. /**
  6800. * Creates an extruded shape mesh.
  6801. * 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.
  6802. * Please consider using the same method from the MeshBuilder class instead.
  6803. *
  6804. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6805. * 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
  6806. * extruded along the Z axis.
  6807. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6808. * 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.
  6809. * The parameter `scale` (float, default 1) is the value to scale the shape.
  6810. * 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
  6811. * 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
  6812. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6813. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6814. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6815. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6816. */
  6817. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6818. /**
  6819. * Creates an custom extruded shape mesh.
  6820. * 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.
  6821. * Please consider using the same method from the MeshBuilder class instead.
  6822. *
  6823. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6824. * 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
  6825. * extruded along the Z axis.
  6826. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6827. * 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
  6828. * and the distance of this point from the begining of the path :
  6829. * ```javascript
  6830. * var rotationFunction = function(i, distance) {
  6831. * // do things
  6832. * return rotationValue; }
  6833. * ```
  6834. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  6835. * 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
  6836. * and the distance of this point from the begining of the path :
  6837. * ```javascript
  6838. * var scaleFunction = function(i, distance) {
  6839. * // do things
  6840. * return scaleValue;}
  6841. * ```
  6842. * It must returns a float value that will be the scale value applied to the shape on each path point.
  6843. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  6844. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  6845. * 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
  6846. * 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
  6847. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6848. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6849. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6850. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6851. */
  6852. 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;
  6853. /**
  6854. * Creates lathe mesh.
  6855. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  6856. * Please consider using the same method from the MeshBuilder class instead.
  6857. * 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
  6858. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  6859. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  6860. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  6861. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6862. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6863. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6864. */
  6865. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6866. /**
  6867. * Creates a plane mesh.
  6868. * Please consider using the same method from the MeshBuilder class instead.
  6869. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6870. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6871. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6872. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6873. */
  6874. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6875. /**
  6876. * Creates a ground mesh.
  6877. * Please consider using the same method from the MeshBuilder class instead.
  6878. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6879. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6880. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6881. */
  6882. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  6883. /**
  6884. * Creates a tiled ground mesh.
  6885. * Please consider using the same method from the MeshBuilder class instead.
  6886. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6887. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6888. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6889. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6890. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6891. * numbers of subdivisions on the ground width and height of each tile.
  6892. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6893. */
  6894. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6895. w: number;
  6896. h: number;
  6897. }, precision: {
  6898. w: number;
  6899. h: number;
  6900. }, scene: Scene, updatable?: boolean): Mesh;
  6901. /**
  6902. * Creates a ground mesh from a height map.
  6903. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6904. * Please consider using the same method from the MeshBuilder class instead.
  6905. * The parameter `url` sets the URL of the height map image resource.
  6906. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6907. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6908. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6909. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6910. * 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).
  6911. * This function is passed the newly built mesh :
  6912. * ```javascript
  6913. * function(mesh) { // do things
  6914. * return; }
  6915. * ```
  6916. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6917. */
  6918. 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;
  6919. /**
  6920. * Creates a tube mesh.
  6921. * 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.
  6922. * Please consider using the same method from the MeshBuilder class instead.
  6923. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  6924. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6925. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6926. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6927. * 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.
  6928. * It must return a radius value (positive float) :
  6929. * ```javascript
  6930. * var radiusFunction = function(i, distance) {
  6931. * // do things
  6932. * return radius; }
  6933. * ```
  6934. * 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
  6935. * 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
  6936. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6937. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6938. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6939. */
  6940. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  6941. (i: number, distance: number): number;
  6942. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6943. /**
  6944. * Creates a polyhedron mesh.
  6945. * Please consider using the same method from the MeshBuilder class instead.
  6946. * 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
  6947. * to choose the wanted type.
  6948. * The parameter `size` (positive float, default 1) sets the polygon size.
  6949. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  6950. * 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`.
  6951. * 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
  6952. * 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)`).
  6953. * 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
  6954. * 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.
  6955. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6956. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6957. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6958. */
  6959. static CreatePolyhedron(name: string, options: {
  6960. type?: number;
  6961. size?: number;
  6962. sizeX?: number;
  6963. sizeY?: number;
  6964. sizeZ?: number;
  6965. custom?: any;
  6966. faceUV?: Vector4[];
  6967. faceColors?: Color4[];
  6968. updatable?: boolean;
  6969. sideOrientation?: number;
  6970. }, scene: Scene): Mesh;
  6971. /**
  6972. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  6973. * Please consider using the same method from the MeshBuilder class instead.
  6974. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  6975. * 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`).
  6976. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  6977. * 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.
  6978. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6979. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6980. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6981. */
  6982. static CreateIcoSphere(name: string, options: {
  6983. radius?: number;
  6984. flat?: boolean;
  6985. subdivisions?: number;
  6986. sideOrientation?: number;
  6987. updatable?: boolean;
  6988. }, scene: Scene): Mesh;
  6989. /**
  6990. * Creates a decal mesh.
  6991. * Please consider using the same method from the MeshBuilder class instead.
  6992. * 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.
  6993. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  6994. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  6995. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  6996. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  6997. */
  6998. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  6999. /**
  7000. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  7001. */
  7002. setPositionsForCPUSkinning(): Float32Array;
  7003. /**
  7004. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  7005. */
  7006. setNormalsForCPUSkinning(): Float32Array;
  7007. /**
  7008. * Update the vertex buffers by applying transformation from the bones
  7009. * @param {skeleton} skeleton to apply
  7010. */
  7011. applySkeleton(skeleton: Skeleton): Mesh;
  7012. /**
  7013. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  7014. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  7015. */
  7016. static MinMax(meshes: AbstractMesh[]): {
  7017. min: Vector3;
  7018. max: Vector3;
  7019. };
  7020. /**
  7021. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  7022. */
  7023. static Center(meshesOrMinMaxVector: any): Vector3;
  7024. /**
  7025. * Merge the array of meshes into a single mesh for performance reasons.
  7026. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  7027. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  7028. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  7029. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  7030. */
  7031. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
  7032. }
  7033. }
  7034. declare module BABYLON {
  7035. interface IGetSetVerticesData {
  7036. isVerticesDataPresent(kind: string): boolean;
  7037. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array;
  7038. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  7039. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  7040. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  7041. setIndices(indices: number[] | Int32Array): void;
  7042. }
  7043. class VertexData {
  7044. positions: number[] | Float32Array;
  7045. normals: number[] | Float32Array;
  7046. uvs: number[] | Float32Array;
  7047. uvs2: number[] | Float32Array;
  7048. uvs3: number[] | Float32Array;
  7049. uvs4: number[] | Float32Array;
  7050. uvs5: number[] | Float32Array;
  7051. uvs6: number[] | Float32Array;
  7052. colors: number[] | Float32Array;
  7053. matricesIndices: number[] | Float32Array;
  7054. matricesWeights: number[] | Float32Array;
  7055. matricesIndicesExtra: number[] | Float32Array;
  7056. matricesWeightsExtra: number[] | Float32Array;
  7057. indices: number[] | Int32Array;
  7058. set(data: number[] | Float32Array, kind: string): void;
  7059. applyToMesh(mesh: Mesh, updatable?: boolean): void;
  7060. applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  7061. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  7062. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  7063. private _applyTo(meshOrGeometry, updatable?);
  7064. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  7065. transform(matrix: Matrix): void;
  7066. merge(other: VertexData): void;
  7067. private _mergeElement(source, other);
  7068. serialize(): any;
  7069. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
  7070. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
  7071. private static _ExtractFrom(meshOrGeometry, copyWhenShared?);
  7072. static CreateRibbon(options: {
  7073. pathArray: Vector3[][];
  7074. closeArray?: boolean;
  7075. closePath?: boolean;
  7076. offset?: number;
  7077. sideOrientation?: number;
  7078. invertUV?: boolean;
  7079. }): VertexData;
  7080. static CreateBox(options: {
  7081. size?: number;
  7082. width?: number;
  7083. height?: number;
  7084. depth?: number;
  7085. faceUV?: Vector4[];
  7086. faceColors?: Color4[];
  7087. sideOrientation?: number;
  7088. }): VertexData;
  7089. static CreateSphere(options: {
  7090. segments?: number;
  7091. diameter?: number;
  7092. diameterX?: number;
  7093. diameterY?: number;
  7094. diameterZ?: number;
  7095. arc?: number;
  7096. slice?: number;
  7097. sideOrientation?: number;
  7098. }): VertexData;
  7099. static CreateCylinder(options: {
  7100. height?: number;
  7101. diameterTop?: number;
  7102. diameterBottom?: number;
  7103. diameter?: number;
  7104. tessellation?: number;
  7105. subdivisions?: number;
  7106. arc?: number;
  7107. faceColors?: Color4[];
  7108. faceUV?: Vector4[];
  7109. hasRings?: boolean;
  7110. enclose?: boolean;
  7111. sideOrientation?: number;
  7112. }): VertexData;
  7113. static CreateTorus(options: {
  7114. diameter?: number;
  7115. thickness?: number;
  7116. tessellation?: number;
  7117. sideOrientation?: number;
  7118. }): VertexData;
  7119. static CreateLineSystem(options: {
  7120. lines: Vector3[][];
  7121. }): VertexData;
  7122. static CreateDashedLines(options: {
  7123. points: Vector3[];
  7124. dashSize?: number;
  7125. gapSize?: number;
  7126. dashNb?: number;
  7127. }): VertexData;
  7128. static CreateGround(options: {
  7129. width?: number;
  7130. height?: number;
  7131. subdivisions?: number;
  7132. subdivisionsX?: number;
  7133. subdivisionsY?: number;
  7134. }): VertexData;
  7135. static CreateTiledGround(options: {
  7136. xmin: number;
  7137. zmin: number;
  7138. xmax: number;
  7139. zmax: number;
  7140. subdivisions?: {
  7141. w: number;
  7142. h: number;
  7143. };
  7144. precision?: {
  7145. w: number;
  7146. h: number;
  7147. };
  7148. }): VertexData;
  7149. static CreateGroundFromHeightMap(options: {
  7150. width: number;
  7151. height: number;
  7152. subdivisions: number;
  7153. minHeight: number;
  7154. maxHeight: number;
  7155. buffer: Uint8Array;
  7156. bufferWidth: number;
  7157. bufferHeight: number;
  7158. }): VertexData;
  7159. static CreatePlane(options: {
  7160. size?: number;
  7161. width?: number;
  7162. height?: number;
  7163. sideOrientation?: number;
  7164. }): VertexData;
  7165. static CreateDisc(options: {
  7166. radius?: number;
  7167. tessellation?: number;
  7168. arc?: number;
  7169. sideOrientation?: number;
  7170. }): VertexData;
  7171. static CreateIcoSphere(options: {
  7172. radius?: number;
  7173. radiusX?: number;
  7174. radiusY?: number;
  7175. radiusZ?: number;
  7176. flat?: boolean;
  7177. subdivisions?: number;
  7178. sideOrientation?: number;
  7179. }): VertexData;
  7180. static CreatePolyhedron(options: {
  7181. type?: number;
  7182. size?: number;
  7183. sizeX?: number;
  7184. sizeY?: number;
  7185. sizeZ?: number;
  7186. custom?: any;
  7187. faceUV?: Vector4[];
  7188. faceColors?: Color4[];
  7189. flat?: boolean;
  7190. sideOrientation?: number;
  7191. }): VertexData;
  7192. static CreateTorusKnot(options: {
  7193. radius?: number;
  7194. tube?: number;
  7195. radialSegments?: number;
  7196. tubularSegments?: number;
  7197. p?: number;
  7198. q?: number;
  7199. sideOrientation?: number;
  7200. }): VertexData;
  7201. /**
  7202. * @param {any} - positions (number[] or Float32Array)
  7203. * @param {any} - indices (number[] or Uint16Array)
  7204. * @param {any} - normals (number[] or Float32Array)
  7205. */
  7206. static ComputeNormals(positions: any, indices: any, normals: any): void;
  7207. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs);
  7208. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  7209. }
  7210. }
  7211. declare module BABYLON {
  7212. class MeshBuilder {
  7213. private static updateSideOrientation(orientation, scene);
  7214. /**
  7215. * Creates a box mesh.
  7216. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  7217. * The parameter `size` sets the size (float) of each box side (default 1).
  7218. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  7219. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
  7220. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7221. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7222. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7223. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7224. */
  7225. static CreateBox(name: string, options: {
  7226. size?: number;
  7227. width?: number;
  7228. height?: number;
  7229. depth?: number;
  7230. faceUV?: Vector4[];
  7231. faceColors?: Color4[];
  7232. sideOrientation?: number;
  7233. updatable?: boolean;
  7234. }, scene: Scene): Mesh;
  7235. /**
  7236. * Creates a sphere mesh.
  7237. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  7238. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  7239. * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value than `diameter`).
  7240. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  7241. * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  7242. * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
  7243. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7244. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7245. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7246. */
  7247. static CreateSphere(name: string, options: {
  7248. segments?: number;
  7249. diameter?: number;
  7250. diameterX?: number;
  7251. diameterY?: number;
  7252. diameterZ?: number;
  7253. arc?: number;
  7254. slice?: number;
  7255. sideOrientation?: number;
  7256. updatable?: boolean;
  7257. }, scene: any): Mesh;
  7258. /**
  7259. * Creates a plane polygonal mesh. By default, this is a disc.
  7260. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  7261. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  7262. * 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.
  7263. * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
  7264. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7265. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7266. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7267. */
  7268. static CreateDisc(name: string, options: {
  7269. radius?: number;
  7270. tessellation?: number;
  7271. arc?: number;
  7272. updatable?: boolean;
  7273. sideOrientation?: number;
  7274. }, scene: Scene): Mesh;
  7275. /**
  7276. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  7277. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  7278. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  7279. * 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`).
  7280. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  7281. * 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.
  7282. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7283. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7284. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7285. */
  7286. static CreateIcoSphere(name: string, options: {
  7287. radius?: number;
  7288. radiusX?: number;
  7289. radiusY?: number;
  7290. radiusZ?: number;
  7291. flat?: boolean;
  7292. subdivisions?: number;
  7293. sideOrientation?: number;
  7294. updatable?: boolean;
  7295. }, scene: Scene): Mesh;
  7296. /**
  7297. * Creates a ribbon mesh.
  7298. * 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.
  7299. *
  7300. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  7301. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  7302. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  7303. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  7304. * 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.
  7305. * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  7306. * 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
  7307. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7308. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7309. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7310. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7311. */
  7312. static CreateRibbon(name: string, options: {
  7313. pathArray: Vector3[][];
  7314. closeArray?: boolean;
  7315. closePath?: boolean;
  7316. offset?: number;
  7317. updatable?: boolean;
  7318. sideOrientation?: number;
  7319. instance?: Mesh;
  7320. invertUV?: boolean;
  7321. }, scene?: Scene): Mesh;
  7322. /**
  7323. * Creates a cylinder or a cone mesh.
  7324. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  7325. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  7326. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  7327. * 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.
  7328. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  7329. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  7330. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  7331. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  7332. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  7333. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).
  7334. * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
  7335. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  7336. * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
  7337. * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
  7338. * If `enclose` is false, a ring surface is one element.
  7339. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  7340. * Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
  7341. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7342. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7343. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7344. */
  7345. static CreateCylinder(name: string, options: {
  7346. height?: number;
  7347. diameterTop?: number;
  7348. diameterBottom?: number;
  7349. diameter?: number;
  7350. tessellation?: number;
  7351. subdivisions?: number;
  7352. arc?: number;
  7353. faceColors?: Color4[];
  7354. faceUV?: Vector4[];
  7355. updatable?: boolean;
  7356. hasRings?: boolean;
  7357. enclose?: boolean;
  7358. sideOrientation?: number;
  7359. }, scene: any): Mesh;
  7360. /**
  7361. * Creates a torus mesh.
  7362. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  7363. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  7364. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  7365. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  7366. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7367. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7368. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7369. */
  7370. static CreateTorus(name: string, options: {
  7371. diameter?: number;
  7372. thickness?: number;
  7373. tessellation?: number;
  7374. updatable?: boolean;
  7375. sideOrientation?: number;
  7376. }, scene: any): Mesh;
  7377. /**
  7378. * Creates a torus knot mesh.
  7379. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  7380. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  7381. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  7382. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  7383. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  7384. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7385. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7386. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7387. */
  7388. static CreateTorusKnot(name: string, options: {
  7389. radius?: number;
  7390. tube?: number;
  7391. radialSegments?: number;
  7392. tubularSegments?: number;
  7393. p?: number;
  7394. q?: number;
  7395. updatable?: boolean;
  7396. sideOrientation?: number;
  7397. }, scene: any): Mesh;
  7398. /**
  7399. * Creates a line system mesh.
  7400. * A line system is a pool of many lines gathered in a single mesh.
  7401. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  7402. * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter.
  7403. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  7404. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  7405. * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
  7406. * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  7407. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  7408. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7409. */
  7410. static CreateLineSystem(name: string, options: {
  7411. lines: Vector3[][];
  7412. updatable: boolean;
  7413. instance?: LinesMesh;
  7414. }, scene: Scene): LinesMesh;
  7415. /**
  7416. * Creates a line mesh.
  7417. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  7418. * 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.
  7419. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7420. * The parameter `points` is an array successive Vector3.
  7421. * 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
  7422. * When updating an instance, remember that only point positions can change, not the number of points.
  7423. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7424. */
  7425. static CreateLines(name: string, options: {
  7426. points: Vector3[];
  7427. updatable?: boolean;
  7428. instance?: LinesMesh;
  7429. }, scene: Scene): LinesMesh;
  7430. /**
  7431. * Creates a dashed line mesh.
  7432. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  7433. * 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.
  7434. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7435. * The parameter `points` is an array successive Vector3.
  7436. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  7437. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  7438. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  7439. * 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
  7440. * When updating an instance, remember that only point positions can change, not the number of points.
  7441. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7442. */
  7443. static CreateDashedLines(name: string, options: {
  7444. points: Vector3[];
  7445. dashSize?: number;
  7446. gapSize?: number;
  7447. dashNb?: number;
  7448. updatable?: boolean;
  7449. instance?: LinesMesh;
  7450. }, scene: Scene): LinesMesh;
  7451. /**
  7452. * Creates an extruded shape mesh.
  7453. * 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.
  7454. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  7455. *
  7456. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7457. * 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
  7458. * extruded along the Z axis.
  7459. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7460. * 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.
  7461. * The parameter `scale` (float, default 1) is the value to scale the shape.
  7462. * 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
  7463. * 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
  7464. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7465. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7466. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7467. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7468. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7469. */
  7470. static ExtrudeShape(name: string, options: {
  7471. shape: Vector3[];
  7472. path: Vector3[];
  7473. scale?: number;
  7474. rotation?: number;
  7475. cap?: number;
  7476. updatable?: boolean;
  7477. sideOrientation?: number;
  7478. instance?: Mesh;
  7479. invertUV?: boolean;
  7480. }, scene: Scene): Mesh;
  7481. /**
  7482. * Creates an custom extruded shape mesh.
  7483. * 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.
  7484. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  7485. *
  7486. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7487. * 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
  7488. * extruded along the Z axis.
  7489. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7490. * 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
  7491. * and the distance of this point from the begining of the path :
  7492. * ```javascript
  7493. * var rotationFunction = function(i, distance) {
  7494. * // do things
  7495. * return rotationValue; }
  7496. * ```
  7497. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  7498. * 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
  7499. * and the distance of this point from the begining of the path :
  7500. * ```javascript
  7501. * var scaleFunction = function(i, distance) {
  7502. * // do things
  7503. * return scaleValue;}
  7504. * ```
  7505. * It must returns a float value that will be the scale value applied to the shape on each path point.
  7506. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  7507. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  7508. * 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
  7509. * 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
  7510. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7511. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7512. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7513. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7514. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7515. */
  7516. static ExtrudeShapeCustom(name: string, options: {
  7517. shape: Vector3[];
  7518. path: Vector3[];
  7519. scaleFunction?: any;
  7520. rotationFunction?: any;
  7521. ribbonCloseArray?: boolean;
  7522. ribbonClosePath?: boolean;
  7523. cap?: number;
  7524. updatable?: boolean;
  7525. sideOrientation?: number;
  7526. instance?: Mesh;
  7527. invertUV?: boolean;
  7528. }, scene: Scene): Mesh;
  7529. /**
  7530. * Creates lathe mesh.
  7531. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  7532. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  7533. *
  7534. * 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
  7535. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  7536. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  7537. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  7538. * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
  7539. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  7540. * 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
  7541. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7542. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7543. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7544. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7545. */
  7546. static CreateLathe(name: string, options: {
  7547. shape: Vector3[];
  7548. radius?: number;
  7549. tessellation?: number;
  7550. arc?: number;
  7551. closed?: boolean;
  7552. updatable?: boolean;
  7553. sideOrientation?: number;
  7554. cap?: number;
  7555. invertUV?: boolean;
  7556. }, scene: Scene): Mesh;
  7557. /**
  7558. * Creates a plane mesh.
  7559. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7560. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  7561. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  7562. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  7563. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7564. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7565. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7566. */
  7567. static CreatePlane(name: string, options: {
  7568. size?: number;
  7569. width?: number;
  7570. height?: number;
  7571. sideOrientation?: number;
  7572. updatable?: boolean;
  7573. sourcePlane?: Plane;
  7574. }, scene: Scene): Mesh;
  7575. /**
  7576. * Creates a ground mesh.
  7577. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7578. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  7579. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  7580. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7581. */
  7582. static CreateGround(name: string, options: {
  7583. width?: number;
  7584. height?: number;
  7585. subdivisions?: number;
  7586. subdivisionsX?: number;
  7587. subdivisionsY?: number;
  7588. updatable?: boolean;
  7589. }, scene: any): Mesh;
  7590. /**
  7591. * Creates a tiled ground mesh.
  7592. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  7593. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  7594. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  7595. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  7596. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  7597. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  7598. * numbers of subdivisions on the ground width and height of each tile.
  7599. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7600. */
  7601. static CreateTiledGround(name: string, options: {
  7602. xmin: number;
  7603. zmin: number;
  7604. xmax: number;
  7605. zmax: number;
  7606. subdivisions?: {
  7607. w: number;
  7608. h: number;
  7609. };
  7610. precision?: {
  7611. w: number;
  7612. h: number;
  7613. };
  7614. updatable?: boolean;
  7615. }, scene: Scene): Mesh;
  7616. /**
  7617. * Creates a ground mesh from a height map.
  7618. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  7619. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  7620. * The parameter `url` sets the URL of the height map image resource.
  7621. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  7622. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  7623. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  7624. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  7625. * 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).
  7626. * This function is passed the newly built mesh :
  7627. * ```javascript
  7628. * function(mesh) { // do things
  7629. * return; }
  7630. * ```
  7631. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7632. */
  7633. static CreateGroundFromHeightMap(name: string, url: string, options: {
  7634. width?: number;
  7635. height?: number;
  7636. subdivisions?: number;
  7637. minHeight?: number;
  7638. maxHeight?: number;
  7639. updatable?: boolean;
  7640. onReady?: (mesh: GroundMesh) => void;
  7641. }, scene: Scene): GroundMesh;
  7642. /**
  7643. * Creates a tube mesh.
  7644. * 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.
  7645. *
  7646. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  7647. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  7648. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  7649. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  7650. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  7651. * 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.
  7652. * It must return a radius value (positive float) :
  7653. * ```javascript
  7654. * var radiusFunction = function(i, distance) {
  7655. * // do things
  7656. * return radius; }
  7657. * ```
  7658. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  7659. * 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
  7660. * 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
  7661. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7662. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7663. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7664. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7665. */
  7666. static CreateTube(name: string, options: {
  7667. path: Vector3[];
  7668. radius?: number;
  7669. tessellation?: number;
  7670. radiusFunction?: {
  7671. (i: number, distance: number): number;
  7672. };
  7673. cap?: number;
  7674. arc?: number;
  7675. updatable?: boolean;
  7676. sideOrientation?: number;
  7677. instance?: Mesh;
  7678. invertUV?: boolean;
  7679. }, scene: Scene): Mesh;
  7680. /**
  7681. * Creates a polyhedron mesh.
  7682. *
  7683. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  7684. * 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
  7685. * to choose the wanted type.
  7686. * The parameter `size` (positive float, default 1) sets the polygon size.
  7687. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  7688. * 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`.
  7689. * 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
  7690. * 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)`).
  7691. * 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
  7692. * 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.
  7693. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7694. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7695. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7696. */
  7697. static CreatePolyhedron(name: string, options: {
  7698. type?: number;
  7699. size?: number;
  7700. sizeX?: number;
  7701. sizeY?: number;
  7702. sizeZ?: number;
  7703. custom?: any;
  7704. faceUV?: Vector4[];
  7705. faceColors?: Color4[];
  7706. flat?: boolean;
  7707. updatable?: boolean;
  7708. sideOrientation?: number;
  7709. }, scene: Scene): Mesh;
  7710. /**
  7711. * Creates a decal mesh.
  7712. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  7713. * 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.
  7714. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  7715. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  7716. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  7717. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  7718. */
  7719. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  7720. position?: Vector3;
  7721. normal?: Vector3;
  7722. size?: Vector3;
  7723. angle?: number;
  7724. }): Mesh;
  7725. private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV);
  7726. }
  7727. }
  7728. declare module BABYLON.Internals {
  7729. class MeshLODLevel {
  7730. distance: number;
  7731. mesh: Mesh;
  7732. constructor(distance: number, mesh: Mesh);
  7733. }
  7734. }
  7735. declare module BABYLON {
  7736. /**
  7737. * A simplifier interface for future simplification implementations.
  7738. */
  7739. interface ISimplifier {
  7740. /**
  7741. * Simplification of a given mesh according to the given settings.
  7742. * Since this requires computation, it is assumed that the function runs async.
  7743. * @param settings The settings of the simplification, including quality and distance
  7744. * @param successCallback A callback that will be called after the mesh was simplified.
  7745. * @param errorCallback in case of an error, this callback will be called. optional.
  7746. */
  7747. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  7748. }
  7749. /**
  7750. * Expected simplification settings.
  7751. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  7752. */
  7753. interface ISimplificationSettings {
  7754. quality: number;
  7755. distance: number;
  7756. optimizeMesh?: boolean;
  7757. }
  7758. class SimplificationSettings implements ISimplificationSettings {
  7759. quality: number;
  7760. distance: number;
  7761. optimizeMesh: boolean;
  7762. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  7763. }
  7764. interface ISimplificationTask {
  7765. settings: Array<ISimplificationSettings>;
  7766. simplificationType: SimplificationType;
  7767. mesh: Mesh;
  7768. successCallback?: () => void;
  7769. parallelProcessing: boolean;
  7770. }
  7771. class SimplificationQueue {
  7772. private _simplificationArray;
  7773. running: any;
  7774. constructor();
  7775. addTask(task: ISimplificationTask): void;
  7776. executeNext(): void;
  7777. runSimplification(task: ISimplificationTask): void;
  7778. private getSimplifier(task);
  7779. }
  7780. /**
  7781. * The implemented types of simplification.
  7782. * At the moment only Quadratic Error Decimation is implemented.
  7783. */
  7784. enum SimplificationType {
  7785. QUADRATIC = 0,
  7786. }
  7787. class DecimationTriangle {
  7788. vertices: Array<DecimationVertex>;
  7789. normal: Vector3;
  7790. error: Array<number>;
  7791. deleted: boolean;
  7792. isDirty: boolean;
  7793. borderFactor: number;
  7794. deletePending: boolean;
  7795. originalOffset: number;
  7796. constructor(vertices: Array<DecimationVertex>);
  7797. }
  7798. class DecimationVertex {
  7799. position: Vector3;
  7800. id: any;
  7801. q: QuadraticMatrix;
  7802. isBorder: boolean;
  7803. triangleStart: number;
  7804. triangleCount: number;
  7805. originalOffsets: Array<number>;
  7806. constructor(position: Vector3, id: any);
  7807. updatePosition(newPosition: Vector3): void;
  7808. }
  7809. class QuadraticMatrix {
  7810. data: Array<number>;
  7811. constructor(data?: Array<number>);
  7812. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  7813. addInPlace(matrix: QuadraticMatrix): void;
  7814. addArrayInPlace(data: Array<number>): void;
  7815. add(matrix: QuadraticMatrix): QuadraticMatrix;
  7816. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  7817. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  7818. }
  7819. class Reference {
  7820. vertexId: number;
  7821. triangleId: number;
  7822. constructor(vertexId: number, triangleId: number);
  7823. }
  7824. /**
  7825. * An implementation of the Quadratic Error simplification algorithm.
  7826. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  7827. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  7828. * @author RaananW
  7829. */
  7830. class QuadraticErrorSimplification implements ISimplifier {
  7831. private _mesh;
  7832. private triangles;
  7833. private vertices;
  7834. private references;
  7835. private initialized;
  7836. private _reconstructedMesh;
  7837. syncIterations: number;
  7838. aggressiveness: number;
  7839. decimationIterations: number;
  7840. boundingBoxEpsilon: number;
  7841. constructor(_mesh: Mesh);
  7842. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  7843. private isTriangleOnBoundingBox(triangle);
  7844. private runDecimation(settings, submeshIndex, successCallback);
  7845. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  7846. private init(callback);
  7847. private reconstructMesh(submeshIndex);
  7848. private initDecimatedMesh();
  7849. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  7850. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  7851. private identifyBorder();
  7852. private updateMesh(identifyBorders?);
  7853. private vertexError(q, point);
  7854. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  7855. }
  7856. }
  7857. declare module BABYLON {
  7858. class Polygon {
  7859. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  7860. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  7861. static Parse(input: string): Vector2[];
  7862. static StartingAt(x: number, y: number): Path2;
  7863. }
  7864. class PolygonMeshBuilder {
  7865. private _points;
  7866. private _outlinepoints;
  7867. private _holes;
  7868. private _name;
  7869. private _scene;
  7870. private _epoints;
  7871. private _eholes;
  7872. private _addToepoint(points);
  7873. constructor(name: string, contours: Path2, scene: Scene);
  7874. constructor(name: string, contours: Vector2[], scene: Scene);
  7875. addHole(hole: Vector2[]): PolygonMeshBuilder;
  7876. build(updatable?: boolean, depth?: number): Mesh;
  7877. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  7878. }
  7879. }
  7880. declare module BABYLON {
  7881. class SubMesh implements ICullable {
  7882. materialIndex: number;
  7883. verticesStart: number;
  7884. verticesCount: number;
  7885. indexStart: any;
  7886. indexCount: number;
  7887. linesIndexCount: number;
  7888. private _mesh;
  7889. private _renderingMesh;
  7890. private _boundingInfo;
  7891. private _linesIndexBuffer;
  7892. _lastColliderWorldVertices: Vector3[];
  7893. _trianglePlanes: Plane[];
  7894. _lastColliderTransformMatrix: Matrix;
  7895. _renderId: number;
  7896. _alphaIndex: number;
  7897. _distanceToCamera: number;
  7898. _id: number;
  7899. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  7900. IsGlobal: boolean;
  7901. getBoundingInfo(): BoundingInfo;
  7902. getMesh(): AbstractMesh;
  7903. getRenderingMesh(): Mesh;
  7904. getMaterial(): Material;
  7905. refreshBoundingInfo(): void;
  7906. _checkCollision(collider: Collider): boolean;
  7907. updateBoundingInfo(world: Matrix): void;
  7908. isInFrustum(frustumPlanes: Plane[]): boolean;
  7909. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  7910. render(enableAlphaMode: boolean): void;
  7911. getLinesIndexBuffer(indices: number[] | Int32Array, engine: Engine): WebGLBuffer;
  7912. canIntersects(ray: Ray): boolean;
  7913. intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo;
  7914. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  7915. dispose(): void;
  7916. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  7917. }
  7918. }
  7919. declare module BABYLON {
  7920. class VertexBuffer {
  7921. private _buffer;
  7922. private _kind;
  7923. private _offset;
  7924. private _size;
  7925. private _stride;
  7926. private _ownsBuffer;
  7927. constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  7928. getKind(): string;
  7929. isUpdatable(): boolean;
  7930. getData(): number[] | Float32Array;
  7931. getBuffer(): WebGLBuffer;
  7932. getStrideSize(): number;
  7933. getOffset(): number;
  7934. getSize(): number;
  7935. getIsInstanced(): boolean;
  7936. create(data?: number[] | Float32Array): void;
  7937. update(data: number[] | Float32Array): void;
  7938. updateDirectly(data: Float32Array, offset: number): void;
  7939. dispose(): void;
  7940. private static _PositionKind;
  7941. private static _NormalKind;
  7942. private static _UVKind;
  7943. private static _UV2Kind;
  7944. private static _UV3Kind;
  7945. private static _UV4Kind;
  7946. private static _UV5Kind;
  7947. private static _UV6Kind;
  7948. private static _ColorKind;
  7949. private static _MatricesIndicesKind;
  7950. private static _MatricesWeightsKind;
  7951. private static _MatricesIndicesExtraKind;
  7952. private static _MatricesWeightsExtraKind;
  7953. static PositionKind: string;
  7954. static NormalKind: string;
  7955. static UVKind: string;
  7956. static UV2Kind: string;
  7957. static UV3Kind: string;
  7958. static UV4Kind: string;
  7959. static UV5Kind: string;
  7960. static UV6Kind: string;
  7961. static ColorKind: string;
  7962. static MatricesIndicesKind: string;
  7963. static MatricesWeightsKind: string;
  7964. static MatricesIndicesExtraKind: string;
  7965. static MatricesWeightsExtraKind: string;
  7966. }
  7967. }
  7968. declare module BABYLON {
  7969. interface PhysicsImpostorJoint {
  7970. mainImpostor: PhysicsImpostor;
  7971. connectedImpostor: PhysicsImpostor;
  7972. joint: PhysicsJoint;
  7973. }
  7974. class PhysicsEngine {
  7975. private _physicsPlugin;
  7976. gravity: Vector3;
  7977. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  7978. setGravity(gravity: Vector3): void;
  7979. /**
  7980. * Set the time step of the physics engine.
  7981. * default is 1/60.
  7982. * To slow it down, enter 1/600 for example.
  7983. * To speed it up, 1/30
  7984. * @param {number} newTimeStep the new timestep to apply to this world.
  7985. */
  7986. setTimeStep(newTimeStep?: number): void;
  7987. dispose(): void;
  7988. getPhysicsPluginName(): string;
  7989. /**
  7990. * @Deprecated
  7991. *
  7992. */
  7993. static NoImpostor: number;
  7994. static SphereImpostor: number;
  7995. static BoxImpostor: number;
  7996. static PlaneImpostor: number;
  7997. static MeshImpostor: number;
  7998. static CylinderImpostor: number;
  7999. static HeightmapImpostor: number;
  8000. static CapsuleImpostor: number;
  8001. static ConeImpostor: number;
  8002. static ConvexHullImpostor: number;
  8003. static Epsilon: number;
  8004. private _impostors;
  8005. private _joints;
  8006. /**
  8007. * Adding a new impostor for the impostor tracking.
  8008. * This will be done by the impostor itself.
  8009. * @param {PhysicsImpostor} impostor the impostor to add
  8010. */
  8011. addImpostor(impostor: PhysicsImpostor): void;
  8012. /**
  8013. * Remove an impostor from the engine.
  8014. * This impostor and its mesh will not longer be updated by the physics engine.
  8015. * @param {PhysicsImpostor} impostor the impostor to remove
  8016. */
  8017. removeImpostor(impostor: PhysicsImpostor): void;
  8018. /**
  8019. * Add a joint to the physics engine
  8020. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  8021. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  8022. * @param {PhysicsJoint} the joint that will connect both impostors.
  8023. */
  8024. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8025. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8026. /**
  8027. * Called by the scene. no need to call it.
  8028. */
  8029. _step(delta: number): void;
  8030. getPhysicsPlugin(): IPhysicsEnginePlugin;
  8031. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  8032. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  8033. }
  8034. interface IPhysicsEnginePlugin {
  8035. world: any;
  8036. name: string;
  8037. setGravity(gravity: Vector3): any;
  8038. setTimeStep(timeStep: number): any;
  8039. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  8040. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  8041. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  8042. generatePhysicsBody(impostor: PhysicsImpostor): any;
  8043. removePhysicsBody(impostor: PhysicsImpostor): any;
  8044. generateJoint(joint: PhysicsImpostorJoint): any;
  8045. removeJoint(joint: PhysicsImpostorJoint): any;
  8046. isSupported(): boolean;
  8047. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  8048. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  8049. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  8050. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  8051. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  8052. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  8053. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  8054. sleepBody(impostor: PhysicsImpostor): any;
  8055. wakeUpBody(impostor: PhysicsImpostor): any;
  8056. updateDistanceJoint(joint: DistanceJoint, maxDistance: number, minDistance?: number): any;
  8057. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  8058. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  8059. dispose(): any;
  8060. }
  8061. }
  8062. declare module BABYLON {
  8063. interface PhysicsImpostorParameters {
  8064. mass: number;
  8065. friction?: number;
  8066. restitution?: number;
  8067. nativeOptions?: any;
  8068. }
  8069. interface IPhysicsEnabledObject {
  8070. position: Vector3;
  8071. rotationQuaternion: Quaternion;
  8072. scaling: Vector3;
  8073. rotation?: Vector3;
  8074. parent?: any;
  8075. getBoundingInfo?(): BoundingInfo;
  8076. computeWorldMatrix?(force: boolean): void;
  8077. getChildMeshes?(): Array<AbstractMesh>;
  8078. getVerticesData?(kind: string): Array<number> | Float32Array;
  8079. getIndices?(): Array<number> | Int32Array;
  8080. getScene?(): Scene;
  8081. }
  8082. class PhysicsImpostor {
  8083. object: IPhysicsEnabledObject;
  8084. type: number;
  8085. private _options;
  8086. private _scene;
  8087. static DEFAULT_OBJECT_SIZE: Vector3;
  8088. private _physicsEngine;
  8089. private _physicsBody;
  8090. private _bodyUpdateRequired;
  8091. private _onBeforePhysicsStepCallbacks;
  8092. private _onAfterPhysicsStepCallbacks;
  8093. private _onPhysicsCollideCallbacks;
  8094. private _deltaPosition;
  8095. private _deltaRotation;
  8096. private _deltaRotationConjugated;
  8097. private _parent;
  8098. uniqueId: number;
  8099. private _joints;
  8100. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  8101. /**
  8102. * This function will completly initialize this impostor.
  8103. * It will create a new body - but only if this mesh has no parent.
  8104. * If it has, this impostor will not be used other than to define the impostor
  8105. * of the child mesh.
  8106. */
  8107. _init(): void;
  8108. private _getPhysicsParent();
  8109. /**
  8110. * Should a new body be generated.
  8111. */
  8112. isBodyInitRequired(): boolean;
  8113. setScalingUpdated(updated: boolean): void;
  8114. /**
  8115. * Force a regeneration of this or the parent's impostor's body.
  8116. * Use under cautious - This will remove all joints already implemented.
  8117. */
  8118. forceUpdate(): void;
  8119. /**
  8120. * Gets the body that holds this impostor. Either its own, or its parent.
  8121. */
  8122. /**
  8123. * Set the physics body. Used mainly by the physics engine/plugin
  8124. */
  8125. physicsBody: any;
  8126. parent: PhysicsImpostor;
  8127. resetUpdateFlags(): void;
  8128. getObjectExtendSize(): Vector3;
  8129. getObjectCenter(): Vector3;
  8130. /**
  8131. * Get a specific parametes from the options parameter.
  8132. */
  8133. getParam(paramName: string): any;
  8134. /**
  8135. * Sets a specific parameter in the options given to the physics plugin
  8136. */
  8137. setParam(paramName: string, value: number): void;
  8138. /**
  8139. * Specifically change the body's mass option. Won't recreate the physics body object
  8140. */
  8141. setMass(mass: number): void;
  8142. getLinearVelocity(): Vector3;
  8143. /**
  8144. * Set the body's linear velocity.
  8145. */
  8146. setLinearVelocity(velocity: Vector3): void;
  8147. getAngularVelocity(): Vector3;
  8148. /**
  8149. * Set the body's linear velocity.
  8150. */
  8151. setAngularVelocity(velocity: Vector3): void;
  8152. /**
  8153. * Execute a function with the physics plugin native code.
  8154. * Provide a function the will have two variables - the world object and the physics body object.
  8155. */
  8156. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  8157. /**
  8158. * Register a function that will be executed before the physics world is stepping forward.
  8159. */
  8160. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8161. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8162. /**
  8163. * Register a function that will be executed after the physics step
  8164. */
  8165. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8166. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8167. /**
  8168. * register a function that will be executed when this impostor collides against a different body.
  8169. */
  8170. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  8171. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  8172. private _tmpPositionWithDelta;
  8173. private _tmpRotationWithDelta;
  8174. /**
  8175. * this function is executed by the physics engine.
  8176. */
  8177. beforeStep: () => void;
  8178. /**
  8179. * this function is executed by the physics engine.
  8180. */
  8181. afterStep: () => void;
  8182. onCollide: (e: {
  8183. body: any;
  8184. }) => void;
  8185. /**
  8186. * Apply a force
  8187. */
  8188. applyForce(force: Vector3, contactPoint: Vector3): void;
  8189. /**
  8190. * Apply an impulse
  8191. */
  8192. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  8193. /**
  8194. * A help function to create a joint.
  8195. */
  8196. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  8197. /**
  8198. * Add a joint to this impostor with a different impostor.
  8199. */
  8200. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8201. /**
  8202. * Will keep this body still, in a sleep mode.
  8203. */
  8204. sleep(): void;
  8205. /**
  8206. * Wake the body up.
  8207. */
  8208. wakeUp(): void;
  8209. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  8210. dispose(): void;
  8211. setDeltaPosition(position: Vector3): void;
  8212. setDeltaRotation(rotation: Quaternion): void;
  8213. static NoImpostor: number;
  8214. static SphereImpostor: number;
  8215. static BoxImpostor: number;
  8216. static PlaneImpostor: number;
  8217. static MeshImpostor: number;
  8218. static CylinderImpostor: number;
  8219. static ParticleImpostor: number;
  8220. static HeightmapImpostor: number;
  8221. }
  8222. }
  8223. declare module BABYLON {
  8224. interface PhysicsJointData {
  8225. mainPivot?: Vector3;
  8226. connectedPivot?: Vector3;
  8227. mainAxis?: Vector3;
  8228. connectedAxis?: Vector3;
  8229. collision?: boolean;
  8230. nativeParams?: any;
  8231. }
  8232. /**
  8233. * This is a holder class for the physics joint created by the physics plugin.
  8234. * It holds a set of functions to control the underlying joint.
  8235. */
  8236. class PhysicsJoint {
  8237. type: number;
  8238. jointData: PhysicsJointData;
  8239. private _physicsJoint;
  8240. protected _physicsPlugin: IPhysicsEnginePlugin;
  8241. constructor(type: number, jointData: PhysicsJointData);
  8242. physicsJoint: any;
  8243. physicsPlugin: IPhysicsEnginePlugin;
  8244. /**
  8245. * Execute a function that is physics-plugin specific.
  8246. * @param {Function} func the function that will be executed.
  8247. * It accepts two parameters: the physics world and the physics joint.
  8248. */
  8249. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  8250. static DistanceJoint: number;
  8251. static HingeJoint: number;
  8252. static BallAndSocketJoint: number;
  8253. static WheelJoint: number;
  8254. static SliderJoint: number;
  8255. static PrismaticJoint: number;
  8256. static UniversalJoint: number;
  8257. static Hinge2Joint: number;
  8258. static PointToPointJoint: number;
  8259. static SpringJoint: number;
  8260. static LockJoint: number;
  8261. }
  8262. /**
  8263. * A class representing a physics distance joint.
  8264. */
  8265. class DistanceJoint extends PhysicsJoint {
  8266. constructor(jointData: DistanceJointData);
  8267. /**
  8268. * Update the predefined distance.
  8269. */
  8270. updateDistance(maxDistance: number, minDistance?: number): void;
  8271. }
  8272. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  8273. constructor(type: number, jointData: PhysicsJointData);
  8274. /**
  8275. * Set the motor values.
  8276. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8277. * @param {number} force the force to apply
  8278. * @param {number} maxForce max force for this motor.
  8279. */
  8280. setMotor(force?: number, maxForce?: number): void;
  8281. /**
  8282. * Set the motor's limits.
  8283. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8284. */
  8285. setLimit(upperLimit: number, lowerLimit?: number): void;
  8286. }
  8287. /**
  8288. * This class represents a single hinge physics joint
  8289. */
  8290. class HingeJoint extends MotorEnabledJoint {
  8291. constructor(jointData: PhysicsJointData);
  8292. /**
  8293. * Set the motor values.
  8294. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8295. * @param {number} force the force to apply
  8296. * @param {number} maxForce max force for this motor.
  8297. */
  8298. setMotor(force?: number, maxForce?: number): void;
  8299. /**
  8300. * Set the motor's limits.
  8301. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8302. */
  8303. setLimit(upperLimit: number, lowerLimit?: number): void;
  8304. }
  8305. /**
  8306. * This class represents a dual hinge physics joint (same as wheel joint)
  8307. */
  8308. class Hinge2Joint extends MotorEnabledJoint {
  8309. constructor(jointData: PhysicsJointData);
  8310. /**
  8311. * Set the motor values.
  8312. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8313. * @param {number} force the force to apply
  8314. * @param {number} maxForce max force for this motor.
  8315. * @param {motorIndex} the motor's index, 0 or 1.
  8316. */
  8317. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  8318. /**
  8319. * Set the motor limits.
  8320. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8321. * @param {number} upperLimit the upper limit
  8322. * @param {number} lowerLimit lower limit
  8323. * @param {motorIndex} the motor's index, 0 or 1.
  8324. */
  8325. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  8326. }
  8327. interface IMotorEnabledJoint {
  8328. physicsJoint: any;
  8329. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  8330. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  8331. }
  8332. interface DistanceJointData extends PhysicsJointData {
  8333. maxDistance: number;
  8334. }
  8335. interface SpringJointData extends PhysicsJointData {
  8336. length: number;
  8337. stiffness: number;
  8338. damping: number;
  8339. }
  8340. }
  8341. declare module BABYLON {
  8342. class Particle {
  8343. position: Vector3;
  8344. direction: Vector3;
  8345. color: Color4;
  8346. colorStep: Color4;
  8347. lifeTime: number;
  8348. age: number;
  8349. size: number;
  8350. angle: number;
  8351. angularSpeed: number;
  8352. copyTo(other: Particle): void;
  8353. }
  8354. }
  8355. declare module BABYLON {
  8356. class ParticleSystem implements IDisposable, IAnimatable {
  8357. name: string;
  8358. static BLENDMODE_ONEONE: number;
  8359. static BLENDMODE_STANDARD: number;
  8360. animations: Animation[];
  8361. id: string;
  8362. renderingGroupId: number;
  8363. emitter: any;
  8364. emitRate: number;
  8365. manualEmitCount: number;
  8366. updateSpeed: number;
  8367. targetStopDuration: number;
  8368. disposeOnStop: boolean;
  8369. minEmitPower: number;
  8370. maxEmitPower: number;
  8371. minLifeTime: number;
  8372. maxLifeTime: number;
  8373. minSize: number;
  8374. maxSize: number;
  8375. minAngularSpeed: number;
  8376. maxAngularSpeed: number;
  8377. particleTexture: Texture;
  8378. layerMask: number;
  8379. /**
  8380. * An event triggered when the system is disposed.
  8381. * @type {BABYLON.Observable}
  8382. */
  8383. onDisposeObservable: Observable<ParticleSystem>;
  8384. private _onDisposeObserver;
  8385. onDispose: () => void;
  8386. updateFunction: (particles: Particle[]) => void;
  8387. blendMode: number;
  8388. forceDepthWrite: boolean;
  8389. gravity: Vector3;
  8390. direction1: Vector3;
  8391. direction2: Vector3;
  8392. minEmitBox: Vector3;
  8393. maxEmitBox: Vector3;
  8394. color1: Color4;
  8395. color2: Color4;
  8396. colorDead: Color4;
  8397. textureMask: Color4;
  8398. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  8399. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  8400. private particles;
  8401. private _capacity;
  8402. private _scene;
  8403. private _stockParticles;
  8404. private _newPartsExcess;
  8405. private _vertexData;
  8406. private _vertexBuffer;
  8407. private _vertexBuffers;
  8408. private _indexBuffer;
  8409. private _effect;
  8410. private _customEffect;
  8411. private _cachedDefines;
  8412. private _scaledColorStep;
  8413. private _colorDiff;
  8414. private _scaledDirection;
  8415. private _scaledGravity;
  8416. private _currentRenderId;
  8417. private _alive;
  8418. private _started;
  8419. private _stopped;
  8420. private _actualFrame;
  8421. private _scaledUpdateSpeed;
  8422. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  8423. recycleParticle(particle: Particle): void;
  8424. getCapacity(): number;
  8425. isAlive(): boolean;
  8426. isStarted(): boolean;
  8427. start(): void;
  8428. stop(): void;
  8429. _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  8430. private _update(newParticles);
  8431. private _getEffect();
  8432. animate(): void;
  8433. render(): number;
  8434. dispose(): void;
  8435. clone(name: string, newEmitter: any): ParticleSystem;
  8436. serialize(): any;
  8437. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  8438. }
  8439. }
  8440. declare module BABYLON {
  8441. class SolidParticle {
  8442. idx: number;
  8443. color: Color4;
  8444. position: Vector3;
  8445. rotation: Vector3;
  8446. rotationQuaternion: Quaternion;
  8447. scaling: Vector3;
  8448. uvs: Vector4;
  8449. velocity: Vector3;
  8450. alive: boolean;
  8451. isVisible: boolean;
  8452. _pos: number;
  8453. _model: ModelShape;
  8454. shapeId: number;
  8455. idxInShape: number;
  8456. _modelBoundingInfo: BoundingInfo;
  8457. _boundingInfo: BoundingInfo;
  8458. _sps: SolidParticleSystem;
  8459. /**
  8460. * Creates a Solid Particle object.
  8461. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  8462. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  8463. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  8464. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  8465. * `shapeId` (integer) is the model shape identifier in the SPS.
  8466. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  8467. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  8468. */
  8469. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
  8470. /**
  8471. * legacy support, changed scale to scaling
  8472. */
  8473. scale: Vector3;
  8474. /**
  8475. * legacy support, changed quaternion to rotationQuaternion
  8476. */
  8477. quaternion: Quaternion;
  8478. /**
  8479. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  8480. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  8481. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  8482. */
  8483. intersectsMesh(target: Mesh | SolidParticle): boolean;
  8484. }
  8485. class ModelShape {
  8486. shapeID: number;
  8487. _shape: Vector3[];
  8488. _shapeUV: number[];
  8489. _positionFunction: (particle: SolidParticle, i: number, s: number) => void;
  8490. _vertexFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void;
  8491. /**
  8492. * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.
  8493. * SPS internal tool, don't use it manually.
  8494. */
  8495. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  8496. }
  8497. }
  8498. declare module BABYLON {
  8499. /**
  8500. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  8501. */
  8502. class SolidParticleSystem implements IDisposable {
  8503. /**
  8504. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  8505. * Example : var p = SPS.particles[i];
  8506. */
  8507. particles: SolidParticle[];
  8508. /**
  8509. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  8510. */
  8511. nbParticles: number;
  8512. /**
  8513. * If the particles must ever face the camera (default false). Useful for planar particles.
  8514. */
  8515. billboard: boolean;
  8516. /**
  8517. * Recompute normals when adding a shape
  8518. */
  8519. recomputeNormals: boolean;
  8520. /**
  8521. * This a counter ofr your own usage. It's not set by any SPS functions.
  8522. */
  8523. counter: number;
  8524. /**
  8525. * The SPS name. This name is also given to the underlying mesh.
  8526. */
  8527. name: string;
  8528. /**
  8529. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  8530. */
  8531. mesh: Mesh;
  8532. /**
  8533. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  8534. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  8535. */
  8536. vars: any;
  8537. /**
  8538. * This array is populated when the SPS is set as 'pickable'.
  8539. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  8540. * Each element of this array is an object `{idx: int, faceId: int}`.
  8541. * `idx` is the picked particle index in the `SPS.particles` array
  8542. * `faceId` is the picked face index counted within this particle.
  8543. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  8544. */
  8545. pickedParticles: {
  8546. idx: number;
  8547. faceId: number;
  8548. }[];
  8549. private _scene;
  8550. private _positions;
  8551. private _indices;
  8552. private _normals;
  8553. private _colors;
  8554. private _uvs;
  8555. private _positions32;
  8556. private _normals32;
  8557. private _fixedNormal32;
  8558. private _colors32;
  8559. private _uvs32;
  8560. private _index;
  8561. private _updatable;
  8562. private _pickable;
  8563. private _isVisibilityBoxLocked;
  8564. private _alwaysVisible;
  8565. private _shapeCounter;
  8566. private _copy;
  8567. private _shape;
  8568. private _shapeUV;
  8569. private _color;
  8570. private _computeParticleColor;
  8571. private _computeParticleTexture;
  8572. private _computeParticleRotation;
  8573. private _computeParticleVertex;
  8574. private _computeBoundingBox;
  8575. private _cam_axisZ;
  8576. private _cam_axisY;
  8577. private _cam_axisX;
  8578. private _axisX;
  8579. private _axisY;
  8580. private _axisZ;
  8581. private _camera;
  8582. private _particle;
  8583. private _camDir;
  8584. private _rotMatrix;
  8585. private _invertMatrix;
  8586. private _rotated;
  8587. private _quaternion;
  8588. private _vertex;
  8589. private _normal;
  8590. private _yaw;
  8591. private _pitch;
  8592. private _roll;
  8593. private _halfroll;
  8594. private _halfpitch;
  8595. private _halfyaw;
  8596. private _sinRoll;
  8597. private _cosRoll;
  8598. private _sinPitch;
  8599. private _cosPitch;
  8600. private _sinYaw;
  8601. private _cosYaw;
  8602. private _w;
  8603. private _minimum;
  8604. private _maximum;
  8605. private _scale;
  8606. private _translation;
  8607. private _minBbox;
  8608. private _maxBbox;
  8609. private _particlesIntersect;
  8610. _bSphereOnly: boolean;
  8611. _bSphereRadiusFactor: number;
  8612. /**
  8613. * Creates a SPS (Solid Particle System) object.
  8614. * `name` (String) is the SPS name, this will be the underlying mesh name.
  8615. * `scene` (Scene) is the scene in which the SPS is added.
  8616. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  8617. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  8618. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  8619. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  8620. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  8621. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  8622. */
  8623. constructor(name: string, scene: Scene, options?: {
  8624. updatable?: boolean;
  8625. isPickable?: boolean;
  8626. particleIntersection?: boolean;
  8627. boundingSphereOnly?: boolean;
  8628. bSphereRadiusFactor?: number;
  8629. });
  8630. /**
  8631. * Builds the SPS underlying mesh. Returns a standard Mesh.
  8632. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  8633. */
  8634. buildMesh(): Mesh;
  8635. /**
  8636. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  8637. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  8638. * Thus the particles generated from `digest()` have their property `position` set yet.
  8639. * `mesh` ( Mesh ) is the mesh to be digested
  8640. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  8641. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  8642. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  8643. */
  8644. digest(mesh: Mesh, options?: {
  8645. facetNb?: number;
  8646. number?: number;
  8647. delta?: number;
  8648. }): SolidParticleSystem;
  8649. private _resetCopy();
  8650. private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options);
  8651. private _posToShape(positions);
  8652. private _uvsToShapeUV(uvs);
  8653. private _addParticle(idx, idxpos, model, shapeId, idxInShape, bInfo?);
  8654. /**
  8655. * Adds some particles to the SPS from the model shape. Returns the shape id.
  8656. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  8657. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  8658. * `nb` (positive integer) the number of particles to be created from this model
  8659. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  8660. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  8661. */
  8662. addShape(mesh: Mesh, nb: number, options?: {
  8663. positionFunction?: any;
  8664. vertexFunction?: any;
  8665. }): number;
  8666. private _rebuildParticle(particle);
  8667. /**
  8668. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  8669. */
  8670. rebuildMesh(): void;
  8671. /**
  8672. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  8673. * This method calls `updateParticle()` for each particle of the SPS.
  8674. * For an animated SPS, it is usually called within the render loop.
  8675. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  8676. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  8677. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  8678. */
  8679. setParticles(start?: number, end?: number, update?: boolean): void;
  8680. private _quaternionRotationYPR();
  8681. private _quaternionToRotationMatrix();
  8682. /**
  8683. * Disposes the SPS
  8684. */
  8685. dispose(): void;
  8686. /**
  8687. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  8688. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8689. */
  8690. refreshVisibleSize(): void;
  8691. /**
  8692. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  8693. * @param size the size (float) of the visibility box
  8694. * note : this doesn't lock the SPS mesh bounding box.
  8695. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8696. */
  8697. setVisibilityBox(size: number): void;
  8698. /**
  8699. * Sets the SPS as always visible or not
  8700. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8701. */
  8702. isAlwaysVisible: boolean;
  8703. /**
  8704. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  8705. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8706. */
  8707. isVisibilityBoxLocked: boolean;
  8708. /**
  8709. * Tells to `setParticles()` to compute the particle rotations or not.
  8710. * Default value : true. The SPS is faster when it's set to false.
  8711. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  8712. */
  8713. computeParticleRotation: boolean;
  8714. /**
  8715. * Tells to `setParticles()` to compute the particle colors or not.
  8716. * Default value : true. The SPS is faster when it's set to false.
  8717. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  8718. */
  8719. computeParticleColor: boolean;
  8720. /**
  8721. * Tells to `setParticles()` to compute the particle textures or not.
  8722. * Default value : true. The SPS is faster when it's set to false.
  8723. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  8724. */
  8725. computeParticleTexture: boolean;
  8726. /**
  8727. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  8728. * Default value : false. The SPS is faster when it's set to false.
  8729. * Note : the particle custom vertex positions aren't stored values.
  8730. */
  8731. computeParticleVertex: boolean;
  8732. /**
  8733. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  8734. */
  8735. computeBoundingBox: boolean;
  8736. /**
  8737. * This function does nothing. It may be overwritten to set all the particle first values.
  8738. * The SPS doesn't call this function, you may have to call it by your own.
  8739. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8740. */
  8741. initParticles(): void;
  8742. /**
  8743. * This function does nothing. It may be overwritten to recycle a particle.
  8744. * The SPS doesn't call this function, you may have to call it by your own.
  8745. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8746. */
  8747. recycleParticle(particle: SolidParticle): SolidParticle;
  8748. /**
  8749. * Updates a particle : this function should be overwritten by the user.
  8750. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  8751. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8752. * ex : just set a particle position or velocity and recycle conditions
  8753. */
  8754. updateParticle(particle: SolidParticle): SolidParticle;
  8755. /**
  8756. * Updates a vertex of a particle : it can be overwritten by the user.
  8757. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  8758. * @param particle the current particle
  8759. * @param vertex the current index of the current particle
  8760. * @param pt the index of the current vertex in the particle shape
  8761. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  8762. * ex : just set a vertex particle position
  8763. */
  8764. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  8765. /**
  8766. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  8767. * This does nothing and may be overwritten by the user.
  8768. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8769. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8770. * @param update the boolean update value actually passed to setParticles()
  8771. */
  8772. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  8773. /**
  8774. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  8775. * This will be passed three parameters.
  8776. * This does nothing and may be overwritten by the user.
  8777. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8778. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8779. * @param update the boolean update value actually passed to setParticles()
  8780. */
  8781. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  8782. }
  8783. }
  8784. declare module BABYLON {
  8785. class ReflectionProbe {
  8786. name: string;
  8787. private _scene;
  8788. private _renderTargetTexture;
  8789. private _projectionMatrix;
  8790. private _viewMatrix;
  8791. private _target;
  8792. private _add;
  8793. private _attachedMesh;
  8794. invertYAxis: boolean;
  8795. position: Vector3;
  8796. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  8797. refreshRate: number;
  8798. getScene(): Scene;
  8799. cubeTexture: RenderTargetTexture;
  8800. renderList: AbstractMesh[];
  8801. attachToMesh(mesh: AbstractMesh): void;
  8802. dispose(): void;
  8803. }
  8804. }
  8805. declare module BABYLON {
  8806. class AnaglyphPostProcess extends PostProcess {
  8807. private _passedProcess;
  8808. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  8809. }
  8810. }
  8811. declare module BABYLON {
  8812. class BlackAndWhitePostProcess extends PostProcess {
  8813. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8814. }
  8815. }
  8816. declare module BABYLON {
  8817. class BlurPostProcess extends PostProcess {
  8818. direction: Vector2;
  8819. blurWidth: number;
  8820. constructor(name: string, direction: Vector2, blurWidth: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8821. }
  8822. }
  8823. declare module BABYLON {
  8824. class ColorCorrectionPostProcess extends PostProcess {
  8825. private _colorTableTexture;
  8826. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8827. }
  8828. }
  8829. declare module BABYLON {
  8830. class ConvolutionPostProcess extends PostProcess {
  8831. kernel: number[];
  8832. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8833. static EdgeDetect0Kernel: number[];
  8834. static EdgeDetect1Kernel: number[];
  8835. static EdgeDetect2Kernel: number[];
  8836. static SharpenKernel: number[];
  8837. static EmbossKernel: number[];
  8838. static GaussianKernel: number[];
  8839. }
  8840. }
  8841. declare module BABYLON {
  8842. class DisplayPassPostProcess extends PostProcess {
  8843. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8844. }
  8845. }
  8846. declare module BABYLON {
  8847. class FilterPostProcess extends PostProcess {
  8848. kernelMatrix: Matrix;
  8849. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8850. }
  8851. }
  8852. declare module BABYLON {
  8853. class FxaaPostProcess extends PostProcess {
  8854. texelWidth: number;
  8855. texelHeight: number;
  8856. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8857. }
  8858. }
  8859. declare module BABYLON {
  8860. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  8861. /**
  8862. * Public members
  8863. */
  8864. /**
  8865. * Gaussian blur coefficient
  8866. * @type {number}
  8867. */
  8868. gaussCoeff: number;
  8869. /**
  8870. * Gaussian blur mean
  8871. * @type {number}
  8872. */
  8873. gaussMean: number;
  8874. /**
  8875. * Gaussian blur standard deviation
  8876. * @type {number}
  8877. */
  8878. gaussStandDev: number;
  8879. /**
  8880. * Gaussian blur multiplier. Multiplies the blur effect
  8881. * @type {number}
  8882. */
  8883. gaussMultiplier: number;
  8884. /**
  8885. * Exposure, controls the overall intensity of the pipeline
  8886. * @type {number}
  8887. */
  8888. exposure: number;
  8889. /**
  8890. * Minimum luminance that the post-process can output. Luminance is >= 0
  8891. * @type {number}
  8892. */
  8893. minimumLuminance: number;
  8894. /**
  8895. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  8896. * @type {number}
  8897. */
  8898. maximumLuminance: number;
  8899. /**
  8900. * Increase rate for luminance: eye adaptation speed to dark
  8901. * @type {number}
  8902. */
  8903. luminanceIncreaserate: number;
  8904. /**
  8905. * Decrease rate for luminance: eye adaptation speed to bright
  8906. * @type {number}
  8907. */
  8908. luminanceDecreaseRate: number;
  8909. /**
  8910. * Minimum luminance needed to compute HDR
  8911. * @type {number}
  8912. */
  8913. brightThreshold: number;
  8914. /**
  8915. * Private members
  8916. */
  8917. private _guassianBlurHPostProcess;
  8918. private _guassianBlurVPostProcess;
  8919. private _brightPassPostProcess;
  8920. private _textureAdderPostProcess;
  8921. private _downSampleX4PostProcess;
  8922. private _originalPostProcess;
  8923. private _hdrPostProcess;
  8924. private _hdrCurrentLuminance;
  8925. private _hdrOutputLuminance;
  8926. static LUM_STEPS: number;
  8927. private _downSamplePostProcesses;
  8928. private _scene;
  8929. private _needUpdate;
  8930. /**
  8931. * @constructor
  8932. * @param {string} name - The rendering pipeline name
  8933. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  8934. * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  8935. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  8936. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  8937. */
  8938. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  8939. /**
  8940. * Tells the pipeline to update its post-processes
  8941. */
  8942. update(): void;
  8943. /**
  8944. * Returns the current calculated luminance
  8945. */
  8946. getCurrentLuminance(): number;
  8947. /**
  8948. * Returns the currently drawn luminance
  8949. */
  8950. getOutputLuminance(): number;
  8951. /**
  8952. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  8953. */
  8954. dispose(): void;
  8955. /**
  8956. * Creates the HDR post-process and computes the luminance adaptation
  8957. */
  8958. private _createHDRPostProcess(scene, ratio);
  8959. /**
  8960. * Texture Adder post-process
  8961. */
  8962. private _createTextureAdderPostProcess(scene, ratio);
  8963. /**
  8964. * Down sample X4 post-process
  8965. */
  8966. private _createDownSampleX4PostProcess(scene, ratio);
  8967. /**
  8968. * Bright pass post-process
  8969. */
  8970. private _createBrightPassPostProcess(scene, ratio);
  8971. /**
  8972. * Luminance generator. Creates the luminance post-process and down sample post-processes
  8973. */
  8974. private _createLuminanceGeneratorPostProcess(scene);
  8975. /**
  8976. * Gaussian blur post-processes. Horizontal and Vertical
  8977. */
  8978. private _createGaussianBlurPostProcess(scene, ratio);
  8979. }
  8980. }
  8981. declare module BABYLON {
  8982. class LensRenderingPipeline extends PostProcessRenderPipeline {
  8983. /**
  8984. * The chromatic aberration PostProcess id in the pipeline
  8985. * @type {string}
  8986. */
  8987. LensChromaticAberrationEffect: string;
  8988. /**
  8989. * The highlights enhancing PostProcess id in the pipeline
  8990. * @type {string}
  8991. */
  8992. HighlightsEnhancingEffect: string;
  8993. /**
  8994. * The depth-of-field PostProcess id in the pipeline
  8995. * @type {string}
  8996. */
  8997. LensDepthOfFieldEffect: string;
  8998. private _scene;
  8999. private _depthTexture;
  9000. private _grainTexture;
  9001. private _chromaticAberrationPostProcess;
  9002. private _highlightsPostProcess;
  9003. private _depthOfFieldPostProcess;
  9004. private _edgeBlur;
  9005. private _grainAmount;
  9006. private _chromaticAberration;
  9007. private _distortion;
  9008. private _highlightsGain;
  9009. private _highlightsThreshold;
  9010. private _dofDistance;
  9011. private _dofAperture;
  9012. private _dofDarken;
  9013. private _dofPentagon;
  9014. private _blurNoise;
  9015. /**
  9016. * @constructor
  9017. *
  9018. * Effect parameters are as follow:
  9019. * {
  9020. * chromatic_aberration: number; // from 0 to x (1 for realism)
  9021. * edge_blur: number; // from 0 to x (1 for realism)
  9022. * distortion: number; // from 0 to x (1 for realism)
  9023. * grain_amount: number; // from 0 to 1
  9024. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  9025. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  9026. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  9027. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  9028. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  9029. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  9030. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  9031. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  9032. * }
  9033. * Note: if an effect parameter is unset, effect is disabled
  9034. *
  9035. * @param {string} name - The rendering pipeline name
  9036. * @param {object} parameters - An object containing all parameters (see above)
  9037. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9038. * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  9039. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9040. */
  9041. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  9042. setEdgeBlur(amount: number): void;
  9043. disableEdgeBlur(): void;
  9044. setGrainAmount(amount: number): void;
  9045. disableGrain(): void;
  9046. setChromaticAberration(amount: number): void;
  9047. disableChromaticAberration(): void;
  9048. setEdgeDistortion(amount: number): void;
  9049. disableEdgeDistortion(): void;
  9050. setFocusDistance(amount: number): void;
  9051. disableDepthOfField(): void;
  9052. setAperture(amount: number): void;
  9053. setDarkenOutOfFocus(amount: number): void;
  9054. enablePentagonBokeh(): void;
  9055. disablePentagonBokeh(): void;
  9056. enableNoiseBlur(): void;
  9057. disableNoiseBlur(): void;
  9058. setHighlightsGain(amount: number): void;
  9059. setHighlightsThreshold(amount: number): void;
  9060. disableHighlights(): void;
  9061. /**
  9062. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  9063. */
  9064. dispose(disableDepthRender?: boolean): void;
  9065. private _createChromaticAberrationPostProcess(ratio);
  9066. private _createHighlightsPostProcess(ratio);
  9067. private _createDepthOfFieldPostProcess(ratio);
  9068. private _createGrainTexture();
  9069. }
  9070. }
  9071. declare module BABYLON {
  9072. class PassPostProcess extends PostProcess {
  9073. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9074. }
  9075. }
  9076. declare module BABYLON {
  9077. type PostProcessOptions = {
  9078. width: number;
  9079. height: number;
  9080. };
  9081. class PostProcess {
  9082. name: string;
  9083. width: number;
  9084. height: number;
  9085. renderTargetSamplingMode: number;
  9086. clearColor: Color4;
  9087. enablePixelPerfectMode: boolean;
  9088. private _camera;
  9089. private _scene;
  9090. private _engine;
  9091. private _options;
  9092. private _reusable;
  9093. private _textureType;
  9094. _textures: SmartArray<WebGLTexture>;
  9095. _currentRenderTextureInd: number;
  9096. private _effect;
  9097. private _samplers;
  9098. private _fragmentUrl;
  9099. private _parameters;
  9100. private _scaleRatio;
  9101. /**
  9102. * An event triggered when the postprocess is activated.
  9103. * @type {BABYLON.Observable}
  9104. */
  9105. onActivateObservable: Observable<Camera>;
  9106. private _onActivateObserver;
  9107. onActivate: (camera: Camera) => void;
  9108. /**
  9109. * An event triggered when the postprocess changes its size.
  9110. * @type {BABYLON.Observable}
  9111. */
  9112. onSizeChangedObservable: Observable<PostProcess>;
  9113. private _onSizeChangedObserver;
  9114. onSizeChanged: (postProcess: PostProcess) => void;
  9115. /**
  9116. * An event triggered when the postprocess applies its effect.
  9117. * @type {BABYLON.Observable}
  9118. */
  9119. onApplyObservable: Observable<Effect>;
  9120. private _onApplyObserver;
  9121. onApply: (effect: Effect) => void;
  9122. /**
  9123. * An event triggered before rendering the postprocess
  9124. * @type {BABYLON.Observable}
  9125. */
  9126. onBeforeRenderObservable: Observable<Effect>;
  9127. private _onBeforeRenderObserver;
  9128. onBeforeRender: (effect: Effect) => void;
  9129. /**
  9130. * An event triggered after rendering the postprocess
  9131. * @type {BABYLON.Observable}
  9132. */
  9133. onAfterRenderObservable: Observable<Effect>;
  9134. private _onAfterRenderObserver;
  9135. onAfterRender: (efect: Effect) => void;
  9136. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
  9137. updateEffect(defines?: string): void;
  9138. isReusable(): boolean;
  9139. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  9140. markTextureDirty(): void;
  9141. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  9142. isSupported: boolean;
  9143. apply(): Effect;
  9144. dispose(camera?: Camera): void;
  9145. }
  9146. }
  9147. declare module BABYLON {
  9148. class PostProcessManager {
  9149. private _scene;
  9150. private _indexBuffer;
  9151. private _vertexBuffers;
  9152. constructor(scene: Scene);
  9153. private _prepareBuffers();
  9154. _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  9155. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  9156. _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void;
  9157. dispose(): void;
  9158. }
  9159. }
  9160. declare module BABYLON {
  9161. class RefractionPostProcess extends PostProcess {
  9162. color: Color3;
  9163. depth: number;
  9164. colorLevel: number;
  9165. private _refRexture;
  9166. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9167. dispose(camera: Camera): void;
  9168. }
  9169. }
  9170. declare module BABYLON {
  9171. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  9172. /**
  9173. * The PassPostProcess id in the pipeline that contains the original scene color
  9174. * @type {string}
  9175. */
  9176. SSAOOriginalSceneColorEffect: string;
  9177. /**
  9178. * The SSAO PostProcess id in the pipeline
  9179. * @type {string}
  9180. */
  9181. SSAORenderEffect: string;
  9182. /**
  9183. * The horizontal blur PostProcess id in the pipeline
  9184. * @type {string}
  9185. */
  9186. SSAOBlurHRenderEffect: string;
  9187. /**
  9188. * The vertical blur PostProcess id in the pipeline
  9189. * @type {string}
  9190. */
  9191. SSAOBlurVRenderEffect: string;
  9192. /**
  9193. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  9194. * @type {string}
  9195. */
  9196. SSAOCombineRenderEffect: string;
  9197. /**
  9198. * The output strength of the SSAO post-process. Default value is 1.0.
  9199. * @type {number}
  9200. */
  9201. totalStrength: number;
  9202. /**
  9203. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  9204. * @type {number}
  9205. */
  9206. radius: number;
  9207. /**
  9208. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  9209. * Must not be equal to fallOff and superior to fallOff.
  9210. * Default value is 0.975
  9211. * @type {number}
  9212. */
  9213. area: number;
  9214. /**
  9215. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  9216. * Must not be equal to area and inferior to area.
  9217. * Default value is 0.0
  9218. * @type {number}
  9219. */
  9220. fallOff: number;
  9221. /**
  9222. * The base color of the SSAO post-process
  9223. * The final result is "base + ssao" between [0, 1]
  9224. * @type {number}
  9225. */
  9226. base: number;
  9227. private _scene;
  9228. private _depthTexture;
  9229. private _randomTexture;
  9230. private _originalColorPostProcess;
  9231. private _ssaoPostProcess;
  9232. private _blurHPostProcess;
  9233. private _blurVPostProcess;
  9234. private _ssaoCombinePostProcess;
  9235. private _firstUpdate;
  9236. private _ratio;
  9237. /**
  9238. * @constructor
  9239. * @param {string} name - The rendering pipeline name
  9240. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9241. * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 }
  9242. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9243. */
  9244. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  9245. /**
  9246. * Returns the horizontal blur PostProcess
  9247. * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
  9248. */
  9249. getBlurHPostProcess(): BlurPostProcess;
  9250. /**
  9251. * Returns the vertical blur PostProcess
  9252. * @return {BABYLON.BlurPostProcess} The vertical blur post-process
  9253. */
  9254. getBlurVPostProcess(): BlurPostProcess;
  9255. /**
  9256. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  9257. */
  9258. dispose(disableDepthRender?: boolean): void;
  9259. private _createBlurPostProcess(ratio);
  9260. private _createSSAOPostProcess(ratio);
  9261. private _createSSAOCombinePostProcess(ratio);
  9262. private _createRandomTexture();
  9263. }
  9264. }
  9265. declare module BABYLON {
  9266. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  9267. /**
  9268. * Public members
  9269. */
  9270. originalPostProcess: PostProcess;
  9271. downSampleX4PostProcess: PostProcess;
  9272. brightPassPostProcess: PostProcess;
  9273. gaussianBlurHPostProcesses: PostProcess[];
  9274. gaussianBlurVPostProcesses: PostProcess[];
  9275. textureAdderPostProcess: PostProcess;
  9276. textureAdderFinalPostProcess: PostProcess;
  9277. lensFlarePostProcess: PostProcess;
  9278. lensFlareComposePostProcess: PostProcess;
  9279. depthOfFieldPostProcess: PostProcess;
  9280. brightThreshold: number;
  9281. blurWidth: number;
  9282. gaussianCoefficient: number;
  9283. gaussianMean: number;
  9284. gaussianStandardDeviation: number;
  9285. exposure: number;
  9286. lensTexture: Texture;
  9287. lensColorTexture: Texture;
  9288. lensFlareStrength: number;
  9289. lensFlareGhostDispersal: number;
  9290. lensFlareHaloWidth: number;
  9291. lensFlareDistortionStrength: number;
  9292. lensStarTexture: Texture;
  9293. lensFlareDirtTexture: Texture;
  9294. depthOfFieldDistance: number;
  9295. animations: Animation[];
  9296. /**
  9297. * Private members
  9298. */
  9299. private _scene;
  9300. private _depthRenderer;
  9301. private _depthOfFieldEnabled;
  9302. private _lensFlareEnabled;
  9303. DepthOfFieldEnabled: boolean;
  9304. LensFlareEnabled: boolean;
  9305. /**
  9306. * @constructor
  9307. * @param {string} name - The rendering pipeline name
  9308. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9309. * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  9310. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  9311. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9312. */
  9313. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  9314. private _createDownSampleX4PostProcess(scene, ratio);
  9315. private _createBrightPassPostProcess(scene, ratio);
  9316. private _createGaussianBlurPostProcesses(scene, ratio, indice);
  9317. private _createTextureAdderPostProcess(scene, ratio);
  9318. private _createLensFlarePostProcess(scene, ratio);
  9319. private _createDepthOfFieldPostProcess(scene, ratio);
  9320. dispose(): void;
  9321. }
  9322. }
  9323. declare module BABYLON {
  9324. class StereoscopicInterlacePostProcess extends PostProcess {
  9325. private _stepSize;
  9326. private _passedProcess;
  9327. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9328. }
  9329. }
  9330. declare module BABYLON {
  9331. enum TonemappingOperator {
  9332. Hable = 0,
  9333. Reinhard = 1,
  9334. HejiDawson = 2,
  9335. Photographic = 3,
  9336. }
  9337. class TonemapPostProcess extends PostProcess {
  9338. private _operator;
  9339. exposureAdjustment: number;
  9340. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  9341. }
  9342. }
  9343. declare module BABYLON {
  9344. class VolumetricLightScatteringPostProcess extends PostProcess {
  9345. private _volumetricLightScatteringPass;
  9346. private _volumetricLightScatteringRTT;
  9347. private _viewPort;
  9348. private _screenCoordinates;
  9349. private _cachedDefines;
  9350. /**
  9351. * If not undefined, the mesh position is computed from the attached node position
  9352. * @type {{position: Vector3}}
  9353. */
  9354. attachedNode: {
  9355. position: Vector3;
  9356. };
  9357. /**
  9358. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  9359. * @type {Vector3}
  9360. */
  9361. customMeshPosition: Vector3;
  9362. /**
  9363. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  9364. * @type {boolean}
  9365. */
  9366. useCustomMeshPosition: boolean;
  9367. /**
  9368. * If the post-process should inverse the light scattering direction
  9369. * @type {boolean}
  9370. */
  9371. invert: boolean;
  9372. /**
  9373. * The internal mesh used by the post-process
  9374. * @type {boolean}
  9375. */
  9376. mesh: Mesh;
  9377. useDiffuseColor: boolean;
  9378. /**
  9379. * Array containing the excluded meshes not rendered in the internal pass
  9380. */
  9381. excludedMeshes: AbstractMesh[];
  9382. /**
  9383. * Controls the overall intensity of the post-process
  9384. * @type {number}
  9385. */
  9386. exposure: number;
  9387. /**
  9388. * Dissipates each sample's contribution in range [0, 1]
  9389. * @type {number}
  9390. */
  9391. decay: number;
  9392. /**
  9393. * Controls the overall intensity of each sample
  9394. * @type {number}
  9395. */
  9396. weight: number;
  9397. /**
  9398. * Controls the density of each sample
  9399. * @type {number}
  9400. */
  9401. density: number;
  9402. /**
  9403. * @constructor
  9404. * @param {string} name - The post-process name
  9405. * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
  9406. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  9407. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  9408. * @param {number} samples - The post-process quality, default 100
  9409. * @param {number} samplingMode - The post-process filtering mode
  9410. * @param {BABYLON.Engine} engine - The babylon engine
  9411. * @param {boolean} reusable - If the post-process is reusable
  9412. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  9413. */
  9414. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  9415. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9416. /**
  9417. * Sets the new light position for light scattering effect
  9418. * @param {BABYLON.Vector3} The new custom light position
  9419. */
  9420. setCustomMeshPosition(position: Vector3): void;
  9421. /**
  9422. * Returns the light position for light scattering effect
  9423. * @return {BABYLON.Vector3} The custom light position
  9424. */
  9425. getCustomMeshPosition(): Vector3;
  9426. /**
  9427. * Disposes the internal assets and detaches the post-process from the camera
  9428. */
  9429. dispose(camera: Camera): void;
  9430. /**
  9431. * Returns the render target texture used by the post-process
  9432. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  9433. */
  9434. getPass(): RenderTargetTexture;
  9435. private _meshExcluded(mesh);
  9436. private _createPass(scene, ratio);
  9437. private _updateMeshScreenCoordinates(scene);
  9438. /**
  9439. * Creates a default mesh for the Volumeric Light Scattering post-process
  9440. * @param {string} The mesh name
  9441. * @param {BABYLON.Scene} The scene where to create the mesh
  9442. * @return {BABYLON.Mesh} the default mesh
  9443. */
  9444. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  9445. }
  9446. }
  9447. declare module BABYLON {
  9448. class VRDistortionCorrectionPostProcess extends PostProcess {
  9449. aspectRatio: number;
  9450. private _isRightEye;
  9451. private _distortionFactors;
  9452. private _postProcessScaleFactor;
  9453. private _lensCenterOffset;
  9454. private _scaleIn;
  9455. private _scaleFactor;
  9456. private _lensCenter;
  9457. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  9458. }
  9459. }
  9460. declare module BABYLON {
  9461. class BoundingBoxRenderer {
  9462. frontColor: Color3;
  9463. backColor: Color3;
  9464. showBackLines: boolean;
  9465. renderList: SmartArray<BoundingBox>;
  9466. private _scene;
  9467. private _colorShader;
  9468. private _vertexBuffers;
  9469. private _indexBuffer;
  9470. constructor(scene: Scene);
  9471. private _prepareRessources();
  9472. reset(): void;
  9473. render(): void;
  9474. dispose(): void;
  9475. }
  9476. }
  9477. declare module BABYLON {
  9478. class DepthRenderer {
  9479. private _scene;
  9480. private _depthMap;
  9481. private _effect;
  9482. private _viewMatrix;
  9483. private _projectionMatrix;
  9484. private _transformMatrix;
  9485. private _worldViewProjection;
  9486. private _cachedDefines;
  9487. constructor(scene: Scene, type?: number);
  9488. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9489. getDepthMap(): RenderTargetTexture;
  9490. dispose(): void;
  9491. }
  9492. }
  9493. declare module BABYLON {
  9494. class EdgesRenderer {
  9495. edgesWidthScalerForOrthographic: number;
  9496. edgesWidthScalerForPerspective: number;
  9497. private _source;
  9498. private _linesPositions;
  9499. private _linesNormals;
  9500. private _linesIndices;
  9501. private _epsilon;
  9502. private _indicesCount;
  9503. private _lineShader;
  9504. private _ib;
  9505. private _buffers;
  9506. private _checkVerticesInsteadOfIndices;
  9507. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  9508. private _prepareRessources();
  9509. dispose(): void;
  9510. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  9511. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  9512. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  9513. _generateEdgesLines(): void;
  9514. render(): void;
  9515. }
  9516. }
  9517. declare module BABYLON {
  9518. class OutlineRenderer {
  9519. private _scene;
  9520. private _effect;
  9521. private _cachedDefines;
  9522. constructor(scene: Scene);
  9523. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  9524. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9525. }
  9526. }
  9527. declare module BABYLON {
  9528. class RenderingGroup {
  9529. index: number;
  9530. private _scene;
  9531. private _opaqueSubMeshes;
  9532. private _transparentSubMeshes;
  9533. private _alphaTestSubMeshes;
  9534. private _activeVertices;
  9535. private _opaqueSortCompareFn;
  9536. private _alphaTestSortCompareFn;
  9537. private _transparentSortCompareFn;
  9538. private _renderOpaque;
  9539. private _renderAlphaTest;
  9540. private _renderTransparent;
  9541. onBeforeTransparentRendering: () => void;
  9542. /**
  9543. * Set the opaque sort comparison function.
  9544. * If null the sub meshes will be render in the order they were created
  9545. */
  9546. opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9547. /**
  9548. * Set the alpha test sort comparison function.
  9549. * If null the sub meshes will be render in the order they were created
  9550. */
  9551. alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9552. /**
  9553. * Set the transparent sort comparison function.
  9554. * If null the sub meshes will be render in the order they were created
  9555. */
  9556. transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9557. /**
  9558. * Creates a new rendering group.
  9559. * @param index The rendering group index
  9560. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  9561. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  9562. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  9563. */
  9564. constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
  9565. /**
  9566. * Render all the sub meshes contained in the group.
  9567. * @param customRenderFunction Used to override the default render behaviour of the group.
  9568. * @returns true if rendered some submeshes.
  9569. */
  9570. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
  9571. /**
  9572. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  9573. * @param subMeshes The submeshes to render
  9574. */
  9575. private renderOpaqueSorted(subMeshes);
  9576. /**
  9577. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  9578. * @param subMeshes The submeshes to render
  9579. */
  9580. private renderAlphaTestSorted(subMeshes);
  9581. /**
  9582. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  9583. * @param subMeshes The submeshes to render
  9584. */
  9585. private renderTransparentSorted(subMeshes);
  9586. /**
  9587. * Renders the submeshes in a specified order.
  9588. * @param subMeshes The submeshes to sort before render
  9589. * @param sortCompareFn The comparison function use to sort
  9590. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  9591. * @param transparent Specifies to activate blending if true
  9592. */
  9593. private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
  9594. /**
  9595. * Renders the submeshes in the order they were dispatched (no sort applied).
  9596. * @param subMeshes The submeshes to render
  9597. */
  9598. private static renderUnsorted(subMeshes);
  9599. /**
  9600. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9601. * are rendered back to front if in the same alpha index.
  9602. *
  9603. * @param a The first submesh
  9604. * @param b The second submesh
  9605. * @returns The result of the comparison
  9606. */
  9607. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  9608. /**
  9609. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9610. * are rendered back to front.
  9611. *
  9612. * @param a The first submesh
  9613. * @param b The second submesh
  9614. * @returns The result of the comparison
  9615. */
  9616. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  9617. /**
  9618. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9619. * are rendered front to back (prevent overdraw).
  9620. *
  9621. * @param a The first submesh
  9622. * @param b The second submesh
  9623. * @returns The result of the comparison
  9624. */
  9625. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  9626. /**
  9627. * Resets the different lists of submeshes to prepare a new frame.
  9628. */
  9629. prepare(): void;
  9630. /**
  9631. * Inserts the submesh in its correct queue depending on its material.
  9632. * @param subMesh The submesh to dispatch
  9633. */
  9634. dispatch(subMesh: SubMesh): void;
  9635. }
  9636. }
  9637. declare module BABYLON {
  9638. class RenderingManager {
  9639. /**
  9640. * The max id used for rendering groups (not included)
  9641. */
  9642. static MAX_RENDERINGGROUPS: number;
  9643. /**
  9644. * The min id used for rendering groups (included)
  9645. */
  9646. static MIN_RENDERINGGROUPS: number;
  9647. private _scene;
  9648. private _renderingGroups;
  9649. private _depthStencilBufferAlreadyCleaned;
  9650. private _currentIndex;
  9651. private _currentActiveMeshes;
  9652. private _currentRenderParticles;
  9653. private _currentRenderSprites;
  9654. private _autoClearDepthStencil;
  9655. private _customOpaqueSortCompareFn;
  9656. private _customAlphaTestSortCompareFn;
  9657. private _customTransparentSortCompareFn;
  9658. private _renderinGroupInfo;
  9659. constructor(scene: Scene);
  9660. private _renderParticles(index, activeMeshes);
  9661. private _renderSprites(index);
  9662. private _clearDepthStencilBuffer();
  9663. private _renderSpritesAndParticles();
  9664. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  9665. reset(): void;
  9666. dispatch(subMesh: SubMesh): void;
  9667. /**
  9668. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  9669. * This allowed control for front to back rendering or reversly depending of the special needs.
  9670. *
  9671. * @param renderingGroupId The rendering group id corresponding to its index
  9672. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  9673. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  9674. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  9675. */
  9676. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  9677. /**
  9678. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  9679. *
  9680. * @param renderingGroupId The rendering group id corresponding to its index
  9681. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  9682. */
  9683. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  9684. }
  9685. }
  9686. declare module BABYLON {
  9687. class Sprite {
  9688. name: string;
  9689. position: Vector3;
  9690. color: Color4;
  9691. width: number;
  9692. height: number;
  9693. angle: number;
  9694. cellIndex: number;
  9695. invertU: number;
  9696. invertV: number;
  9697. disposeWhenFinishedAnimating: boolean;
  9698. animations: Animation[];
  9699. isPickable: boolean;
  9700. actionManager: ActionManager;
  9701. private _animationStarted;
  9702. private _loopAnimation;
  9703. private _fromIndex;
  9704. private _toIndex;
  9705. private _delay;
  9706. private _direction;
  9707. private _frameCount;
  9708. private _manager;
  9709. private _time;
  9710. private _onAnimationEnd;
  9711. size: number;
  9712. constructor(name: string, manager: SpriteManager);
  9713. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  9714. stopAnimation(): void;
  9715. _animate(deltaTime: number): void;
  9716. dispose(): void;
  9717. }
  9718. }
  9719. declare module BABYLON {
  9720. class SpriteManager {
  9721. name: string;
  9722. sprites: Sprite[];
  9723. renderingGroupId: number;
  9724. layerMask: number;
  9725. fogEnabled: boolean;
  9726. isPickable: boolean;
  9727. cellWidth: number;
  9728. cellHeight: number;
  9729. /**
  9730. * An event triggered when the manager is disposed.
  9731. * @type {BABYLON.Observable}
  9732. */
  9733. onDisposeObservable: Observable<SpriteManager>;
  9734. private _onDisposeObserver;
  9735. onDispose: () => void;
  9736. private _capacity;
  9737. private _spriteTexture;
  9738. private _epsilon;
  9739. private _scene;
  9740. private _vertexData;
  9741. private _buffer;
  9742. private _vertexBuffers;
  9743. private _indexBuffer;
  9744. private _effectBase;
  9745. private _effectFog;
  9746. texture: Texture;
  9747. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  9748. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  9749. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  9750. render(): void;
  9751. dispose(): void;
  9752. }
  9753. }
  9754. declare module BABYLON.Internals {
  9755. class _AlphaState {
  9756. private _isAlphaBlendDirty;
  9757. private _isBlendFunctionParametersDirty;
  9758. private _alphaBlend;
  9759. private _blendFunctionParameters;
  9760. /**
  9761. * Initializes the state.
  9762. */
  9763. constructor();
  9764. isDirty: boolean;
  9765. alphaBlend: boolean;
  9766. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  9767. reset(): void;
  9768. apply(gl: WebGLRenderingContext): void;
  9769. }
  9770. }
  9771. declare module BABYLON.Internals {
  9772. class _DepthCullingState {
  9773. private _isDepthTestDirty;
  9774. private _isDepthMaskDirty;
  9775. private _isDepthFuncDirty;
  9776. private _isCullFaceDirty;
  9777. private _isCullDirty;
  9778. private _isZOffsetDirty;
  9779. private _depthTest;
  9780. private _depthMask;
  9781. private _depthFunc;
  9782. private _cull;
  9783. private _cullFace;
  9784. private _zOffset;
  9785. /**
  9786. * Initializes the state.
  9787. */
  9788. constructor();
  9789. isDirty: boolean;
  9790. zOffset: number;
  9791. cullFace: number;
  9792. cull: boolean;
  9793. depthFunc: number;
  9794. depthMask: boolean;
  9795. depthTest: boolean;
  9796. reset(): void;
  9797. apply(gl: WebGLRenderingContext): void;
  9798. }
  9799. }
  9800. declare module BABYLON.Internals {
  9801. class _StencilState {
  9802. private _isStencilTestDirty;
  9803. private _isStencilMaskDirty;
  9804. private _isStencilFuncDirty;
  9805. private _isStencilOpDirty;
  9806. private _stencilTest;
  9807. private _stencilMask;
  9808. private _stencilFunc;
  9809. private _stencilFuncRef;
  9810. private _stencilFuncMask;
  9811. private _stencilOpStencilFail;
  9812. private _stencilOpDepthFail;
  9813. private _stencilOpStencilDepthPass;
  9814. isDirty: boolean;
  9815. stencilFunc: number;
  9816. stencilFuncRef: number;
  9817. stencilFuncMask: number;
  9818. stencilOpStencilFail: number;
  9819. stencilOpDepthFail: number;
  9820. stencilOpStencilDepthPass: number;
  9821. stencilMask: number;
  9822. stencilTest: boolean;
  9823. constructor();
  9824. reset(): void;
  9825. apply(gl: WebGLRenderingContext): void;
  9826. }
  9827. }
  9828. declare module BABYLON.Internals {
  9829. class AndOrNotEvaluator {
  9830. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  9831. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  9832. private static _SimplifyNegation(booleanString);
  9833. }
  9834. }
  9835. declare module BABYLON {
  9836. interface IAssetTask {
  9837. onSuccess: (task: IAssetTask) => void;
  9838. onError: (task: IAssetTask) => void;
  9839. isCompleted: boolean;
  9840. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  9841. }
  9842. class MeshAssetTask implements IAssetTask {
  9843. name: string;
  9844. meshesNames: any;
  9845. rootUrl: string;
  9846. sceneFilename: string;
  9847. loadedMeshes: Array<AbstractMesh>;
  9848. loadedParticleSystems: Array<ParticleSystem>;
  9849. loadedSkeletons: Array<Skeleton>;
  9850. onSuccess: (task: IAssetTask) => void;
  9851. onError: (task: IAssetTask) => void;
  9852. isCompleted: boolean;
  9853. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  9854. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9855. }
  9856. class TextFileAssetTask implements IAssetTask {
  9857. name: string;
  9858. url: string;
  9859. onSuccess: (task: IAssetTask) => void;
  9860. onError: (task: IAssetTask) => void;
  9861. isCompleted: boolean;
  9862. text: string;
  9863. constructor(name: string, url: string);
  9864. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9865. }
  9866. class BinaryFileAssetTask implements IAssetTask {
  9867. name: string;
  9868. url: string;
  9869. onSuccess: (task: IAssetTask) => void;
  9870. onError: (task: IAssetTask) => void;
  9871. isCompleted: boolean;
  9872. data: ArrayBuffer;
  9873. constructor(name: string, url: string);
  9874. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9875. }
  9876. class ImageAssetTask implements IAssetTask {
  9877. name: string;
  9878. url: string;
  9879. onSuccess: (task: IAssetTask) => void;
  9880. onError: (task: IAssetTask) => void;
  9881. isCompleted: boolean;
  9882. image: HTMLImageElement;
  9883. constructor(name: string, url: string);
  9884. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9885. }
  9886. interface ITextureAssetTask extends IAssetTask {
  9887. onSuccess: (task: ITextureAssetTask) => void;
  9888. onError: (task: ITextureAssetTask) => void;
  9889. texture: Texture;
  9890. }
  9891. class TextureAssetTask implements ITextureAssetTask {
  9892. name: string;
  9893. url: string;
  9894. noMipmap: boolean;
  9895. invertY: boolean;
  9896. samplingMode: number;
  9897. onSuccess: (task: ITextureAssetTask) => void;
  9898. onError: (task: ITextureAssetTask) => void;
  9899. isCompleted: boolean;
  9900. texture: Texture;
  9901. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  9902. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9903. }
  9904. class CubeTextureAssetTask implements IAssetTask {
  9905. name: string;
  9906. url: string;
  9907. extensions: string[];
  9908. noMipmap: boolean;
  9909. files: string[];
  9910. onSuccess: (task: IAssetTask) => void;
  9911. onError: (task: IAssetTask) => void;
  9912. isCompleted: boolean;
  9913. texture: CubeTexture;
  9914. constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
  9915. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9916. }
  9917. class AssetsManager {
  9918. private _scene;
  9919. protected tasks: IAssetTask[];
  9920. protected waitingTasksCount: number;
  9921. onFinish: (tasks: IAssetTask[]) => void;
  9922. onTaskSuccess: (task: IAssetTask) => void;
  9923. onTaskError: (task: IAssetTask) => void;
  9924. useDefaultLoadingScreen: boolean;
  9925. constructor(scene: Scene);
  9926. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  9927. addTextFileTask(taskName: string, url: string): IAssetTask;
  9928. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  9929. addImageTask(taskName: string, url: string): IAssetTask;
  9930. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
  9931. private _decreaseWaitingTasksCount();
  9932. private _runTask(task);
  9933. reset(): AssetsManager;
  9934. load(): AssetsManager;
  9935. }
  9936. }
  9937. declare module BABYLON {
  9938. class Database {
  9939. private callbackManifestChecked;
  9940. private currentSceneUrl;
  9941. private db;
  9942. private enableSceneOffline;
  9943. private enableTexturesOffline;
  9944. private manifestVersionFound;
  9945. private mustUpdateRessources;
  9946. private hasReachedQuota;
  9947. private isSupported;
  9948. private idbFactory;
  9949. static IsUASupportingBlobStorage: boolean;
  9950. static IDBStorageEnabled: boolean;
  9951. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  9952. static parseURL: (url: string) => string;
  9953. static ReturnFullUrlLocation: (url: string) => string;
  9954. checkManifestFile(): void;
  9955. openAsync(successCallback: any, errorCallback: any): void;
  9956. loadImageFromDB(url: string, image: HTMLImageElement): void;
  9957. private _loadImageFromDBAsync(url, image, notInDBCallback);
  9958. private _saveImageIntoDBAsync(url, image);
  9959. private _checkVersionFromDB(url, versionLoaded);
  9960. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  9961. private _saveVersionIntoDBAsync(url, callback);
  9962. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  9963. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  9964. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  9965. }
  9966. }
  9967. declare module BABYLON {
  9968. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9969. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9970. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9971. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9972. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9973. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9974. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9975. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  9976. class SerializationHelper {
  9977. static Serialize<T>(entity: T, serializationObject?: any): any;
  9978. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  9979. static Clone<T>(creationFunction: () => T, source: T): T;
  9980. }
  9981. }
  9982. declare module BABYLON {
  9983. class DynamicFloatArrayElementInfo {
  9984. offset: number;
  9985. }
  9986. /**
  9987. * The purpose of this class is to store float32 based elements of a given size (defined by the stride argument) in a dynamic fashion, that is, you can add/free elements. You can then access to a defragmented/packed version of the underlying Float32Array by calling the pack() method.
  9988. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  9989. * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
  9990. * Allocating an Element will return a instance of DynamicFloatArrayElement which contains the offset into the Float32Array of where the element starts, you are then responsible to copy your data using this offset.
  9991. * Beware, calling pack() may change the offset of some Entries because this method will defragment the Float32Array to replace empty elements by moving allocated ones at their location.
  9992. * This method will return an ArrayBufferView on the existing Float32Array that describes the used elements. Use this View to update the WebGLBuffer and NOT the "buffer" field of the class. The pack() method won't shrink/reallocate the buffer to keep it GC friendly, all the empty space will be put at the end of the buffer, the method just ensure there are no "free holes".
  9993. */
  9994. class DynamicFloatArray {
  9995. /**
  9996. * Construct an instance of the dynamic float array
  9997. * @param stride size of one element in float (i.e. not bytes!)
  9998. * @param initialElementCount the number of available entries at construction
  9999. */
  10000. constructor(stride: number, initialElementCount: number);
  10001. /**
  10002. * Allocate an element in the array.
  10003. * @return the element info instance that contains the offset into the main buffer of the element's location.
  10004. * Beware, this offset may change when you call pack()
  10005. */
  10006. allocElement(): DynamicFloatArrayElementInfo;
  10007. /**
  10008. * Free the element corresponding to the given element info
  10009. * @param elInfo the element that describe the allocated element
  10010. */
  10011. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  10012. /**
  10013. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  10014. * Instances of DynamicFloatArrayElement may have their 'offset' member changed as data could be copied from one location to another, so be sure to read/write your data based on the value inside this member after you called pack().
  10015. * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  10016. */
  10017. pack(): Float32Array;
  10018. private _moveElement(element, destOffset);
  10019. private _growBuffer();
  10020. /**
  10021. * This is the main buffer, all elements are stored inside, you use the DynamicFloatArrayElement instance of a given element to know its location into this buffer, then you have the responsibility to perform write operations in this buffer at the right location!
  10022. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  10023. */
  10024. buffer: Float32Array;
  10025. /**
  10026. * Get the total count of entries that can fit in the current buffer
  10027. * @returns the elements count
  10028. */
  10029. totalElementCount: number;
  10030. /**
  10031. * Get the count of free entries that can still be allocated without resizing the buffer
  10032. * @returns the free elements count
  10033. */
  10034. freeElementCount: number;
  10035. /**
  10036. * Get the count of allocated elements
  10037. * @returns the allocated elements count
  10038. */
  10039. usedElementCount: number;
  10040. /**
  10041. * Return the size of one element in float
  10042. * @returns the size in float
  10043. */
  10044. stride: number;
  10045. compareValueOffset: number;
  10046. sortingAscending: boolean;
  10047. sort(): boolean;
  10048. private _allEntries;
  10049. private _freeEntries;
  10050. private _stride;
  10051. private _lastUsed;
  10052. private _firstFree;
  10053. private _sortTable;
  10054. private _sortedTable;
  10055. }
  10056. }
  10057. declare module Earcut {
  10058. /**
  10059. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  10060. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  10061. * @param holeIndices is an array of hole indices if any (e.g. [5, 8] for a 12- vertice input would mean one hole with vertices 5–7 and another with 8–11).
  10062. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  10063. */
  10064. function earcut(data: number[], holeIndices: number[], dim: number): any[];
  10065. /**
  10066. * return a percentage difference between the polygon area and its triangulation area;
  10067. * used to verify correctness of triangulation
  10068. */
  10069. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  10070. /**
  10071. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  10072. */
  10073. function flatten(data: number[][][]): {
  10074. vertices: any[];
  10075. holes: any[];
  10076. dimensions: number;
  10077. };
  10078. }
  10079. declare module BABYLON {
  10080. class FilesInput {
  10081. private _engine;
  10082. private _currentScene;
  10083. private _canvas;
  10084. private _sceneLoadedCallback;
  10085. private _progressCallback;
  10086. private _additionnalRenderLoopLogicCallback;
  10087. private _textureLoadingCallback;
  10088. private _startingProcessingFilesCallback;
  10089. private _elementToMonitor;
  10090. static FilesTextures: any[];
  10091. static FilesToLoad: any[];
  10092. private _sceneFileToLoad;
  10093. private _filesToLoad;
  10094. constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any);
  10095. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  10096. private renderFunction();
  10097. private drag(e);
  10098. private drop(eventDrop);
  10099. loadFiles(event: any): void;
  10100. reload(): void;
  10101. }
  10102. }
  10103. declare module BABYLON {
  10104. class Gamepads {
  10105. private babylonGamepads;
  10106. private oneGamepadConnected;
  10107. private isMonitoring;
  10108. private gamepadEventSupported;
  10109. private gamepadSupportAvailable;
  10110. private _callbackGamepadConnected;
  10111. private _onGamepadConnectedEvent;
  10112. private _onGamepadDisonnectedEvent;
  10113. private static gamepadDOMInfo;
  10114. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  10115. dispose(): void;
  10116. private _onGamepadConnected(evt);
  10117. private _addNewGamepad(gamepad);
  10118. private _onGamepadDisconnected(evt);
  10119. private _startMonitoringGamepads();
  10120. private _stopMonitoringGamepads();
  10121. private _checkGamepadsStatus();
  10122. private _updateGamepadObjects();
  10123. }
  10124. class StickValues {
  10125. x: any;
  10126. y: any;
  10127. constructor(x: any, y: any);
  10128. }
  10129. class Gamepad {
  10130. id: string;
  10131. index: number;
  10132. browserGamepad: any;
  10133. private _leftStick;
  10134. private _rightStick;
  10135. private _onleftstickchanged;
  10136. private _onrightstickchanged;
  10137. constructor(id: string, index: number, browserGamepad: any);
  10138. onleftstickchanged(callback: (values: StickValues) => void): void;
  10139. onrightstickchanged(callback: (values: StickValues) => void): void;
  10140. leftStick: StickValues;
  10141. rightStick: StickValues;
  10142. update(): void;
  10143. }
  10144. class GenericPad extends Gamepad {
  10145. id: string;
  10146. index: number;
  10147. gamepad: any;
  10148. private _buttons;
  10149. private _onbuttondown;
  10150. private _onbuttonup;
  10151. onbuttondown(callback: (buttonPressed: number) => void): void;
  10152. onbuttonup(callback: (buttonReleased: number) => void): void;
  10153. constructor(id: string, index: number, gamepad: any);
  10154. private _setButtonValue(newValue, currentValue, buttonIndex);
  10155. update(): void;
  10156. }
  10157. enum Xbox360Button {
  10158. A = 0,
  10159. B = 1,
  10160. X = 2,
  10161. Y = 3,
  10162. Start = 4,
  10163. Back = 5,
  10164. LB = 6,
  10165. RB = 7,
  10166. LeftStick = 8,
  10167. RightStick = 9,
  10168. }
  10169. enum Xbox360Dpad {
  10170. Up = 0,
  10171. Down = 1,
  10172. Left = 2,
  10173. Right = 3,
  10174. }
  10175. class Xbox360Pad extends Gamepad {
  10176. private _leftTrigger;
  10177. private _rightTrigger;
  10178. private _onlefttriggerchanged;
  10179. private _onrighttriggerchanged;
  10180. private _onbuttondown;
  10181. private _onbuttonup;
  10182. private _ondpaddown;
  10183. private _ondpadup;
  10184. private _buttonA;
  10185. private _buttonB;
  10186. private _buttonX;
  10187. private _buttonY;
  10188. private _buttonBack;
  10189. private _buttonStart;
  10190. private _buttonLB;
  10191. private _buttonRB;
  10192. private _buttonLeftStick;
  10193. private _buttonRightStick;
  10194. private _dPadUp;
  10195. private _dPadDown;
  10196. private _dPadLeft;
  10197. private _dPadRight;
  10198. onlefttriggerchanged(callback: (value: number) => void): void;
  10199. onrighttriggerchanged(callback: (value: number) => void): void;
  10200. leftTrigger: number;
  10201. rightTrigger: number;
  10202. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  10203. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  10204. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  10205. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  10206. private _setButtonValue(newValue, currentValue, buttonType);
  10207. private _setDPadValue(newValue, currentValue, buttonType);
  10208. buttonA: number;
  10209. buttonB: number;
  10210. buttonX: number;
  10211. buttonY: number;
  10212. buttonStart: number;
  10213. buttonBack: number;
  10214. buttonLB: number;
  10215. buttonRB: number;
  10216. buttonLeftStick: number;
  10217. buttonRightStick: number;
  10218. dPadUp: number;
  10219. dPadDown: number;
  10220. dPadLeft: number;
  10221. dPadRight: number;
  10222. update(): void;
  10223. }
  10224. }
  10225. interface Navigator {
  10226. getGamepads(func?: any): any;
  10227. webkitGetGamepads(func?: any): any;
  10228. msGetGamepads(func?: any): any;
  10229. webkitGamepads(func?: any): any;
  10230. }
  10231. declare module BABYLON {
  10232. interface ILoadingScreen {
  10233. displayLoadingUI: () => void;
  10234. hideLoadingUI: () => void;
  10235. loadingUIBackgroundColor: string;
  10236. loadingUIText: string;
  10237. }
  10238. class DefaultLoadingScreen implements ILoadingScreen {
  10239. private _renderingCanvas;
  10240. private _loadingText;
  10241. private _loadingDivBackgroundColor;
  10242. private _loadingDiv;
  10243. private _loadingTextDiv;
  10244. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  10245. displayLoadingUI(): void;
  10246. hideLoadingUI(): void;
  10247. loadingUIText: string;
  10248. loadingUIBackgroundColor: string;
  10249. private _resizeLoadingUI;
  10250. }
  10251. }
  10252. declare module BABYLON {
  10253. /**
  10254. * A class serves as a medium between the observable and its observers
  10255. */
  10256. class EventState {
  10257. /**
  10258. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  10259. */
  10260. constructor(mask: number, skipNextObservers?: boolean);
  10261. initalize(mask: number, skipNextObservers?: boolean): EventState;
  10262. /**
  10263. * An Observer can set this property to true to prevent subsequent observers of being notified
  10264. */
  10265. skipNextObservers: boolean;
  10266. /**
  10267. * Get the mask value that were used to trigger the event corresponding to this EventState object
  10268. */
  10269. mask: number;
  10270. }
  10271. /**
  10272. * Represent an Observer registered to a given Observable object.
  10273. */
  10274. class Observer<T> {
  10275. callback: (eventData: T, eventState: EventState) => void;
  10276. mask: number;
  10277. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  10278. }
  10279. /**
  10280. * The Observable class is a simple implementation of the Observable pattern.
  10281. * 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.
  10282. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  10283. * 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).
  10284. * 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.
  10285. */
  10286. class Observable<T> {
  10287. _observers: Observer<T>[];
  10288. private _eventState;
  10289. constructor();
  10290. /**
  10291. * Create a new Observer with the specified callback
  10292. * @param callback the callback that will be executed for that Observer
  10293. * @param mask the mask used to filter observers
  10294. * @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.
  10295. */
  10296. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  10297. /**
  10298. * Remove an Observer from the Observable object
  10299. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  10300. */
  10301. remove(observer: Observer<T>): boolean;
  10302. /**
  10303. * Remove a callback from the Observable object
  10304. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  10305. */
  10306. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  10307. /**
  10308. * Notify all Observers by calling their respective callback with the given data
  10309. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  10310. * @param eventData
  10311. * @param mask
  10312. */
  10313. notifyObservers(eventData: T, mask?: number): boolean;
  10314. /**
  10315. * return true is the Observable has at least one Observer registered
  10316. */
  10317. hasObservers(): boolean;
  10318. /**
  10319. * Clear the list of observers
  10320. */
  10321. clear(): void;
  10322. /**
  10323. * Clone the current observable
  10324. */
  10325. clone(): Observable<T>;
  10326. }
  10327. }
  10328. declare module BABYLON {
  10329. /**
  10330. * This class describe a rectangle that were added to the map.
  10331. * You have access to its coordinates either in pixel or normalized (UV)
  10332. */
  10333. class PackedRect {
  10334. constructor(root: PackedRect, parent: PackedRect, pos: Vector2, size: Size);
  10335. /**
  10336. * @returns the position of this node into the map
  10337. */
  10338. pos: Vector2;
  10339. /**
  10340. * @returns the size of the rectangle this node handles
  10341. */
  10342. contentSize: Size;
  10343. /**
  10344. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  10345. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  10346. */
  10347. UVs: Vector2[];
  10348. /**
  10349. * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations) and then using only a part of the PackRect.
  10350. * This method will return the UVs for this part by given the custom size of what you really use
  10351. * @param customSize must be less/equal to the allocated size, UV will be compute from this
  10352. */
  10353. getUVsForCustomSize(customSize: Size): Vector2[];
  10354. /**
  10355. * Free this rectangle from the map.
  10356. * Call this method when you no longer need the rectangle to be in the map.
  10357. */
  10358. freeContent(): void;
  10359. protected isUsed: boolean;
  10360. protected findAndSplitNode(contentSize: Size): PackedRect;
  10361. private findNode(size);
  10362. private splitNode(contentSize);
  10363. private attemptDefrag();
  10364. private clearNode();
  10365. private isRecursiveFree;
  10366. protected evalFreeSize(size: number): number;
  10367. protected _root: PackedRect;
  10368. protected _parent: PackedRect;
  10369. private _contentSize;
  10370. private _initialSize;
  10371. private _leftNode;
  10372. private _rightNode;
  10373. private _bottomNode;
  10374. private _pos;
  10375. protected _size: Size;
  10376. }
  10377. /**
  10378. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
  10379. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  10380. * Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
  10381. */
  10382. class RectPackingMap extends PackedRect {
  10383. /**
  10384. * Create an instance of the object with a dimension using the given size
  10385. * @param size The dimension of the rectangle that will contain all the sub ones.
  10386. */
  10387. constructor(size: Size);
  10388. /**
  10389. * Add a rectangle, finding the best location to store it into the map
  10390. * @param size the dimension of the rectangle to store
  10391. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  10392. */
  10393. addRect(size: Size): PackedRect;
  10394. /**
  10395. * Return the current space free normalized between [0;1]
  10396. * @returns {}
  10397. */
  10398. freeSpace: number;
  10399. }
  10400. }
  10401. declare module BABYLON {
  10402. class SceneOptimization {
  10403. priority: number;
  10404. apply: (scene: Scene) => boolean;
  10405. constructor(priority?: number);
  10406. }
  10407. class TextureOptimization extends SceneOptimization {
  10408. priority: number;
  10409. maximumSize: number;
  10410. constructor(priority?: number, maximumSize?: number);
  10411. apply: (scene: Scene) => boolean;
  10412. }
  10413. class HardwareScalingOptimization extends SceneOptimization {
  10414. priority: number;
  10415. maximumScale: number;
  10416. private _currentScale;
  10417. constructor(priority?: number, maximumScale?: number);
  10418. apply: (scene: Scene) => boolean;
  10419. }
  10420. class ShadowsOptimization extends SceneOptimization {
  10421. apply: (scene: Scene) => boolean;
  10422. }
  10423. class PostProcessesOptimization extends SceneOptimization {
  10424. apply: (scene: Scene) => boolean;
  10425. }
  10426. class LensFlaresOptimization extends SceneOptimization {
  10427. apply: (scene: Scene) => boolean;
  10428. }
  10429. class ParticlesOptimization extends SceneOptimization {
  10430. apply: (scene: Scene) => boolean;
  10431. }
  10432. class RenderTargetsOptimization extends SceneOptimization {
  10433. apply: (scene: Scene) => boolean;
  10434. }
  10435. class MergeMeshesOptimization extends SceneOptimization {
  10436. static _UpdateSelectionTree: boolean;
  10437. static UpdateSelectionTree: boolean;
  10438. private _canBeMerged;
  10439. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  10440. }
  10441. class SceneOptimizerOptions {
  10442. targetFrameRate: number;
  10443. trackerDuration: number;
  10444. optimizations: SceneOptimization[];
  10445. constructor(targetFrameRate?: number, trackerDuration?: number);
  10446. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10447. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10448. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10449. }
  10450. class SceneOptimizer {
  10451. static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void;
  10452. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  10453. }
  10454. }
  10455. declare module BABYLON {
  10456. class SceneSerializer {
  10457. static ClearCache(): void;
  10458. static Serialize(scene: Scene): any;
  10459. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  10460. }
  10461. }
  10462. declare module BABYLON {
  10463. class SmartArray<T> {
  10464. data: Array<T>;
  10465. length: number;
  10466. private _id;
  10467. private _duplicateId;
  10468. constructor(capacity: number);
  10469. push(value: any): void;
  10470. pushNoDuplicate(value: any): boolean;
  10471. sort(compareFn: any): void;
  10472. reset(): void;
  10473. concat(array: any): void;
  10474. concatWithNoDuplicate(array: any): void;
  10475. indexOf(value: any): number;
  10476. private static _GlobalId;
  10477. }
  10478. }
  10479. declare module BABYLON {
  10480. /**
  10481. * This class implement a typical dictionary using a string as key and the generic type T as value.
  10482. * The underlying implementation relies on an associative array to ensure the best performances.
  10483. * The value can be anything including 'null' but except 'undefined'
  10484. */
  10485. class StringDictionary<T> {
  10486. /**
  10487. * This will clear this dictionary and copy the content from the 'source' one.
  10488. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  10489. * @param source the dictionary to take the content from and copy to this dictionary
  10490. */
  10491. copyFrom(source: StringDictionary<T>): void;
  10492. /**
  10493. * Get a value based from its key
  10494. * @param key the given key to get the matching value from
  10495. * @return the value if found, otherwise undefined is returned
  10496. */
  10497. get(key: string): T;
  10498. /**
  10499. * Get a value from its key or add it if it doesn't exist.
  10500. * This method will ensure you that a given key/data will be present in the dictionary.
  10501. * @param key the given key to get the matching value from
  10502. * @param factory the factory that will create the value if the key is not present in the dictionary.
  10503. * The factory will only be invoked if there's no data for the given key.
  10504. * @return the value corresponding to the key.
  10505. */
  10506. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  10507. /**
  10508. * Get a value from its key if present in the dictionary otherwise add it
  10509. * @param key the key to get the value from
  10510. * @param val if there's no such key/value pair in the dictionary add it with this value
  10511. * @return the value corresponding to the key
  10512. */
  10513. getOrAdd(key: string, val: T): T;
  10514. /**
  10515. * Check if there's a given key in the dictionary
  10516. * @param key the key to check for
  10517. * @return true if the key is present, false otherwise
  10518. */
  10519. contains(key: any): boolean;
  10520. /**
  10521. * Add a new key and its corresponding value
  10522. * @param key the key to add
  10523. * @param value the value corresponding to the key
  10524. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  10525. */
  10526. add(key: string, value: T): boolean;
  10527. set(key: string, value: T): boolean;
  10528. /**
  10529. * Get the element of the given key and remove it from the dictionary
  10530. * @param key
  10531. */
  10532. getAndRemove(key: string): T;
  10533. /**
  10534. * Remove a key/value from the dictionary.
  10535. * @param key the key to remove
  10536. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  10537. */
  10538. remove(key: string): boolean;
  10539. /**
  10540. * Clear the whole content of the dictionary
  10541. */
  10542. clear(): void;
  10543. count: number;
  10544. /**
  10545. * Execute a callback on each key/val of the dictionary.
  10546. * Note that you can remove any element in this dictionary in the callback implementation
  10547. * @param callback the callback to execute on a given key/value pair
  10548. */
  10549. forEach(callback: (key: string, val: T) => void): void;
  10550. /**
  10551. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  10552. * If the callback returns null or undefined the method will iterate to the next key/value pair
  10553. * Note that you can remove any element in this dictionary in the callback implementation
  10554. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  10555. */
  10556. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  10557. private _count;
  10558. private _data;
  10559. }
  10560. }
  10561. declare module BABYLON {
  10562. class Tags {
  10563. static EnableFor(obj: any): void;
  10564. static DisableFor(obj: any): void;
  10565. static HasTags(obj: any): boolean;
  10566. static GetTags(obj: any, asString?: boolean): any;
  10567. static AddTagsTo(obj: any, tagsString: string): void;
  10568. static _AddTagTo(obj: any, tag: string): void;
  10569. static RemoveTagsFrom(obj: any, tagsString: string): void;
  10570. static _RemoveTagFrom(obj: any, tag: string): void;
  10571. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  10572. }
  10573. }
  10574. declare module BABYLON.Internals {
  10575. interface DDSInfo {
  10576. width: number;
  10577. height: number;
  10578. mipmapCount: number;
  10579. isFourCC: boolean;
  10580. isRGB: boolean;
  10581. isLuminance: boolean;
  10582. isCube: boolean;
  10583. }
  10584. class DDSTools {
  10585. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  10586. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10587. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10588. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10589. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  10590. }
  10591. }
  10592. declare module BABYLON.Internals {
  10593. class TGATools {
  10594. private static _TYPE_NO_DATA;
  10595. private static _TYPE_INDEXED;
  10596. private static _TYPE_RGB;
  10597. private static _TYPE_GREY;
  10598. private static _TYPE_RLE_INDEXED;
  10599. private static _TYPE_RLE_RGB;
  10600. private static _TYPE_RLE_GREY;
  10601. private static _ORIGIN_MASK;
  10602. private static _ORIGIN_SHIFT;
  10603. private static _ORIGIN_BL;
  10604. private static _ORIGIN_BR;
  10605. private static _ORIGIN_UL;
  10606. private static _ORIGIN_UR;
  10607. static GetTGAHeader(data: Uint8Array): any;
  10608. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  10609. static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10610. static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10611. static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10612. static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10613. static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10614. static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array;
  10615. }
  10616. }
  10617. declare module BABYLON {
  10618. interface IAnimatable {
  10619. animations: Array<Animation>;
  10620. }
  10621. class Tools {
  10622. static BaseUrl: string;
  10623. static CorsBehavior: any;
  10624. static UseFallbackTexture: boolean;
  10625. static Instantiate(className: string): any;
  10626. static SetImmediate(action: () => void): void;
  10627. static IsExponentOfTwo(value: number): boolean;
  10628. static GetExponentOfTwo(value: number, max: number): number;
  10629. static GetFilename(path: string): string;
  10630. static GetDOMTextContent(element: HTMLElement): string;
  10631. static ToDegrees(angle: number): number;
  10632. static ToRadians(angle: number): number;
  10633. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  10634. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number, bias?: Vector2): {
  10635. minimum: Vector3;
  10636. maximum: Vector3;
  10637. };
  10638. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
  10639. minimum: Vector3;
  10640. maximum: Vector3;
  10641. };
  10642. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i) => Vector2;
  10643. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
  10644. minimum: Vector2;
  10645. maximum: Vector2;
  10646. };
  10647. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  10648. static GetPointerPrefix(): string;
  10649. /**
  10650. * @param func - the function to be called
  10651. * @param requester - the object that will request the next frame. Falls back to window.
  10652. */
  10653. static QueueNewFrame(func: any, requester?: any): void;
  10654. static RequestFullscreen(element: any): void;
  10655. static ExitFullscreen(): void;
  10656. static SetCorsBehavior(url: string, img: HTMLImageElement): string;
  10657. static CleanUrl(url: string): string;
  10658. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  10659. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  10660. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  10661. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  10662. static FileAsURL(content: string): string;
  10663. static Format(value: number, decimals?: number): string;
  10664. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  10665. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  10666. static IsEmpty(obj: any): boolean;
  10667. static RegisterTopRootEvents(events: {
  10668. name: string;
  10669. handler: EventListener;
  10670. }[]): void;
  10671. static UnregisterTopRootEvents(events: {
  10672. name: string;
  10673. handler: EventListener;
  10674. }[]): void;
  10675. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
  10676. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
  10677. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  10678. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  10679. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  10680. /**
  10681. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  10682. * Be aware Math.random() could cause collisions, but:
  10683. * "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"
  10684. */
  10685. static RandomId(): string;
  10686. private static _NoneLogLevel;
  10687. private static _MessageLogLevel;
  10688. private static _WarningLogLevel;
  10689. private static _ErrorLogLevel;
  10690. private static _LogCache;
  10691. static errorsCount: number;
  10692. static OnNewCacheEntry: (entry: string) => void;
  10693. static NoneLogLevel: number;
  10694. static MessageLogLevel: number;
  10695. static WarningLogLevel: number;
  10696. static ErrorLogLevel: number;
  10697. static AllLogLevel: number;
  10698. private static _AddLogEntry(entry);
  10699. private static _FormatMessage(message);
  10700. static Log: (message: string) => void;
  10701. private static _LogDisabled(message);
  10702. private static _LogEnabled(message);
  10703. static Warn: (message: string) => void;
  10704. private static _WarnDisabled(message);
  10705. private static _WarnEnabled(message);
  10706. static Error: (message: string) => void;
  10707. private static _ErrorDisabled(message);
  10708. private static _ErrorEnabled(message);
  10709. static LogCache: string;
  10710. static ClearLogCache(): void;
  10711. static LogLevels: number;
  10712. private static _PerformanceNoneLogLevel;
  10713. private static _PerformanceUserMarkLogLevel;
  10714. private static _PerformanceConsoleLogLevel;
  10715. private static _performance;
  10716. static PerformanceNoneLogLevel: number;
  10717. static PerformanceUserMarkLogLevel: number;
  10718. static PerformanceConsoleLogLevel: number;
  10719. static PerformanceLogLevel: number;
  10720. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  10721. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  10722. static _StartUserMark(counterName: string, condition?: boolean): void;
  10723. static _EndUserMark(counterName: string, condition?: boolean): void;
  10724. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  10725. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  10726. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  10727. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  10728. static Now: number;
  10729. /**
  10730. * This method will return the name of the class used to create the instance of the given object.
  10731. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  10732. * @param object the object to get the class name from
  10733. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  10734. */
  10735. static getClassName(object: any, isType?: boolean): string;
  10736. static first<T>(array: Array<T>, predicate: (item) => boolean): T;
  10737. /**
  10738. * This method will return the name of the full name of the class, including its owning module (if any).
  10739. * 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).
  10740. * @param object the object to get the class name from
  10741. * @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.
  10742. */
  10743. static getFullClassName(object: any, isType?: boolean): string;
  10744. /**
  10745. * 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.
  10746. * @param array
  10747. */
  10748. static arrayOrStringFeeder(array: any): (i) => number;
  10749. /**
  10750. * Compute the hashCode of a stream of number
  10751. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  10752. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  10753. * @return the hash code computed
  10754. */
  10755. static hashCodeFromStream(feeder: (index: number) => number): number;
  10756. }
  10757. /**
  10758. * This class is used to track a performance counter which is number based.
  10759. * The user has access to many properties which give statistics of different nature
  10760. *
  10761. * The implementer can track two kinds of Performance Counter: time and count
  10762. * 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.
  10763. * 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.
  10764. */
  10765. class PerfCounter {
  10766. /**
  10767. * Returns the smallest value ever
  10768. */
  10769. min: number;
  10770. /**
  10771. * Returns the biggest value ever
  10772. */
  10773. max: number;
  10774. /**
  10775. * Returns the average value since the performance counter is running
  10776. */
  10777. average: number;
  10778. /**
  10779. * Returns the average value of the last second the counter was monitored
  10780. */
  10781. lastSecAverage: number;
  10782. /**
  10783. * Returns the current value
  10784. */
  10785. current: number;
  10786. total: number;
  10787. constructor();
  10788. /**
  10789. * Call this method to start monitoring a new frame.
  10790. * 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.
  10791. */
  10792. fetchNewFrame(): void;
  10793. /**
  10794. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  10795. * @param newCount the count value to add to the monitored count
  10796. * @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.
  10797. */
  10798. addCount(newCount: number, fetchResult: boolean): void;
  10799. /**
  10800. * Start monitoring this performance counter
  10801. */
  10802. beginMonitoring(): void;
  10803. /**
  10804. * Compute the time lapsed since the previous beginMonitoring() call.
  10805. * @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
  10806. */
  10807. endMonitoring(newFrame?: boolean): void;
  10808. private _fetchResult();
  10809. private _startMonitoringTime;
  10810. private _min;
  10811. private _max;
  10812. private _average;
  10813. private _current;
  10814. private _totalValueCount;
  10815. private _totalAccumulated;
  10816. private _lastSecAverage;
  10817. private _lastSecAccumulated;
  10818. private _lastSecTime;
  10819. private _lastSecValueCount;
  10820. }
  10821. /**
  10822. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  10823. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  10824. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  10825. * @param name The name of the class, case should be preserved
  10826. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  10827. */
  10828. function className(name: string, module?: string): (target: Object) => void;
  10829. /**
  10830. * An implementation of a loop for asynchronous functions.
  10831. */
  10832. class AsyncLoop {
  10833. iterations: number;
  10834. private _fn;
  10835. private _successCallback;
  10836. index: number;
  10837. private _done;
  10838. /**
  10839. * Constroctor.
  10840. * @param iterations the number of iterations.
  10841. * @param _fn the function to run each iteration
  10842. * @param _successCallback the callback that will be called upon succesful execution
  10843. * @param offset starting offset.
  10844. */
  10845. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  10846. /**
  10847. * Execute the next iteration. Must be called after the last iteration was finished.
  10848. */
  10849. executeNext(): void;
  10850. /**
  10851. * Break the loop and run the success callback.
  10852. */
  10853. breakLoop(): void;
  10854. /**
  10855. * Helper function
  10856. */
  10857. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  10858. /**
  10859. * A for-loop that will run a given number of iterations synchronous and the rest async.
  10860. * @param iterations total number of iterations
  10861. * @param syncedIterations number of synchronous iterations in each async iteration.
  10862. * @param fn the function to call each iteration.
  10863. * @param callback a success call back that will be called when iterating stops.
  10864. * @param breakFunction a break condition (optional)
  10865. * @param timeout timeout settings for the setTimeout function. default - 0.
  10866. * @constructor
  10867. */
  10868. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  10869. }
  10870. }
  10871. declare module BABYLON {
  10872. enum JoystickAxis {
  10873. X = 0,
  10874. Y = 1,
  10875. Z = 2,
  10876. }
  10877. class VirtualJoystick {
  10878. reverseLeftRight: boolean;
  10879. reverseUpDown: boolean;
  10880. deltaPosition: Vector3;
  10881. pressed: boolean;
  10882. private static _globalJoystickIndex;
  10883. private static vjCanvas;
  10884. private static vjCanvasContext;
  10885. private static vjCanvasWidth;
  10886. private static vjCanvasHeight;
  10887. private static halfWidth;
  10888. private static halfHeight;
  10889. private _action;
  10890. private _axisTargetedByLeftAndRight;
  10891. private _axisTargetedByUpAndDown;
  10892. private _joystickSensibility;
  10893. private _inversedSensibility;
  10894. private _rotationSpeed;
  10895. private _inverseRotationSpeed;
  10896. private _rotateOnAxisRelativeToMesh;
  10897. private _joystickPointerID;
  10898. private _joystickColor;
  10899. private _joystickPointerPos;
  10900. private _joystickPreviousPointerPos;
  10901. private _joystickPointerStartPos;
  10902. private _deltaJoystickVector;
  10903. private _leftJoystick;
  10904. private _joystickIndex;
  10905. private _touches;
  10906. private _onPointerDownHandlerRef;
  10907. private _onPointerMoveHandlerRef;
  10908. private _onPointerUpHandlerRef;
  10909. private _onPointerOutHandlerRef;
  10910. private _onResize;
  10911. constructor(leftJoystick?: boolean);
  10912. setJoystickSensibility(newJoystickSensibility: number): void;
  10913. private _onPointerDown(e);
  10914. private _onPointerMove(e);
  10915. private _onPointerUp(e);
  10916. /**
  10917. * Change the color of the virtual joystick
  10918. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  10919. */
  10920. setJoystickColor(newColor: string): void;
  10921. setActionOnTouch(action: () => any): void;
  10922. setAxisForLeftRight(axis: JoystickAxis): void;
  10923. setAxisForUpDown(axis: JoystickAxis): void;
  10924. private _clearCanvas();
  10925. private _drawVirtualJoystick();
  10926. releaseCanvas(): void;
  10927. }
  10928. }
  10929. declare module BABYLON {
  10930. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  10931. camera: ArcRotateCamera;
  10932. gamepad: Gamepad;
  10933. private _gamepads;
  10934. gamepadRotationSensibility: number;
  10935. gamepadMoveSensibility: number;
  10936. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  10937. detachControl(element: HTMLElement): void;
  10938. checkInputs(): void;
  10939. private _onNewGameConnected(gamepad);
  10940. getTypeName(): string;
  10941. getSimpleName(): string;
  10942. }
  10943. }
  10944. declare module BABYLON {
  10945. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  10946. camera: ArcRotateCamera;
  10947. private _keys;
  10948. private _onKeyDown;
  10949. private _onKeyUp;
  10950. private _onLostFocus;
  10951. keysUp: number[];
  10952. keysDown: number[];
  10953. keysLeft: number[];
  10954. keysRight: number[];
  10955. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  10956. detachControl(element: HTMLElement): void;
  10957. checkInputs(): void;
  10958. getTypeName(): string;
  10959. getSimpleName(): string;
  10960. }
  10961. }
  10962. declare module BABYLON {
  10963. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  10964. camera: ArcRotateCamera;
  10965. private _wheel;
  10966. private _observer;
  10967. wheelPrecision: number;
  10968. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  10969. detachControl(element: HTMLElement): void;
  10970. getTypeName(): string;
  10971. getSimpleName(): string;
  10972. }
  10973. }
  10974. declare module BABYLON {
  10975. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  10976. camera: ArcRotateCamera;
  10977. buttons: number[];
  10978. angularSensibilityX: number;
  10979. angularSensibilityY: number;
  10980. pinchPrecision: number;
  10981. panningSensibility: number;
  10982. private _isPanClick;
  10983. pinchInwards: boolean;
  10984. private _pointerInput;
  10985. private _observer;
  10986. private _onKeyDown;
  10987. private _onKeyUp;
  10988. private _onMouseMove;
  10989. private _onGestureStart;
  10990. private _onGesture;
  10991. private _MSGestureHandler;
  10992. private _onLostFocus;
  10993. private _onContextMenu;
  10994. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  10995. detachControl(element: HTMLElement): void;
  10996. getTypeName(): string;
  10997. getSimpleName(): string;
  10998. }
  10999. }
  11000. declare module BABYLON {
  11001. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  11002. camera: ArcRotateCamera;
  11003. alphaCorrection: number;
  11004. betaCorrection: number;
  11005. gammaCorrection: number;
  11006. private _alpha;
  11007. private _beta;
  11008. private _gamma;
  11009. private _dirty;
  11010. private _offsetOrientation;
  11011. private _deviceOrientationHandler;
  11012. constructor();
  11013. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11014. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  11015. checkInputs(): void;
  11016. detachControl(element: HTMLElement): void;
  11017. getTypeName(): string;
  11018. getSimpleName(): string;
  11019. }
  11020. }
  11021. declare module BABYLON {
  11022. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  11023. private _camera;
  11024. private _screenOrientationAngle;
  11025. private _constantTranform;
  11026. private _screenQuaternion;
  11027. private _alpha;
  11028. private _beta;
  11029. private _gamma;
  11030. constructor();
  11031. camera: FreeCamera;
  11032. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11033. private _orientationChanged;
  11034. private _deviceOrientation;
  11035. detachControl(element: HTMLElement): void;
  11036. checkInputs(): void;
  11037. getTypeName(): string;
  11038. getSimpleName(): string;
  11039. }
  11040. }
  11041. declare module BABYLON {
  11042. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  11043. camera: FreeCamera;
  11044. gamepad: Gamepad;
  11045. private _gamepads;
  11046. gamepadAngularSensibility: number;
  11047. gamepadMoveSensibility: number;
  11048. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11049. detachControl(element: HTMLElement): void;
  11050. checkInputs(): void;
  11051. private _onNewGameConnected(gamepad);
  11052. getTypeName(): string;
  11053. getSimpleName(): string;
  11054. }
  11055. }
  11056. declare module BABYLON {
  11057. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  11058. camera: FreeCamera;
  11059. private _keys;
  11060. private _onKeyDown;
  11061. private _onKeyUp;
  11062. keysUp: number[];
  11063. keysDown: number[];
  11064. keysLeft: number[];
  11065. keysRight: number[];
  11066. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11067. detachControl(element: HTMLElement): void;
  11068. checkInputs(): void;
  11069. getTypeName(): string;
  11070. _onLostFocus(e: FocusEvent): void;
  11071. getSimpleName(): string;
  11072. }
  11073. }
  11074. declare module BABYLON {
  11075. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  11076. touchEnabled: boolean;
  11077. camera: FreeCamera;
  11078. buttons: number[];
  11079. angularSensibility: number;
  11080. private _pointerInput;
  11081. private _onMouseMove;
  11082. private _observer;
  11083. private previousPosition;
  11084. constructor(touchEnabled?: boolean);
  11085. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11086. detachControl(element: HTMLElement): void;
  11087. getTypeName(): string;
  11088. getSimpleName(): string;
  11089. }
  11090. }
  11091. declare module BABYLON {
  11092. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  11093. camera: FreeCamera;
  11094. private _offsetX;
  11095. private _offsetY;
  11096. private _pointerCount;
  11097. private _pointerPressed;
  11098. private _pointerInput;
  11099. private _observer;
  11100. private _onLostFocus;
  11101. touchAngularSensibility: number;
  11102. touchMoveSensibility: number;
  11103. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11104. detachControl(element: HTMLElement): void;
  11105. checkInputs(): void;
  11106. getTypeName(): string;
  11107. getSimpleName(): string;
  11108. }
  11109. }
  11110. declare module BABYLON {
  11111. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  11112. camera: FreeCamera;
  11113. private _leftjoystick;
  11114. private _rightjoystick;
  11115. getLeftJoystick(): VirtualJoystick;
  11116. getRightJoystick(): VirtualJoystick;
  11117. checkInputs(): void;
  11118. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11119. detachControl(element: HTMLElement): void;
  11120. getTypeName(): string;
  11121. getSimpleName(): string;
  11122. }
  11123. }
  11124. declare module BABYLON {
  11125. class VRCameraMetrics {
  11126. hResolution: number;
  11127. vResolution: number;
  11128. hScreenSize: number;
  11129. vScreenSize: number;
  11130. vScreenCenter: number;
  11131. eyeToScreenDistance: number;
  11132. lensSeparationDistance: number;
  11133. interpupillaryDistance: number;
  11134. distortionK: number[];
  11135. chromaAbCorrection: number[];
  11136. postProcessScaleFactor: number;
  11137. lensCenterOffset: number;
  11138. compensateDistortion: boolean;
  11139. aspectRatio: number;
  11140. aspectRatioFov: number;
  11141. leftHMatrix: Matrix;
  11142. rightHMatrix: Matrix;
  11143. leftPreViewMatrix: Matrix;
  11144. rightPreViewMatrix: Matrix;
  11145. static GetDefault(): VRCameraMetrics;
  11146. }
  11147. }
  11148. declare module BABYLON {
  11149. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  11150. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  11151. getTypeName(): string;
  11152. }
  11153. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  11154. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  11155. getTypeName(): string;
  11156. }
  11157. }
  11158. declare var HMDVRDevice: any;
  11159. declare var VRDisplay: any;
  11160. declare var VRFrameData: any;
  11161. declare module BABYLON {
  11162. interface WebVROptions {
  11163. trackPosition?: boolean;
  11164. positionScale?: number;
  11165. displayName?: string;
  11166. }
  11167. class WebVRFreeCamera extends FreeCamera {
  11168. private webVROptions;
  11169. _vrDevice: any;
  11170. private _cacheState;
  11171. private _vrEnabled;
  11172. private _attached;
  11173. private _oldSize;
  11174. private _oldHardwareScaleFactor;
  11175. private _frameData;
  11176. private _quaternionCache;
  11177. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, webVROptions?: WebVROptions);
  11178. _checkInputs(): void;
  11179. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11180. detachControl(element: HTMLElement): void;
  11181. requestVRFullscreen(requestPointerlock: boolean): void;
  11182. getTypeName(): string;
  11183. resetToCurrentRotation(): void;
  11184. }
  11185. }
  11186. declare module BABYLON {
  11187. interface IOctreeContainer<T> {
  11188. blocks: Array<OctreeBlock<T>>;
  11189. }
  11190. class Octree<T> {
  11191. maxDepth: number;
  11192. blocks: Array<OctreeBlock<T>>;
  11193. dynamicContent: T[];
  11194. private _maxBlockCapacity;
  11195. private _selectionContent;
  11196. private _creationFunc;
  11197. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  11198. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  11199. addMesh(entry: T): void;
  11200. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  11201. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  11202. intersectsRay(ray: Ray): SmartArray<T>;
  11203. static _CreateBlocks<T>(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer<T>, creationFunc: (entry: T, block: OctreeBlock<T>) => void): void;
  11204. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  11205. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  11206. }
  11207. }
  11208. declare module BABYLON {
  11209. class OctreeBlock<T> {
  11210. entries: T[];
  11211. blocks: Array<OctreeBlock<T>>;
  11212. private _depth;
  11213. private _maxDepth;
  11214. private _capacity;
  11215. private _minPoint;
  11216. private _maxPoint;
  11217. private _boundingVectors;
  11218. private _creationFunc;
  11219. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  11220. capacity: number;
  11221. minPoint: Vector3;
  11222. maxPoint: Vector3;
  11223. addEntry(entry: T): void;
  11224. addEntries(entries: T[]): void;
  11225. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  11226. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  11227. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  11228. createInnerBlocks(): void;
  11229. }
  11230. }
  11231. declare module BABYLON {
  11232. interface IShadowGenerator {
  11233. getShadowMap(): RenderTargetTexture;
  11234. dispose(): void;
  11235. }
  11236. class ShadowGenerator implements IShadowGenerator {
  11237. private static _FILTER_NONE;
  11238. private static _FILTER_VARIANCESHADOWMAP;
  11239. private static _FILTER_POISSONSAMPLING;
  11240. private static _FILTER_BLURVARIANCESHADOWMAP;
  11241. static FILTER_NONE: number;
  11242. static FILTER_VARIANCESHADOWMAP: number;
  11243. static FILTER_POISSONSAMPLING: number;
  11244. static FILTER_BLURVARIANCESHADOWMAP: number;
  11245. private _filter;
  11246. blurScale: number;
  11247. private _blurBoxOffset;
  11248. private _bias;
  11249. private _lightDirection;
  11250. forceBackFacesOnly: boolean;
  11251. bias: number;
  11252. blurBoxOffset: number;
  11253. filter: number;
  11254. useVarianceShadowMap: boolean;
  11255. usePoissonSampling: boolean;
  11256. useBlurVarianceShadowMap: boolean;
  11257. private _light;
  11258. private _scene;
  11259. private _shadowMap;
  11260. private _shadowMap2;
  11261. private _darkness;
  11262. private _transparencyShadow;
  11263. private _effect;
  11264. private _viewMatrix;
  11265. private _projectionMatrix;
  11266. private _transformMatrix;
  11267. private _worldViewProjection;
  11268. private _cachedPosition;
  11269. private _cachedDirection;
  11270. private _cachedDefines;
  11271. private _currentRenderID;
  11272. private _downSamplePostprocess;
  11273. private _boxBlurPostprocess;
  11274. private _mapSize;
  11275. private _currentFaceIndex;
  11276. private _currentFaceIndexCache;
  11277. private _useFullFloat;
  11278. constructor(mapSize: number, light: IShadowLight);
  11279. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  11280. getShadowMap(): RenderTargetTexture;
  11281. getShadowMapForRendering(): RenderTargetTexture;
  11282. getLight(): IShadowLight;
  11283. getTransformMatrix(): Matrix;
  11284. getDarkness(): number;
  11285. setDarkness(darkness: number): void;
  11286. setTransparencyShadow(hasShadow: boolean): void;
  11287. private _packHalf(depth);
  11288. dispose(): void;
  11289. serialize(): any;
  11290. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  11291. }
  11292. }
  11293. declare module BABYLON.Internals {
  11294. }
  11295. declare module BABYLON {
  11296. class BaseTexture {
  11297. name: string;
  11298. hasAlpha: boolean;
  11299. getAlphaFromRGB: boolean;
  11300. level: number;
  11301. coordinatesIndex: number;
  11302. coordinatesMode: number;
  11303. wrapU: number;
  11304. wrapV: number;
  11305. anisotropicFilteringLevel: number;
  11306. isCube: boolean;
  11307. isRenderTarget: boolean;
  11308. uid: string;
  11309. toString(): string;
  11310. animations: Animation[];
  11311. /**
  11312. * An event triggered when the texture is disposed.
  11313. * @type {BABYLON.Observable}
  11314. */
  11315. onDisposeObservable: Observable<BaseTexture>;
  11316. private _onDisposeObserver;
  11317. onDispose: () => void;
  11318. delayLoadState: number;
  11319. _cachedAnisotropicFilteringLevel: number;
  11320. private _scene;
  11321. _texture: WebGLTexture;
  11322. private _uid;
  11323. constructor(scene: Scene);
  11324. getScene(): Scene;
  11325. getTextureMatrix(): Matrix;
  11326. getReflectionTextureMatrix(): Matrix;
  11327. getInternalTexture(): WebGLTexture;
  11328. isReady(): boolean;
  11329. getSize(): ISize;
  11330. getBaseSize(): ISize;
  11331. scale(ratio: number): void;
  11332. canRescale: boolean;
  11333. _removeFromCache(url: string, noMipmap: boolean): void;
  11334. _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture;
  11335. delayLoad(): void;
  11336. clone(): BaseTexture;
  11337. releaseInternalTexture(): void;
  11338. dispose(): void;
  11339. serialize(): any;
  11340. }
  11341. }
  11342. declare module BABYLON {
  11343. /**
  11344. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  11345. * It can help converting any input color in a desired output one. This can then be used to create effects
  11346. * from sepia, black and white to sixties or futuristic rendering...
  11347. *
  11348. * The only supported format is currently 3dl.
  11349. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  11350. */
  11351. class ColorGradingTexture extends BaseTexture {
  11352. /**
  11353. * The current internal texture size.
  11354. */
  11355. private _size;
  11356. /**
  11357. * The current texture matrix. (will always be identity in color grading texture)
  11358. */
  11359. private _textureMatrix;
  11360. /**
  11361. * The texture URL.
  11362. */
  11363. url: string;
  11364. /**
  11365. * Empty line regex stored for GC.
  11366. */
  11367. private static _noneEmptyLineRegex;
  11368. /**
  11369. * Instantiates a ColorGradingTexture from the following parameters.
  11370. *
  11371. * @param url The location of the color gradind data (currently only supporting 3dl)
  11372. * @param scene The scene the texture will be used in
  11373. */
  11374. constructor(url: string, scene: Scene);
  11375. /**
  11376. * Returns the texture matrix used in most of the material.
  11377. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  11378. */
  11379. getTextureMatrix(): Matrix;
  11380. /**
  11381. * Occurs when the file being loaded is a .3dl LUT file.
  11382. */
  11383. private load3dlTexture();
  11384. /**
  11385. * Starts the loading process of the texture.
  11386. */
  11387. private loadTexture();
  11388. /**
  11389. * Clones the color gradind texture.
  11390. */
  11391. clone(): ColorGradingTexture;
  11392. /**
  11393. * Called during delayed load for textures.
  11394. */
  11395. delayLoad(): void;
  11396. /**
  11397. * Binds the color grading to the shader.
  11398. * @param colorGrading The texture to bind
  11399. * @param effect The effect to bind to
  11400. */
  11401. static Bind(colorGrading: BaseTexture, effect: Effect): void;
  11402. /**
  11403. * Prepare the list of uniforms associated with the ColorGrading effects.
  11404. * @param uniformsList The list of uniforms used in the effect
  11405. * @param samplersList The list of samplers used in the effect
  11406. */
  11407. static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
  11408. /**
  11409. * Parses a color grading texture serialized by Babylon.
  11410. * @param parsedTexture The texture information being parsedTexture
  11411. * @param scene The scene to load the texture in
  11412. * @param rootUrl The root url of the data assets to load
  11413. * @return A color gradind texture
  11414. */
  11415. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
  11416. /**
  11417. * Serializes the LUT texture to json format.
  11418. */
  11419. serialize(): any;
  11420. }
  11421. }
  11422. declare module BABYLON {
  11423. class CubeTexture extends BaseTexture {
  11424. url: string;
  11425. coordinatesMode: number;
  11426. private _noMipmap;
  11427. private _files;
  11428. private _extensions;
  11429. private _textureMatrix;
  11430. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  11431. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void);
  11432. delayLoad(): void;
  11433. getReflectionTextureMatrix(): Matrix;
  11434. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  11435. clone(): CubeTexture;
  11436. }
  11437. }
  11438. declare module BABYLON {
  11439. class DynamicTexture extends Texture {
  11440. private _generateMipMaps;
  11441. private _canvas;
  11442. private _context;
  11443. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  11444. canRescale: boolean;
  11445. scale(ratio: number): void;
  11446. getContext(): CanvasRenderingContext2D;
  11447. clear(): void;
  11448. update(invertY?: boolean): void;
  11449. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  11450. clone(): DynamicTexture;
  11451. }
  11452. }
  11453. declare module BABYLON {
  11454. /**
  11455. * This class given information about a given character.
  11456. */
  11457. class CharInfo {
  11458. /**
  11459. * The normalized ([0;1]) top/left position of the character in the texture
  11460. */
  11461. topLeftUV: Vector2;
  11462. /**
  11463. * The normalized ([0;1]) right/bottom position of the character in the texture
  11464. */
  11465. bottomRightUV: Vector2;
  11466. charWidth: number;
  11467. }
  11468. class FontTexture extends Texture {
  11469. private _canvas;
  11470. private _context;
  11471. private _lineHeight;
  11472. private _lineHeightSuper;
  11473. private _xMargin;
  11474. private _yMargin;
  11475. private _offset;
  11476. private _currentFreePosition;
  11477. private _charInfos;
  11478. private _curCharCount;
  11479. private _lastUpdateCharCount;
  11480. private _spaceWidth;
  11481. private _spaceWidthSuper;
  11482. private _usedCounter;
  11483. private _superSample;
  11484. private _sdfCanvas;
  11485. private _sdfContext;
  11486. private _signedDistanceField;
  11487. private _cachedFontId;
  11488. private _sdfScale;
  11489. isSuperSampled: boolean;
  11490. isSignedDistanceField: boolean;
  11491. spaceWidth: number;
  11492. lineHeight: number;
  11493. static GetCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): FontTexture;
  11494. static ReleaseCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): void;
  11495. /**
  11496. * Create a new instance of the FontTexture class
  11497. * @param name the name of the texture
  11498. * @param font the font to use, use the W3C CSS notation
  11499. * @param scene the scene that owns the texture
  11500. * @param maxCharCount the approximative maximum count of characters that could fit in the texture. This is an approximation because most of the fonts are proportional (each char has its own Width). The 'W' character's width is used to compute the size of the texture based on the given maxCharCount
  11501. * @param samplingMode the texture sampling mode
  11502. * @param superSample if true the FontTexture will be created with a font of a size twice bigger than the given one but all properties (lineHeight, charWidth, etc.) will be according to the original size. This is made to improve the text quality.
  11503. */
  11504. constructor(name: string, font: string, scene: Scene, maxCharCount?: number, samplingMode?: number, superSample?: boolean, signedDistanceField?: boolean);
  11505. /**
  11506. * Make sure the given char is present in the font map.
  11507. * @param char the character to get or add
  11508. * @return the CharInfo instance corresponding to the given character
  11509. */
  11510. getChar(char: string): CharInfo;
  11511. private _computeSDFChar(source);
  11512. measureText(text: string, tabulationSize?: number): Size;
  11513. private getSuperSampleFont(font);
  11514. private getFontHeight(font);
  11515. canRescale: boolean;
  11516. getContext(): CanvasRenderingContext2D;
  11517. /**
  11518. * Call this method when you've call getChar() at least one time, this will update the texture if needed.
  11519. * Don't be afraid to call it, if no new character was added, this method simply does nothing.
  11520. */
  11521. update(): void;
  11522. clone(): FontTexture;
  11523. /**
  11524. * For FontTexture retrieved using GetCachedFontTexture, use this method when you transfer this object's lifetime to another party in order to share this resource.
  11525. * When the other party is done with this object, decCachedFontTextureCounter must be called.
  11526. */
  11527. incCachedFontTextureCounter(): void;
  11528. /**
  11529. * Use this method only in conjunction with incCachedFontTextureCounter, call it when you no longer need to use this shared resource.
  11530. */
  11531. decCachedFontTextureCounter(): void;
  11532. }
  11533. }
  11534. declare module BABYLON {
  11535. /**
  11536. * This represents a texture coming from an HDR input.
  11537. *
  11538. * The only supported format is currently panorama picture stored in RGBE format.
  11539. * Example of such files can be found on HDRLib: http://hdrlib.com/
  11540. */
  11541. class HDRCubeTexture extends BaseTexture {
  11542. private static _facesMapping;
  11543. private _useInGammaSpace;
  11544. private _generateHarmonics;
  11545. private _noMipmap;
  11546. private _extensions;
  11547. private _textureMatrix;
  11548. private _size;
  11549. private _usePMREMGenerator;
  11550. private _isBABYLONPreprocessed;
  11551. /**
  11552. * The texture URL.
  11553. */
  11554. url: string;
  11555. /**
  11556. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  11557. */
  11558. coordinatesMode: number;
  11559. /**
  11560. * The spherical polynomial data extracted from the texture.
  11561. */
  11562. sphericalPolynomial: SphericalPolynomial;
  11563. /**
  11564. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  11565. * This is usefull at run time to apply the good shader.
  11566. */
  11567. isPMREM: boolean;
  11568. /**
  11569. * Instantiates an HDRTexture from the following parameters.
  11570. *
  11571. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  11572. * @param scene The scene the texture will be used in
  11573. * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
  11574. * @param noMipmap Forces to not generate the mipmap if true
  11575. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  11576. * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  11577. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  11578. */
  11579. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  11580. /**
  11581. * Occurs when the file is a preprocessed .babylon.hdr file.
  11582. */
  11583. private loadBabylonTexture();
  11584. /**
  11585. * Occurs when the file is raw .hdr file.
  11586. */
  11587. private loadHDRTexture();
  11588. /**
  11589. * Starts the loading process of the texture.
  11590. */
  11591. private loadTexture();
  11592. clone(): HDRCubeTexture;
  11593. delayLoad(): void;
  11594. getReflectionTextureMatrix(): Matrix;
  11595. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  11596. serialize(): any;
  11597. /**
  11598. * Saves as a file the data contained in the texture in a binary format.
  11599. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  11600. * as the spherical used in the lighting.
  11601. * @param url The HDR file url.
  11602. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  11603. * @param onError Method called if any error happens during download.
  11604. * @return The packed binary data.
  11605. */
  11606. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  11607. /**
  11608. * Serializes the data contained in the texture in a binary format.
  11609. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  11610. * as the spherical used in the lighting.
  11611. * @param url The HDR file url.
  11612. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  11613. * @param onError Method called if any error happens during download.
  11614. * @return The packed binary data.
  11615. */
  11616. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer) => void), onError?: (() => void)): void;
  11617. }
  11618. }
  11619. declare module BABYLON {
  11620. class MapTexture extends Texture {
  11621. private _rectPackingMap;
  11622. private _size;
  11623. private _replacedViewport;
  11624. constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean);
  11625. /**
  11626. * Allocate a rectangle of a given size in the texture map
  11627. * @param size the size of the rectangle to allocation
  11628. * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
  11629. */
  11630. allocateRect(size: Size): PackedRect;
  11631. /**
  11632. * Free a given rectangle from the texture map
  11633. * @param rectInfo the instance corresponding to the rect to free.
  11634. */
  11635. freeRect(rectInfo: PackedRect): void;
  11636. /**
  11637. * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
  11638. * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
  11639. * @returns {}
  11640. */
  11641. freeSpace: number;
  11642. /**
  11643. * Bind the texture to the rendering engine to render in the zone of a given rectangle.
  11644. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  11645. * Don't forget to call unbindTexture when you're done rendering
  11646. * @param rect the zone to render to
  11647. * @param clear true to clear the portion's color/depth data
  11648. */
  11649. bindTextureForRect(rect: PackedRect, clear: boolean): void;
  11650. /**
  11651. * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
  11652. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  11653. * Don't forget to call unbindTexture when you're done rendering
  11654. * @param pos the position into the texture
  11655. * @param size the portion to fit the clip space to
  11656. * @param clear true to clear the portion's color/depth data
  11657. */
  11658. bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
  11659. /**
  11660. * Unbind the texture map from the rendering engine.
  11661. * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
  11662. * @param dumpForDebug if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.
  11663. */
  11664. unbindTexture(dumpForDebug?: boolean): void;
  11665. canRescale: boolean;
  11666. clone(): MapTexture;
  11667. }
  11668. }
  11669. declare module BABYLON {
  11670. class MirrorTexture extends RenderTargetTexture {
  11671. mirrorPlane: Plane;
  11672. private _transformMatrix;
  11673. private _mirrorMatrix;
  11674. private _savedViewMatrix;
  11675. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  11676. clone(): MirrorTexture;
  11677. serialize(): any;
  11678. }
  11679. }
  11680. declare module BABYLON {
  11681. class RawTexture extends Texture {
  11682. format: number;
  11683. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  11684. update(data: ArrayBufferView): void;
  11685. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11686. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11687. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11688. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11689. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11690. }
  11691. }
  11692. declare module BABYLON {
  11693. /**
  11694. * Creates a refraction texture used by refraction channel of the standard material.
  11695. * @param name the texture name
  11696. * @param size size of the underlying texture
  11697. * @param scene root scene
  11698. */
  11699. class RefractionTexture extends RenderTargetTexture {
  11700. refractionPlane: Plane;
  11701. depth: number;
  11702. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  11703. clone(): RefractionTexture;
  11704. serialize(): any;
  11705. }
  11706. }
  11707. declare module BABYLON {
  11708. class RenderTargetTexture extends Texture {
  11709. isCube: boolean;
  11710. static _REFRESHRATE_RENDER_ONCE: number;
  11711. static _REFRESHRATE_RENDER_ONEVERYFRAME: number;
  11712. static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  11713. static REFRESHRATE_RENDER_ONCE: number;
  11714. static REFRESHRATE_RENDER_ONEVERYFRAME: number;
  11715. static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  11716. /**
  11717. * Use this predicate to dynamically define the list of mesh you want to render.
  11718. * If set, the renderList property will be overwritten.
  11719. */
  11720. renderListPredicate: (AbstractMesh) => boolean;
  11721. /**
  11722. * Use this list to define the list of mesh you want to render.
  11723. */
  11724. renderList: AbstractMesh[];
  11725. renderParticles: boolean;
  11726. renderSprites: boolean;
  11727. coordinatesMode: number;
  11728. activeCamera: Camera;
  11729. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  11730. useCameraPostProcesses: boolean;
  11731. /**
  11732. * An event triggered when the texture is unbind.
  11733. * @type {BABYLON.Observable}
  11734. */
  11735. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  11736. private _onAfterUnbindObserver;
  11737. onAfterUnbind: () => void;
  11738. /**
  11739. * An event triggered before rendering the texture
  11740. * @type {BABYLON.Observable}
  11741. */
  11742. onBeforeRenderObservable: Observable<number>;
  11743. private _onBeforeRenderObserver;
  11744. onBeforeRender: (faceIndex: number) => void;
  11745. /**
  11746. * An event triggered after rendering the texture
  11747. * @type {BABYLON.Observable}
  11748. */
  11749. onAfterRenderObservable: Observable<number>;
  11750. private _onAfterRenderObserver;
  11751. onAfterRender: (faceIndex: number) => void;
  11752. /**
  11753. * An event triggered after the texture clear
  11754. * @type {BABYLON.Observable}
  11755. */
  11756. onClearObservable: Observable<Engine>;
  11757. private _onClearObserver;
  11758. onClear: (Engine: Engine) => void;
  11759. private _size;
  11760. _generateMipMaps: boolean;
  11761. private _renderingManager;
  11762. _waitingRenderList: string[];
  11763. private _doNotChangeAspectRatio;
  11764. private _currentRefreshId;
  11765. private _refreshRate;
  11766. private _textureMatrix;
  11767. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean);
  11768. resetRefreshCounter(): void;
  11769. refreshRate: number;
  11770. _shouldRender(): boolean;
  11771. isReady(): boolean;
  11772. getRenderSize(): number;
  11773. canRescale: boolean;
  11774. scale(ratio: number): void;
  11775. getReflectionTextureMatrix(): Matrix;
  11776. resize(size: any, generateMipMaps?: boolean): void;
  11777. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  11778. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], currentRenderListLength: number, useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  11779. /**
  11780. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  11781. * This allowed control for front to back rendering or reversly depending of the special needs.
  11782. *
  11783. * @param renderingGroupId The rendering group id corresponding to its index
  11784. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  11785. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  11786. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  11787. */
  11788. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  11789. /**
  11790. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  11791. *
  11792. * @param renderingGroupId The rendering group id corresponding to its index
  11793. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  11794. */
  11795. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  11796. clone(): RenderTargetTexture;
  11797. serialize(): any;
  11798. }
  11799. }
  11800. declare module BABYLON {
  11801. class Texture extends BaseTexture {
  11802. static NEAREST_SAMPLINGMODE: number;
  11803. static BILINEAR_SAMPLINGMODE: number;
  11804. static TRILINEAR_SAMPLINGMODE: number;
  11805. static EXPLICIT_MODE: number;
  11806. static SPHERICAL_MODE: number;
  11807. static PLANAR_MODE: number;
  11808. static CUBIC_MODE: number;
  11809. static PROJECTION_MODE: number;
  11810. static SKYBOX_MODE: number;
  11811. static INVCUBIC_MODE: number;
  11812. static EQUIRECTANGULAR_MODE: number;
  11813. static FIXED_EQUIRECTANGULAR_MODE: number;
  11814. static CLAMP_ADDRESSMODE: number;
  11815. static WRAP_ADDRESSMODE: number;
  11816. static MIRROR_ADDRESSMODE: number;
  11817. url: string;
  11818. uOffset: number;
  11819. vOffset: number;
  11820. uScale: number;
  11821. vScale: number;
  11822. uAng: number;
  11823. vAng: number;
  11824. wAng: number;
  11825. noMipmap: boolean;
  11826. private _noMipmap;
  11827. _invertY: boolean;
  11828. private _rowGenerationMatrix;
  11829. private _cachedTextureMatrix;
  11830. private _projectionModeMatrix;
  11831. private _t0;
  11832. private _t1;
  11833. private _t2;
  11834. private _cachedUOffset;
  11835. private _cachedVOffset;
  11836. private _cachedUScale;
  11837. private _cachedVScale;
  11838. private _cachedUAng;
  11839. private _cachedVAng;
  11840. private _cachedWAng;
  11841. private _cachedCoordinatesMode;
  11842. _samplingMode: number;
  11843. private _buffer;
  11844. private _deleteBuffer;
  11845. private _delayedOnLoad;
  11846. private _delayedOnError;
  11847. private _onLoadObservarble;
  11848. private _delayReloadData;
  11849. constructor(urlOrList: string | Array<string>, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
  11850. delayLoad(): void;
  11851. updateSamplingMode(samplingMode: number): void;
  11852. private _prepareRowForTextureGeneration(x, y, z, t);
  11853. getTextureMatrix(): Matrix;
  11854. getReflectionTextureMatrix(): Matrix;
  11855. clone(): Texture;
  11856. onLoadObservable: Observable<boolean>;
  11857. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  11858. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  11859. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  11860. }
  11861. }
  11862. declare module BABYLON {
  11863. class VideoTexture extends Texture {
  11864. video: HTMLVideoElement;
  11865. private _autoLaunch;
  11866. private _lastUpdate;
  11867. private _generateMipMaps;
  11868. /**
  11869. * Creates a video texture.
  11870. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  11871. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  11872. * @param {BABYLON.Scene} scene is obviously the current scene.
  11873. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  11874. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  11875. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  11876. */
  11877. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  11878. private _createTexture();
  11879. update(): boolean;
  11880. }
  11881. }
  11882. declare module BABYLON {
  11883. class CannonJSPlugin implements IPhysicsEnginePlugin {
  11884. private _useDeltaForWorldStep;
  11885. world: any;
  11886. name: string;
  11887. private _physicsMaterials;
  11888. private _fixedTimeStep;
  11889. private _currentCollisionGroup;
  11890. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  11891. setGravity(gravity: Vector3): void;
  11892. setTimeStep(timeStep: number): void;
  11893. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  11894. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11895. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11896. generatePhysicsBody(impostor: PhysicsImpostor): void;
  11897. private _processChildMeshes(mainImpostor);
  11898. removePhysicsBody(impostor: PhysicsImpostor): void;
  11899. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  11900. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  11901. private _addMaterial(name, friction, restitution);
  11902. private _checkWithEpsilon(value);
  11903. private _createShape(impostor);
  11904. private _createHeightmap(object, pointDepth?);
  11905. private _minus90X;
  11906. private _plus90X;
  11907. private _tmpPosition;
  11908. private _tmpQuaternion;
  11909. private _tmpDeltaPosition;
  11910. private _tmpDeltaRotation;
  11911. private _tmpUnityRotation;
  11912. private _updatePhysicsBodyTransformation(impostor);
  11913. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  11914. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  11915. isSupported(): boolean;
  11916. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11917. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11918. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  11919. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  11920. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  11921. sleepBody(impostor: PhysicsImpostor): void;
  11922. wakeUpBody(impostor: PhysicsImpostor): void;
  11923. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  11924. private enableMotor(joint, motorIndex?);
  11925. private disableMotor(joint, motorIndex?);
  11926. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  11927. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  11928. dispose(): void;
  11929. }
  11930. }
  11931. declare module BABYLON {
  11932. class OimoJSPlugin {
  11933. world: any;
  11934. name: string;
  11935. constructor(iterations?: number);
  11936. setGravity(gravity: Vector3): void;
  11937. setTimeStep(timeStep: number): void;
  11938. private _tmpImpostorsArray;
  11939. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  11940. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11941. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11942. generatePhysicsBody(impostor: PhysicsImpostor): void;
  11943. private _tmpPositionVector;
  11944. removePhysicsBody(impostor: PhysicsImpostor): void;
  11945. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  11946. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  11947. isSupported(): boolean;
  11948. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  11949. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  11950. private _getLastShape(body);
  11951. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11952. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11953. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  11954. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  11955. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  11956. sleepBody(impostor: PhysicsImpostor): void;
  11957. wakeUpBody(impostor: PhysicsImpostor): void;
  11958. updateDistanceJoint(joint: IMotorEnabledJoint, maxDistance: number, minDistance?: number): void;
  11959. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  11960. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  11961. dispose(): void;
  11962. }
  11963. }
  11964. declare module BABYLON {
  11965. class PostProcessRenderEffect {
  11966. private _engine;
  11967. private _postProcesses;
  11968. private _getPostProcess;
  11969. private _singleInstance;
  11970. private _cameras;
  11971. private _indicesForCamera;
  11972. private _renderPasses;
  11973. private _renderEffectAsPasses;
  11974. _name: string;
  11975. applyParameters: (postProcess: PostProcess) => void;
  11976. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  11977. isSupported: boolean;
  11978. _update(): void;
  11979. addPass(renderPass: PostProcessRenderPass): void;
  11980. removePass(renderPass: PostProcessRenderPass): void;
  11981. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  11982. getPass(passName: string): void;
  11983. emptyPasses(): void;
  11984. _attachCameras(cameras: Camera): any;
  11985. _attachCameras(cameras: Camera[]): any;
  11986. _detachCameras(cameras: Camera): any;
  11987. _detachCameras(cameras: Camera[]): any;
  11988. _enable(cameras: Camera): any;
  11989. _enable(cameras: Camera[]): any;
  11990. _disable(cameras: Camera): any;
  11991. _disable(cameras: Camera[]): any;
  11992. getPostProcess(camera?: Camera): PostProcess;
  11993. private _linkParameters();
  11994. private _linkTextures(effect);
  11995. }
  11996. }
  11997. declare module BABYLON {
  11998. class PostProcessRenderPass {
  11999. private _enabled;
  12000. private _renderList;
  12001. private _renderTexture;
  12002. private _scene;
  12003. private _refCount;
  12004. _name: string;
  12005. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  12006. _incRefCount(): number;
  12007. _decRefCount(): number;
  12008. _update(): void;
  12009. setRenderList(renderList: Mesh[]): void;
  12010. getRenderTexture(): RenderTargetTexture;
  12011. }
  12012. }
  12013. declare module BABYLON {
  12014. class PostProcessRenderPipeline {
  12015. private _engine;
  12016. private _renderEffects;
  12017. private _renderEffectsForIsolatedPass;
  12018. private _cameras;
  12019. _name: string;
  12020. private static PASS_EFFECT_NAME;
  12021. private static PASS_SAMPLER_NAME;
  12022. constructor(engine: Engine, name: string);
  12023. isSupported: boolean;
  12024. addEffect(renderEffect: PostProcessRenderEffect): void;
  12025. _enableEffect(renderEffectName: string, cameras: Camera): any;
  12026. _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  12027. _disableEffect(renderEffectName: string, cameras: Camera): any;
  12028. _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  12029. _attachCameras(cameras: Camera, unique: boolean): any;
  12030. _attachCameras(cameras: Camera[], unique: boolean): any;
  12031. _detachCameras(cameras: Camera): any;
  12032. _detachCameras(cameras: Camera[]): any;
  12033. _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  12034. _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  12035. _disableDisplayOnlyPass(cameras: Camera): any;
  12036. _disableDisplayOnlyPass(cameras: Camera[]): any;
  12037. _update(): void;
  12038. dispose(): void;
  12039. }
  12040. }
  12041. declare module BABYLON {
  12042. class PostProcessRenderPipelineManager {
  12043. private _renderPipelines;
  12044. constructor();
  12045. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  12046. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  12047. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  12048. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  12049. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  12050. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  12051. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  12052. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  12053. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  12054. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  12055. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  12056. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  12057. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  12058. update(): void;
  12059. }
  12060. }
  12061. declare module BABYLON.Internals {
  12062. /**
  12063. * Helper class dealing with the extraction of spherical polynomial dataArray
  12064. * from a cube map.
  12065. */
  12066. class CubeMapToSphericalPolynomialTools {
  12067. private static FileFaces;
  12068. /**
  12069. * Converts a cubemap to the according Spherical Polynomial data.
  12070. * This extracts the first 3 orders only as they are the only one used in the lighting.
  12071. *
  12072. * @param cubeInfo The Cube map to extract the information from.
  12073. * @return The Spherical Polynomial data.
  12074. */
  12075. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  12076. }
  12077. }
  12078. declare module BABYLON.Internals {
  12079. /**
  12080. * Header information of HDR texture files.
  12081. */
  12082. interface HDRInfo {
  12083. /**
  12084. * The height of the texture in pixels.
  12085. */
  12086. height: number;
  12087. /**
  12088. * The width of the texture in pixels.
  12089. */
  12090. width: number;
  12091. /**
  12092. * The index of the beginning of the data in the binary file.
  12093. */
  12094. dataPosition: number;
  12095. }
  12096. /**
  12097. * This groups tools to convert HDR texture to native colors array.
  12098. */
  12099. class HDRTools {
  12100. private static Ldexp(mantissa, exponent);
  12101. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  12102. private static readStringLine(uint8array, startIndex);
  12103. /**
  12104. * Reads header information from an RGBE texture stored in a native array.
  12105. * More information on this format are available here:
  12106. * https://en.wikipedia.org/wiki/RGBE_image_format
  12107. *
  12108. * @param uint8array The binary file stored in native array.
  12109. * @return The header information.
  12110. */
  12111. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  12112. /**
  12113. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  12114. * This RGBE texture needs to store the information as a panorama.
  12115. *
  12116. * More information on this format are available here:
  12117. * https://en.wikipedia.org/wiki/RGBE_image_format
  12118. *
  12119. * @param buffer The binary file stored in an array buffer.
  12120. * @param size The expected size of the extracted cubemap.
  12121. * @return The Cube Map information.
  12122. */
  12123. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  12124. /**
  12125. * Returns the pixels data extracted from an RGBE texture.
  12126. * This pixels will be stored left to right up to down in the R G B order in one array.
  12127. *
  12128. * More information on this format are available here:
  12129. * https://en.wikipedia.org/wiki/RGBE_image_format
  12130. *
  12131. * @param uint8array The binary file stored in an array buffer.
  12132. * @param hdrInfo The header information of the file.
  12133. * @return The pixels data in RGB right to left up to down order.
  12134. */
  12135. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  12136. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  12137. }
  12138. }
  12139. declare module BABYLON.Internals {
  12140. /**
  12141. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  12142. */
  12143. interface CubeMapInfo {
  12144. /**
  12145. * The pixel array for the front face.
  12146. * This is stored in RGB, left to right, up to down format.
  12147. */
  12148. front: Float32Array;
  12149. /**
  12150. * The pixel array for the back face.
  12151. * This is stored in RGB, left to right, up to down format.
  12152. */
  12153. back: Float32Array;
  12154. /**
  12155. * The pixel array for the left face.
  12156. * This is stored in RGB, left to right, up to down format.
  12157. */
  12158. left: Float32Array;
  12159. /**
  12160. * The pixel array for the right face.
  12161. * This is stored in RGB, left to right, up to down format.
  12162. */
  12163. right: Float32Array;
  12164. /**
  12165. * The pixel array for the up face.
  12166. * This is stored in RGB, left to right, up to down format.
  12167. */
  12168. up: Float32Array;
  12169. /**
  12170. * The pixel array for the down face.
  12171. * This is stored in RGB, left to right, up to down format.
  12172. */
  12173. down: Float32Array;
  12174. /**
  12175. * The size of the cubemap stored.
  12176. *
  12177. * Each faces will be size * size pixels.
  12178. */
  12179. size: number;
  12180. }
  12181. /**
  12182. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  12183. */
  12184. class PanoramaToCubeMapTools {
  12185. private static FACE_FRONT;
  12186. private static FACE_BACK;
  12187. private static FACE_RIGHT;
  12188. private static FACE_LEFT;
  12189. private static FACE_DOWN;
  12190. private static FACE_UP;
  12191. /**
  12192. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  12193. *
  12194. * @param float32Array The source data.
  12195. * @param inputWidth The width of the input panorama.
  12196. * @param inputhHeight The height of the input panorama.
  12197. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  12198. * @return The cubemap data
  12199. */
  12200. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  12201. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  12202. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  12203. }
  12204. }
  12205. declare namespace BABYLON.Internals {
  12206. /**
  12207. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  12208. * required by the glossinees of a material.
  12209. *
  12210. * This only supports the cosine drop power as well as Warp fixup generation method.
  12211. *
  12212. * This is using the process from CubeMapGen described here:
  12213. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  12214. */
  12215. class PMREMGenerator {
  12216. input: ArrayBufferView[];
  12217. inputSize: number;
  12218. outputSize: number;
  12219. maxNumMipLevels: number;
  12220. numChannels: number;
  12221. isFloat: boolean;
  12222. specularPower: number;
  12223. cosinePowerDropPerMip: number;
  12224. excludeBase: boolean;
  12225. fixup: boolean;
  12226. private static CP_MAX_MIPLEVELS;
  12227. private static CP_UDIR;
  12228. private static CP_VDIR;
  12229. private static CP_FACEAXIS;
  12230. private static CP_FACE_X_POS;
  12231. private static CP_FACE_X_NEG;
  12232. private static CP_FACE_Y_POS;
  12233. private static CP_FACE_Y_NEG;
  12234. private static CP_FACE_Z_POS;
  12235. private static CP_FACE_Z_NEG;
  12236. private static CP_EDGE_LEFT;
  12237. private static CP_EDGE_RIGHT;
  12238. private static CP_EDGE_TOP;
  12239. private static CP_EDGE_BOTTOM;
  12240. private static CP_CORNER_NNN;
  12241. private static CP_CORNER_NNP;
  12242. private static CP_CORNER_NPN;
  12243. private static CP_CORNER_NPP;
  12244. private static CP_CORNER_PNN;
  12245. private static CP_CORNER_PNP;
  12246. private static CP_CORNER_PPN;
  12247. private static CP_CORNER_PPP;
  12248. private static _vectorTemp;
  12249. private static _sgFace2DMapping;
  12250. private static _sgCubeNgh;
  12251. private static _sgCubeEdgeList;
  12252. private static _sgCubeCornerList;
  12253. private _outputSurface;
  12254. private _normCubeMap;
  12255. private _filterLUT;
  12256. private _numMipLevels;
  12257. /**
  12258. * Constructor of the generator.
  12259. *
  12260. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  12261. * @param inputSize The size of the cubemap faces
  12262. * @param outputSize The size of the output cubemap faces
  12263. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  12264. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  12265. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  12266. * @param specularPower The max specular level of the desired cubemap
  12267. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  12268. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  12269. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  12270. */
  12271. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  12272. /**
  12273. * Launches the filter process and return the result.
  12274. *
  12275. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  12276. */
  12277. filterCubeMap(): ArrayBufferView[][];
  12278. private init();
  12279. private filterCubeMapMipChain();
  12280. private getBaseFilterAngle(cosinePower);
  12281. private precomputeFilterLookupTables(srcCubeMapWidth);
  12282. private buildNormalizerSolidAngleCubemap(size);
  12283. private texelCoordToVect(faceIdx, u, v, size, fixup);
  12284. private vectToTexelCoord(x, y, z, size);
  12285. private areaElement(x, y);
  12286. private texelCoordSolidAngle(faceIdx, u, v, size);
  12287. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  12288. private clearFilterExtents(filterExtents);
  12289. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  12290. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  12291. private fixupCubeEdges(cubeMap, cubeMapSize);
  12292. }
  12293. }
  12294. declare module BABYLON {
  12295. class CustomProceduralTexture extends ProceduralTexture {
  12296. private _animate;
  12297. private _time;
  12298. private _config;
  12299. private _texturePath;
  12300. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  12301. private loadJson(jsonUrl);
  12302. isReady(): boolean;
  12303. render(useCameraPostProcess?: boolean): void;
  12304. updateTextures(): void;
  12305. updateShaderUniforms(): void;
  12306. animate: boolean;
  12307. }
  12308. }
  12309. declare module BABYLON {
  12310. class ProceduralTexture extends Texture {
  12311. isCube: boolean;
  12312. private _size;
  12313. _generateMipMaps: boolean;
  12314. isEnabled: boolean;
  12315. private _doNotChangeAspectRatio;
  12316. private _currentRefreshId;
  12317. private _refreshRate;
  12318. onGenerated: () => void;
  12319. private _vertexBuffers;
  12320. private _indexBuffer;
  12321. private _effect;
  12322. private _uniforms;
  12323. private _samplers;
  12324. private _fragment;
  12325. _textures: Texture[];
  12326. private _floats;
  12327. private _floatsArrays;
  12328. private _colors3;
  12329. private _colors4;
  12330. private _vectors2;
  12331. private _vectors3;
  12332. private _matrices;
  12333. private _fallbackTexture;
  12334. private _fallbackTextureUsed;
  12335. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  12336. reset(): void;
  12337. isReady(): boolean;
  12338. resetRefreshCounter(): void;
  12339. setFragment(fragment: any): void;
  12340. refreshRate: number;
  12341. _shouldRender(): boolean;
  12342. getRenderSize(): number;
  12343. resize(size: any, generateMipMaps: any): void;
  12344. private _checkUniform(uniformName);
  12345. setTexture(name: string, texture: Texture): ProceduralTexture;
  12346. setFloat(name: string, value: number): ProceduralTexture;
  12347. setFloats(name: string, value: number[]): ProceduralTexture;
  12348. setColor3(name: string, value: Color3): ProceduralTexture;
  12349. setColor4(name: string, value: Color4): ProceduralTexture;
  12350. setVector2(name: string, value: Vector2): ProceduralTexture;
  12351. setVector3(name: string, value: Vector3): ProceduralTexture;
  12352. setMatrix(name: string, value: Matrix): ProceduralTexture;
  12353. render(useCameraPostProcess?: boolean): void;
  12354. clone(): ProceduralTexture;
  12355. dispose(): void;
  12356. }
  12357. }