babylon.2.2.d.ts 252 KB

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