babylon.d.ts 270 KB

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