babylon.d.ts 272 KB

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