babylon.d.ts 272 KB

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