babylon.d.ts 576 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619
  1. declare module BABYLON {
  2. class InstancingAttributeInfo {
  3. /**
  4. * Index/offset of the attribute in the vertex shader
  5. */
  6. index: number;
  7. /**
  8. * size of the attribute, 1, 2, 3 or 4
  9. */
  10. attributeSize: number;
  11. /**
  12. * type of the attribute, gl.BYTE, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.FIXED, gl.FLOAT.
  13. * default is FLOAT
  14. */
  15. attribyteType: number;
  16. /**
  17. * normalization of fixed-point data. behavior unclear, use FALSE, default is FALSE
  18. */
  19. normalized: boolean;
  20. /**
  21. * Offset of the data in the Vertex Buffer acting as the instancing buffer
  22. */
  23. offset: number;
  24. /**
  25. * Name of the GLSL attribute, for debugging purpose only
  26. */
  27. attributeName: string;
  28. }
  29. class EngineCapabilities {
  30. maxTexturesImageUnits: number;
  31. maxTextureSize: number;
  32. maxCubemapTextureSize: number;
  33. maxRenderTextureSize: number;
  34. maxVertexAttribs: number;
  35. standardDerivatives: boolean;
  36. s3tc: WEBGL_compressed_texture_s3tc;
  37. textureFloat: boolean;
  38. textureAnisotropicFilterExtension: EXT_texture_filter_anisotropic;
  39. maxAnisotropy: number;
  40. instancedArrays: ANGLE_instanced_arrays;
  41. uintIndices: boolean;
  42. highPrecisionShaderSupported: boolean;
  43. fragmentDepthSupported: boolean;
  44. textureFloatLinearFiltering: boolean;
  45. textureFloatRender: boolean;
  46. textureHalfFloat: boolean;
  47. textureHalfFloatLinearFiltering: boolean;
  48. textureHalfFloatRender: boolean;
  49. textureLOD: boolean;
  50. drawBuffersExtension: any;
  51. }
  52. interface EngineOptions extends WebGLContextAttributes {
  53. limitDeviceRatio?: number;
  54. autoEnableWebVR?: boolean;
  55. }
  56. /**
  57. * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
  58. */
  59. class Engine {
  60. private static _ALPHA_DISABLE;
  61. private static _ALPHA_ADD;
  62. private static _ALPHA_COMBINE;
  63. private static _ALPHA_SUBTRACT;
  64. private static _ALPHA_MULTIPLY;
  65. private static _ALPHA_MAXIMIZED;
  66. private static _ALPHA_ONEONE;
  67. private static _DELAYLOADSTATE_NONE;
  68. private static _DELAYLOADSTATE_LOADED;
  69. private static _DELAYLOADSTATE_LOADING;
  70. private static _DELAYLOADSTATE_NOTLOADED;
  71. private static _TEXTUREFORMAT_ALPHA;
  72. private static _TEXTUREFORMAT_LUMINANCE;
  73. private static _TEXTUREFORMAT_LUMINANCE_ALPHA;
  74. private static _TEXTUREFORMAT_RGB;
  75. private static _TEXTUREFORMAT_RGBA;
  76. private static _TEXTURETYPE_UNSIGNED_INT;
  77. private static _TEXTURETYPE_FLOAT;
  78. private static _TEXTURETYPE_HALF_FLOAT;
  79. private static _NEVER;
  80. private static _ALWAYS;
  81. private static _LESS;
  82. private static _EQUAL;
  83. private static _LEQUAL;
  84. private static _GREATER;
  85. private static _GEQUAL;
  86. private static _NOTEQUAL;
  87. static NEVER: number;
  88. static ALWAYS: number;
  89. static LESS: number;
  90. static EQUAL: number;
  91. static LEQUAL: number;
  92. static GREATER: number;
  93. static GEQUAL: number;
  94. static NOTEQUAL: number;
  95. private static _KEEP;
  96. private static _REPLACE;
  97. private static _INCR;
  98. private static _DECR;
  99. private static _INVERT;
  100. private static _INCR_WRAP;
  101. private static _DECR_WRAP;
  102. static KEEP: number;
  103. static REPLACE: number;
  104. static INCR: number;
  105. static DECR: number;
  106. static INVERT: number;
  107. static INCR_WRAP: number;
  108. static DECR_WRAP: number;
  109. static ALPHA_DISABLE: number;
  110. static ALPHA_ONEONE: number;
  111. static ALPHA_ADD: number;
  112. static ALPHA_COMBINE: number;
  113. static ALPHA_SUBTRACT: number;
  114. static ALPHA_MULTIPLY: number;
  115. static ALPHA_MAXIMIZED: number;
  116. static DELAYLOADSTATE_NONE: number;
  117. static DELAYLOADSTATE_LOADED: number;
  118. static DELAYLOADSTATE_LOADING: number;
  119. static DELAYLOADSTATE_NOTLOADED: number;
  120. static TEXTUREFORMAT_ALPHA: number;
  121. static TEXTUREFORMAT_LUMINANCE: number;
  122. static TEXTUREFORMAT_LUMINANCE_ALPHA: number;
  123. static TEXTUREFORMAT_RGB: number;
  124. static TEXTUREFORMAT_RGBA: number;
  125. static TEXTURETYPE_UNSIGNED_INT: number;
  126. static TEXTURETYPE_FLOAT: number;
  127. static TEXTURETYPE_HALF_FLOAT: number;
  128. static Version: string;
  129. static CollisionsEpsilon: number;
  130. static CodeRepository: string;
  131. static ShadersRepository: string;
  132. isFullscreen: boolean;
  133. isPointerLock: boolean;
  134. cullBackFaces: boolean;
  135. renderEvenInBackground: boolean;
  136. enableOfflineSupport: boolean;
  137. scenes: Scene[];
  138. vrDisplaysPromise: any;
  139. private _vrDisplays;
  140. private _vrDisplayEnabled;
  141. private _oldSize;
  142. private _oldHardwareScaleFactor;
  143. private _vrAnimationFrameHandler;
  144. _gl: WebGLRenderingContext;
  145. private _renderingCanvas;
  146. private _windowIsBackground;
  147. private _webGLVersion;
  148. private _badOS;
  149. static audioEngine: AudioEngine;
  150. private _onBlur;
  151. private _onFocus;
  152. private _onFullscreenChange;
  153. private _onPointerLockChange;
  154. private _hardwareScalingLevel;
  155. private _caps;
  156. private _pointerLockRequested;
  157. private _alphaTest;
  158. private _isStencilEnable;
  159. private _loadingScreen;
  160. _drawCalls: PerfCounter;
  161. private _glVersion;
  162. private _glRenderer;
  163. private _glVendor;
  164. private _videoTextureSupported;
  165. private _renderingQueueLaunched;
  166. private _activeRenderLoops;
  167. private fpsRange;
  168. private previousFramesDuration;
  169. private fps;
  170. private deltaTime;
  171. private _depthCullingState;
  172. private _stencilState;
  173. private _alphaState;
  174. private _alphaMode;
  175. private _loadedTexturesCache;
  176. private _maxTextureChannels;
  177. private _activeTexture;
  178. private _activeTexturesCache;
  179. private _currentEffect;
  180. private _currentProgram;
  181. private _compiledEffects;
  182. private _vertexAttribArraysEnabled;
  183. private _cachedViewport;
  184. private _cachedVertexBuffers;
  185. private _cachedIndexBuffer;
  186. private _cachedEffectForVertexBuffers;
  187. private _currentRenderTarget;
  188. private _uintIndicesCurrentlySet;
  189. private _currentBoundBuffer;
  190. private _currentFramebuffer;
  191. private _currentBufferPointers;
  192. private _currentInstanceLocations;
  193. private _currentInstanceBuffers;
  194. private _textureUnits;
  195. private _workingCanvas;
  196. private _workingContext;
  197. private _externalData;
  198. private _bindedRenderFunction;
  199. /**
  200. * @constructor
  201. * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering
  202. * @param {boolean} [antialias] - enable antialias
  203. * @param options - further options to be sent to the getContext function
  204. */
  205. constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio?: boolean);
  206. webGLVersion: string;
  207. /**
  208. * Returns true if the stencil buffer has been enabled through the creation option of the context.
  209. */
  210. isStencilEnable: boolean;
  211. private _prepareWorkingCanvas();
  212. resetTextureCache(): void;
  213. getGlInfo(): {
  214. vendor: string;
  215. renderer: string;
  216. version: string;
  217. };
  218. getAspectRatio(camera: Camera, useScreen?: boolean): number;
  219. getRenderWidth(useScreen?: boolean): number;
  220. getRenderHeight(useScreen?: boolean): number;
  221. getRenderingCanvas(): HTMLCanvasElement;
  222. getRenderingCanvasClientRect(): ClientRect;
  223. setHardwareScalingLevel(level: number): void;
  224. getHardwareScalingLevel(): number;
  225. getLoadedTexturesCache(): WebGLTexture[];
  226. getCaps(): EngineCapabilities;
  227. drawCalls: number;
  228. drawCallsPerfCounter: PerfCounter;
  229. getDepthFunction(): number;
  230. setDepthFunction(depthFunc: number): void;
  231. setDepthFunctionToGreater(): void;
  232. setDepthFunctionToGreaterOrEqual(): void;
  233. setDepthFunctionToLess(): void;
  234. setDepthFunctionToLessOrEqual(): void;
  235. getStencilBuffer(): boolean;
  236. setStencilBuffer(enable: boolean): void;
  237. getStencilMask(): number;
  238. setStencilMask(mask: number): void;
  239. getStencilFunction(): number;
  240. getStencilFunctionReference(): number;
  241. getStencilFunctionMask(): number;
  242. setStencilFunction(stencilFunc: number): void;
  243. setStencilFunctionReference(reference: number): void;
  244. setStencilFunctionMask(mask: number): void;
  245. getStencilOperationFail(): number;
  246. getStencilOperationDepthFail(): number;
  247. getStencilOperationPass(): number;
  248. setStencilOperationFail(operation: number): void;
  249. setStencilOperationDepthFail(operation: number): void;
  250. setStencilOperationPass(operation: number): void;
  251. /**
  252. * stop executing a render loop function and remove it from the execution array
  253. * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed.
  254. */
  255. stopRenderLoop(renderFunction?: () => void): void;
  256. _renderLoop(): void;
  257. /**
  258. * Register and execute a render loop. The engine can have more than one render function.
  259. * @param {Function} renderFunction - the function to continuously execute starting the next render loop.
  260. * @example
  261. * engine.runRenderLoop(function () {
  262. * scene.render()
  263. * })
  264. */
  265. runRenderLoop(renderFunction: () => void): void;
  266. /**
  267. * Toggle full screen mode.
  268. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
  269. * @param {any} options - an options object to be sent to the requestFullscreen function
  270. */
  271. switchFullscreen(requestPointerLock: boolean): void;
  272. clear(color: any, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  273. scissorClear(x: number, y: number, width: number, height: number, clearColor: Color4): void;
  274. /**
  275. * Set the WebGL's viewport
  276. * @param {BABYLON.Viewport} viewport - the viewport element to be used.
  277. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used.
  278. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used.
  279. */
  280. setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void;
  281. /**
  282. * Directly set the WebGL Viewport
  283. * The x, y, width & height are directly passed to the WebGL call
  284. * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state.
  285. */
  286. setDirectViewport(x: number, y: number, width: number, height: number): Viewport;
  287. beginFrame(): void;
  288. endFrame(): void;
  289. /**
  290. * resize the view according to the canvas' size.
  291. * @example
  292. * window.addEventListener("resize", function () {
  293. * engine.resize();
  294. * });
  295. */
  296. resize(): void;
  297. /**
  298. * force a specific size of the canvas
  299. * @param {number} width - the new canvas' width
  300. * @param {number} height - the new canvas' height
  301. */
  302. setSize(width: number, height: number): void;
  303. initWebVR(): void;
  304. enableVR(vrDevice: any): void;
  305. disableVR(): void;
  306. private _onVRFullScreenTriggered;
  307. private _getVRDisplays();
  308. bindFramebuffer(texture: WebGLTexture, faceIndex?: number, requiredWidth?: number, requiredHeight?: number): void;
  309. private bindUnboundFramebuffer(framebuffer);
  310. unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void;
  311. generateMipMapsForCubemap(texture: WebGLTexture): void;
  312. flushFramebuffer(): void;
  313. restoreDefaultFramebuffer(): void;
  314. private _resetVertexBufferBinding();
  315. createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  316. createDynamicVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer;
  317. updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number, count?: number): void;
  318. private _resetIndexBufferBinding();
  319. createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer;
  320. bindArrayBuffer(buffer: WebGLBuffer): void;
  321. private bindIndexBuffer(buffer);
  322. private bindBuffer(buffer, target);
  323. updateArrayBuffer(data: Float32Array): void;
  324. private vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset);
  325. bindBuffersDirectly(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void;
  326. bindBuffers(vertexBuffers: {
  327. [key: string]: VertexBuffer;
  328. }, indexBuffer: WebGLBuffer, effect: Effect): void;
  329. unbindInstanceAttributes(): void;
  330. _releaseBuffer(buffer: WebGLBuffer): boolean;
  331. createInstancesBuffer(capacity: number): WebGLBuffer;
  332. deleteInstancesBuffer(buffer: WebGLBuffer): void;
  333. updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[] | InstancingAttributeInfo[]): void;
  334. applyStates(): void;
  335. draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void;
  336. drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void;
  337. drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  338. _releaseEffect(effect: Effect): void;
  339. createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
  340. createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect;
  341. createShaderProgram(vertexCode: string, fragmentCode: string, defines: string, context?: WebGLRenderingContext): WebGLProgram;
  342. getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
  343. getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[];
  344. enableEffect(effect: Effect): void;
  345. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): void;
  346. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): void;
  347. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): void;
  348. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): void;
  349. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): void;
  350. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): void;
  351. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): void;
  352. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): void;
  353. setArray(uniform: WebGLUniformLocation, array: number[]): void;
  354. setArray2(uniform: WebGLUniformLocation, array: number[]): void;
  355. setArray3(uniform: WebGLUniformLocation, array: number[]): void;
  356. setArray4(uniform: WebGLUniformLocation, array: number[]): void;
  357. setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void;
  358. setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void;
  359. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  360. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void;
  361. setFloat(uniform: WebGLUniformLocation, value: number): void;
  362. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void;
  363. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void;
  364. setBool(uniform: WebGLUniformLocation, bool: number): void;
  365. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
  366. setColor3(uniform: WebGLUniformLocation, color3: Color3): void;
  367. setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void;
  368. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void;
  369. setDepthBuffer(enable: boolean): void;
  370. getDepthWrite(): boolean;
  371. setDepthWrite(enable: boolean): void;
  372. setColorWrite(enable: boolean): void;
  373. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  374. getAlphaMode(): number;
  375. setAlphaTesting(enable: boolean): void;
  376. getAlphaTesting(): boolean;
  377. wipeCaches(): void;
  378. setSamplingMode(texture: WebGLTexture, samplingMode: number): void;
  379. createTexture(urlOrList: string | Array<string>, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture;
  380. private _getInternalFormat(format);
  381. updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void;
  382. createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture;
  383. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): WebGLTexture;
  384. updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void;
  385. updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean): void;
  386. updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void;
  387. createRenderTargetTexture(size: any, options: any): WebGLTexture;
  388. createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture;
  389. createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean, onLoad?: () => void, onError?: () => void): WebGLTexture;
  390. updateTextureSize(texture: WebGLTexture, width: number, height: number): void;
  391. createRawCubeTexture(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer) => ArrayBufferView[], mipmmapGenerator: ((faces: ArrayBufferView[]) => ArrayBufferView[][])): WebGLTexture;
  392. _releaseTexture(texture: WebGLTexture): void;
  393. private setProgram(program);
  394. bindSamplers(effect: Effect): void;
  395. private activateTexture(texture);
  396. _bindTextureDirectly(target: number, texture: WebGLTexture): void;
  397. _bindTexture(channel: number, texture: WebGLTexture): void;
  398. setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
  399. unbindAllTextures(): void;
  400. setTexture(channel: number, uniform: WebGLUniformLocation, texture: BaseTexture): void;
  401. private _setTexture(channel, texture);
  402. setTextureArray(channel: number, uniform: WebGLUniformLocation, textures: BaseTexture[]): void;
  403. _setAnisotropicLevel(key: number, texture: BaseTexture): void;
  404. readPixels(x: number, y: number, width: number, height: number): Uint8Array;
  405. /**
  406. * Add an externaly attached data from its key.
  407. * This method call will fail and return false, if such key already exists.
  408. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  409. * @param key the unique key that identifies the data
  410. * @param data the data object to associate to the key for this Engine instance
  411. * @return true if no such key were already present and the data was added successfully, false otherwise
  412. */
  413. addExternalData<T>(key: string, data: T): boolean;
  414. /**
  415. * Get an externaly attached data from its key
  416. * @param key the unique key that identifies the data
  417. * @return the associated data, if present (can be null), or undefined if not present
  418. */
  419. getExternalData<T>(key: string): T;
  420. /**
  421. * Get an externaly attached data from its key, create it using a factory if it's not already present
  422. * @param key the unique key that identifies the data
  423. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  424. * @return the associated data, can be null if the factory returned null.
  425. */
  426. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  427. /**
  428. * Remove an externaly attached data from the Engine instance
  429. * @param key the unique key that identifies the data
  430. * @return true if the data was successfully removed, false if it doesn't exist
  431. */
  432. removeExternalData(key: any): boolean;
  433. releaseInternalTexture(texture: WebGLTexture): void;
  434. unbindAllAttributes(): void;
  435. dispose(): void;
  436. displayLoadingUI(): void;
  437. hideLoadingUI(): void;
  438. loadingScreen: ILoadingScreen;
  439. loadingUIText: string;
  440. loadingUIBackgroundColor: string;
  441. attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void;
  442. attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void;
  443. getVertexShaderSource(program: WebGLProgram): string;
  444. getFragmentShaderSource(program: WebGLProgram): string;
  445. getFps(): number;
  446. getDeltaTime(): number;
  447. private _measureFps();
  448. private _canRenderToFloatTexture();
  449. private _canRenderToHalfFloatTexture();
  450. private _canRenderToTextureOfType(format, extension);
  451. static isSupported(): boolean;
  452. }
  453. }
  454. interface Window {
  455. mozIndexedDB(func: any): any;
  456. webkitIndexedDB(func: any): any;
  457. msIndexedDB: IDBFactory;
  458. IDBTransaction(func: any): any;
  459. webkitIDBTransaction(func: any): any;
  460. msIDBTransaction(func: any): any;
  461. IDBKeyRange(func: any): any;
  462. webkitIDBKeyRange(func: any): any;
  463. msIDBKeyRange(func: any): any;
  464. webkitURL: HTMLURL;
  465. webkitRequestAnimationFrame(func: any): any;
  466. mozRequestAnimationFrame(func: any): any;
  467. oRequestAnimationFrame(func: any): any;
  468. WebGLRenderingContext: WebGLRenderingContext;
  469. MSGesture: MSGesture;
  470. CANNON: any;
  471. SIMD: any;
  472. AudioContext: AudioContext;
  473. webkitAudioContext: AudioContext;
  474. PointerEvent: any;
  475. Math: Math;
  476. Uint8Array: Uint8ArrayConstructor;
  477. Float32Array: Float32ArrayConstructor;
  478. }
  479. interface AudioContext extends EventTarget {
  480. decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: any): void;
  481. }
  482. interface HTMLURL {
  483. createObjectURL(param1: any, param2?: any): any;
  484. }
  485. interface Document {
  486. exitFullscreen(): void;
  487. webkitCancelFullScreen(): void;
  488. mozCancelFullScreen(): void;
  489. msCancelFullScreen(): void;
  490. mozFullScreen: boolean;
  491. msIsFullScreen: boolean;
  492. fullscreen: boolean;
  493. mozPointerLockElement: HTMLElement;
  494. msPointerLockElement: HTMLElement;
  495. webkitPointerLockElement: HTMLElement;
  496. }
  497. interface HTMLCanvasElement {
  498. requestPointerLock(): void;
  499. msRequestPointerLock?(): void;
  500. mozRequestPointerLock?(): void;
  501. webkitRequestPointerLock?(): void;
  502. }
  503. interface CanvasRenderingContext2D {
  504. imageSmoothingEnabled: boolean;
  505. mozImageSmoothingEnabled: boolean;
  506. oImageSmoothingEnabled: boolean;
  507. webkitImageSmoothingEnabled: boolean;
  508. }
  509. interface WebGLTexture {
  510. isReady: boolean;
  511. isCube: boolean;
  512. url: string;
  513. noMipmap: boolean;
  514. samplingMode: number;
  515. references: number;
  516. generateMipMaps: boolean;
  517. type: number;
  518. onLoadedCallbacks: Array<Function>;
  519. _size: number;
  520. _baseWidth: number;
  521. _baseHeight: number;
  522. _width: number;
  523. _height: number;
  524. _workingCanvas: HTMLCanvasElement;
  525. _workingContext: CanvasRenderingContext2D;
  526. _framebuffer: WebGLFramebuffer;
  527. _depthBuffer: WebGLRenderbuffer;
  528. _cachedCoordinatesMode: number;
  529. _cachedWrapU: number;
  530. _cachedWrapV: number;
  531. _isDisabled: boolean;
  532. }
  533. interface WebGLBuffer {
  534. references: number;
  535. capacity: number;
  536. is32Bits: boolean;
  537. }
  538. interface MouseEvent {
  539. mozMovementX: number;
  540. mozMovementY: number;
  541. webkitMovementX: number;
  542. webkitMovementY: number;
  543. msMovementX: number;
  544. msMovementY: number;
  545. }
  546. interface MSStyleCSSProperties {
  547. webkitTransform: string;
  548. webkitTransition: string;
  549. }
  550. interface Navigator {
  551. getVRDisplays: () => any;
  552. mozGetVRDevices: (any: any) => any;
  553. isCocoonJS: boolean;
  554. }
  555. interface Screen {
  556. orientation: string;
  557. mozOrientation: string;
  558. }
  559. interface HTMLMediaElement {
  560. crossOrigin: string;
  561. }
  562. interface Math {
  563. fround(x: number): number;
  564. imul(a: number, b: number): number;
  565. }
  566. interface SIMDglobal {
  567. SIMD: SIMD;
  568. Math: Math;
  569. Uint8Array: Uint8ArrayConstructor;
  570. Float32Array: Float32ArrayConstructor;
  571. }
  572. interface SIMD {
  573. Float32x4: SIMD.Float32x4Constructor;
  574. Int32x4: SIMD.Int32x4Constructor;
  575. Int16x8: SIMD.Int16x8Constructor;
  576. Int8x16: SIMD.Int8x16Constructor;
  577. Uint32x4: SIMD.Uint32x4Constructor;
  578. Uint16x8: SIMD.Uint16x8Constructor;
  579. Uint8x16: SIMD.Uint8x16Constructor;
  580. Bool32x4: SIMD.Bool32x4Constructor;
  581. Bool16x8: SIMD.Bool16x8Constructor;
  582. Bool8x16: SIMD.Bool8x16Constructor;
  583. }
  584. declare namespace SIMD {
  585. interface Float32x4 {
  586. constructor: Float32x4Constructor;
  587. valueOf(): Float32x4;
  588. toLocaleString(): string;
  589. toString(): string;
  590. }
  591. interface Float32x4Constructor {
  592. (s0?: number, s1?: number, s2?: number, s3?: number): Float32x4;
  593. prototype: Float32x4;
  594. extractLane(simd: SIMD.Float32x4, lane: number): number;
  595. swizzle(a: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  596. shuffle(a: SIMD.Float32x4, b: SIMD.Float32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Float32x4;
  597. check(a: SIMD.Float32x4): SIMD.Float32x4;
  598. splat(n: number): SIMD.Float32x4;
  599. replaceLane(simd: SIMD.Float32x4, lane: number, value: number): SIMD.Float32x4;
  600. select(selector: SIMD.Bool32x4, a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  601. equal(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  602. notEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  603. lessThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  604. lessThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  605. greaterThan(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  606. greaterThanOrEqual(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Bool32x4;
  607. add(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  608. sub(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  609. mul(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  610. div(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  611. neg(a: SIMD.Float32x4): SIMD.Float32x4;
  612. abs(a: SIMD.Float32x4): SIMD.Float32x4;
  613. min(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  614. max(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  615. minNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  616. maxNum(a: SIMD.Float32x4, b: SIMD.Float32x4): SIMD.Float32x4;
  617. reciprocalApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  618. reciprocalSqrtApproximation(a: SIMD.Float32x4): SIMD.Float32x4;
  619. sqrt(a: SIMD.Float32x4): SIMD.Float32x4;
  620. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  621. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  622. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  623. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Float32x4;
  624. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  625. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  626. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  627. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Float32x4): SIMD.Float32x4;
  628. fromInt32x4(value: SIMD.Int32x4): SIMD.Float32x4;
  629. fromUint32x4(value: SIMD.Uint32x4): SIMD.Float32x4;
  630. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Float32x4;
  631. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Float32x4;
  632. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Float32x4;
  633. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Float32x4;
  634. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Float32x4;
  635. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Float32x4;
  636. }
  637. interface Int32x4 {
  638. constructor: Int32x4Constructor;
  639. valueOf(): Int32x4;
  640. toLocaleString(): string;
  641. toString(): string;
  642. }
  643. interface Int32x4Constructor {
  644. (s0?: number, s1?: number, s2?: number, s3?: number): Int32x4;
  645. prototype: Int32x4;
  646. extractLane(simd: SIMD.Int32x4, lane: number): number;
  647. swizzle(a: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  648. shuffle(a: SIMD.Int32x4, b: SIMD.Int32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Int32x4;
  649. check(a: SIMD.Int32x4): SIMD.Int32x4;
  650. splat(n: number): SIMD.Int32x4;
  651. replaceLane(simd: SIMD.Int32x4, lane: number, value: number): SIMD.Int32x4;
  652. select(selector: SIMD.Bool32x4, a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  653. equal(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  654. notEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  655. lessThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  656. lessThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  657. greaterThan(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  658. greaterThanOrEqual(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Bool32x4;
  659. and(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  660. or(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  661. xor(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  662. not(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  663. add(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  664. sub(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  665. mul(a: SIMD.Int32x4, b: SIMD.Int32x4): SIMD.Int32x4;
  666. neg(a: SIMD.Int32x4): SIMD.Int32x4;
  667. shiftLeftByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  668. shiftRightByScalar(a: SIMD.Int32x4, bits: number): SIMD.Int32x4;
  669. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  670. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  671. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  672. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int32x4;
  673. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  674. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  675. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  676. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int32x4): SIMD.Int32x4;
  677. fromFloat32x4(value: SIMD.Float32x4): SIMD.Int32x4;
  678. fromUint32x4(value: SIMD.Uint32x4): SIMD.Int32x4;
  679. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int32x4;
  680. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int32x4;
  681. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int32x4;
  682. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int32x4;
  683. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int32x4;
  684. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int32x4;
  685. }
  686. interface Int16x8 {
  687. constructor: Int16x8Constructor;
  688. valueOf(): Int16x8;
  689. toLocaleString(): string;
  690. toString(): string;
  691. }
  692. interface Int16x8Constructor {
  693. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Int16x8;
  694. prototype: Int16x8;
  695. extractLane(simd: SIMD.Int16x8, lane: number): number;
  696. swizzle(a: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  697. shuffle(a: SIMD.Int16x8, b: SIMD.Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Int16x8;
  698. check(a: SIMD.Int16x8): SIMD.Int16x8;
  699. splat(n: number): SIMD.Int16x8;
  700. replaceLane(simd: SIMD.Int16x8, lane: number, value: number): SIMD.Int16x8;
  701. select(selector: SIMD.Bool16x8, a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  702. equal(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  703. notEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  704. lessThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  705. lessThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  706. greaterThan(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  707. greaterThanOrEqual(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Bool16x8;
  708. and(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  709. or(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  710. xor(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  711. not(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  712. add(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  713. sub(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  714. mul(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  715. neg(a: SIMD.Int16x8): SIMD.Int16x8;
  716. shiftLeftByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  717. shiftRightByScalar(a: SIMD.Int16x8, bits: number): SIMD.Int16x8;
  718. addSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  719. subSaturate(a: SIMD.Int16x8, b: SIMD.Int16x8): SIMD.Int16x8;
  720. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int16x8;
  721. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int16x8): SIMD.Int16x8;
  722. fromUint16x8(value: SIMD.Uint16x8): SIMD.Int16x8;
  723. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int16x8;
  724. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int16x8;
  725. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Int16x8;
  726. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int16x8;
  727. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int16x8;
  728. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int16x8;
  729. }
  730. interface Int8x16 {
  731. constructor: Int8x16Constructor;
  732. valueOf(): Int8x16;
  733. toLocaleString(): string;
  734. toString(): string;
  735. }
  736. interface Int8x16Constructor {
  737. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Int8x16;
  738. prototype: Int8x16;
  739. extractLane(simd: SIMD.Int8x16, lane: number): number;
  740. swizzle(a: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  741. shuffle(a: SIMD.Int8x16, b: SIMD.Int8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Int8x16;
  742. check(a: SIMD.Int8x16): SIMD.Int8x16;
  743. splat(n: number): SIMD.Int8x16;
  744. replaceLane(simd: SIMD.Int8x16, lane: number, value: number): SIMD.Int8x16;
  745. select(selector: SIMD.Bool8x16, a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  746. equal(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  747. notEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  748. lessThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  749. lessThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  750. greaterThan(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  751. greaterThanOrEqual(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Bool8x16;
  752. and(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  753. or(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  754. xor(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  755. not(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  756. add(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  757. sub(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  758. mul(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  759. neg(a: SIMD.Int8x16): SIMD.Int8x16;
  760. shiftLeftByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  761. shiftRightByScalar(a: SIMD.Int8x16, bits: number): SIMD.Int8x16;
  762. addSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  763. subSaturate(a: SIMD.Int8x16, b: SIMD.Int8x16): SIMD.Int8x16;
  764. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Int8x16;
  765. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Int8x16): SIMD.Int8x16;
  766. fromUint8x16(value: SIMD.Uint8x16): SIMD.Int8x16;
  767. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Int8x16;
  768. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Int8x16;
  769. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Int8x16;
  770. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Int8x16;
  771. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Int8x16;
  772. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Int8x16;
  773. }
  774. interface Uint32x4 {
  775. constructor: Uint32x4Constructor;
  776. valueOf(): Uint32x4;
  777. toLocaleString(): string;
  778. toString(): string;
  779. }
  780. interface Uint32x4Constructor {
  781. (s0?: number, s1?: number, s2?: number, s3?: number): Uint32x4;
  782. prototype: Uint32x4;
  783. extractLane(simd: SIMD.Uint32x4, lane: number): number;
  784. swizzle(a: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  785. shuffle(a: SIMD.Uint32x4, b: SIMD.Uint32x4, l1: number, l2: number, l3: number, l4: number): SIMD.Uint32x4;
  786. check(a: SIMD.Uint32x4): SIMD.Uint32x4;
  787. splat(n: number): SIMD.Uint32x4;
  788. replaceLane(simd: SIMD.Uint32x4, lane: number, value: number): SIMD.Uint32x4;
  789. select(selector: SIMD.Bool32x4, a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  790. equal(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  791. notEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  792. lessThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  793. lessThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  794. greaterThan(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  795. greaterThanOrEqual(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Bool32x4;
  796. and(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  797. or(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  798. xor(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  799. not(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  800. add(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  801. sub(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  802. mul(a: SIMD.Uint32x4, b: SIMD.Uint32x4): SIMD.Uint32x4;
  803. shiftLeftByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  804. shiftRightByScalar(a: SIMD.Uint32x4, bits: number): SIMD.Uint32x4;
  805. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  806. load1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  807. load2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  808. load3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint32x4;
  809. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  810. store1(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  811. store2(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  812. store3(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint32x4): SIMD.Uint32x4;
  813. fromFloat32x4(value: SIMD.Float32x4): SIMD.Uint32x4;
  814. fromInt32x4(value: SIMD.Int32x4): SIMD.Uint32x4;
  815. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint32x4;
  816. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint32x4;
  817. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint32x4;
  818. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint32x4;
  819. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint32x4;
  820. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint32x4;
  821. }
  822. interface Uint16x8 {
  823. constructor: Uint16x8Constructor;
  824. valueOf(): Uint16x8;
  825. toLocaleString(): string;
  826. toString(): string;
  827. }
  828. interface Uint16x8Constructor {
  829. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number): Uint16x8;
  830. prototype: Uint16x8;
  831. extractLane(simd: SIMD.Uint16x8, lane: number): number;
  832. swizzle(a: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  833. shuffle(a: SIMD.Uint16x8, b: SIMD.Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): SIMD.Uint16x8;
  834. check(a: SIMD.Uint16x8): SIMD.Uint16x8;
  835. splat(n: number): SIMD.Uint16x8;
  836. replaceLane(simd: SIMD.Uint16x8, lane: number, value: number): SIMD.Uint16x8;
  837. select(selector: SIMD.Bool16x8, a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  838. equal(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  839. notEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  840. lessThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  841. lessThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  842. greaterThan(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  843. greaterThanOrEqual(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Bool16x8;
  844. and(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  845. or(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  846. xor(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  847. not(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  848. add(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  849. sub(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  850. mul(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  851. shiftLeftByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  852. shiftRightByScalar(a: SIMD.Uint16x8, bits: number): SIMD.Uint16x8;
  853. addSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  854. subSaturate(a: SIMD.Uint16x8, b: SIMD.Uint16x8): SIMD.Uint16x8;
  855. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint16x8;
  856. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint16x8): SIMD.Uint16x8;
  857. fromInt16x8(value: SIMD.Int16x8): SIMD.Uint16x8;
  858. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint16x8;
  859. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint16x8;
  860. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint16x8;
  861. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint16x8;
  862. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint16x8;
  863. fromUint8x16Bits(value: SIMD.Uint8x16): SIMD.Uint16x8;
  864. }
  865. interface Uint8x16 {
  866. constructor: Uint8x16Constructor;
  867. valueOf(): Uint8x16;
  868. toLocaleString(): string;
  869. toString(): string;
  870. }
  871. interface Uint8x16Constructor {
  872. (s0?: number, s1?: number, s2?: number, s3?: number, s4?: number, s5?: number, s6?: number, s7?: number, s8?: number, s9?: number, s10?: number, s11?: number, s12?: number, s13?: number, s14?: number, s15?: number): Uint8x16;
  873. prototype: Uint8x16;
  874. extractLane(simd: SIMD.Uint8x16, lane: number): number;
  875. swizzle(a: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  876. shuffle(a: SIMD.Uint8x16, b: SIMD.Uint8x16, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number, l9: number, l10: number, l11: number, l12: number, l13: number, l14: number, l15: number, l16: number): SIMD.Uint8x16;
  877. check(a: SIMD.Uint8x16): SIMD.Uint8x16;
  878. splat(n: number): SIMD.Uint8x16;
  879. replaceLane(simd: SIMD.Uint8x16, lane: number, value: number): SIMD.Uint8x16;
  880. select(selector: SIMD.Bool8x16, a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  881. equal(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  882. notEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  883. lessThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  884. lessThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  885. greaterThan(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  886. greaterThanOrEqual(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Bool8x16;
  887. and(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  888. or(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  889. xor(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  890. not(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  891. add(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  892. sub(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  893. mul(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  894. shiftLeftByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  895. shiftRightByScalar(a: SIMD.Uint8x16, bits: number): SIMD.Uint8x16;
  896. addSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  897. subSaturate(a: SIMD.Uint8x16, b: SIMD.Uint8x16): SIMD.Uint8x16;
  898. load(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number): SIMD.Uint8x16;
  899. store(tarray: Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, index: number, value: SIMD.Uint8x16): SIMD.Uint8x16;
  900. fromInt8x16(value: SIMD.Int8x16): SIMD.Uint8x16;
  901. fromFloat32x4Bits(value: SIMD.Float32x4): SIMD.Uint8x16;
  902. fromInt32x4Bits(value: SIMD.Int32x4): SIMD.Uint8x16;
  903. fromInt16x8Bits(value: SIMD.Int16x8): SIMD.Uint8x16;
  904. fromInt8x16Bits(value: SIMD.Int8x16): SIMD.Uint8x16;
  905. fromUint32x4Bits(value: SIMD.Uint32x4): SIMD.Uint8x16;
  906. fromUint16x8Bits(value: SIMD.Uint16x8): SIMD.Uint8x16;
  907. }
  908. interface Bool32x4 {
  909. constructor: Bool32x4Constructor;
  910. valueOf(): Bool32x4;
  911. toLocaleString(): string;
  912. toString(): string;
  913. }
  914. interface Bool32x4Constructor {
  915. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean): Bool32x4;
  916. prototype: Bool32x4;
  917. extractLane(simd: SIMD.Bool32x4, lane: number): boolean;
  918. check(a: SIMD.Bool32x4): SIMD.Bool32x4;
  919. splat(n: boolean): SIMD.Bool32x4;
  920. replaceLane(simd: SIMD.Bool32x4, lane: number, value: boolean): SIMD.Bool32x4;
  921. allTrue(a: SIMD.Bool32x4): boolean;
  922. anyTrue(a: SIMD.Bool32x4): boolean;
  923. and(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  924. or(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  925. xor(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  926. not(a: SIMD.Bool32x4, b: SIMD.Bool32x4): SIMD.Bool32x4;
  927. }
  928. interface Bool16x8 {
  929. constructor: Bool16x8Constructor;
  930. valueOf(): Bool16x8;
  931. toLocaleString(): string;
  932. toString(): string;
  933. }
  934. interface Bool16x8Constructor {
  935. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean): Bool16x8;
  936. prototype: Bool16x8;
  937. extractLane(simd: SIMD.Bool16x8, lane: number): boolean;
  938. check(a: SIMD.Bool16x8): SIMD.Bool16x8;
  939. splat(n: boolean): SIMD.Bool16x8;
  940. replaceLane(simd: SIMD.Bool16x8, lane: number, value: boolean): SIMD.Bool16x8;
  941. allTrue(a: SIMD.Bool16x8): boolean;
  942. anyTrue(a: SIMD.Bool16x8): boolean;
  943. and(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  944. or(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  945. xor(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  946. not(a: SIMD.Bool16x8, b: SIMD.Bool16x8): SIMD.Bool16x8;
  947. }
  948. interface Bool8x16 {
  949. constructor: Bool8x16Constructor;
  950. valueOf(): Bool8x16;
  951. toLocaleString(): string;
  952. toString(): string;
  953. }
  954. interface Bool8x16Constructor {
  955. (s0?: boolean, s1?: boolean, s2?: boolean, s3?: boolean, s4?: boolean, s5?: boolean, s6?: boolean, s7?: boolean, s8?: boolean, s9?: boolean, s10?: boolean, s11?: boolean, s12?: boolean, s13?: boolean, s14?: boolean, s15?: boolean): Bool8x16;
  956. prototype: Bool8x16;
  957. extractLane(simd: SIMD.Bool8x16, lane: number): boolean;
  958. check(a: SIMD.Bool8x16): SIMD.Bool8x16;
  959. splat(n: boolean): SIMD.Bool8x16;
  960. replaceLane(simd: SIMD.Bool8x16, lane: number, value: boolean): SIMD.Bool8x16;
  961. allTrue(a: SIMD.Bool8x16): boolean;
  962. anyTrue(a: SIMD.Bool8x16): boolean;
  963. and(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  964. or(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  965. xor(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  966. not(a: SIMD.Bool8x16, b: SIMD.Bool8x16): SIMD.Bool8x16;
  967. }
  968. }
  969. declare module BABYLON {
  970. /**
  971. * Node is the basic class for all scene objects (Mesh, Light Camera).
  972. */
  973. class Node {
  974. name: string;
  975. id: string;
  976. uniqueId: number;
  977. state: string;
  978. metadata: any;
  979. doNotSerialize: boolean;
  980. animations: Animation[];
  981. private _ranges;
  982. onReady: (node: Node) => void;
  983. private _childrenFlag;
  984. private _isEnabled;
  985. private _isReady;
  986. _currentRenderId: number;
  987. private _parentRenderId;
  988. _waitingParentId: string;
  989. private _scene;
  990. _cache: any;
  991. private _parentNode;
  992. private _children;
  993. parent: Node;
  994. /**
  995. * An event triggered when the mesh is disposed.
  996. * @type {BABYLON.Observable}
  997. */
  998. onDisposeObservable: Observable<Node>;
  999. private _onDisposeObserver;
  1000. onDispose: () => void;
  1001. /**
  1002. * @constructor
  1003. * @param {string} name - the name and id to be given to this node
  1004. * @param {BABYLON.Scene} the scene this node will be added to
  1005. */
  1006. constructor(name: string, scene: Scene);
  1007. getScene(): Scene;
  1008. getEngine(): Engine;
  1009. getWorldMatrix(): Matrix;
  1010. _initCache(): void;
  1011. updateCache(force?: boolean): void;
  1012. _updateCache(ignoreParentClass?: boolean): void;
  1013. _isSynchronized(): boolean;
  1014. _markSyncedWithParent(): void;
  1015. isSynchronizedWithParent(): boolean;
  1016. isSynchronized(updateCache?: boolean): boolean;
  1017. hasNewParent(update?: boolean): boolean;
  1018. /**
  1019. * Is this node ready to be used/rendered
  1020. * @return {boolean} is it ready
  1021. */
  1022. isReady(): boolean;
  1023. /**
  1024. * Is this node enabled.
  1025. * If the node has a parent and is enabled, the parent will be inspected as well.
  1026. * @return {boolean} whether this node (and its parent) is enabled.
  1027. * @see setEnabled
  1028. */
  1029. isEnabled(): boolean;
  1030. /**
  1031. * Set the enabled state of this node.
  1032. * @param {boolean} value - the new enabled state
  1033. * @see isEnabled
  1034. */
  1035. setEnabled(value: boolean): void;
  1036. /**
  1037. * Is this node a descendant of the given node.
  1038. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
  1039. * @param {BABYLON.Node} ancestor - The parent node to inspect
  1040. * @see parent
  1041. */
  1042. isDescendantOf(ancestor: Node): boolean;
  1043. /**
  1044. * Evaluate the list of children and determine if they should be considered as descendants considering the given criterias
  1045. * @param {BABYLON.Node[]} results the result array containing the nodes matching the given criterias
  1046. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  1047. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  1048. */
  1049. _getDescendants(results: Node[], directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): void;
  1050. /**
  1051. * Will return all nodes that have this node as ascendant.
  1052. * @param {boolean} directDescendantsOnly if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
  1053. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  1054. * @return {BABYLON.Node[]} all children nodes of all types.
  1055. */
  1056. getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];
  1057. /**
  1058. * @param predicate: an optional predicate that will be called on every evaluated children, the predicate must return true for a given child to be part of the result, otherwise it will be ignored.
  1059. * @Deprecated, legacy support.
  1060. * use getDecendants instead.
  1061. */
  1062. getChildren(predicate?: (node: Node) => boolean): Node[];
  1063. /**
  1064. * Get all child-meshes of this node.
  1065. */
  1066. getChildMeshes(directDecendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];
  1067. _setReady(state: boolean): void;
  1068. getAnimationByName(name: string): Animation;
  1069. createAnimationRange(name: string, from: number, to: number): void;
  1070. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  1071. getAnimationRange(name: string): AnimationRange;
  1072. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void;
  1073. serializeAnimationRanges(): any;
  1074. dispose(): void;
  1075. static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void;
  1076. }
  1077. }
  1078. declare module BABYLON {
  1079. interface IDisposable {
  1080. dispose(): void;
  1081. }
  1082. class PointerEventTypes {
  1083. static _POINTERDOWN: number;
  1084. static _POINTERUP: number;
  1085. static _POINTERMOVE: number;
  1086. static _POINTERWHEEL: number;
  1087. static _POINTERPICK: number;
  1088. static POINTERDOWN: number;
  1089. static POINTERUP: number;
  1090. static POINTERMOVE: number;
  1091. static POINTERWHEEL: number;
  1092. static POINTERPICK: number;
  1093. }
  1094. class PointerInfoBase {
  1095. type: number;
  1096. event: PointerEvent | MouseWheelEvent;
  1097. constructor(type: number, event: PointerEvent | MouseWheelEvent);
  1098. }
  1099. /**
  1100. * This class is used to store pointer related info for the onPrePointerObservable event.
  1101. * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
  1102. */
  1103. class PointerInfoPre extends PointerInfoBase {
  1104. constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: any, localY: any);
  1105. localPosition: Vector2;
  1106. skipOnPointerObservable: boolean;
  1107. }
  1108. /**
  1109. * This type contains all the data related to a pointer event in Babylon.js.
  1110. * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
  1111. */
  1112. class PointerInfo extends PointerInfoBase {
  1113. pickInfo: PickingInfo;
  1114. constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: PickingInfo);
  1115. }
  1116. /**
  1117. * This class is used by the onRenderingGroupObservable
  1118. */
  1119. class RenderingGroupInfo {
  1120. /**
  1121. * The Scene that being rendered
  1122. */
  1123. scene: Scene;
  1124. /**
  1125. * The camera currently used for the rendering pass
  1126. */
  1127. camera: Camera;
  1128. /**
  1129. * The ID of the renderingGroup being processed
  1130. */
  1131. renderingGroupId: number;
  1132. /**
  1133. * The rendering stage, can be either STAGE_PRECLEAR, STAGE_PREOPAQUE, STAGE_PRETRANSPARENT, STAGE_POSTTRANSPARENT
  1134. */
  1135. renderStage: number;
  1136. /**
  1137. * Stage corresponding to the very first hook in the renderingGroup phase: before the render buffer may be cleared
  1138. * This stage will be fired no matter what
  1139. */
  1140. static STAGE_PRECLEAR: number;
  1141. /**
  1142. * Called before opaque object are rendered.
  1143. * This stage will be fired only if there's 3D Opaque content to render
  1144. */
  1145. static STAGE_PREOPAQUE: number;
  1146. /**
  1147. * Called after the opaque objects are rendered and before the transparent ones
  1148. * This stage will be fired only if there's 3D transparent content to render
  1149. */
  1150. static STAGE_PRETRANSPARENT: number;
  1151. /**
  1152. * Called after the transparent object are rendered, last hook of the renderingGroup phase
  1153. * This stage will be fired no matter what
  1154. */
  1155. static STAGE_POSTTRANSPARENT: number;
  1156. }
  1157. /**
  1158. * Represents a scene to be rendered by the engine.
  1159. * @see http://doc.babylonjs.com/page.php?p=21911
  1160. */
  1161. class Scene implements IAnimatable {
  1162. private static _FOGMODE_NONE;
  1163. private static _FOGMODE_EXP;
  1164. private static _FOGMODE_EXP2;
  1165. private static _FOGMODE_LINEAR;
  1166. static MinDeltaTime: number;
  1167. static MaxDeltaTime: number;
  1168. static FOGMODE_NONE: number;
  1169. static FOGMODE_EXP: number;
  1170. static FOGMODE_EXP2: number;
  1171. static FOGMODE_LINEAR: number;
  1172. autoClear: boolean;
  1173. clearColor: any;
  1174. ambientColor: Color3;
  1175. forceWireframe: boolean;
  1176. forcePointsCloud: boolean;
  1177. forceShowBoundingBoxes: boolean;
  1178. clipPlane: Plane;
  1179. animationsEnabled: boolean;
  1180. constantlyUpdateMeshUnderPointer: boolean;
  1181. useRightHandedSystem: boolean;
  1182. hoverCursor: string;
  1183. metadata: any;
  1184. /**
  1185. * An event triggered when the scene is disposed.
  1186. * @type {BABYLON.Observable}
  1187. */
  1188. onDisposeObservable: Observable<Scene>;
  1189. private _onDisposeObserver;
  1190. onDispose: () => void;
  1191. /**
  1192. * An event triggered before rendering the scene
  1193. * @type {BABYLON.Observable}
  1194. */
  1195. onBeforeRenderObservable: Observable<Scene>;
  1196. private _onBeforeRenderObserver;
  1197. beforeRender: () => void;
  1198. /**
  1199. * An event triggered after rendering the scene
  1200. * @type {BABYLON.Observable}
  1201. */
  1202. onAfterRenderObservable: Observable<Scene>;
  1203. private _onAfterRenderObserver;
  1204. afterRender: () => void;
  1205. /**
  1206. * An event triggered when the scene is ready
  1207. * @type {BABYLON.Observable}
  1208. */
  1209. onReadyObservable: Observable<Scene>;
  1210. /**
  1211. * An event triggered before rendering a camera
  1212. * @type {BABYLON.Observable}
  1213. */
  1214. onBeforeCameraRenderObservable: Observable<Camera>;
  1215. private _onBeforeCameraRenderObserver;
  1216. beforeCameraRender: () => void;
  1217. /**
  1218. * An event triggered after rendering a camera
  1219. * @type {BABYLON.Observable}
  1220. */
  1221. onAfterCameraRenderObservable: Observable<Camera>;
  1222. private _onAfterCameraRenderObserver;
  1223. afterCameraRender: () => void;
  1224. /**
  1225. * An event triggered when a camera is created
  1226. * @type {BABYLON.Observable}
  1227. */
  1228. onNewCameraAddedObservable: Observable<Camera>;
  1229. /**
  1230. * An event triggered when a camera is removed
  1231. * @type {BABYLON.Observable}
  1232. */
  1233. onCameraRemovedObservable: Observable<Camera>;
  1234. /**
  1235. * An event triggered when a light is created
  1236. * @type {BABYLON.Observable}
  1237. */
  1238. onNewLightAddedObservable: Observable<Light>;
  1239. /**
  1240. * An event triggered when a light is removed
  1241. * @type {BABYLON.Observable}
  1242. */
  1243. onLightRemovedObservable: Observable<Light>;
  1244. /**
  1245. * An event triggered when a geometry is created
  1246. * @type {BABYLON.Observable}
  1247. */
  1248. onNewGeometryAddedObservable: Observable<Geometry>;
  1249. /**
  1250. * An event triggered when a geometry is removed
  1251. * @type {BABYLON.Observable}
  1252. */
  1253. onGeometryRemovedObservable: Observable<Geometry>;
  1254. /**
  1255. * An event triggered when a mesh is created
  1256. * @type {BABYLON.Observable}
  1257. */
  1258. onNewMeshAddedObservable: Observable<AbstractMesh>;
  1259. /**
  1260. * An event triggered when a mesh is removed
  1261. * @type {BABYLON.Observable}
  1262. */
  1263. onMeshRemovedObservable: Observable<AbstractMesh>;
  1264. /**
  1265. * This Observable will be triggered for each stage of each renderingGroup of each rendered camera.
  1266. * The RenderinGroupInfo class contains all the information about the context in which the observable is called
  1267. * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)
  1268. */
  1269. onRenderingGroupObservable: Observable<RenderingGroupInfo>;
  1270. animations: Animation[];
  1271. pointerDownPredicate: (Mesh: AbstractMesh) => boolean;
  1272. pointerUpPredicate: (Mesh: AbstractMesh) => boolean;
  1273. pointerMovePredicate: (Mesh: AbstractMesh) => boolean;
  1274. private _onPointerMove;
  1275. private _onPointerDown;
  1276. private _onPointerUp;
  1277. /**
  1278. * @deprecated Use onPointerObservable instead
  1279. */
  1280. onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1281. /**
  1282. * @deprecated Use onPointerObservable instead
  1283. */
  1284. onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1285. /**
  1286. * @deprecated Use onPointerObservable instead
  1287. */
  1288. onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1289. /**
  1290. * @deprecated Use onPointerObservable instead
  1291. */
  1292. onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void;
  1293. /**
  1294. * This observable event is triggered when any mouse event registered during Scene.attach() is called BEFORE the 3D engine to process anything (mesh/sprite picking for instance).
  1295. * You have the possibility to skip the 3D Engine process and the call to onPointerObservable by setting PointerInfoBase.skipOnPointerObservable to true
  1296. */
  1297. onPrePointerObservable: Observable<PointerInfoPre>;
  1298. /**
  1299. * Observable event triggered each time an input event is received from the rendering canvas
  1300. */
  1301. onPointerObservable: Observable<PointerInfo>;
  1302. unTranslatedPointer: Vector2;
  1303. cameraToUseForPointers: Camera;
  1304. private _pointerX;
  1305. private _pointerY;
  1306. private _unTranslatedPointerX;
  1307. private _unTranslatedPointerY;
  1308. private _startingPointerPosition;
  1309. private _startingPointerTime;
  1310. _mirroredCameraPosition: Vector3;
  1311. private _onKeyDown;
  1312. private _onKeyUp;
  1313. /**
  1314. * is fog enabled on this scene.
  1315. * @type {boolean}
  1316. */
  1317. fogEnabled: boolean;
  1318. fogMode: number;
  1319. fogColor: Color3;
  1320. fogDensity: number;
  1321. fogStart: number;
  1322. fogEnd: number;
  1323. /**
  1324. * is shadow enabled on this scene.
  1325. * @type {boolean}
  1326. */
  1327. shadowsEnabled: boolean;
  1328. /**
  1329. * is light enabled on this scene.
  1330. * @type {boolean}
  1331. */
  1332. lightsEnabled: boolean;
  1333. /**
  1334. * All of the lights added to this scene.
  1335. * @see BABYLON.Light
  1336. * @type {BABYLON.Light[]}
  1337. */
  1338. lights: Light[];
  1339. /**
  1340. * All of the cameras added to this scene.
  1341. * @see BABYLON.Camera
  1342. * @type {BABYLON.Camera[]}
  1343. */
  1344. cameras: Camera[];
  1345. activeCameras: Camera[];
  1346. activeCamera: Camera;
  1347. /**
  1348. * All of the (abstract) meshes added to this scene.
  1349. * @see BABYLON.AbstractMesh
  1350. * @type {BABYLON.AbstractMesh[]}
  1351. */
  1352. meshes: AbstractMesh[];
  1353. private _geometries;
  1354. materials: Material[];
  1355. multiMaterials: MultiMaterial[];
  1356. private _defaultMaterial;
  1357. defaultMaterial: StandardMaterial;
  1358. texturesEnabled: boolean;
  1359. textures: BaseTexture[];
  1360. particlesEnabled: boolean;
  1361. particleSystems: ParticleSystem[];
  1362. spritesEnabled: boolean;
  1363. spriteManagers: SpriteManager[];
  1364. layers: Layer[];
  1365. highlightLayers: HighlightLayer[];
  1366. skeletonsEnabled: boolean;
  1367. skeletons: Skeleton[];
  1368. lensFlaresEnabled: boolean;
  1369. lensFlareSystems: LensFlareSystem[];
  1370. collisionsEnabled: boolean;
  1371. private _workerCollisions;
  1372. collisionCoordinator: ICollisionCoordinator;
  1373. gravity: Vector3;
  1374. postProcessesEnabled: boolean;
  1375. postProcessManager: PostProcessManager;
  1376. postProcessRenderPipelineManager: PostProcessRenderPipelineManager;
  1377. renderTargetsEnabled: boolean;
  1378. dumpNextRenderTargets: boolean;
  1379. customRenderTargets: RenderTargetTexture[];
  1380. useDelayedTextureLoading: boolean;
  1381. importedMeshesFiles: String[];
  1382. probesEnabled: boolean;
  1383. reflectionProbes: ReflectionProbe[];
  1384. database: any;
  1385. /**
  1386. * This scene's action manager
  1387. * @type {BABYLON.ActionManager}
  1388. */
  1389. actionManager: ActionManager;
  1390. _actionManagers: ActionManager[];
  1391. private _meshesForIntersections;
  1392. proceduralTexturesEnabled: boolean;
  1393. _proceduralTextures: ProceduralTexture[];
  1394. mainSoundTrack: SoundTrack;
  1395. soundTracks: SoundTrack[];
  1396. private _audioEnabled;
  1397. private _headphone;
  1398. simplificationQueue: SimplificationQueue;
  1399. private _engine;
  1400. private _totalMeshesCounter;
  1401. private _totalLightsCounter;
  1402. private _totalMaterialsCounter;
  1403. private _totalTexturesCounter;
  1404. private _totalVertices;
  1405. _activeIndices: PerfCounter;
  1406. _activeParticles: PerfCounter;
  1407. private _lastFrameDuration;
  1408. private _evaluateActiveMeshesDuration;
  1409. private _renderTargetsDuration;
  1410. _particlesDuration: PerfCounter;
  1411. private _renderDuration;
  1412. _spritesDuration: PerfCounter;
  1413. _activeBones: PerfCounter;
  1414. private _animationRatio;
  1415. private _animationStartDate;
  1416. _cachedMaterial: Material;
  1417. private _renderId;
  1418. private _executeWhenReadyTimeoutId;
  1419. private _intermediateRendering;
  1420. _toBeDisposed: SmartArray<IDisposable>;
  1421. private _pendingData;
  1422. private _activeMeshes;
  1423. private _processedMaterials;
  1424. private _renderTargets;
  1425. _activeParticleSystems: SmartArray<ParticleSystem>;
  1426. private _activeSkeletons;
  1427. private _softwareSkinnedMeshes;
  1428. private _renderingManager;
  1429. private _physicsEngine;
  1430. _activeAnimatables: Animatable[];
  1431. private _transformMatrix;
  1432. private _pickWithRayInverseMatrix;
  1433. private _edgesRenderers;
  1434. private _boundingBoxRenderer;
  1435. private _outlineRenderer;
  1436. private _viewMatrix;
  1437. private _projectionMatrix;
  1438. private _frustumPlanes;
  1439. private _selectionOctree;
  1440. private _pointerOverMesh;
  1441. private _pointerOverSprite;
  1442. private _debugLayer;
  1443. private _depthRenderer;
  1444. private _uniqueIdCounter;
  1445. private _pickedDownMesh;
  1446. private _pickedDownSprite;
  1447. private _externalData;
  1448. private _uid;
  1449. /**
  1450. * @constructor
  1451. * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
  1452. */
  1453. constructor(engine: Engine);
  1454. debugLayer: DebugLayer;
  1455. workerCollisions: boolean;
  1456. SelectionOctree: Octree<AbstractMesh>;
  1457. /**
  1458. * The mesh that is currently under the pointer.
  1459. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
  1460. */
  1461. meshUnderPointer: AbstractMesh;
  1462. /**
  1463. * Current on-screen X position of the pointer
  1464. * @return {number} X position of the pointer
  1465. */
  1466. pointerX: number;
  1467. /**
  1468. * Current on-screen Y position of the pointer
  1469. * @return {number} Y position of the pointer
  1470. */
  1471. pointerY: number;
  1472. getCachedMaterial(): Material;
  1473. getBoundingBoxRenderer(): BoundingBoxRenderer;
  1474. getOutlineRenderer(): OutlineRenderer;
  1475. getEngine(): Engine;
  1476. getTotalVertices(): number;
  1477. totalVerticesPerfCounter: PerfCounter;
  1478. getActiveIndices(): number;
  1479. totalActiveIndicesPerfCounter: PerfCounter;
  1480. getActiveParticles(): number;
  1481. activeParticlesPerfCounter: PerfCounter;
  1482. getActiveBones(): number;
  1483. activeBonesPerfCounter: PerfCounter;
  1484. getLastFrameDuration(): number;
  1485. lastFramePerfCounter: PerfCounter;
  1486. getEvaluateActiveMeshesDuration(): number;
  1487. evaluateActiveMeshesDurationPerfCounter: PerfCounter;
  1488. getActiveMeshes(): SmartArray<Mesh>;
  1489. getRenderTargetsDuration(): number;
  1490. getRenderDuration(): number;
  1491. renderDurationPerfCounter: PerfCounter;
  1492. getParticlesDuration(): number;
  1493. particlesDurationPerfCounter: PerfCounter;
  1494. getSpritesDuration(): number;
  1495. spriteDuractionPerfCounter: PerfCounter;
  1496. getAnimationRatio(): number;
  1497. getRenderId(): number;
  1498. incrementRenderId(): void;
  1499. private _updatePointerPosition(evt);
  1500. /**
  1501. * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
  1502. * @param attachUp defines if you want to attach events to pointerup
  1503. * @param attachDown defines if you want to attach events to pointerdown
  1504. * @param attachMove defines if you want to attach events to pointermove
  1505. */
  1506. attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void;
  1507. detachControl(): void;
  1508. isReady(): boolean;
  1509. resetCachedMaterial(): void;
  1510. registerBeforeRender(func: () => void): void;
  1511. unregisterBeforeRender(func: () => void): void;
  1512. registerAfterRender(func: () => void): void;
  1513. unregisterAfterRender(func: () => void): void;
  1514. _addPendingData(data: any): void;
  1515. _removePendingData(data: any): void;
  1516. getWaitingItemsCount(): number;
  1517. /**
  1518. * Registers a function to be executed when the scene is ready.
  1519. * @param {Function} func - the function to be executed.
  1520. */
  1521. executeWhenReady(func: () => void): void;
  1522. _checkIsReady(): void;
  1523. /**
  1524. * Will start the animation sequence of a given target
  1525. * @param target - the target
  1526. * @param {number} from - from which frame should animation start
  1527. * @param {number} to - till which frame should animation run.
  1528. * @param {boolean} [loop] - should the animation loop
  1529. * @param {number} [speedRatio] - the speed in which to run the animation
  1530. * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
  1531. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
  1532. * @return {BABYLON.Animatable} the animatable object created for this animation
  1533. * @see BABYLON.Animatable
  1534. * @see http://doc.babylonjs.com/page.php?p=22081
  1535. */
  1536. beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable;
  1537. beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  1538. getAnimatableByTarget(target: any): Animatable;
  1539. Animatables: Animatable[];
  1540. /**
  1541. * Will stop the animation of the given target
  1542. * @param target - the target
  1543. * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
  1544. * @see beginAnimation
  1545. */
  1546. stopAnimation(target: any, animationName?: string): void;
  1547. private _animate();
  1548. getViewMatrix(): Matrix;
  1549. getProjectionMatrix(): Matrix;
  1550. getTransformMatrix(): Matrix;
  1551. setTransformMatrix(view: Matrix, projection: Matrix): void;
  1552. addMesh(newMesh: AbstractMesh): void;
  1553. removeMesh(toRemove: AbstractMesh): number;
  1554. removeSkeleton(toRemove: Skeleton): number;
  1555. removeLight(toRemove: Light): number;
  1556. removeCamera(toRemove: Camera): number;
  1557. addLight(newLight: Light): void;
  1558. addCamera(newCamera: Camera): void;
  1559. /**
  1560. * Switch active camera
  1561. * @param {Camera} newCamera - new active camera
  1562. * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
  1563. */
  1564. switchActiveCamera(newCamera: Camera, attachControl?: boolean): void;
  1565. /**
  1566. * sets the active camera of the scene using its ID
  1567. * @param {string} id - the camera's ID
  1568. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1569. * @see activeCamera
  1570. */
  1571. setActiveCameraByID(id: string): Camera;
  1572. /**
  1573. * sets the active camera of the scene using its name
  1574. * @param {string} name - the camera's name
  1575. * @return {BABYLON.Camera|null} the new active camera or null if none found.
  1576. * @see activeCamera
  1577. */
  1578. setActiveCameraByName(name: string): Camera;
  1579. /**
  1580. * get a material using its id
  1581. * @param {string} the material's ID
  1582. * @return {BABYLON.Material|null} the material or null if none found.
  1583. */
  1584. getMaterialByID(id: string): Material;
  1585. /**
  1586. * get a material using its name
  1587. * @param {string} the material's name
  1588. * @return {BABYLON.Material|null} the material or null if none found.
  1589. */
  1590. getMaterialByName(name: string): Material;
  1591. getLensFlareSystemByName(name: string): LensFlareSystem;
  1592. getLensFlareSystemByID(id: string): LensFlareSystem;
  1593. getCameraByID(id: string): Camera;
  1594. getCameraByUniqueID(uniqueId: number): Camera;
  1595. /**
  1596. * get a camera using its name
  1597. * @param {string} the camera's name
  1598. * @return {BABYLON.Camera|null} the camera or null if none found.
  1599. */
  1600. getCameraByName(name: string): Camera;
  1601. /**
  1602. * get a bone using its id
  1603. * @param {string} the bone's id
  1604. * @return {BABYLON.Bone|null} the bone or null if not found
  1605. */
  1606. getBoneByID(id: string): Bone;
  1607. /**
  1608. * get a bone using its id
  1609. * @param {string} the bone's name
  1610. * @return {BABYLON.Bone|null} the bone or null if not found
  1611. */
  1612. getBoneByName(name: string): Bone;
  1613. /**
  1614. * get a light node using its name
  1615. * @param {string} the light's name
  1616. * @return {BABYLON.Light|null} the light or null if none found.
  1617. */
  1618. getLightByName(name: string): Light;
  1619. /**
  1620. * get a light node using its ID
  1621. * @param {string} the light's id
  1622. * @return {BABYLON.Light|null} the light or null if none found.
  1623. */
  1624. getLightByID(id: string): Light;
  1625. /**
  1626. * get a light node using its scene-generated unique ID
  1627. * @param {number} the light's unique id
  1628. * @return {BABYLON.Light|null} the light or null if none found.
  1629. */
  1630. getLightByUniqueID(uniqueId: number): Light;
  1631. /**
  1632. * get a particle system by id
  1633. * @param id {number} the particle system id
  1634. * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
  1635. */
  1636. getParticleSystemByID(id: string): ParticleSystem;
  1637. /**
  1638. * get a geometry using its ID
  1639. * @param {string} the geometry's id
  1640. * @return {BABYLON.Geometry|null} the geometry or null if none found.
  1641. */
  1642. getGeometryByID(id: string): Geometry;
  1643. /**
  1644. * add a new geometry to this scene.
  1645. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
  1646. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
  1647. * @return {boolean} was the geometry added or not
  1648. */
  1649. pushGeometry(geometry: Geometry, force?: boolean): boolean;
  1650. /**
  1651. * Removes an existing geometry
  1652. * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene.
  1653. * @return {boolean} was the geometry removed or not
  1654. */
  1655. removeGeometry(geometry: Geometry): boolean;
  1656. getGeometries(): Geometry[];
  1657. /**
  1658. * Get the first added mesh found of a given ID
  1659. * @param {string} id - the id to search for
  1660. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1661. */
  1662. getMeshByID(id: string): AbstractMesh;
  1663. getMeshesByID(id: string): Array<AbstractMesh>;
  1664. /**
  1665. * Get a mesh with its auto-generated unique id
  1666. * @param {number} uniqueId - the unique id to search for
  1667. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1668. */
  1669. getMeshByUniqueID(uniqueId: number): AbstractMesh;
  1670. /**
  1671. * Get a the last added mesh found of a given ID
  1672. * @param {string} id - the id to search for
  1673. * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
  1674. */
  1675. getLastMeshByID(id: string): AbstractMesh;
  1676. /**
  1677. * Get a the last added node (Mesh, Camera, Light) found of a given ID
  1678. * @param {string} id - the id to search for
  1679. * @return {BABYLON.Node|null} the node found or null if not found at all.
  1680. */
  1681. getLastEntryByID(id: string): Node;
  1682. getNodeByID(id: string): Node;
  1683. getNodeByName(name: string): Node;
  1684. getMeshByName(name: string): AbstractMesh;
  1685. getSoundByName(name: string): Sound;
  1686. getLastSkeletonByID(id: string): Skeleton;
  1687. getSkeletonById(id: string): Skeleton;
  1688. getSkeletonByName(name: string): Skeleton;
  1689. isActiveMesh(mesh: Mesh): boolean;
  1690. /**
  1691. * Return a unique id as a string which can serve as an identifier for the scene
  1692. */
  1693. uid: string;
  1694. /**
  1695. * Add an externaly attached data from its key.
  1696. * This method call will fail and return false, if such key already exists.
  1697. * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
  1698. * @param key the unique key that identifies the data
  1699. * @param data the data object to associate to the key for this Engine instance
  1700. * @return true if no such key were already present and the data was added successfully, false otherwise
  1701. */
  1702. addExternalData<T>(key: string, data: T): boolean;
  1703. /**
  1704. * Get an externaly attached data from its key
  1705. * @param key the unique key that identifies the data
  1706. * @return the associated data, if present (can be null), or undefined if not present
  1707. */
  1708. getExternalData<T>(key: string): T;
  1709. /**
  1710. * Get an externaly attached data from its key, create it using a factory if it's not already present
  1711. * @param key the unique key that identifies the data
  1712. * @param factory the factory that will be called to create the instance if and only if it doesn't exists
  1713. * @return the associated data, can be null if the factory returned null.
  1714. */
  1715. getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
  1716. /**
  1717. * Remove an externaly attached data from the Engine instance
  1718. * @param key the unique key that identifies the data
  1719. * @return true if the data was successfully removed, false if it doesn't exist
  1720. */
  1721. removeExternalData(key: any): boolean;
  1722. private _evaluateSubMesh(subMesh, mesh);
  1723. _isInIntermediateRendering(): boolean;
  1724. private _evaluateActiveMeshes();
  1725. private _activeMesh(sourceMesh, mesh);
  1726. updateTransformMatrix(force?: boolean): void;
  1727. private _renderForCamera(camera);
  1728. private _processSubCameras(camera);
  1729. private _checkIntersections();
  1730. render(): void;
  1731. private _updateAudioParameters();
  1732. audioEnabled: boolean;
  1733. private _disableAudio();
  1734. private _enableAudio();
  1735. headphone: boolean;
  1736. private _switchAudioModeForHeadphones();
  1737. private _switchAudioModeForNormalSpeakers();
  1738. enableDepthRenderer(): DepthRenderer;
  1739. disableDepthRenderer(): void;
  1740. freezeMaterials(): void;
  1741. unfreezeMaterials(): void;
  1742. dispose(): void;
  1743. disposeSounds(): void;
  1744. getWorldExtends(): {
  1745. min: Vector3;
  1746. max: Vector3;
  1747. };
  1748. createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>;
  1749. createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray;
  1750. createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray;
  1751. private _internalPick(rayFunction, predicate, fastCheck?);
  1752. private _internalMultiPick(rayFunction, predicate);
  1753. private _internalPickSprites(ray, predicate?, fastCheck?, camera?);
  1754. pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1755. pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo;
  1756. pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo;
  1757. multiPick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, camera?: Camera): PickingInfo[];
  1758. multiPickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean): PickingInfo[];
  1759. setPointerOverMesh(mesh: AbstractMesh): void;
  1760. getPointerOverMesh(): AbstractMesh;
  1761. setPointerOverSprite(sprite: Sprite): void;
  1762. getPointerOverSprite(): Sprite;
  1763. getPhysicsEngine(): PhysicsEngine;
  1764. /**
  1765. * Enables physics to the current scene
  1766. * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine
  1767. * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS.
  1768. * @return {boolean} was the physics engine initialized
  1769. */
  1770. enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean;
  1771. disablePhysicsEngine(): void;
  1772. isPhysicsEnabled(): boolean;
  1773. /**
  1774. *
  1775. * Sets the gravity of the physics engine (and NOT of the scene)
  1776. * @param {BABYLON.Vector3} [gravity] - the new gravity to be used
  1777. */
  1778. setGravity(gravity: Vector3): void;
  1779. /**
  1780. * Legacy support, using the new API
  1781. * @Deprecated
  1782. */
  1783. createCompoundImpostor(parts: any, options: PhysicsImpostorParameters): any;
  1784. deleteCompoundImpostor(compound: any): void;
  1785. createDefaultCameraOrLight(): void;
  1786. private _getByTags(list, tagsQuery, forEach?);
  1787. getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[];
  1788. getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[];
  1789. getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[];
  1790. getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[];
  1791. /**
  1792. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  1793. * This allowed control for front to back rendering or reversly depending of the special needs.
  1794. *
  1795. * @param renderingGroupId The rendering group id corresponding to its index
  1796. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  1797. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  1798. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  1799. */
  1800. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  1801. /**
  1802. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  1803. *
  1804. * @param renderingGroupId The rendering group id corresponding to its index
  1805. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  1806. */
  1807. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  1808. }
  1809. }
  1810. declare module BABYLON {
  1811. class Action {
  1812. triggerOptions: any;
  1813. trigger: number;
  1814. _actionManager: ActionManager;
  1815. private _nextActiveAction;
  1816. private _child;
  1817. private _condition;
  1818. private _triggerParameter;
  1819. constructor(triggerOptions: any, condition?: Condition);
  1820. _prepare(): void;
  1821. getTriggerParameter(): any;
  1822. _executeCurrent(evt: ActionEvent): void;
  1823. execute(evt: ActionEvent): void;
  1824. skipToNextActiveAction(): void;
  1825. then(action: Action): Action;
  1826. _getProperty(propertyPath: string): string;
  1827. _getEffectiveTarget(target: any, propertyPath: string): any;
  1828. serialize(parent: any): any;
  1829. protected _serialize(serializedAction: any, parent?: any): any;
  1830. static _SerializeValueAsString: (value: any) => string;
  1831. static _GetTargetProperty: (target: Scene | Node) => {
  1832. name: string;
  1833. targetType: string;
  1834. value: string;
  1835. };
  1836. }
  1837. }
  1838. declare module BABYLON {
  1839. /**
  1840. * ActionEvent is the event beint sent when an action is triggered.
  1841. */
  1842. class ActionEvent {
  1843. source: any;
  1844. pointerX: number;
  1845. pointerY: number;
  1846. meshUnderPointer: AbstractMesh;
  1847. sourceEvent: any;
  1848. additionalData: any;
  1849. /**
  1850. * @constructor
  1851. * @param source The mesh or sprite that triggered the action.
  1852. * @param pointerX The X mouse cursor position at the time of the event
  1853. * @param pointerY The Y mouse cursor position at the time of the event
  1854. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  1855. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  1856. */
  1857. constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any);
  1858. /**
  1859. * Helper function to auto-create an ActionEvent from a source mesh.
  1860. * @param source The source mesh that triggered the event
  1861. * @param evt {Event} The original (browser) event
  1862. */
  1863. static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent;
  1864. /**
  1865. * Helper function to auto-create an ActionEvent from a source mesh.
  1866. * @param source The source sprite that triggered the event
  1867. * @param scene Scene associated with the sprite
  1868. * @param evt {Event} The original (browser) event
  1869. */
  1870. static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent;
  1871. /**
  1872. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  1873. * @param scene the scene where the event occurred
  1874. * @param evt {Event} The original (browser) event
  1875. */
  1876. static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent;
  1877. static CreateNewFromPrimitive(prim: any, pointerPos: Vector2, evt?: Event, additionalData?: any): ActionEvent;
  1878. }
  1879. /**
  1880. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  1881. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  1882. */
  1883. class ActionManager {
  1884. private static _NothingTrigger;
  1885. private static _OnPickTrigger;
  1886. private static _OnLeftPickTrigger;
  1887. private static _OnRightPickTrigger;
  1888. private static _OnCenterPickTrigger;
  1889. private static _OnPickDownTrigger;
  1890. private static _OnPickUpTrigger;
  1891. private static _OnLongPressTrigger;
  1892. private static _OnPointerOverTrigger;
  1893. private static _OnPointerOutTrigger;
  1894. private static _OnEveryFrameTrigger;
  1895. private static _OnIntersectionEnterTrigger;
  1896. private static _OnIntersectionExitTrigger;
  1897. private static _OnKeyDownTrigger;
  1898. private static _OnKeyUpTrigger;
  1899. private static _OnPickOutTrigger;
  1900. static NothingTrigger: number;
  1901. static OnPickTrigger: number;
  1902. static OnLeftPickTrigger: number;
  1903. static OnRightPickTrigger: number;
  1904. static OnCenterPickTrigger: number;
  1905. static OnPickDownTrigger: number;
  1906. static OnPickUpTrigger: number;
  1907. static OnPickOutTrigger: number;
  1908. static OnLongPressTrigger: number;
  1909. static OnPointerOverTrigger: number;
  1910. static OnPointerOutTrigger: number;
  1911. static OnEveryFrameTrigger: number;
  1912. static OnIntersectionEnterTrigger: number;
  1913. static OnIntersectionExitTrigger: number;
  1914. static OnKeyDownTrigger: number;
  1915. static OnKeyUpTrigger: number;
  1916. static DragMovementThreshold: number;
  1917. static LongPressDelay: number;
  1918. actions: Action[];
  1919. hoverCursor: string;
  1920. private _scene;
  1921. constructor(scene: Scene);
  1922. dispose(): void;
  1923. getScene(): Scene;
  1924. /**
  1925. * Does this action manager handles actions of any of the given triggers
  1926. * @param {number[]} triggers - the triggers to be tested
  1927. * @return {boolean} whether one (or more) of the triggers is handeled
  1928. */
  1929. hasSpecificTriggers(triggers: number[]): boolean;
  1930. /**
  1931. * Does this action manager handles actions of a given trigger
  1932. * @param {number} trigger - the trigger to be tested
  1933. * @return {boolean} whether the trigger is handeled
  1934. */
  1935. hasSpecificTrigger(trigger: number): boolean;
  1936. /**
  1937. * Does this action manager has pointer triggers
  1938. * @return {boolean} whether or not it has pointer triggers
  1939. */
  1940. hasPointerTriggers: boolean;
  1941. /**
  1942. * Does this action manager has pick triggers
  1943. * @return {boolean} whether or not it has pick triggers
  1944. */
  1945. hasPickTriggers: boolean;
  1946. /**
  1947. * Registers an action to this action manager
  1948. * @param {BABYLON.Action} action - the action to be registered
  1949. * @return {BABYLON.Action} the action amended (prepared) after registration
  1950. */
  1951. registerAction(action: Action): Action;
  1952. /**
  1953. * Process a specific trigger
  1954. * @param {number} trigger - the trigger to process
  1955. * @param evt {BABYLON.ActionEvent} the event details to be processed
  1956. */
  1957. processTrigger(trigger: number, evt: ActionEvent): void;
  1958. _getEffectiveTarget(target: any, propertyPath: string): any;
  1959. _getProperty(propertyPath: string): string;
  1960. serialize(name: string): any;
  1961. static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void;
  1962. static GetTriggerName(trigger: number): string;
  1963. }
  1964. }
  1965. declare module BABYLON {
  1966. class Condition {
  1967. _actionManager: ActionManager;
  1968. _evaluationId: number;
  1969. _currentResult: boolean;
  1970. constructor(actionManager: ActionManager);
  1971. isValid(): boolean;
  1972. _getProperty(propertyPath: string): string;
  1973. _getEffectiveTarget(target: any, propertyPath: string): any;
  1974. serialize(): any;
  1975. protected _serialize(serializedCondition: any): any;
  1976. }
  1977. class ValueCondition extends Condition {
  1978. propertyPath: string;
  1979. value: any;
  1980. operator: number;
  1981. private static _IsEqual;
  1982. private static _IsDifferent;
  1983. private static _IsGreater;
  1984. private static _IsLesser;
  1985. static IsEqual: number;
  1986. static IsDifferent: number;
  1987. static IsGreater: number;
  1988. static IsLesser: number;
  1989. _actionManager: ActionManager;
  1990. private _target;
  1991. private _effectiveTarget;
  1992. private _property;
  1993. constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number);
  1994. isValid(): boolean;
  1995. serialize(): any;
  1996. static GetOperatorName(operator: number): string;
  1997. }
  1998. class PredicateCondition extends Condition {
  1999. predicate: () => boolean;
  2000. _actionManager: ActionManager;
  2001. constructor(actionManager: ActionManager, predicate: () => boolean);
  2002. isValid(): boolean;
  2003. }
  2004. class StateCondition extends Condition {
  2005. value: string;
  2006. _actionManager: ActionManager;
  2007. private _target;
  2008. constructor(actionManager: ActionManager, target: any, value: string);
  2009. isValid(): boolean;
  2010. serialize(): any;
  2011. }
  2012. }
  2013. declare module BABYLON {
  2014. class SwitchBooleanAction extends Action {
  2015. propertyPath: string;
  2016. private _target;
  2017. private _effectiveTarget;
  2018. private _property;
  2019. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  2020. _prepare(): void;
  2021. execute(): void;
  2022. serialize(parent: any): any;
  2023. }
  2024. class SetStateAction extends Action {
  2025. value: string;
  2026. private _target;
  2027. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  2028. execute(): void;
  2029. serialize(parent: any): any;
  2030. }
  2031. class SetValueAction extends Action {
  2032. propertyPath: string;
  2033. value: any;
  2034. private _target;
  2035. private _effectiveTarget;
  2036. private _property;
  2037. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  2038. _prepare(): void;
  2039. execute(): void;
  2040. serialize(parent: any): any;
  2041. }
  2042. class IncrementValueAction extends Action {
  2043. propertyPath: string;
  2044. value: any;
  2045. private _target;
  2046. private _effectiveTarget;
  2047. private _property;
  2048. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  2049. _prepare(): void;
  2050. execute(): void;
  2051. serialize(parent: any): any;
  2052. }
  2053. class PlayAnimationAction extends Action {
  2054. from: number;
  2055. to: number;
  2056. loop: boolean;
  2057. private _target;
  2058. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  2059. _prepare(): void;
  2060. execute(): void;
  2061. serialize(parent: any): any;
  2062. }
  2063. class StopAnimationAction extends Action {
  2064. private _target;
  2065. constructor(triggerOptions: any, target: any, condition?: Condition);
  2066. _prepare(): void;
  2067. execute(): void;
  2068. serialize(parent: any): any;
  2069. }
  2070. class DoNothingAction extends Action {
  2071. constructor(triggerOptions?: any, condition?: Condition);
  2072. execute(): void;
  2073. serialize(parent: any): any;
  2074. }
  2075. class CombineAction extends Action {
  2076. children: Action[];
  2077. constructor(triggerOptions: any, children: Action[], condition?: Condition);
  2078. _prepare(): void;
  2079. execute(evt: ActionEvent): void;
  2080. serialize(parent: any): any;
  2081. }
  2082. class ExecuteCodeAction extends Action {
  2083. func: (evt: ActionEvent) => void;
  2084. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  2085. execute(evt: ActionEvent): void;
  2086. }
  2087. class SetParentAction extends Action {
  2088. private _parent;
  2089. private _target;
  2090. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  2091. _prepare(): void;
  2092. execute(): void;
  2093. serialize(parent: any): any;
  2094. }
  2095. class PlaySoundAction extends Action {
  2096. private _sound;
  2097. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2098. _prepare(): void;
  2099. execute(): void;
  2100. serialize(parent: any): any;
  2101. }
  2102. class StopSoundAction extends Action {
  2103. private _sound;
  2104. constructor(triggerOptions: any, sound: Sound, condition?: Condition);
  2105. _prepare(): void;
  2106. execute(): void;
  2107. serialize(parent: any): any;
  2108. }
  2109. }
  2110. declare module BABYLON {
  2111. class InterpolateValueAction extends Action {
  2112. propertyPath: string;
  2113. value: any;
  2114. duration: number;
  2115. stopOtherAnimations: boolean;
  2116. onInterpolationDone: () => void;
  2117. private _target;
  2118. private _effectiveTarget;
  2119. private _property;
  2120. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean, onInterpolationDone?: () => void);
  2121. _prepare(): void;
  2122. execute(): void;
  2123. serialize(parent: any): any;
  2124. }
  2125. }
  2126. declare module BABYLON {
  2127. class Animatable {
  2128. target: any;
  2129. fromFrame: number;
  2130. toFrame: number;
  2131. loopAnimation: boolean;
  2132. speedRatio: number;
  2133. onAnimationEnd: any;
  2134. private _localDelayOffset;
  2135. private _pausedDelay;
  2136. private _animations;
  2137. private _paused;
  2138. private _scene;
  2139. animationStarted: boolean;
  2140. constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any);
  2141. getAnimations(): Animation[];
  2142. appendAnimations(target: any, animations: Animation[]): void;
  2143. getAnimationByTargetProperty(property: string): Animation;
  2144. reset(): void;
  2145. enableBlending(blendingSpeed: number): void;
  2146. disableBlending(): void;
  2147. goToFrame(frame: number): void;
  2148. pause(): void;
  2149. restart(): void;
  2150. stop(animationName?: string): void;
  2151. _animate(delay: number): boolean;
  2152. }
  2153. }
  2154. declare module BABYLON {
  2155. class AnimationRange {
  2156. name: string;
  2157. from: number;
  2158. to: number;
  2159. constructor(name: string, from: number, to: number);
  2160. clone(): AnimationRange;
  2161. }
  2162. /**
  2163. * Composed of a frame, and an action function
  2164. */
  2165. class AnimationEvent {
  2166. frame: number;
  2167. action: () => void;
  2168. onlyOnce: boolean;
  2169. isDone: boolean;
  2170. constructor(frame: number, action: () => void, onlyOnce?: boolean);
  2171. }
  2172. class PathCursor {
  2173. private path;
  2174. private _onchange;
  2175. value: number;
  2176. animations: Animation[];
  2177. constructor(path: Path2);
  2178. getPoint(): Vector3;
  2179. moveAhead(step?: number): PathCursor;
  2180. moveBack(step?: number): PathCursor;
  2181. move(step: number): PathCursor;
  2182. private ensureLimits();
  2183. private markAsDirty(propertyName);
  2184. private raiseOnChange();
  2185. onchange(f: (cursor: PathCursor) => void): PathCursor;
  2186. }
  2187. class Animation {
  2188. name: string;
  2189. targetProperty: string;
  2190. framePerSecond: number;
  2191. dataType: number;
  2192. loopMode: number;
  2193. enableBlending: boolean;
  2194. private _keys;
  2195. private _offsetsCache;
  2196. private _highLimitsCache;
  2197. private _stopped;
  2198. _target: any;
  2199. private _blendingFactor;
  2200. private _easingFunction;
  2201. private _events;
  2202. targetPropertyPath: string[];
  2203. currentFrame: number;
  2204. allowMatricesInterpolation: boolean;
  2205. blendingSpeed: number;
  2206. private _originalBlendValue;
  2207. private _ranges;
  2208. static _PrepareAnimation(name: string, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animation;
  2209. static CreateAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2210. static CreateMergeAndStartAnimation(name: string, node: Node, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction, onAnimationEnd?: () => void): Animatable;
  2211. constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number, enableBlending?: boolean);
  2212. /**
  2213. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2214. */
  2215. toString(fullDetails?: boolean): string;
  2216. /**
  2217. * Add an event to this animation.
  2218. */
  2219. addEvent(event: AnimationEvent): void;
  2220. /**
  2221. * Remove all events found at the given frame
  2222. * @param frame
  2223. */
  2224. removeEvents(frame: number): void;
  2225. createRange(name: string, from: number, to: number): void;
  2226. deleteRange(name: string, deleteFrames?: boolean): void;
  2227. getRange(name: string): AnimationRange;
  2228. reset(): void;
  2229. isStopped(): boolean;
  2230. getKeys(): Array<{
  2231. frame: number;
  2232. value: any;
  2233. }>;
  2234. getHighestFrame(): number;
  2235. getEasingFunction(): IEasingFunction;
  2236. setEasingFunction(easingFunction: EasingFunction): void;
  2237. floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
  2238. quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
  2239. vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
  2240. vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
  2241. sizeInterpolateFunction(startValue: Size, endValue: Size, gradient: number): Size;
  2242. color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
  2243. matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  2244. clone(): Animation;
  2245. setKeys(values: Array<{
  2246. frame: number;
  2247. value: any;
  2248. }>): void;
  2249. private _getKeyValue(value);
  2250. private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?);
  2251. setValue(currentValue: any, blend?: boolean): void;
  2252. goToFrame(frame: number): void;
  2253. animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, blend?: boolean): boolean;
  2254. serialize(): any;
  2255. private static _ANIMATIONTYPE_FLOAT;
  2256. private static _ANIMATIONTYPE_VECTOR3;
  2257. private static _ANIMATIONTYPE_QUATERNION;
  2258. private static _ANIMATIONTYPE_MATRIX;
  2259. private static _ANIMATIONTYPE_COLOR3;
  2260. private static _ANIMATIONTYPE_VECTOR2;
  2261. private static _ANIMATIONTYPE_SIZE;
  2262. private static _ANIMATIONLOOPMODE_RELATIVE;
  2263. private static _ANIMATIONLOOPMODE_CYCLE;
  2264. private static _ANIMATIONLOOPMODE_CONSTANT;
  2265. static ANIMATIONTYPE_FLOAT: number;
  2266. static ANIMATIONTYPE_VECTOR3: number;
  2267. static ANIMATIONTYPE_VECTOR2: number;
  2268. static ANIMATIONTYPE_SIZE: number;
  2269. static ANIMATIONTYPE_QUATERNION: number;
  2270. static ANIMATIONTYPE_MATRIX: number;
  2271. static ANIMATIONTYPE_COLOR3: number;
  2272. static ANIMATIONLOOPMODE_RELATIVE: number;
  2273. static ANIMATIONLOOPMODE_CYCLE: number;
  2274. static ANIMATIONLOOPMODE_CONSTANT: number;
  2275. static Parse(parsedAnimation: any): Animation;
  2276. static AppendSerializedAnimations(source: IAnimatable, destination: any): any;
  2277. }
  2278. }
  2279. declare module BABYLON {
  2280. interface IEasingFunction {
  2281. ease(gradient: number): number;
  2282. }
  2283. class EasingFunction implements IEasingFunction {
  2284. private static _EASINGMODE_EASEIN;
  2285. private static _EASINGMODE_EASEOUT;
  2286. private static _EASINGMODE_EASEINOUT;
  2287. static EASINGMODE_EASEIN: number;
  2288. static EASINGMODE_EASEOUT: number;
  2289. static EASINGMODE_EASEINOUT: number;
  2290. private _easingMode;
  2291. setEasingMode(easingMode: number): void;
  2292. getEasingMode(): number;
  2293. easeInCore(gradient: number): number;
  2294. ease(gradient: number): number;
  2295. }
  2296. class CircleEase extends EasingFunction implements IEasingFunction {
  2297. easeInCore(gradient: number): number;
  2298. }
  2299. class BackEase extends EasingFunction implements IEasingFunction {
  2300. amplitude: number;
  2301. constructor(amplitude?: number);
  2302. easeInCore(gradient: number): number;
  2303. }
  2304. class BounceEase extends EasingFunction implements IEasingFunction {
  2305. bounces: number;
  2306. bounciness: number;
  2307. constructor(bounces?: number, bounciness?: number);
  2308. easeInCore(gradient: number): number;
  2309. }
  2310. class CubicEase extends EasingFunction implements IEasingFunction {
  2311. easeInCore(gradient: number): number;
  2312. }
  2313. class ElasticEase extends EasingFunction implements IEasingFunction {
  2314. oscillations: number;
  2315. springiness: number;
  2316. constructor(oscillations?: number, springiness?: number);
  2317. easeInCore(gradient: number): number;
  2318. }
  2319. class ExponentialEase extends EasingFunction implements IEasingFunction {
  2320. exponent: number;
  2321. constructor(exponent?: number);
  2322. easeInCore(gradient: number): number;
  2323. }
  2324. class PowerEase extends EasingFunction implements IEasingFunction {
  2325. power: number;
  2326. constructor(power?: number);
  2327. easeInCore(gradient: number): number;
  2328. }
  2329. class QuadraticEase extends EasingFunction implements IEasingFunction {
  2330. easeInCore(gradient: number): number;
  2331. }
  2332. class QuarticEase extends EasingFunction implements IEasingFunction {
  2333. easeInCore(gradient: number): number;
  2334. }
  2335. class QuinticEase extends EasingFunction implements IEasingFunction {
  2336. easeInCore(gradient: number): number;
  2337. }
  2338. class SineEase extends EasingFunction implements IEasingFunction {
  2339. easeInCore(gradient: number): number;
  2340. }
  2341. class BezierCurveEase extends EasingFunction implements IEasingFunction {
  2342. x1: number;
  2343. y1: number;
  2344. x2: number;
  2345. y2: number;
  2346. constructor(x1?: number, y1?: number, x2?: number, y2?: number);
  2347. easeInCore(gradient: number): number;
  2348. }
  2349. }
  2350. declare module BABYLON {
  2351. class Analyser {
  2352. SMOOTHING: number;
  2353. FFT_SIZE: number;
  2354. BARGRAPHAMPLITUDE: number;
  2355. DEBUGCANVASPOS: {
  2356. x: number;
  2357. y: number;
  2358. };
  2359. DEBUGCANVASSIZE: {
  2360. width: number;
  2361. height: number;
  2362. };
  2363. private _byteFreqs;
  2364. private _byteTime;
  2365. private _floatFreqs;
  2366. private _webAudioAnalyser;
  2367. private _debugCanvas;
  2368. private _debugCanvasContext;
  2369. private _scene;
  2370. private _registerFunc;
  2371. private _audioEngine;
  2372. constructor(scene: Scene);
  2373. getFrequencyBinCount(): number;
  2374. getByteFrequencyData(): Uint8Array;
  2375. getByteTimeDomainData(): Uint8Array;
  2376. getFloatFrequencyData(): Uint8Array;
  2377. drawDebugCanvas(): void;
  2378. stopDebugCanvas(): void;
  2379. connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void;
  2380. dispose(): void;
  2381. }
  2382. }
  2383. declare module BABYLON {
  2384. class AudioEngine {
  2385. private _audioContext;
  2386. private _audioContextInitialized;
  2387. canUseWebAudio: boolean;
  2388. masterGain: GainNode;
  2389. private _connectedAnalyser;
  2390. WarnedWebAudioUnsupported: boolean;
  2391. unlocked: boolean;
  2392. onAudioUnlocked: () => any;
  2393. isMP3supported: boolean;
  2394. isOGGsupported: boolean;
  2395. audioContext: AudioContext;
  2396. constructor();
  2397. private _unlockiOSaudio();
  2398. private _initializeAudioContext();
  2399. dispose(): void;
  2400. getGlobalVolume(): number;
  2401. setGlobalVolume(newVolume: number): void;
  2402. connectToAnalyser(analyser: Analyser): void;
  2403. }
  2404. }
  2405. declare module BABYLON {
  2406. class Sound {
  2407. name: string;
  2408. autoplay: boolean;
  2409. loop: boolean;
  2410. useCustomAttenuation: boolean;
  2411. soundTrackId: number;
  2412. spatialSound: boolean;
  2413. refDistance: number;
  2414. rolloffFactor: number;
  2415. maxDistance: number;
  2416. distanceModel: string;
  2417. private _panningModel;
  2418. onended: () => any;
  2419. private _playbackRate;
  2420. private _streaming;
  2421. private _startTime;
  2422. private _startOffset;
  2423. private _position;
  2424. private _localDirection;
  2425. private _volume;
  2426. private _isLoaded;
  2427. private _isReadyToPlay;
  2428. isPlaying: boolean;
  2429. isPaused: boolean;
  2430. private _isDirectional;
  2431. private _readyToPlayCallback;
  2432. private _audioBuffer;
  2433. private _soundSource;
  2434. private _streamingSource;
  2435. private _soundPanner;
  2436. private _soundGain;
  2437. private _inputAudioNode;
  2438. private _ouputAudioNode;
  2439. private _coneInnerAngle;
  2440. private _coneOuterAngle;
  2441. private _coneOuterGain;
  2442. private _scene;
  2443. private _connectedMesh;
  2444. private _customAttenuationFunction;
  2445. private _registerFunc;
  2446. private _isOutputConnected;
  2447. private _htmlAudioElement;
  2448. private _urlType;
  2449. /**
  2450. * Create a sound and attach it to a scene
  2451. * @param name Name of your sound
  2452. * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
  2453. * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
  2454. * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
  2455. */
  2456. constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any);
  2457. dispose(): void;
  2458. private _soundLoaded(audioData);
  2459. setAudioBuffer(audioBuffer: AudioBuffer): void;
  2460. updateOptions(options: any): void;
  2461. private _createSpatialParameters();
  2462. private _updateSpatialParameters();
  2463. switchPanningModelToHRTF(): void;
  2464. switchPanningModelToEqualPower(): void;
  2465. private _switchPanningModel();
  2466. connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void;
  2467. /**
  2468. * Transform this sound into a directional source
  2469. * @param coneInnerAngle Size of the inner cone in degree
  2470. * @param coneOuterAngle Size of the outer cone in degree
  2471. * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
  2472. */
  2473. setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void;
  2474. setPosition(newPosition: Vector3): void;
  2475. setLocalDirectionToMesh(newLocalDirection: Vector3): void;
  2476. private _updateDirection();
  2477. updateDistanceFromListener(): void;
  2478. setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void;
  2479. /**
  2480. * Play the sound
  2481. * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
  2482. * @param offset (optional) Start the sound setting it at a specific time
  2483. */
  2484. play(time?: number, offset?: number): void;
  2485. private _onended();
  2486. /**
  2487. * Stop the sound
  2488. * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
  2489. */
  2490. stop(time?: number): void;
  2491. pause(): void;
  2492. setVolume(newVolume: number, time?: number): void;
  2493. setPlaybackRate(newPlaybackRate: number): void;
  2494. getVolume(): number;
  2495. attachToMesh(meshToConnectTo: AbstractMesh): void;
  2496. detachFromMesh(): void;
  2497. private _onRegisterAfterWorldMatrixUpdate(connectedMesh);
  2498. clone(): Sound;
  2499. getAudioBuffer(): AudioBuffer;
  2500. serialize(): any;
  2501. static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound;
  2502. }
  2503. }
  2504. declare module BABYLON {
  2505. class SoundTrack {
  2506. private _outputAudioNode;
  2507. private _inputAudioNode;
  2508. private _trackConvolver;
  2509. private _scene;
  2510. id: number;
  2511. soundCollection: Array<Sound>;
  2512. private _isMainTrack;
  2513. private _connectedAnalyser;
  2514. private _options;
  2515. private _isInitialized;
  2516. constructor(scene: Scene, options?: any);
  2517. private _initializeSoundTrackAudioGraph();
  2518. dispose(): void;
  2519. AddSound(sound: Sound): void;
  2520. RemoveSound(sound: Sound): void;
  2521. setVolume(newVolume: number): void;
  2522. switchPanningModelToHRTF(): void;
  2523. switchPanningModelToEqualPower(): void;
  2524. connectToAnalyser(analyser: Analyser): void;
  2525. }
  2526. }
  2527. declare module BABYLON {
  2528. class Bone extends Node {
  2529. name: string;
  2530. children: Bone[];
  2531. animations: Animation[];
  2532. length: number;
  2533. private _skeleton;
  2534. _matrix: Matrix;
  2535. private _restPose;
  2536. private _baseMatrix;
  2537. private _worldTransform;
  2538. private _absoluteTransform;
  2539. private _invertedAbsoluteTransform;
  2540. private _parent;
  2541. private _scaleMatrix;
  2542. private _scaleVector;
  2543. private _negateScaleChildren;
  2544. private _scalingDeterminant;
  2545. constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix, restPose?: Matrix);
  2546. getParent(): Bone;
  2547. getLocalMatrix(): Matrix;
  2548. getBaseMatrix(): Matrix;
  2549. getRestPose(): Matrix;
  2550. returnToRest(): void;
  2551. getWorldMatrix(): Matrix;
  2552. getInvertedAbsoluteTransform(): Matrix;
  2553. getAbsoluteTransform(): Matrix;
  2554. updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean): void;
  2555. _updateDifferenceMatrix(rootMatrix?: Matrix): void;
  2556. markAsDirty(): void;
  2557. copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired?: boolean, skelDimensionsRatio?: Vector3): boolean;
  2558. translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2559. setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2560. setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void;
  2561. setScale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2562. scale(x: number, y: number, z: number, scaleChildren?: boolean): void;
  2563. setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void;
  2564. rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void;
  2565. setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void;
  2566. setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void;
  2567. setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void;
  2568. setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void;
  2569. private _rotateWithMatrix(rmat, space?, mesh?);
  2570. private _getNegativeRotationToRef(rotMatInv, space?, mesh?);
  2571. getScale(): Vector3;
  2572. getScaleToRef(result: Vector3): void;
  2573. getPosition(space?: Space, mesh?: AbstractMesh): Vector3;
  2574. getPositionToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2575. getAbsolutePosition(mesh?: AbstractMesh): Vector3;
  2576. getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void;
  2577. computeAbsoluteTransforms(): void;
  2578. private _syncScaleVector;
  2579. getDirection(localAxis: Vector3, mesh?: AbstractMesh): Vector3;
  2580. getDirectionToRef(localAxis: Vector3, mesh: AbstractMesh, result: Vector3): void;
  2581. getRotation(space?: Space, mesh?: AbstractMesh): Vector3;
  2582. getRotationToRef(space: Space, mesh: AbstractMesh, result: Vector3): void;
  2583. getRotationQuaternion(space?: Space, mesh?: AbstractMesh): Quaternion;
  2584. getRotationQuaternionToRef(space: Space, mesh: AbstractMesh, result: Quaternion): void;
  2585. getAbsolutePositionFromLocal(position: Vector3, mesh?: AbstractMesh): Vector3;
  2586. getAbsolutePositionFromLocalToRef(position: Vector3, mesh: AbstractMesh, result: Vector3): void;
  2587. }
  2588. }
  2589. declare module BABYLON {
  2590. class BoneIKController {
  2591. targetMesh: AbstractMesh;
  2592. poleTargetMesh: AbstractMesh;
  2593. poleTargetBone: Bone;
  2594. targetPosition: Vector3;
  2595. poleTargetPosition: Vector3;
  2596. poleTargetLocalOffset: Vector3;
  2597. poleAngle: number;
  2598. mesh: AbstractMesh;
  2599. private _bone1;
  2600. private _bone2;
  2601. private _bone1Length;
  2602. private _bone2Length;
  2603. private _maxAngle;
  2604. private _maxReach;
  2605. private _tmpVec1;
  2606. private _tmpVec2;
  2607. private _tmpVec3;
  2608. private _tmpVec4;
  2609. private _tmpVec5;
  2610. private _tmpMat1;
  2611. private _tmpMat2;
  2612. private _rightHandedSystem;
  2613. private _bendAxis;
  2614. maxAngle: number;
  2615. constructor(mesh: AbstractMesh, bone: Bone, options?: {
  2616. targetMesh?: AbstractMesh;
  2617. poleTargetMesh?: AbstractMesh;
  2618. poleTargetBone?: Bone;
  2619. poleTargetLocalOffset?: Vector3;
  2620. poleAngle?: number;
  2621. bendAxis?: Vector3;
  2622. maxAngle?: number;
  2623. });
  2624. private _setMaxAngle(ang);
  2625. update(): void;
  2626. }
  2627. }
  2628. declare module BABYLON {
  2629. class BoneLookController {
  2630. target: Vector3;
  2631. mesh: AbstractMesh;
  2632. bone: Bone;
  2633. upAxis: Vector3;
  2634. adjustYaw: number;
  2635. adjustPitch: number;
  2636. adjustRoll: number;
  2637. private _tmpVec1;
  2638. private _tmpVec2;
  2639. private _tmpVec3;
  2640. private _tmpVec4;
  2641. private _tmpMat1;
  2642. private _tmpMat2;
  2643. constructor(mesh: AbstractMesh, bone: Bone, target: Vector3, options?: {
  2644. adjustYaw?: number;
  2645. adjustPitch?: number;
  2646. adjustRoll?: number;
  2647. });
  2648. update(): void;
  2649. }
  2650. }
  2651. declare module BABYLON {
  2652. class Skeleton {
  2653. name: string;
  2654. id: string;
  2655. bones: Bone[];
  2656. dimensionsAtRest: Vector3;
  2657. needInitialSkinMatrix: boolean;
  2658. private _scene;
  2659. private _isDirty;
  2660. private _transformMatrices;
  2661. private _meshesWithPoseMatrix;
  2662. private _animatables;
  2663. private _identity;
  2664. private _ranges;
  2665. private _lastAbsoluteTransformsUpdateId;
  2666. constructor(name: string, id: string, scene: Scene);
  2667. getTransformMatrices(mesh: AbstractMesh): Float32Array;
  2668. getScene(): Scene;
  2669. /**
  2670. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2671. */
  2672. toString(fullDetails?: boolean): string;
  2673. /**
  2674. * Get bone's index searching by name
  2675. * @param {string} name is bone's name to search for
  2676. * @return {number} Indice of the bone. Returns -1 if not found
  2677. */
  2678. getBoneIndexByName(name: string): number;
  2679. createAnimationRange(name: string, from: number, to: number): void;
  2680. deleteAnimationRange(name: string, deleteFrames?: boolean): void;
  2681. getAnimationRange(name: string): AnimationRange;
  2682. /**
  2683. * Returns as an Array, all AnimationRanges defined on this skeleton
  2684. */
  2685. getAnimationRanges(): AnimationRange[];
  2686. /**
  2687. * note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
  2688. */
  2689. copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean;
  2690. returnToRest(): void;
  2691. private _getHighestAnimationFrame();
  2692. beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable;
  2693. _markAsDirty(): void;
  2694. _registerMeshWithPoseMatrix(mesh: AbstractMesh): void;
  2695. _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void;
  2696. _computeTransformMatrices(targetMatrix: Float32Array, initialSkinMatrix: Matrix): void;
  2697. prepare(): void;
  2698. getAnimatables(): IAnimatable[];
  2699. clone(name: string, id: string): Skeleton;
  2700. enableBlending(blendingSpeed?: number): void;
  2701. dispose(): void;
  2702. serialize(): any;
  2703. static Parse(parsedSkeleton: any, scene: Scene): Skeleton;
  2704. computeAbsoluteTransforms(forceUpdate?: boolean): void;
  2705. getPoseMatrix(): Matrix;
  2706. }
  2707. }
  2708. declare module BABYLON {
  2709. class BoundingBox implements ICullable {
  2710. minimum: Vector3;
  2711. maximum: Vector3;
  2712. vectors: Vector3[];
  2713. center: Vector3;
  2714. extendSize: Vector3;
  2715. directions: Vector3[];
  2716. vectorsWorld: Vector3[];
  2717. minimumWorld: Vector3;
  2718. maximumWorld: Vector3;
  2719. private _worldMatrix;
  2720. constructor(minimum: Vector3, maximum: Vector3);
  2721. getWorldMatrix(): Matrix;
  2722. setWorldMatrix(matrix: Matrix): BoundingBox;
  2723. _update(world: Matrix): void;
  2724. isInFrustum(frustumPlanes: Plane[]): boolean;
  2725. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2726. intersectsPoint(point: Vector3): boolean;
  2727. intersectsSphere(sphere: BoundingSphere): boolean;
  2728. intersectsMinMax(min: Vector3, max: Vector3): boolean;
  2729. static Intersects(box0: BoundingBox, box1: BoundingBox): boolean;
  2730. static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
  2731. static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2732. static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean;
  2733. }
  2734. }
  2735. declare module BABYLON {
  2736. interface ICullable {
  2737. isInFrustum(frustumPlanes: Plane[]): boolean;
  2738. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2739. }
  2740. class BoundingInfo implements ICullable {
  2741. minimum: Vector3;
  2742. maximum: Vector3;
  2743. boundingBox: BoundingBox;
  2744. boundingSphere: BoundingSphere;
  2745. private _isLocked;
  2746. constructor(minimum: Vector3, maximum: Vector3);
  2747. isLocked: boolean;
  2748. update(world: Matrix): void;
  2749. isInFrustum(frustumPlanes: Plane[]): boolean;
  2750. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  2751. _checkCollision(collider: Collider): boolean;
  2752. intersectsPoint(point: Vector3): boolean;
  2753. intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
  2754. }
  2755. }
  2756. declare module BABYLON {
  2757. class BoundingSphere {
  2758. minimum: Vector3;
  2759. maximum: Vector3;
  2760. center: Vector3;
  2761. radius: number;
  2762. centerWorld: Vector3;
  2763. radiusWorld: number;
  2764. private _tempRadiusVector;
  2765. constructor(minimum: Vector3, maximum: Vector3);
  2766. _update(world: Matrix): void;
  2767. isInFrustum(frustumPlanes: Plane[]): boolean;
  2768. intersectsPoint(point: Vector3): boolean;
  2769. static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
  2770. }
  2771. }
  2772. declare module BABYLON {
  2773. class Ray {
  2774. origin: Vector3;
  2775. direction: Vector3;
  2776. length: number;
  2777. private _edge1;
  2778. private _edge2;
  2779. private _pvec;
  2780. private _tvec;
  2781. private _qvec;
  2782. constructor(origin: Vector3, direction: Vector3, length?: number);
  2783. intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
  2784. intersectsBox(box: BoundingBox): boolean;
  2785. intersectsSphere(sphere: BoundingSphere): boolean;
  2786. intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
  2787. intersectsPlane(plane: Plane): number;
  2788. private static smallnum;
  2789. private static rayl;
  2790. /**
  2791. * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
  2792. * @param sega the first point of the segment to test the intersection against
  2793. * @param segb the second point of the segment to test the intersection against
  2794. * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
  2795. * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
  2796. */
  2797. intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
  2798. static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
  2799. /**
  2800. * 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
  2801. * transformed to the given world matrix.
  2802. * @param origin The origin point
  2803. * @param end The end point
  2804. * @param world a matrix to transform the ray to. Default is the identity matrix.
  2805. */
  2806. static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
  2807. static Transform(ray: Ray, matrix: Matrix): Ray;
  2808. }
  2809. }
  2810. declare module BABYLON {
  2811. class ArcRotateCamera extends TargetCamera {
  2812. alpha: number;
  2813. beta: number;
  2814. radius: number;
  2815. target: Vector3;
  2816. inertialAlphaOffset: number;
  2817. inertialBetaOffset: number;
  2818. inertialRadiusOffset: number;
  2819. lowerAlphaLimit: any;
  2820. upperAlphaLimit: any;
  2821. lowerBetaLimit: number;
  2822. upperBetaLimit: number;
  2823. lowerRadiusLimit: any;
  2824. upperRadiusLimit: any;
  2825. inertialPanningX: number;
  2826. inertialPanningY: number;
  2827. angularSensibilityX: number;
  2828. angularSensibilityY: number;
  2829. pinchPrecision: number;
  2830. panningSensibility: number;
  2831. keysUp: number[];
  2832. keysDown: number[];
  2833. keysLeft: number[];
  2834. keysRight: number[];
  2835. wheelPrecision: number;
  2836. zoomOnFactor: number;
  2837. targetScreenOffset: Vector2;
  2838. allowUpsideDown: boolean;
  2839. _viewMatrix: Matrix;
  2840. _useCtrlForPanning: boolean;
  2841. _panningMouseButton: number;
  2842. inputs: ArcRotateCameraInputsManager;
  2843. _reset: () => void;
  2844. panningAxis: Vector3;
  2845. private _localDirection;
  2846. private _transformedDirection;
  2847. onCollide: (collidedMesh: AbstractMesh) => void;
  2848. checkCollisions: boolean;
  2849. collisionRadius: Vector3;
  2850. private _collider;
  2851. private _previousPosition;
  2852. private _collisionVelocity;
  2853. private _newPosition;
  2854. private _previousAlpha;
  2855. private _previousBeta;
  2856. private _previousRadius;
  2857. private _collisionTriggered;
  2858. private _targetBoundingCenter;
  2859. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
  2860. _initCache(): void;
  2861. _updateCache(ignoreParentClass?: boolean): void;
  2862. private _getTargetPosition();
  2863. _isSynchronizedViewMatrix(): boolean;
  2864. attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean, panningMouseButton?: number): void;
  2865. detachControl(element: HTMLElement): void;
  2866. _checkInputs(): void;
  2867. private _checkLimits();
  2868. rebuildAnglesAndRadius(): void;
  2869. setPosition(position: Vector3): void;
  2870. setTarget(target: Vector3, toBoundingCenter?: boolean): void;
  2871. _getViewMatrix(): Matrix;
  2872. private _onCollisionPositionChange;
  2873. zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void;
  2874. focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void;
  2875. /**
  2876. * @override
  2877. * Override Camera.createRigCamera
  2878. */
  2879. createRigCamera(name: string, cameraIndex: number): Camera;
  2880. /**
  2881. * @override
  2882. * Override Camera._updateRigCameras
  2883. */
  2884. _updateRigCameras(): void;
  2885. dispose(): void;
  2886. getTypeName(): string;
  2887. }
  2888. }
  2889. declare module BABYLON {
  2890. class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
  2891. constructor(camera: ArcRotateCamera);
  2892. addMouseWheel(): ArcRotateCameraInputsManager;
  2893. addPointers(): ArcRotateCameraInputsManager;
  2894. addKeyboard(): ArcRotateCameraInputsManager;
  2895. addGamepad(): ArcRotateCameraInputsManager;
  2896. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  2897. }
  2898. }
  2899. declare module BABYLON {
  2900. class Camera extends Node {
  2901. inputs: CameraInputsManager<Camera>;
  2902. private static _PERSPECTIVE_CAMERA;
  2903. private static _ORTHOGRAPHIC_CAMERA;
  2904. private static _FOVMODE_VERTICAL_FIXED;
  2905. private static _FOVMODE_HORIZONTAL_FIXED;
  2906. private static _RIG_MODE_NONE;
  2907. private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH;
  2908. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
  2909. private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
  2910. private static _RIG_MODE_STEREOSCOPIC_OVERUNDER;
  2911. private static _RIG_MODE_VR;
  2912. private static _RIG_MODE_WEBVR;
  2913. static PERSPECTIVE_CAMERA: number;
  2914. static ORTHOGRAPHIC_CAMERA: number;
  2915. static FOVMODE_VERTICAL_FIXED: number;
  2916. static FOVMODE_HORIZONTAL_FIXED: number;
  2917. static RIG_MODE_NONE: number;
  2918. static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number;
  2919. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number;
  2920. static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number;
  2921. static RIG_MODE_STEREOSCOPIC_OVERUNDER: number;
  2922. static RIG_MODE_VR: number;
  2923. static RIG_MODE_WEBVR: number;
  2924. static ForceAttachControlToAlwaysPreventDefault: boolean;
  2925. position: Vector3;
  2926. upVector: Vector3;
  2927. orthoLeft: any;
  2928. orthoRight: any;
  2929. orthoBottom: any;
  2930. orthoTop: any;
  2931. fov: number;
  2932. minZ: number;
  2933. maxZ: number;
  2934. inertia: number;
  2935. mode: number;
  2936. isIntermediate: boolean;
  2937. viewport: Viewport;
  2938. layerMask: number;
  2939. fovMode: number;
  2940. cameraRigMode: number;
  2941. interaxialDistance: number;
  2942. isStereoscopicSideBySide: boolean;
  2943. _cameraRigParams: any;
  2944. _rigCameras: Camera[];
  2945. _rigPostProcess: PostProcess;
  2946. private _computedViewMatrix;
  2947. _projectionMatrix: Matrix;
  2948. private _doNotComputeProjectionMatrix;
  2949. private _worldMatrix;
  2950. _postProcesses: PostProcess[];
  2951. private _transformMatrix;
  2952. private _webvrViewMatrix;
  2953. _activeMeshes: SmartArray<Mesh>;
  2954. private _globalPosition;
  2955. private _frustumPlanes;
  2956. private _refreshFrustumPlanes;
  2957. constructor(name: string, position: Vector3, scene: Scene);
  2958. /**
  2959. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  2960. */
  2961. toString(fullDetails?: boolean): string;
  2962. globalPosition: Vector3;
  2963. getActiveMeshes(): SmartArray<Mesh>;
  2964. isActiveMesh(mesh: Mesh): boolean;
  2965. _initCache(): void;
  2966. _updateCache(ignoreParentClass?: boolean): void;
  2967. _updateFromScene(): void;
  2968. _isSynchronized(): boolean;
  2969. _isSynchronizedViewMatrix(): boolean;
  2970. _isSynchronizedProjectionMatrix(): boolean;
  2971. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  2972. detachControl(element: HTMLElement): void;
  2973. update(): void;
  2974. _checkInputs(): void;
  2975. private _cascadePostProcessesToRigCams();
  2976. attachPostProcess(postProcess: PostProcess, insertAt?: number): number;
  2977. detachPostProcess(postProcess: PostProcess, atIndices?: any): number[];
  2978. getWorldMatrix(): Matrix;
  2979. _getViewMatrix(): Matrix;
  2980. getViewMatrix(force?: boolean): Matrix;
  2981. _computeViewMatrix(force?: boolean): Matrix;
  2982. freezeProjectionMatrix(projection?: Matrix): void;
  2983. unfreezeProjectionMatrix(): void;
  2984. getProjectionMatrix(force?: boolean): Matrix;
  2985. getTranformationMatrix(): Matrix;
  2986. private updateFrustumPlanes();
  2987. isInFrustum(target: ICullable): boolean;
  2988. isCompletelyInFrustum(target: ICullable): boolean;
  2989. dispose(): void;
  2990. setCameraRigMode(mode: number, rigParams: any): void;
  2991. private _getVRProjectionMatrix();
  2992. private _getWebVRProjectionMatrix();
  2993. private _getWebVRViewMatrix();
  2994. setCameraRigParameter(name: string, value: any): void;
  2995. /**
  2996. * needs to be overridden by children so sub has required properties to be copied
  2997. */
  2998. createRigCamera(name: string, cameraIndex: number): Camera;
  2999. /**
  3000. * May need to be overridden by children
  3001. */
  3002. _updateRigCameras(): void;
  3003. _setupInputs(): void;
  3004. serialize(): any;
  3005. getTypeName(): string;
  3006. clone(name: string): Camera;
  3007. getDirection(localAxis: Vector3): Vector3;
  3008. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  3009. static GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera;
  3010. static Parse(parsedCamera: any, scene: Scene): Camera;
  3011. }
  3012. }
  3013. declare module BABYLON {
  3014. var CameraInputTypes: {};
  3015. interface ICameraInput<TCamera extends BABYLON.Camera> {
  3016. camera: TCamera;
  3017. getTypeName(): string;
  3018. getSimpleName(): string;
  3019. attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
  3020. detachControl: (element: HTMLElement) => void;
  3021. checkInputs?: () => void;
  3022. }
  3023. interface CameraInputsMap<TCamera extends BABYLON.Camera> {
  3024. [name: string]: ICameraInput<TCamera>;
  3025. [idx: number]: ICameraInput<TCamera>;
  3026. }
  3027. class CameraInputsManager<TCamera extends BABYLON.Camera> {
  3028. attached: CameraInputsMap<TCamera>;
  3029. attachedElement: HTMLElement;
  3030. noPreventDefault: boolean;
  3031. camera: TCamera;
  3032. checkInputs: () => void;
  3033. constructor(camera: TCamera);
  3034. add(input: ICameraInput<TCamera>): void;
  3035. remove(inputToRemove: ICameraInput<TCamera>): void;
  3036. removeByType(inputType: string): void;
  3037. private _addCheckInputs(fn);
  3038. attachInput(input: ICameraInput<TCamera>): void;
  3039. attachElement(element: HTMLElement, noPreventDefault?: boolean): void;
  3040. detachElement(element: HTMLElement): void;
  3041. rebuildInputCheck(): void;
  3042. clear(): void;
  3043. serialize(serializedCamera: any): void;
  3044. parse(parsedCamera: any): void;
  3045. }
  3046. }
  3047. declare module BABYLON {
  3048. class DeviceOrientationCamera extends FreeCamera {
  3049. private _initialQuaternion;
  3050. private _quaternionCache;
  3051. constructor(name: string, position: Vector3, scene: Scene);
  3052. getTypeName(): string;
  3053. _checkInputs(): void;
  3054. resetToCurrentRotation(axis?: Axis): void;
  3055. }
  3056. }
  3057. declare module BABYLON {
  3058. class FollowCamera extends TargetCamera {
  3059. radius: number;
  3060. rotationOffset: number;
  3061. heightOffset: number;
  3062. cameraAcceleration: number;
  3063. maxCameraSpeed: number;
  3064. target: AbstractMesh;
  3065. constructor(name: string, position: Vector3, scene: Scene, target?: AbstractMesh);
  3066. private getRadians(degrees);
  3067. private follow(cameraTarget);
  3068. _checkInputs(): void;
  3069. getTypeName(): string;
  3070. }
  3071. class ArcFollowCamera extends TargetCamera {
  3072. alpha: number;
  3073. beta: number;
  3074. radius: number;
  3075. target: AbstractMesh;
  3076. private _cartesianCoordinates;
  3077. constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene);
  3078. private follow();
  3079. _checkInputs(): void;
  3080. getTypeName(): string;
  3081. }
  3082. }
  3083. declare module BABYLON {
  3084. class FreeCamera extends TargetCamera {
  3085. ellipsoid: Vector3;
  3086. checkCollisions: boolean;
  3087. applyGravity: boolean;
  3088. inputs: FreeCameraInputsManager;
  3089. angularSensibility: number;
  3090. keysUp: number[];
  3091. keysDown: number[];
  3092. keysLeft: number[];
  3093. keysRight: number[];
  3094. onCollide: (collidedMesh: AbstractMesh) => void;
  3095. private _collider;
  3096. private _needMoveForGravity;
  3097. private _oldPosition;
  3098. private _diffPosition;
  3099. private _newPosition;
  3100. _localDirection: Vector3;
  3101. _transformedDirection: Vector3;
  3102. constructor(name: string, position: Vector3, scene: Scene);
  3103. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  3104. detachControl(element: HTMLElement): void;
  3105. _collideWithWorld(velocity: Vector3): void;
  3106. private _onCollisionPositionChange;
  3107. _checkInputs(): void;
  3108. _decideIfNeedsToMove(): boolean;
  3109. _updatePosition(): void;
  3110. dispose(): void;
  3111. getTypeName(): string;
  3112. }
  3113. }
  3114. declare module BABYLON {
  3115. class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  3116. constructor(camera: FreeCamera);
  3117. addKeyboard(): FreeCameraInputsManager;
  3118. addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
  3119. addGamepad(): FreeCameraInputsManager;
  3120. addDeviceOrientation(): FreeCameraInputsManager;
  3121. addTouch(): FreeCameraInputsManager;
  3122. addVirtualJoystick(): FreeCameraInputsManager;
  3123. }
  3124. }
  3125. declare module BABYLON {
  3126. class GamepadCamera extends UniversalCamera {
  3127. gamepadAngularSensibility: number;
  3128. gamepadMoveSensibility: number;
  3129. constructor(name: string, position: Vector3, scene: Scene);
  3130. getTypeName(): string;
  3131. }
  3132. }
  3133. declare module BABYLON {
  3134. class AnaglyphFreeCamera extends FreeCamera {
  3135. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3136. getTypeName(): string;
  3137. }
  3138. class AnaglyphArcRotateCamera extends ArcRotateCamera {
  3139. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene);
  3140. getTypeName(): string;
  3141. }
  3142. class AnaglyphGamepadCamera extends GamepadCamera {
  3143. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3144. getTypeName(): string;
  3145. }
  3146. class AnaglyphUniversalCamera extends UniversalCamera {
  3147. constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene);
  3148. getTypeName(): string;
  3149. }
  3150. class StereoscopicFreeCamera extends FreeCamera {
  3151. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3152. getTypeName(): string;
  3153. }
  3154. class StereoscopicArcRotateCamera extends ArcRotateCamera {
  3155. constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3156. getTypeName(): string;
  3157. }
  3158. class StereoscopicGamepadCamera extends GamepadCamera {
  3159. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3160. getTypeName(): string;
  3161. }
  3162. class StereoscopicUniversalCamera extends UniversalCamera {
  3163. constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene);
  3164. getTypeName(): string;
  3165. }
  3166. }
  3167. declare module BABYLON {
  3168. class TargetCamera extends Camera {
  3169. cameraDirection: Vector3;
  3170. cameraRotation: Vector2;
  3171. rotation: Vector3;
  3172. rotationQuaternion: Quaternion;
  3173. speed: number;
  3174. noRotationConstraint: boolean;
  3175. lockedTarget: any;
  3176. _currentTarget: Vector3;
  3177. _viewMatrix: Matrix;
  3178. _camMatrix: Matrix;
  3179. _cameraTransformMatrix: Matrix;
  3180. _cameraRotationMatrix: Matrix;
  3181. private _rigCamTransformMatrix;
  3182. _referencePoint: Vector3;
  3183. private _defaultUpVector;
  3184. _transformedReferencePoint: Vector3;
  3185. _lookAtTemp: Matrix;
  3186. _tempMatrix: Matrix;
  3187. _reset: () => void;
  3188. constructor(name: string, position: Vector3, scene: Scene);
  3189. getFrontPosition(distance: number): Vector3;
  3190. _getLockedTargetPosition(): Vector3;
  3191. _initCache(): void;
  3192. _updateCache(ignoreParentClass?: boolean): void;
  3193. _isSynchronizedViewMatrix(): boolean;
  3194. _computeLocalCameraSpeed(): number;
  3195. setTarget(target: Vector3): void;
  3196. getTarget(): Vector3;
  3197. _decideIfNeedsToMove(): boolean;
  3198. _updatePosition(): void;
  3199. _checkInputs(): void;
  3200. private _updateCameraRotationMatrix();
  3201. _getViewMatrix(): Matrix;
  3202. /**
  3203. * @override
  3204. * Override Camera.createRigCamera
  3205. */
  3206. createRigCamera(name: string, cameraIndex: number): Camera;
  3207. /**
  3208. * @override
  3209. * Override Camera._updateRigCameras
  3210. */
  3211. _updateRigCameras(): void;
  3212. private _getRigCamPosition(halfSpace, result);
  3213. getTypeName(): string;
  3214. }
  3215. }
  3216. declare module BABYLON {
  3217. class TouchCamera extends FreeCamera {
  3218. touchAngularSensibility: number;
  3219. touchMoveSensibility: number;
  3220. constructor(name: string, position: Vector3, scene: Scene);
  3221. getTypeName(): string;
  3222. _setupInputs(): void;
  3223. }
  3224. }
  3225. declare module BABYLON {
  3226. class UniversalCamera extends TouchCamera {
  3227. gamepadAngularSensibility: number;
  3228. gamepadMoveSensibility: number;
  3229. constructor(name: string, position: Vector3, scene: Scene);
  3230. getTypeName(): string;
  3231. }
  3232. }
  3233. declare module BABYLON {
  3234. class VirtualJoysticksCamera extends FreeCamera {
  3235. constructor(name: string, position: Vector3, scene: Scene);
  3236. }
  3237. }
  3238. declare module BABYLON.Debug {
  3239. class AxesViewer {
  3240. private _xline;
  3241. private _yline;
  3242. private _zline;
  3243. private _xmesh;
  3244. private _ymesh;
  3245. private _zmesh;
  3246. scene: Scene;
  3247. scaleLines: number;
  3248. constructor(scene: Scene, scaleLines?: number);
  3249. update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
  3250. dispose(): void;
  3251. }
  3252. }
  3253. declare module BABYLON.Debug {
  3254. class BoneAxesViewer extends Debug.AxesViewer {
  3255. mesh: Mesh;
  3256. bone: Bone;
  3257. pos: Vector3;
  3258. xaxis: Vector3;
  3259. yaxis: Vector3;
  3260. zaxis: Vector3;
  3261. constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
  3262. update(): void;
  3263. dispose(): void;
  3264. }
  3265. }
  3266. declare module BABYLON {
  3267. class DebugLayer {
  3268. private _scene;
  3269. private _camera;
  3270. private _transformationMatrix;
  3271. private _enabled;
  3272. private _labelsEnabled;
  3273. private _displayStatistics;
  3274. private _displayTree;
  3275. private _displayLogs;
  3276. private _globalDiv;
  3277. private _statsDiv;
  3278. private _statsSubsetDiv;
  3279. private _optionsDiv;
  3280. private _optionsSubsetDiv;
  3281. private _logDiv;
  3282. private _logSubsetDiv;
  3283. private _treeDiv;
  3284. private _treeSubsetDiv;
  3285. private _drawingCanvas;
  3286. private _drawingContext;
  3287. private _rootElement;
  3288. private _skeletonViewers;
  3289. _syncPositions: () => void;
  3290. private _syncData;
  3291. private _syncUI;
  3292. private _onCanvasClick;
  3293. private _clickPosition;
  3294. private _ratio;
  3295. private _identityMatrix;
  3296. private _showUI;
  3297. private _needToRefreshMeshesTree;
  3298. shouldDisplayLabel: (node: Node) => boolean;
  3299. shouldDisplayAxis: (mesh: Mesh) => boolean;
  3300. axisRatio: number;
  3301. accentColor: string;
  3302. customStatsFunction: () => string;
  3303. constructor(scene: Scene);
  3304. private _refreshMeshesTreeContent();
  3305. private _renderSingleAxis(zero, unit, unitText, label, color);
  3306. private _renderAxis(projectedPosition, mesh, globalViewport);
  3307. private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle);
  3308. private _isClickInsideRect(x, y, width, height);
  3309. isVisible(): boolean;
  3310. hide(): void;
  3311. private _clearSkeletonViewers();
  3312. show(showUI?: boolean, camera?: Camera, rootElement?: HTMLElement): void;
  3313. private _clearLabels();
  3314. private _generateheader(root, text);
  3315. private _generateTexBox(root, title, color);
  3316. private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?);
  3317. private _generateCheckBox(root, title, initialState, task, tag?);
  3318. private _generateButton(root, title, task, tag?);
  3319. private _generateRadio(root, title, name, initialState, task, tag?);
  3320. private _generateDOMelements();
  3321. private _displayStats();
  3322. }
  3323. }
  3324. declare module BABYLON.Debug {
  3325. /**
  3326. * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
  3327. */
  3328. class SkeletonViewer {
  3329. skeleton: Skeleton;
  3330. mesh: AbstractMesh;
  3331. autoUpdateBonesMatrices: boolean;
  3332. renderingGroupId: number;
  3333. color: Color3;
  3334. private _scene;
  3335. private _debugLines;
  3336. private _debugMesh;
  3337. private _isEnabled;
  3338. private _renderFunction;
  3339. constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
  3340. isEnabled: boolean;
  3341. private _getBonePosition(position, bone, meshMat, x?, y?, z?);
  3342. private _getLinesForBonesWithLength(bones, meshMat);
  3343. private _getLinesForBonesNoLength(bones, meshMat);
  3344. update(): void;
  3345. dispose(): void;
  3346. }
  3347. }
  3348. declare module BABYLON {
  3349. /**
  3350. * Highlight layer options. This helps customizing the behaviour
  3351. * of the highlight layer.
  3352. */
  3353. interface IHighlightLayerOptions {
  3354. /**
  3355. * Multiplication factor apply to the canvas size to compute the render target size
  3356. * used to generated the glowing objects (the smaller the faster).
  3357. */
  3358. mainTextureRatio?: number;
  3359. /**
  3360. * Enforces a fixed size texture to ensure resize independant blur.
  3361. */
  3362. mainTextureFixedSize?: number;
  3363. /**
  3364. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  3365. * of the picture to blur (the smaller the faster).
  3366. */
  3367. blurTextureSizeRatio?: number;
  3368. /**
  3369. * How big in texel of the blur texture is the vertical blur.
  3370. */
  3371. blurVerticalSize?: number;
  3372. /**
  3373. * How big in texel of the blur texture is the horizontal blur.
  3374. */
  3375. blurHorizontalSize?: number;
  3376. /**
  3377. * Alpha blending mode used to apply the blur. Default is combine.
  3378. */
  3379. alphaBlendingMode?: number;
  3380. /**
  3381. * The camera attached to the layer.
  3382. */
  3383. camera?: Camera;
  3384. }
  3385. /**
  3386. * The highlight layer Helps adding a glow effect around a mesh.
  3387. *
  3388. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  3389. * glowy meshes to your scene.
  3390. *
  3391. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  3392. */
  3393. class HighlightLayer {
  3394. /**
  3395. * The neutral color used during the preparation of the glow effect.
  3396. * This is black by default as the blend operation is a blend operation.
  3397. */
  3398. static neutralColor: Color4;
  3399. /**
  3400. * Stencil value used for glowing meshes.
  3401. */
  3402. static glowingMeshStencilReference: number;
  3403. /**
  3404. * Stencil value used for the other meshes in the scene.
  3405. */
  3406. static normalMeshStencilReference: number;
  3407. private _scene;
  3408. private _engine;
  3409. private _options;
  3410. private _vertexBuffers;
  3411. private _indexBuffer;
  3412. private _downSamplePostprocess;
  3413. private _horizontalBlurPostprocess;
  3414. private _verticalBlurPostprocess;
  3415. private _cachedDefines;
  3416. private _glowMapGenerationEffect;
  3417. private _glowMapMergeEffect;
  3418. private _blurTexture;
  3419. private _mainTexture;
  3420. private _mainTextureDesiredSize;
  3421. private _meshes;
  3422. private _maxSize;
  3423. private _shouldRender;
  3424. private _instanceGlowingMeshStencilReference;
  3425. private _excludedMeshes;
  3426. /**
  3427. * Specifies whether or not the inner glow is ACTIVE in the layer.
  3428. */
  3429. innerGlow: boolean;
  3430. /**
  3431. * Specifies whether or not the outer glow is ACTIVE in the layer.
  3432. */
  3433. outerGlow: boolean;
  3434. /**
  3435. * Specifies wether the highlight layer is enabled or not.
  3436. */
  3437. isEnabled: boolean;
  3438. /**
  3439. * Gets the horizontal size of the blur.
  3440. */
  3441. /**
  3442. * Specifies the horizontal size of the blur.
  3443. */
  3444. blurHorizontalSize: number;
  3445. /**
  3446. * Gets the vertical size of the blur.
  3447. */
  3448. /**
  3449. * Specifies the vertical size of the blur.
  3450. */
  3451. blurVerticalSize: number;
  3452. /**
  3453. * Gets the camera attached to the layer.
  3454. */
  3455. camera: Camera;
  3456. /**
  3457. * An event triggered when the highlight layer has been disposed.
  3458. * @type {BABYLON.Observable}
  3459. */
  3460. onDisposeObservable: Observable<HighlightLayer>;
  3461. /**
  3462. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  3463. * @type {BABYLON.Observable}
  3464. */
  3465. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  3466. /**
  3467. * An event triggered when the highlight layer is being blurred.
  3468. * @type {BABYLON.Observable}
  3469. */
  3470. onBeforeBlurObservable: Observable<HighlightLayer>;
  3471. /**
  3472. * An event triggered when the highlight layer has been blurred.
  3473. * @type {BABYLON.Observable}
  3474. */
  3475. onAfterBlurObservable: Observable<HighlightLayer>;
  3476. /**
  3477. * An event triggered when the glowing blurred texture is being merged in the scene.
  3478. * @type {BABYLON.Observable}
  3479. */
  3480. onBeforeComposeObservable: Observable<HighlightLayer>;
  3481. /**
  3482. * An event triggered when the glowing blurred texture has been merged in the scene.
  3483. * @type {BABYLON.Observable}
  3484. */
  3485. onAfterComposeObservable: Observable<HighlightLayer>;
  3486. /**
  3487. * An event triggered when the highlight layer changes its size.
  3488. * @type {BABYLON.Observable}
  3489. */
  3490. onSizeChangedObservable: Observable<HighlightLayer>;
  3491. /**
  3492. * Instantiates a new highlight Layer and references it to the scene..
  3493. * @param name The name of the layer
  3494. * @param scene The scene to use the layer in
  3495. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  3496. */
  3497. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  3498. /**
  3499. * Creates the render target textures and post processes used in the highlight layer.
  3500. */
  3501. private createTextureAndPostProcesses();
  3502. /**
  3503. * Checks for the readiness of the element composing the layer.
  3504. * @param subMesh the mesh to check for
  3505. * @param useInstances specify wether or not to use instances to render the mesh
  3506. * @param emissiveTexture the associated emissive texture used to generate the glow
  3507. * @return true if ready otherwise, false
  3508. */
  3509. private isReady(subMesh, useInstances, emissiveTexture);
  3510. /**
  3511. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  3512. */
  3513. render(): void;
  3514. /**
  3515. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  3516. * @param mesh The mesh to exclude from the highlight layer
  3517. */
  3518. addExcludedMesh(mesh: Mesh): void;
  3519. /**
  3520. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  3521. * @param mesh The mesh to highlight
  3522. */
  3523. removeExcludedMesh(mesh: Mesh): void;
  3524. /**
  3525. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  3526. * @param mesh The mesh to highlight
  3527. * @param color The color of the highlight
  3528. * @param glowEmissiveOnly Extract the glow from the emissive texture
  3529. */
  3530. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  3531. /**
  3532. * Remove a mesh from the highlight layer in order to make it stop glowing.
  3533. * @param mesh The mesh to highlight
  3534. */
  3535. removeMesh(mesh: Mesh): void;
  3536. /**
  3537. * Returns true if the layer contains information to display, otherwise false.
  3538. */
  3539. shouldRender(): boolean;
  3540. /**
  3541. * Sets the main texture desired size which is the closest power of two
  3542. * of the engine canvas size.
  3543. */
  3544. private setMainTextureSize();
  3545. /**
  3546. * Force the stencil to the normal expected value for none glowing parts
  3547. */
  3548. private defaultStencilReference(mesh);
  3549. /**
  3550. * Dispose only the render target textures and post process.
  3551. */
  3552. private disposeTextureAndPostProcesses();
  3553. /**
  3554. * Dispose the highlight layer and free resources.
  3555. */
  3556. dispose(): void;
  3557. }
  3558. }
  3559. declare module BABYLON {
  3560. class Layer {
  3561. name: string;
  3562. texture: Texture;
  3563. isBackground: boolean;
  3564. color: Color4;
  3565. scale: Vector2;
  3566. offset: Vector2;
  3567. alphaBlendingMode: number;
  3568. alphaTest: boolean;
  3569. private _scene;
  3570. private _vertexBuffers;
  3571. private _indexBuffer;
  3572. private _effect;
  3573. private _alphaTestEffect;
  3574. /**
  3575. * An event triggered when the layer is disposed.
  3576. * @type {BABYLON.Observable}
  3577. */
  3578. onDisposeObservable: Observable<Layer>;
  3579. private _onDisposeObserver;
  3580. onDispose: () => void;
  3581. /**
  3582. * An event triggered before rendering the scene
  3583. * @type {BABYLON.Observable}
  3584. */
  3585. onBeforeRenderObservable: Observable<Layer>;
  3586. private _onBeforeRenderObserver;
  3587. onBeforeRender: () => void;
  3588. /**
  3589. * An event triggered after rendering the scene
  3590. * @type {BABYLON.Observable}
  3591. */
  3592. onAfterRenderObservable: Observable<Layer>;
  3593. private _onAfterRenderObserver;
  3594. onAfterRender: () => void;
  3595. constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
  3596. render(): void;
  3597. dispose(): void;
  3598. }
  3599. }
  3600. declare module BABYLON {
  3601. class LensFlare {
  3602. size: number;
  3603. position: number;
  3604. color: Color3;
  3605. texture: Texture;
  3606. alphaMode: number;
  3607. private _system;
  3608. constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
  3609. dispose: () => void;
  3610. }
  3611. }
  3612. declare module BABYLON {
  3613. class LensFlareSystem {
  3614. name: string;
  3615. lensFlares: LensFlare[];
  3616. borderLimit: number;
  3617. viewportBorder: number;
  3618. meshesSelectionPredicate: (mesh: Mesh) => boolean;
  3619. layerMask: number;
  3620. id: string;
  3621. private _scene;
  3622. private _emitter;
  3623. private _vertexBuffers;
  3624. private _indexBuffer;
  3625. private _effect;
  3626. private _positionX;
  3627. private _positionY;
  3628. private _isEnabled;
  3629. constructor(name: string, emitter: any, scene: Scene);
  3630. isEnabled: boolean;
  3631. getScene(): Scene;
  3632. getEmitter(): any;
  3633. setEmitter(newEmitter: any): void;
  3634. getEmitterPosition(): Vector3;
  3635. computeEffectivePosition(globalViewport: Viewport): boolean;
  3636. _isVisible(): boolean;
  3637. render(): boolean;
  3638. dispose(): void;
  3639. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  3640. serialize(): any;
  3641. }
  3642. }
  3643. declare module BABYLON {
  3644. class DirectionalLight extends Light implements IShadowLight {
  3645. position: Vector3;
  3646. direction: Vector3;
  3647. private _transformedDirection;
  3648. transformedPosition: Vector3;
  3649. private _worldMatrix;
  3650. shadowOrthoScale: number;
  3651. autoUpdateExtends: boolean;
  3652. private _orthoLeft;
  3653. private _orthoRight;
  3654. private _orthoTop;
  3655. private _orthoBottom;
  3656. constructor(name: string, direction: Vector3, scene: Scene);
  3657. getAbsolutePosition(): Vector3;
  3658. setDirectionToTarget(target: Vector3): Vector3;
  3659. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3660. supportsVSM(): boolean;
  3661. needRefreshPerFrame(): boolean;
  3662. needCube(): boolean;
  3663. getShadowDirection(faceIndex?: number): Vector3;
  3664. computeTransformedPosition(): boolean;
  3665. transferToEffect(effect: Effect, directionUniformName: string): void;
  3666. _getWorldMatrix(): Matrix;
  3667. getTypeID(): number;
  3668. }
  3669. }
  3670. declare module BABYLON {
  3671. class HemisphericLight extends Light {
  3672. groundColor: Color3;
  3673. direction: Vector3;
  3674. private _worldMatrix;
  3675. constructor(name: string, direction: Vector3, scene: Scene);
  3676. setDirectionToTarget(target: Vector3): Vector3;
  3677. getShadowGenerator(): ShadowGenerator;
  3678. transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void;
  3679. _getWorldMatrix(): Matrix;
  3680. getTypeID(): number;
  3681. }
  3682. }
  3683. declare module BABYLON {
  3684. interface IShadowLight {
  3685. id: string;
  3686. position: Vector3;
  3687. transformedPosition: Vector3;
  3688. name: string;
  3689. computeTransformedPosition(): boolean;
  3690. getScene(): Scene;
  3691. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3692. supportsVSM(): boolean;
  3693. needRefreshPerFrame(): boolean;
  3694. needCube(): boolean;
  3695. getShadowDirection(faceIndex?: number): Vector3;
  3696. _shadowGenerator: IShadowGenerator;
  3697. }
  3698. class Light extends Node {
  3699. private static _LIGHTMAP_DEFAULT;
  3700. private static _LIGHTMAP_SPECULAR;
  3701. private static _LIGHTMAP_SHADOWSONLY;
  3702. /**
  3703. * If every light affecting the material is in this lightmapMode,
  3704. * material.lightmapTexture adds or multiplies
  3705. * (depends on material.useLightmapAsShadowmap)
  3706. * after every other light calculations.
  3707. */
  3708. static LIGHTMAP_DEFAULT: number;
  3709. /**
  3710. * material.lightmapTexture as only diffuse lighting from this light
  3711. * adds pnly specular lighting from this light
  3712. * adds dynamic shadows
  3713. */
  3714. static LIGHTMAP_SPECULAR: number;
  3715. /**
  3716. * material.lightmapTexture as only lighting
  3717. * no light calculation from this light
  3718. * only adds dynamic shadows from this light
  3719. */
  3720. static LIGHTMAP_SHADOWSONLY: number;
  3721. diffuse: Color3;
  3722. specular: Color3;
  3723. intensity: number;
  3724. range: number;
  3725. includeOnlyWithLayerMask: number;
  3726. includedOnlyMeshes: AbstractMesh[];
  3727. excludedMeshes: AbstractMesh[];
  3728. excludeWithLayerMask: number;
  3729. lightmapMode: number;
  3730. radius: number;
  3731. _shadowGenerator: IShadowGenerator;
  3732. private _parentedWorldMatrix;
  3733. _excludedMeshesIds: string[];
  3734. _includedOnlyMeshesIds: string[];
  3735. constructor(name: string, scene: Scene);
  3736. /**
  3737. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  3738. */
  3739. toString(fullDetails?: boolean): string;
  3740. getShadowGenerator(): IShadowGenerator;
  3741. getAbsolutePosition(): Vector3;
  3742. transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void;
  3743. _getWorldMatrix(): Matrix;
  3744. canAffectMesh(mesh: AbstractMesh): boolean;
  3745. getWorldMatrix(): Matrix;
  3746. dispose(): void;
  3747. getTypeID(): number;
  3748. clone(name: string): Light;
  3749. serialize(): any;
  3750. static GetConstructorFromName(type: number, name: string, scene: Scene): () => Light;
  3751. static Parse(parsedLight: any, scene: Scene): Light;
  3752. }
  3753. }
  3754. declare module BABYLON {
  3755. class PointLight extends Light implements IShadowLight {
  3756. private _worldMatrix;
  3757. transformedPosition: Vector3;
  3758. position: Vector3;
  3759. constructor(name: string, position: Vector3, scene: Scene);
  3760. getAbsolutePosition(): Vector3;
  3761. computeTransformedPosition(): boolean;
  3762. transferToEffect(effect: Effect, positionUniformName: string): void;
  3763. needCube(): boolean;
  3764. supportsVSM(): boolean;
  3765. needRefreshPerFrame(): boolean;
  3766. getShadowDirection(faceIndex?: number): Vector3;
  3767. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3768. _getWorldMatrix(): Matrix;
  3769. getTypeID(): number;
  3770. }
  3771. }
  3772. declare module BABYLON {
  3773. class SpotLight extends Light implements IShadowLight {
  3774. position: Vector3;
  3775. direction: Vector3;
  3776. angle: number;
  3777. exponent: number;
  3778. transformedPosition: Vector3;
  3779. private _transformedDirection;
  3780. private _worldMatrix;
  3781. constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
  3782. getAbsolutePosition(): Vector3;
  3783. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  3784. needCube(): boolean;
  3785. supportsVSM(): boolean;
  3786. needRefreshPerFrame(): boolean;
  3787. getShadowDirection(faceIndex?: number): Vector3;
  3788. setDirectionToTarget(target: Vector3): Vector3;
  3789. computeTransformedPosition(): boolean;
  3790. transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void;
  3791. _getWorldMatrix(): Matrix;
  3792. getTypeID(): number;
  3793. getRotation(): Vector3;
  3794. }
  3795. }
  3796. declare module BABYLON {
  3797. interface ISceneLoaderPluginExtensions {
  3798. [extension: string]: {
  3799. isBinary: boolean;
  3800. };
  3801. }
  3802. interface ISceneLoaderPlugin {
  3803. extensions: string | ISceneLoaderPluginExtensions;
  3804. importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
  3805. load: (scene: Scene, data: string, rootUrl: string) => boolean;
  3806. }
  3807. interface ISceneLoaderPluginAsync {
  3808. extensions: string | ISceneLoaderPluginExtensions;
  3809. importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onerror?: () => void) => void;
  3810. loadAsync: (scene: Scene, data: string, rootUrl: string, onsuccess: () => void, onerror: () => void) => boolean;
  3811. }
  3812. class SceneLoader {
  3813. private static _ForceFullSceneLoadingForIncremental;
  3814. private static _ShowLoadingScreen;
  3815. static NO_LOGGING: number;
  3816. static MINIMAL_LOGGING: number;
  3817. static SUMMARY_LOGGING: number;
  3818. static DETAILED_LOGGING: number;
  3819. private static _loggingLevel;
  3820. static ForceFullSceneLoadingForIncremental: boolean;
  3821. static ShowLoadingScreen: boolean;
  3822. static loggingLevel: number;
  3823. private static _registeredPlugins;
  3824. private static _getDefaultPlugin();
  3825. private static _getPluginForExtension(extension);
  3826. private static _getPluginForFilename(sceneFilename);
  3827. private static _getDirectLoad(sceneFilename);
  3828. static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
  3829. static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
  3830. static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, message: string, exception?: any) => void): void;
  3831. /**
  3832. * Load a scene
  3833. * @param rootUrl a string that defines the root url for scene and resources
  3834. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  3835. * @param engine is the instance of BABYLON.Engine to use to create the scene
  3836. */
  3837. static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  3838. /**
  3839. * Append a scene
  3840. * @param rootUrl a string that defines the root url for scene and resources
  3841. * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
  3842. * @param scene is the instance of BABYLON.Scene to append to
  3843. */
  3844. static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void;
  3845. }
  3846. }
  3847. declare module BABYLON {
  3848. /**
  3849. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  3850. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  3851. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  3852. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  3853. */
  3854. class ColorCurves {
  3855. private _dirty;
  3856. private _tempColor;
  3857. private _globalCurve;
  3858. private _highlightsCurve;
  3859. private _midtonesCurve;
  3860. private _shadowsCurve;
  3861. private _positiveCurve;
  3862. private _negativeCurve;
  3863. private _globalHue;
  3864. private _globalDensity;
  3865. private _globalSaturation;
  3866. private _globalExposure;
  3867. /**
  3868. * Gets the global Hue value.
  3869. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3870. */
  3871. /**
  3872. * Sets the global Hue value.
  3873. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3874. */
  3875. GlobalHue: number;
  3876. /**
  3877. * Gets the global Density value.
  3878. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3879. * Values less than zero provide a filter of opposite hue.
  3880. */
  3881. /**
  3882. * Sets the global Density value.
  3883. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3884. * Values less than zero provide a filter of opposite hue.
  3885. */
  3886. GlobalDensity: number;
  3887. /**
  3888. * Gets the global Saturation value.
  3889. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3890. */
  3891. /**
  3892. * Sets the global Saturation value.
  3893. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3894. */
  3895. GlobalSaturation: number;
  3896. private _highlightsHue;
  3897. private _highlightsDensity;
  3898. private _highlightsSaturation;
  3899. private _highlightsExposure;
  3900. /**
  3901. * Gets the highlights Hue value.
  3902. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3903. */
  3904. /**
  3905. * Sets the highlights Hue value.
  3906. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3907. */
  3908. HighlightsHue: number;
  3909. /**
  3910. * Gets the highlights Density value.
  3911. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3912. * Values less than zero provide a filter of opposite hue.
  3913. */
  3914. /**
  3915. * Sets the highlights Density value.
  3916. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3917. * Values less than zero provide a filter of opposite hue.
  3918. */
  3919. HighlightsDensity: number;
  3920. /**
  3921. * Gets the highlights Saturation value.
  3922. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3923. */
  3924. /**
  3925. * Sets the highlights Saturation value.
  3926. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3927. */
  3928. HighlightsSaturation: number;
  3929. /**
  3930. * Gets the highlights Exposure value.
  3931. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3932. */
  3933. /**
  3934. * Sets the highlights Exposure value.
  3935. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3936. */
  3937. HighlightsExposure: number;
  3938. private _midtonesHue;
  3939. private _midtonesDensity;
  3940. private _midtonesSaturation;
  3941. private _midtonesExposure;
  3942. /**
  3943. * Gets the midtones Hue value.
  3944. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3945. */
  3946. /**
  3947. * Sets the midtones Hue value.
  3948. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3949. */
  3950. MidtonesHue: number;
  3951. /**
  3952. * Gets the midtones Density value.
  3953. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3954. * Values less than zero provide a filter of opposite hue.
  3955. */
  3956. /**
  3957. * Sets the midtones Density value.
  3958. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3959. * Values less than zero provide a filter of opposite hue.
  3960. */
  3961. MidtonesDensity: number;
  3962. /**
  3963. * Gets the midtones Saturation value.
  3964. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3965. */
  3966. /**
  3967. * Sets the midtones Saturation value.
  3968. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  3969. */
  3970. MidtonesSaturation: number;
  3971. /**
  3972. * Gets the midtones Exposure value.
  3973. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3974. */
  3975. /**
  3976. * Sets the midtones Exposure value.
  3977. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  3978. */
  3979. MidtonesExposure: number;
  3980. private _shadowsHue;
  3981. private _shadowsDensity;
  3982. private _shadowsSaturation;
  3983. private _shadowsExposure;
  3984. /**
  3985. * Gets the shadows Hue value.
  3986. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3987. */
  3988. /**
  3989. * Sets the shadows Hue value.
  3990. * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
  3991. */
  3992. ShadowsHue: number;
  3993. /**
  3994. * Gets the shadows Density value.
  3995. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  3996. * Values less than zero provide a filter of opposite hue.
  3997. */
  3998. /**
  3999. * Sets the shadows Density value.
  4000. * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
  4001. * Values less than zero provide a filter of opposite hue.
  4002. */
  4003. ShadowsDensity: number;
  4004. /**
  4005. * Gets the shadows Saturation value.
  4006. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  4007. */
  4008. /**
  4009. * Sets the shadows Saturation value.
  4010. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
  4011. */
  4012. ShadowsSaturation: number;
  4013. /**
  4014. * Gets the shadows Exposure value.
  4015. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  4016. */
  4017. /**
  4018. * Sets the shadows Exposure value.
  4019. * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
  4020. */
  4021. ShadowsExposure: number;
  4022. /**
  4023. * Binds the color curves to the shader.
  4024. * @param colorCurves The color curve to bind
  4025. * @param effect The effect to bind to
  4026. */
  4027. static Bind(colorCurves: ColorCurves, effect: Effect): void;
  4028. /**
  4029. * Prepare the list of uniforms associated with the ColorCurves effects.
  4030. * @param uniformsList The list of uniforms used in the effect
  4031. */
  4032. static PrepareUniforms(uniformsList: string[]): void;
  4033. /**
  4034. * Returns color grading data based on a hue, density, saturation and exposure value.
  4035. * @param filterHue The hue of the color filter.
  4036. * @param filterDensity The density of the color filter.
  4037. * @param saturation The saturation.
  4038. * @param exposure The exposure.
  4039. * @param result The result data container.
  4040. */
  4041. private getColorGradingDataToRef(hue, density, saturation, exposure, result);
  4042. /**
  4043. * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
  4044. * @param value The input slider value in range [-100,100].
  4045. * @returns Adjusted value.
  4046. */
  4047. private static applyColorGradingSliderNonlinear(value);
  4048. /**
  4049. * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
  4050. * @param hue The hue (H) input.
  4051. * @param saturation The saturation (S) input.
  4052. * @param brightness The brightness (B) input.
  4053. * @result An RGBA color represented as Vector4.
  4054. */
  4055. private static fromHSBToRef(hue, saturation, brightness, result);
  4056. /**
  4057. * Returns a value clamped between min and max
  4058. * @param value The value to clamp
  4059. * @param min The minimum of value
  4060. * @param max The maximum of value
  4061. * @returns The clamped value.
  4062. */
  4063. private static clamp(value, min, max);
  4064. /**
  4065. * Clones the current color curve instance.
  4066. * @return The cloned curves
  4067. */
  4068. clone(): ColorCurves;
  4069. /**
  4070. * Serializes the current color curve instance to a json representation.
  4071. * @return a JSON representation
  4072. */
  4073. serialize(): any;
  4074. /**
  4075. * Parses the color curve from a json representation.
  4076. * @param source the JSON source to parse
  4077. * @return The parsed curves
  4078. */
  4079. static Parse(source: any): ColorCurves;
  4080. }
  4081. }
  4082. declare module BABYLON {
  4083. class EffectFallbacks {
  4084. private _defines;
  4085. private _currentRank;
  4086. private _maxRank;
  4087. private _mesh;
  4088. private _meshRank;
  4089. addFallback(rank: number, define: string): void;
  4090. addCPUSkinningFallback(rank: number, mesh: BABYLON.AbstractMesh): void;
  4091. isMoreFallbacks: boolean;
  4092. reduce(currentDefines: string): string;
  4093. }
  4094. class Effect {
  4095. name: any;
  4096. defines: string;
  4097. onCompiled: (effect: Effect) => void;
  4098. onError: (effect: Effect, errors: string) => void;
  4099. onBind: (effect: Effect) => void;
  4100. private _engine;
  4101. private _uniformsNames;
  4102. private _samplers;
  4103. private _isReady;
  4104. private _compilationError;
  4105. private _attributesNames;
  4106. private _attributes;
  4107. private _uniforms;
  4108. _key: string;
  4109. private _indexParameters;
  4110. private _program;
  4111. private _valueCache;
  4112. constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any);
  4113. isReady(): boolean;
  4114. getProgram(): WebGLProgram;
  4115. getAttributesNames(): string[];
  4116. getAttributeLocation(index: number): number;
  4117. getAttributeLocationByName(name: string): number;
  4118. getAttributesCount(): number;
  4119. getUniformIndex(uniformName: string): number;
  4120. getUniform(uniformName: string): WebGLUniformLocation;
  4121. getSamplers(): string[];
  4122. getCompilationError(): string;
  4123. getVertexShaderSource(): string;
  4124. getFragmentShaderSource(): string;
  4125. _loadVertexShader(vertex: any, callback: (data: any) => void): void;
  4126. _loadFragmentShader(fragment: any, callback: (data: any) => void): void;
  4127. private _dumpShadersName();
  4128. private _processIncludes(sourceCode, callback);
  4129. private _processPrecision(source);
  4130. private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?);
  4131. isSupported: boolean;
  4132. _bindTexture(channel: string, texture: WebGLTexture): void;
  4133. setTexture(channel: string, texture: BaseTexture): void;
  4134. setTextureArray(channel: string, textures: BaseTexture[]): void;
  4135. setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
  4136. _cacheMatrix(uniformName: string, matrix: Matrix): boolean;
  4137. _cacheFloat2(uniformName: string, x: number, y: number): boolean;
  4138. _cacheFloat3(uniformName: string, x: number, y: number, z: number): boolean;
  4139. _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): boolean;
  4140. setIntArray(uniformName: string, array: Int32Array): Effect;
  4141. setIntArray2(uniformName: string, array: Int32Array): Effect;
  4142. setIntArray3(uniformName: string, array: Int32Array): Effect;
  4143. setIntArray4(uniformName: string, array: Int32Array): Effect;
  4144. setFloatArray(uniformName: string, array: Float32Array): Effect;
  4145. setFloatArray2(uniformName: string, array: Float32Array): Effect;
  4146. setFloatArray3(uniformName: string, array: Float32Array): Effect;
  4147. setFloatArray4(uniformName: string, array: Float32Array): Effect;
  4148. setArray(uniformName: string, array: number[]): Effect;
  4149. setArray2(uniformName: string, array: number[]): Effect;
  4150. setArray3(uniformName: string, array: number[]): Effect;
  4151. setArray4(uniformName: string, array: number[]): Effect;
  4152. setMatrices(uniformName: string, matrices: Float32Array): Effect;
  4153. setMatrix(uniformName: string, matrix: Matrix): Effect;
  4154. setMatrix3x3(uniformName: string, matrix: Float32Array): Effect;
  4155. setMatrix2x2(uniformName: string, matrix: Float32Array): Effect;
  4156. setFloat(uniformName: string, value: number): Effect;
  4157. setBool(uniformName: string, bool: boolean): Effect;
  4158. setVector2(uniformName: string, vector2: Vector2): Effect;
  4159. setFloat2(uniformName: string, x: number, y: number): Effect;
  4160. setVector3(uniformName: string, vector3: Vector3): Effect;
  4161. setFloat3(uniformName: string, x: number, y: number, z: number): Effect;
  4162. setVector4(uniformName: string, vector4: Vector4): Effect;
  4163. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect;
  4164. setColor3(uniformName: string, color3: Color3): Effect;
  4165. setColor4(uniformName: string, color3: Color3, alpha: number): Effect;
  4166. static ShadersStore: {};
  4167. static IncludesShadersStore: {};
  4168. }
  4169. }
  4170. declare module BABYLON {
  4171. class FresnelParameters {
  4172. isEnabled: boolean;
  4173. leftColor: Color3;
  4174. rightColor: Color3;
  4175. bias: number;
  4176. power: number;
  4177. clone(): FresnelParameters;
  4178. serialize(): any;
  4179. static Parse(parsedFresnelParameters: any): FresnelParameters;
  4180. }
  4181. }
  4182. declare module BABYLON {
  4183. class MaterialDefines {
  4184. _keys: string[];
  4185. rebuild(): void;
  4186. isEqual(other: MaterialDefines): boolean;
  4187. cloneTo(other: MaterialDefines): void;
  4188. reset(): void;
  4189. toString(): string;
  4190. }
  4191. class Material {
  4192. private static _TriangleFillMode;
  4193. private static _WireFrameFillMode;
  4194. private static _PointFillMode;
  4195. static TriangleFillMode: number;
  4196. static WireFrameFillMode: number;
  4197. static PointFillMode: number;
  4198. private static _ClockWiseSideOrientation;
  4199. private static _CounterClockWiseSideOrientation;
  4200. static ClockWiseSideOrientation: number;
  4201. static CounterClockWiseSideOrientation: number;
  4202. id: string;
  4203. name: string;
  4204. checkReadyOnEveryCall: boolean;
  4205. checkReadyOnlyOnce: boolean;
  4206. state: string;
  4207. alpha: number;
  4208. backFaceCulling: boolean;
  4209. sideOrientation: number;
  4210. onCompiled: (effect: Effect) => void;
  4211. onError: (effect: Effect, errors: string) => void;
  4212. getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
  4213. doNotSerialize: boolean;
  4214. /**
  4215. * An event triggered when the material is disposed.
  4216. * @type {BABYLON.Observable}
  4217. */
  4218. onDisposeObservable: Observable<Material>;
  4219. private _onDisposeObserver;
  4220. onDispose: () => void;
  4221. /**
  4222. * An event triggered when the material is bound.
  4223. * @type {BABYLON.Observable}
  4224. */
  4225. onBindObservable: Observable<AbstractMesh>;
  4226. private _onBindObserver;
  4227. onBind: (Mesh: AbstractMesh) => void;
  4228. /**
  4229. * An event triggered when the material is unbound.
  4230. * @type {BABYLON.Observable}
  4231. */
  4232. onUnBindObservable: Observable<Material>;
  4233. alphaMode: number;
  4234. disableDepthWrite: boolean;
  4235. fogEnabled: boolean;
  4236. pointSize: number;
  4237. zOffset: number;
  4238. wireframe: boolean;
  4239. pointsCloud: boolean;
  4240. fillMode: number;
  4241. _effect: Effect;
  4242. _wasPreviouslyReady: boolean;
  4243. private _scene;
  4244. private _fillMode;
  4245. private _cachedDepthWriteState;
  4246. constructor(name: string, scene: Scene, doNotAdd?: boolean);
  4247. /**
  4248. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  4249. * subclasses should override adding information pertainent to themselves
  4250. */
  4251. toString(fullDetails?: boolean): string;
  4252. isFrozen: boolean;
  4253. freeze(): void;
  4254. unfreeze(): void;
  4255. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4256. getEffect(): Effect;
  4257. getScene(): Scene;
  4258. needAlphaBlending(): boolean;
  4259. needAlphaTesting(): boolean;
  4260. getAlphaTestTexture(): BaseTexture;
  4261. markDirty(): void;
  4262. _preBind(): void;
  4263. bind(world: Matrix, mesh?: Mesh): void;
  4264. bindOnlyWorldMatrix(world: Matrix): void;
  4265. unbind(): void;
  4266. clone(name: string): Material;
  4267. getBindedMeshes(): AbstractMesh[];
  4268. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4269. serialize(): any;
  4270. static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial;
  4271. static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): any;
  4272. }
  4273. }
  4274. declare module BABYLON {
  4275. class MaterialHelper {
  4276. static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines, maxSimultaneousLights?: number): boolean;
  4277. static PrepareUniformsAndSamplersList(uniformsList: string[], samplersList: string[], defines: MaterialDefines, maxSimultaneousLights?: number): void;
  4278. static HandleFallbacksForShadows(defines: MaterialDefines, fallbacks: EffectFallbacks, maxSimultaneousLights?: number): void;
  4279. static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: MaterialDefines, fallbacks: EffectFallbacks): void;
  4280. static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void;
  4281. static BindLightShadow(light: Light, scene: Scene, mesh: AbstractMesh, lightIndex: number, effect: Effect, depthValuesAlreadySet: boolean): boolean;
  4282. static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void;
  4283. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, maxSimultaneousLights?: number): void;
  4284. static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect): void;
  4285. static BindBonesParameters(mesh: AbstractMesh, effect: Effect): void;
  4286. static BindLogDepth(defines: MaterialDefines, effect: Effect, scene: Scene): void;
  4287. static BindClipPlane(effect: Effect, scene: Scene): void;
  4288. }
  4289. }
  4290. declare module BABYLON {
  4291. class MultiMaterial extends Material {
  4292. subMaterials: Material[];
  4293. constructor(name: string, scene: Scene);
  4294. getSubMaterial(index: any): Material;
  4295. isReady(mesh?: AbstractMesh): boolean;
  4296. clone(name: string, cloneChildren?: boolean): MultiMaterial;
  4297. serialize(): any;
  4298. }
  4299. }
  4300. declare module BABYLON {
  4301. /**
  4302. * The Physically based material of BJS.
  4303. *
  4304. * This offers the main features of a standard PBR material.
  4305. * For more information, please refer to the documentation :
  4306. * http://doc.babylonjs.com/extensions/Physically_Based_Rendering
  4307. */
  4308. class PBRMaterial extends BABYLON.Material {
  4309. /**
  4310. * Intensity of the direct lights e.g. the four lights available in your scene.
  4311. * This impacts both the direct diffuse and specular highlights.
  4312. */
  4313. directIntensity: number;
  4314. /**
  4315. * Intensity of the emissive part of the material.
  4316. * This helps controlling the emissive effect without modifying the emissive color.
  4317. */
  4318. emissiveIntensity: number;
  4319. /**
  4320. * Intensity of the environment e.g. how much the environment will light the object
  4321. * either through harmonics for rough material or through the refelction for shiny ones.
  4322. */
  4323. environmentIntensity: number;
  4324. /**
  4325. * This is a special control allowing the reduction of the specular highlights coming from the
  4326. * four lights of the scene. Those highlights may not be needed in full environment lighting.
  4327. */
  4328. specularIntensity: number;
  4329. private _lightingInfos;
  4330. /**
  4331. * Debug Control allowing disabling the bump map on this material.
  4332. */
  4333. disableBumpMap: boolean;
  4334. /**
  4335. * Debug Control helping enforcing or dropping the darkness of shadows.
  4336. * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
  4337. */
  4338. overloadedShadowIntensity: number;
  4339. /**
  4340. * Debug Control helping dropping the shading effect coming from the diffuse lighting.
  4341. * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
  4342. */
  4343. overloadedShadeIntensity: number;
  4344. private _overloadedShadowInfos;
  4345. /**
  4346. * The camera exposure used on this material.
  4347. * This property is here and not in the camera to allow controlling exposure without full screen post process.
  4348. * This corresponds to a photographic exposure.
  4349. */
  4350. cameraExposure: number;
  4351. /**
  4352. * The camera contrast used on this material.
  4353. * This property is here and not in the camera to allow controlling contrast without full screen post process.
  4354. */
  4355. cameraContrast: number;
  4356. /**
  4357. * Color Grading 2D Lookup Texture.
  4358. * This allows special effects like sepia, black and white to sixties rendering style.
  4359. */
  4360. cameraColorGradingTexture: BaseTexture;
  4361. /**
  4362. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4363. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4364. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  4365. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4366. */
  4367. cameraColorCurves: ColorCurves;
  4368. private _cameraInfos;
  4369. private _microsurfaceTextureLods;
  4370. /**
  4371. * Debug Control allowing to overload the ambient color.
  4372. * This as to be use with the overloadedAmbientIntensity parameter.
  4373. */
  4374. overloadedAmbient: Color3;
  4375. /**
  4376. * Debug Control indicating how much the overloaded ambient color is used against the default one.
  4377. */
  4378. overloadedAmbientIntensity: number;
  4379. /**
  4380. * Debug Control allowing to overload the albedo color.
  4381. * This as to be use with the overloadedAlbedoIntensity parameter.
  4382. */
  4383. overloadedAlbedo: Color3;
  4384. /**
  4385. * Debug Control indicating how much the overloaded albedo color is used against the default one.
  4386. */
  4387. overloadedAlbedoIntensity: number;
  4388. /**
  4389. * Debug Control allowing to overload the reflectivity color.
  4390. * This as to be use with the overloadedReflectivityIntensity parameter.
  4391. */
  4392. overloadedReflectivity: Color3;
  4393. /**
  4394. * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
  4395. */
  4396. overloadedReflectivityIntensity: number;
  4397. /**
  4398. * Debug Control allowing to overload the emissive color.
  4399. * This as to be use with the overloadedEmissiveIntensity parameter.
  4400. */
  4401. overloadedEmissive: Color3;
  4402. /**
  4403. * Debug Control indicating how much the overloaded emissive color is used against the default one.
  4404. */
  4405. overloadedEmissiveIntensity: number;
  4406. private _overloadedIntensity;
  4407. /**
  4408. * Debug Control allowing to overload the reflection color.
  4409. * This as to be use with the overloadedReflectionIntensity parameter.
  4410. */
  4411. overloadedReflection: Color3;
  4412. /**
  4413. * Debug Control indicating how much the overloaded reflection color is used against the default one.
  4414. */
  4415. overloadedReflectionIntensity: number;
  4416. /**
  4417. * Debug Control allowing to overload the microsurface.
  4418. * This as to be use with the overloadedMicroSurfaceIntensity parameter.
  4419. */
  4420. overloadedMicroSurface: number;
  4421. /**
  4422. * Debug Control indicating how much the overloaded microsurface is used against the default one.
  4423. */
  4424. overloadedMicroSurfaceIntensity: number;
  4425. private _overloadedMicroSurface;
  4426. /**
  4427. * AKA Diffuse Texture in standard nomenclature.
  4428. */
  4429. albedoTexture: BaseTexture;
  4430. /**
  4431. * AKA Occlusion Texture in other nomenclature.
  4432. */
  4433. ambientTexture: BaseTexture;
  4434. /**
  4435. * AKA Occlusion Texture Intensity in other nomenclature.
  4436. */
  4437. ambientTextureStrength: number;
  4438. opacityTexture: BaseTexture;
  4439. reflectionTexture: BaseTexture;
  4440. emissiveTexture: BaseTexture;
  4441. /**
  4442. * AKA Specular texture in other nomenclature.
  4443. */
  4444. reflectivityTexture: BaseTexture;
  4445. bumpTexture: BaseTexture;
  4446. lightmapTexture: BaseTexture;
  4447. refractionTexture: BaseTexture;
  4448. ambientColor: Color3;
  4449. /**
  4450. * AKA Diffuse Color in other nomenclature.
  4451. */
  4452. albedoColor: Color3;
  4453. /**
  4454. * AKA Specular Color in other nomenclature.
  4455. */
  4456. reflectivityColor: Color3;
  4457. reflectionColor: Color3;
  4458. emissiveColor: Color3;
  4459. /**
  4460. * AKA Glossiness in other nomenclature.
  4461. */
  4462. microSurface: number;
  4463. /**
  4464. * source material index of refraction (IOR)' / 'destination material IOR.
  4465. */
  4466. indexOfRefraction: number;
  4467. /**
  4468. * Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.
  4469. */
  4470. invertRefractionY: boolean;
  4471. opacityFresnelParameters: FresnelParameters;
  4472. emissiveFresnelParameters: FresnelParameters;
  4473. /**
  4474. * This parameters will make the material used its opacity to control how much it is refracting aginst not.
  4475. * Materials half opaque for instance using refraction could benefit from this control.
  4476. */
  4477. linkRefractionWithTransparency: boolean;
  4478. /**
  4479. * The emissive and albedo are linked to never be more than one (Energy conservation).
  4480. */
  4481. linkEmissiveWithAlbedo: boolean;
  4482. useLightmapAsShadowmap: boolean;
  4483. /**
  4484. * In this mode, the emissive informtaion will always be added to the lighting once.
  4485. * A light for instance can be thought as emissive.
  4486. */
  4487. useEmissiveAsIllumination: boolean;
  4488. /**
  4489. * Secifies that the alpha is coming form the albedo channel alpha channel.
  4490. */
  4491. useAlphaFromAlbedoTexture: boolean;
  4492. /**
  4493. * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).
  4494. * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
  4495. */
  4496. useSpecularOverAlpha: boolean;
  4497. /**
  4498. * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
  4499. */
  4500. useMicroSurfaceFromReflectivityMapAlpha: boolean;
  4501. /**
  4502. * In case the reflectivity map does not contain the microsurface information in its alpha channel,
  4503. * The material will try to infer what glossiness each pixel should be.
  4504. */
  4505. useAutoMicroSurfaceFromReflectivityMap: boolean;
  4506. /**
  4507. * Allows to work with scalar in linear mode. This is definitely a matter of preferences and tools used during
  4508. * the creation of the material.
  4509. */
  4510. useScalarInLinearSpace: boolean;
  4511. /**
  4512. * BJS is using an harcoded light falloff based on a manually sets up range.
  4513. * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.
  4514. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
  4515. */
  4516. usePhysicalLightFalloff: boolean;
  4517. /**
  4518. * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).
  4519. * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
  4520. */
  4521. useRadianceOverAlpha: boolean;
  4522. /**
  4523. * Allows using the bump map in parallax mode.
  4524. */
  4525. useParallax: boolean;
  4526. /**
  4527. * Allows using the bump map in parallax occlusion mode.
  4528. */
  4529. useParallaxOcclusion: boolean;
  4530. /**
  4531. * Controls the scale bias of the parallax mode.
  4532. */
  4533. parallaxScaleBias: number;
  4534. /**
  4535. * If sets to true, disables all the lights affecting the material.
  4536. */
  4537. disableLighting: boolean;
  4538. /**
  4539. * Number of Simultaneous lights allowed on the material.
  4540. */
  4541. maxSimultaneousLights: number;
  4542. /**
  4543. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4544. */
  4545. invertNormalMapX: boolean;
  4546. /**
  4547. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4548. */
  4549. invertNormalMapY: boolean;
  4550. private _renderTargets;
  4551. private _worldViewProjectionMatrix;
  4552. private _globalAmbientColor;
  4553. private _tempColor;
  4554. private _renderId;
  4555. private _defines;
  4556. private _cachedDefines;
  4557. private _useLogarithmicDepth;
  4558. /**
  4559. * Instantiates a new PBRMaterial instance.
  4560. *
  4561. * @param name The material name
  4562. * @param scene The scene the material will be use in.
  4563. */
  4564. constructor(name: string, scene: Scene);
  4565. useLogarithmicDepth: boolean;
  4566. needAlphaBlending(): boolean;
  4567. needAlphaTesting(): boolean;
  4568. private _shouldUseAlphaFromAlbedoTexture();
  4569. getAlphaTestTexture(): BaseTexture;
  4570. private _checkCache(scene, mesh?, useInstances?);
  4571. private convertColorToLinearSpaceToRef(color, ref);
  4572. private static convertColorToLinearSpaceToRef(color, ref, useScalarInLinear);
  4573. private static _scaledAlbedo;
  4574. private static _scaledReflectivity;
  4575. private static _scaledEmissive;
  4576. private static _scaledReflection;
  4577. static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines, useScalarInLinearSpace: boolean, maxSimultaneousLights: number, usePhysicalLightFalloff: boolean): void;
  4578. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4579. unbind(): void;
  4580. bindOnlyWorldMatrix(world: Matrix): void;
  4581. private _myScene;
  4582. private _myShadowGenerator;
  4583. bind(world: Matrix, mesh?: Mesh): void;
  4584. getAnimatables(): IAnimatable[];
  4585. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4586. clone(name: string): PBRMaterial;
  4587. serialize(): any;
  4588. static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
  4589. }
  4590. }
  4591. declare module BABYLON {
  4592. class ShaderMaterial extends Material {
  4593. private _shaderPath;
  4594. private _options;
  4595. private _textures;
  4596. private _textureArrays;
  4597. private _floats;
  4598. private _floatsArrays;
  4599. private _colors3;
  4600. private _colors4;
  4601. private _vectors2;
  4602. private _vectors3;
  4603. private _vectors4;
  4604. private _matrices;
  4605. private _matrices3x3;
  4606. private _matrices2x2;
  4607. private _vectors3Arrays;
  4608. private _cachedWorldViewMatrix;
  4609. private _renderId;
  4610. constructor(name: string, scene: Scene, shaderPath: any, options: any);
  4611. needAlphaBlending(): boolean;
  4612. needAlphaTesting(): boolean;
  4613. private _checkUniform(uniformName);
  4614. setTexture(name: string, texture: Texture): ShaderMaterial;
  4615. setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
  4616. setFloat(name: string, value: number): ShaderMaterial;
  4617. setFloats(name: string, value: number[]): ShaderMaterial;
  4618. setColor3(name: string, value: Color3): ShaderMaterial;
  4619. setColor4(name: string, value: Color4): ShaderMaterial;
  4620. setVector2(name: string, value: Vector2): ShaderMaterial;
  4621. setVector3(name: string, value: Vector3): ShaderMaterial;
  4622. setVector4(name: string, value: Vector4): ShaderMaterial;
  4623. setMatrix(name: string, value: Matrix): ShaderMaterial;
  4624. setMatrix3x3(name: string, value: Float32Array): ShaderMaterial;
  4625. setMatrix2x2(name: string, value: Float32Array): ShaderMaterial;
  4626. setArray3(name: string, value: number[]): ShaderMaterial;
  4627. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4628. bindOnlyWorldMatrix(world: Matrix): void;
  4629. bind(world: Matrix, mesh?: Mesh): void;
  4630. clone(name: string): ShaderMaterial;
  4631. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4632. serialize(): any;
  4633. static Parse(source: any, scene: Scene, rootUrl: string): ShaderMaterial;
  4634. }
  4635. }
  4636. declare module BABYLON {
  4637. class StandardMaterial extends Material {
  4638. diffuseTexture: BaseTexture;
  4639. ambientTexture: BaseTexture;
  4640. opacityTexture: BaseTexture;
  4641. reflectionTexture: BaseTexture;
  4642. emissiveTexture: BaseTexture;
  4643. specularTexture: BaseTexture;
  4644. bumpTexture: BaseTexture;
  4645. lightmapTexture: BaseTexture;
  4646. refractionTexture: BaseTexture;
  4647. ambientColor: Color3;
  4648. diffuseColor: Color3;
  4649. specularColor: Color3;
  4650. emissiveColor: Color3;
  4651. specularPower: number;
  4652. useAlphaFromDiffuseTexture: boolean;
  4653. useEmissiveAsIllumination: boolean;
  4654. linkEmissiveWithDiffuse: boolean;
  4655. useReflectionFresnelFromSpecular: boolean;
  4656. useSpecularOverAlpha: boolean;
  4657. useReflectionOverAlpha: boolean;
  4658. disableLighting: boolean;
  4659. useParallax: boolean;
  4660. useParallaxOcclusion: boolean;
  4661. parallaxScaleBias: number;
  4662. roughness: number;
  4663. indexOfRefraction: number;
  4664. invertRefractionY: boolean;
  4665. useLightmapAsShadowmap: boolean;
  4666. diffuseFresnelParameters: FresnelParameters;
  4667. opacityFresnelParameters: FresnelParameters;
  4668. reflectionFresnelParameters: FresnelParameters;
  4669. refractionFresnelParameters: FresnelParameters;
  4670. emissiveFresnelParameters: FresnelParameters;
  4671. useGlossinessFromSpecularMapAlpha: boolean;
  4672. maxSimultaneousLights: number;
  4673. /**
  4674. * If sets to true, x component of normal map value will invert (x = 1.0 - x).
  4675. */
  4676. invertNormalMapX: boolean;
  4677. /**
  4678. * If sets to true, y component of normal map value will invert (y = 1.0 - y).
  4679. */
  4680. invertNormalMapY: boolean;
  4681. /**
  4682. * Color Grading 2D Lookup Texture.
  4683. * This allows special effects like sepia, black and white to sixties rendering style.
  4684. */
  4685. cameraColorGradingTexture: BaseTexture;
  4686. /**
  4687. * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
  4688. * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
  4689. * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
  4690. * corresponding to low luminance, medium luminance, and high luminance areas respectively.
  4691. */
  4692. cameraColorCurves: ColorCurves;
  4693. private _renderTargets;
  4694. private _worldViewProjectionMatrix;
  4695. private _globalAmbientColor;
  4696. private _renderId;
  4697. private _defines;
  4698. private _cachedDefines;
  4699. private _useLogarithmicDepth;
  4700. constructor(name: string, scene: Scene);
  4701. useLogarithmicDepth: boolean;
  4702. needAlphaBlending(): boolean;
  4703. needAlphaTesting(): boolean;
  4704. private _shouldUseAlphaFromDiffuseTexture();
  4705. getAlphaTestTexture(): BaseTexture;
  4706. private _checkCache(scene, mesh?, useInstances?);
  4707. isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
  4708. unbind(): void;
  4709. bindOnlyWorldMatrix(world: Matrix): void;
  4710. bind(world: Matrix, mesh?: Mesh): void;
  4711. getAnimatables(): IAnimatable[];
  4712. dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
  4713. clone(name: string): StandardMaterial;
  4714. serialize(): any;
  4715. static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial;
  4716. static DiffuseTextureEnabled: boolean;
  4717. static AmbientTextureEnabled: boolean;
  4718. static OpacityTextureEnabled: boolean;
  4719. static ReflectionTextureEnabled: boolean;
  4720. static EmissiveTextureEnabled: boolean;
  4721. static SpecularTextureEnabled: boolean;
  4722. static BumpTextureEnabled: boolean;
  4723. static FresnelEnabled: boolean;
  4724. static LightmapTextureEnabled: boolean;
  4725. static RefractionTextureEnabled: boolean;
  4726. static ColorGradingTextureEnabled: boolean;
  4727. }
  4728. }
  4729. declare module BABYLON {
  4730. class SIMDHelper {
  4731. private static _isEnabled;
  4732. static IsEnabled: boolean;
  4733. static DisableSIMD(): void;
  4734. static EnableSIMD(): void;
  4735. }
  4736. }
  4737. declare module BABYLON {
  4738. const ToGammaSpace: number;
  4739. const ToLinearSpace: number;
  4740. const Epsilon: number;
  4741. class MathTools {
  4742. static WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  4743. static ToHex(i: number): string;
  4744. static Sign(value: number): number;
  4745. static Clamp(value: number, min?: number, max?: number): number;
  4746. }
  4747. class Color3 {
  4748. r: number;
  4749. g: number;
  4750. b: number;
  4751. constructor(r?: number, g?: number, b?: number);
  4752. toString(): string;
  4753. getClassName(): string;
  4754. getHashCode(): number;
  4755. toArray(array: number[], index?: number): Color3;
  4756. toColor4(alpha?: number): Color4;
  4757. asArray(): number[];
  4758. toLuminance(): number;
  4759. multiply(otherColor: Color3): Color3;
  4760. multiplyToRef(otherColor: Color3, result: Color3): Color3;
  4761. equals(otherColor: Color3): boolean;
  4762. equalsFloats(r: number, g: number, b: number): boolean;
  4763. scale(scale: number): Color3;
  4764. scaleToRef(scale: number, result: Color3): Color3;
  4765. add(otherColor: Color3): Color3;
  4766. addToRef(otherColor: Color3, result: Color3): Color3;
  4767. subtract(otherColor: Color3): Color3;
  4768. subtractToRef(otherColor: Color3, result: Color3): Color3;
  4769. clone(): Color3;
  4770. copyFrom(source: Color3): Color3;
  4771. copyFromFloats(r: number, g: number, b: number): Color3;
  4772. toHexString(): string;
  4773. toLinearSpace(): Color3;
  4774. toLinearSpaceToRef(convertedColor: Color3): Color3;
  4775. toGammaSpace(): Color3;
  4776. toGammaSpaceToRef(convertedColor: Color3): Color3;
  4777. static FromHexString(hex: string): Color3;
  4778. static FromArray(array: number[], offset?: number): Color3;
  4779. static FromInts(r: number, g: number, b: number): Color3;
  4780. static Lerp(start: Color3, end: Color3, amount: number): Color3;
  4781. static Red(): Color3;
  4782. static Green(): Color3;
  4783. static Blue(): Color3;
  4784. static Black(): Color3;
  4785. static White(): Color3;
  4786. static Purple(): Color3;
  4787. static Magenta(): Color3;
  4788. static Yellow(): Color3;
  4789. static Gray(): Color3;
  4790. }
  4791. class Color4 {
  4792. r: number;
  4793. g: number;
  4794. b: number;
  4795. a: number;
  4796. constructor(r: number, g: number, b: number, a: number);
  4797. addInPlace(right: any): Color4;
  4798. asArray(): number[];
  4799. toArray(array: number[], index?: number): Color4;
  4800. add(right: Color4): Color4;
  4801. subtract(right: Color4): Color4;
  4802. subtractToRef(right: Color4, result: Color4): Color4;
  4803. scale(scale: number): Color4;
  4804. scaleToRef(scale: number, result: Color4): Color4;
  4805. /**
  4806. * Multipy an RGBA Color4 value by another and return a new Color4 object
  4807. * @param color The Color4 (RGBA) value to multiply by
  4808. * @returns A new Color4.
  4809. */
  4810. multiply(color: Color4): Color4;
  4811. /**
  4812. * Multipy an RGBA Color4 value by another and push the result in a reference value
  4813. * @param color The Color4 (RGBA) value to multiply by
  4814. * @param result The Color4 (RGBA) to fill the result in
  4815. * @returns the result Color4.
  4816. */
  4817. multiplyToRef(color: Color4, result: Color4): Color4;
  4818. toString(): string;
  4819. getClassName(): string;
  4820. getHashCode(): number;
  4821. clone(): Color4;
  4822. copyFrom(source: Color4): Color4;
  4823. toHexString(): string;
  4824. static FromHexString(hex: string): Color4;
  4825. static Lerp(left: Color4, right: Color4, amount: number): Color4;
  4826. static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void;
  4827. static FromArray(array: number[], offset?: number): Color4;
  4828. static FromInts(r: number, g: number, b: number, a: number): Color4;
  4829. static CheckColors4(colors: number[], count: number): number[];
  4830. }
  4831. class Vector2 {
  4832. x: number;
  4833. y: number;
  4834. constructor(x: number, y: number);
  4835. toString(): string;
  4836. getClassName(): string;
  4837. getHashCode(): number;
  4838. toArray(array: number[] | Float32Array, index?: number): Vector2;
  4839. asArray(): number[];
  4840. copyFrom(source: Vector2): Vector2;
  4841. copyFromFloats(x: number, y: number): Vector2;
  4842. add(otherVector: Vector2): Vector2;
  4843. addToRef(otherVector: Vector2, result: Vector2): Vector2;
  4844. addInPlace(otherVector: Vector2): Vector2;
  4845. addVector3(otherVector: Vector3): Vector2;
  4846. subtract(otherVector: Vector2): Vector2;
  4847. subtractToRef(otherVector: Vector2, result: Vector2): Vector2;
  4848. subtractInPlace(otherVector: Vector2): Vector2;
  4849. multiplyInPlace(otherVector: Vector2): Vector2;
  4850. multiply(otherVector: Vector2): Vector2;
  4851. multiplyToRef(otherVector: Vector2, result: Vector2): Vector2;
  4852. multiplyByFloats(x: number, y: number): Vector2;
  4853. divide(otherVector: Vector2): Vector2;
  4854. divideToRef(otherVector: Vector2, result: Vector2): Vector2;
  4855. negate(): Vector2;
  4856. scaleInPlace(scale: number): Vector2;
  4857. scale(scale: number): Vector2;
  4858. equals(otherVector: Vector2): boolean;
  4859. equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean;
  4860. length(): number;
  4861. lengthSquared(): number;
  4862. normalize(): Vector2;
  4863. clone(): Vector2;
  4864. static Zero(): Vector2;
  4865. static FromArray(array: number[] | Float32Array, offset?: number): Vector2;
  4866. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void;
  4867. static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
  4868. static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
  4869. static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
  4870. static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
  4871. static Dot(left: Vector2, right: Vector2): number;
  4872. static Normalize(vector: Vector2): Vector2;
  4873. static Minimize(left: Vector2, right: Vector2): Vector2;
  4874. static Maximize(left: Vector2, right: Vector2): Vector2;
  4875. static Transform(vector: Vector2, transformation: Matrix): Vector2;
  4876. static TransformToRef(vector: Vector2, transformation: Matrix, result: Vector2): void;
  4877. static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
  4878. static Distance(value1: Vector2, value2: Vector2): number;
  4879. static DistanceSquared(value1: Vector2, value2: Vector2): number;
  4880. static Center(value1: Vector2, value2: Vector2): Vector2;
  4881. static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
  4882. }
  4883. class Vector3 {
  4884. x: number;
  4885. y: number;
  4886. z: number;
  4887. constructor(x: number, y: number, z: number);
  4888. toString(): string;
  4889. getClassName(): string;
  4890. getHashCode(): number;
  4891. asArray(): number[];
  4892. toArray(array: number[] | Float32Array, index?: number): Vector3;
  4893. toQuaternion(): Quaternion;
  4894. addInPlace(otherVector: Vector3): Vector3;
  4895. add(otherVector: Vector3): Vector3;
  4896. addToRef(otherVector: Vector3, result: Vector3): Vector3;
  4897. subtractInPlace(otherVector: Vector3): Vector3;
  4898. subtract(otherVector: Vector3): Vector3;
  4899. subtractToRef(otherVector: Vector3, result: Vector3): Vector3;
  4900. subtractFromFloats(x: number, y: number, z: number): Vector3;
  4901. subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3;
  4902. negate(): Vector3;
  4903. scaleInPlace(scale: number): Vector3;
  4904. scale(scale: number): Vector3;
  4905. scaleToRef(scale: number, result: Vector3): void;
  4906. equals(otherVector: Vector3): boolean;
  4907. equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean;
  4908. equalsToFloats(x: number, y: number, z: number): boolean;
  4909. multiplyInPlace(otherVector: Vector3): Vector3;
  4910. multiply(otherVector: Vector3): Vector3;
  4911. multiplyToRef(otherVector: Vector3, result: Vector3): Vector3;
  4912. multiplyByFloats(x: number, y: number, z: number): Vector3;
  4913. divide(otherVector: Vector3): Vector3;
  4914. divideToRef(otherVector: Vector3, result: Vector3): Vector3;
  4915. MinimizeInPlace(other: Vector3): Vector3;
  4916. MaximizeInPlace(other: Vector3): Vector3;
  4917. length(): number;
  4918. lengthSquared(): number;
  4919. normalize(): Vector3;
  4920. clone(): Vector3;
  4921. copyFrom(source: Vector3): Vector3;
  4922. copyFromFloats(x: number, y: number, z: number): Vector3;
  4923. static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number;
  4924. static FromArray(array: number[] | Float32Array, offset?: number): Vector3;
  4925. static FromFloatArray(array: Float32Array, offset?: number): Vector3;
  4926. static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void;
  4927. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void;
  4928. static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
  4929. static Zero(): Vector3;
  4930. static Up(): Vector3;
  4931. static Forward(): Vector3;
  4932. static Right(): Vector3;
  4933. static Left(): Vector3;
  4934. static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
  4935. static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  4936. static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  4937. static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
  4938. static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
  4939. static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
  4940. static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
  4941. static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
  4942. static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
  4943. static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
  4944. static Dot(left: Vector3, right: Vector3): number;
  4945. static Cross(left: Vector3, right: Vector3): Vector3;
  4946. static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
  4947. static Normalize(vector: Vector3): Vector3;
  4948. static NormalizeToRef(vector: Vector3, result: Vector3): void;
  4949. private static _viewportMatrixCache;
  4950. private static _matrixCache;
  4951. static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3;
  4952. static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3;
  4953. static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3;
  4954. static Minimize(left: Vector3, right: Vector3): Vector3;
  4955. static Maximize(left: Vector3, right: Vector3): Vector3;
  4956. static Distance(value1: Vector3, value2: Vector3): number;
  4957. static DistanceSquared(value1: Vector3, value2: Vector3): number;
  4958. static Center(value1: Vector3, value2: Vector3): Vector3;
  4959. /**
  4960. * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),
  4961. * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply
  4962. * to something in order to rotate it from its local system to the given target system.
  4963. */
  4964. static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3;
  4965. /**
  4966. * The same than RotationFromAxis but updates the passed ref Vector3 parameter.
  4967. */
  4968. static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void;
  4969. }
  4970. class Vector4 {
  4971. x: number;
  4972. y: number;
  4973. z: number;
  4974. w: number;
  4975. constructor(x: number, y: number, z: number, w: number);
  4976. toString(): string;
  4977. getClassName(): string;
  4978. getHashCode(): number;
  4979. asArray(): number[];
  4980. toArray(array: number[], index?: number): Vector4;
  4981. addInPlace(otherVector: Vector4): Vector4;
  4982. add(otherVector: Vector4): Vector4;
  4983. addToRef(otherVector: Vector4, result: Vector4): Vector4;
  4984. subtractInPlace(otherVector: Vector4): Vector4;
  4985. subtract(otherVector: Vector4): Vector4;
  4986. subtractToRef(otherVector: Vector4, result: Vector4): Vector4;
  4987. subtractFromFloats(x: number, y: number, z: number, w: number): Vector4;
  4988. subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4;
  4989. negate(): Vector4;
  4990. scaleInPlace(scale: number): Vector4;
  4991. scale(scale: number): Vector4;
  4992. scaleToRef(scale: number, result: Vector4): void;
  4993. equals(otherVector: Vector4): boolean;
  4994. equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean;
  4995. equalsToFloats(x: number, y: number, z: number, w: number): boolean;
  4996. multiplyInPlace(otherVector: Vector4): Vector4;
  4997. multiply(otherVector: Vector4): Vector4;
  4998. multiplyToRef(otherVector: Vector4, result: Vector4): Vector4;
  4999. multiplyByFloats(x: number, y: number, z: number, w: number): Vector4;
  5000. divide(otherVector: Vector4): Vector4;
  5001. divideToRef(otherVector: Vector4, result: Vector4): Vector4;
  5002. MinimizeInPlace(other: Vector4): Vector4;
  5003. MaximizeInPlace(other: Vector4): Vector4;
  5004. length(): number;
  5005. lengthSquared(): number;
  5006. normalize(): Vector4;
  5007. toVector3(): Vector3;
  5008. clone(): Vector4;
  5009. copyFrom(source: Vector4): Vector4;
  5010. copyFromFloats(x: number, y: number, z: number, w: number): Vector4;
  5011. static FromArray(array: number[], offset?: number): Vector4;
  5012. static FromArrayToRef(array: number[], offset: number, result: Vector4): void;
  5013. static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void;
  5014. static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void;
  5015. static Zero(): Vector4;
  5016. static Normalize(vector: Vector4): Vector4;
  5017. static NormalizeToRef(vector: Vector4, result: Vector4): void;
  5018. static Minimize(left: Vector4, right: Vector4): Vector4;
  5019. static Maximize(left: Vector4, right: Vector4): Vector4;
  5020. static Distance(value1: Vector4, value2: Vector4): number;
  5021. static DistanceSquared(value1: Vector4, value2: Vector4): number;
  5022. static Center(value1: Vector4, value2: Vector4): Vector4;
  5023. }
  5024. interface ISize {
  5025. width: number;
  5026. height: number;
  5027. }
  5028. class Size implements ISize {
  5029. width: number;
  5030. height: number;
  5031. constructor(width: number, height: number);
  5032. toString(): string;
  5033. getClassName(): string;
  5034. getHashCode(): number;
  5035. copyFrom(src: Size): void;
  5036. copyFromFloats(width: number, height: number): void;
  5037. multiplyByFloats(w: number, h: number): Size;
  5038. clone(): Size;
  5039. equals(other: Size): boolean;
  5040. surface: number;
  5041. static Zero(): Size;
  5042. add(otherSize: Size): Size;
  5043. substract(otherSize: Size): Size;
  5044. static Lerp(start: Size, end: Size, amount: number): Size;
  5045. }
  5046. class Quaternion {
  5047. x: number;
  5048. y: number;
  5049. z: number;
  5050. w: number;
  5051. constructor(x?: number, y?: number, z?: number, w?: number);
  5052. toString(): string;
  5053. getClassName(): string;
  5054. getHashCode(): number;
  5055. asArray(): number[];
  5056. equals(otherQuaternion: Quaternion): boolean;
  5057. clone(): Quaternion;
  5058. copyFrom(other: Quaternion): Quaternion;
  5059. copyFromFloats(x: number, y: number, z: number, w: number): Quaternion;
  5060. add(other: Quaternion): Quaternion;
  5061. subtract(other: Quaternion): Quaternion;
  5062. scale(value: number): Quaternion;
  5063. multiply(q1: Quaternion): Quaternion;
  5064. multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion;
  5065. multiplyInPlace(q1: Quaternion): Quaternion;
  5066. conjugateToRef(ref: Quaternion): Quaternion;
  5067. conjugateInPlace(): Quaternion;
  5068. conjugate(): Quaternion;
  5069. length(): number;
  5070. normalize(): Quaternion;
  5071. toEulerAngles(order?: string): Vector3;
  5072. toEulerAnglesToRef(result: Vector3, order?: string): Quaternion;
  5073. toRotationMatrix(result: Matrix): Quaternion;
  5074. fromRotationMatrix(matrix: Matrix): Quaternion;
  5075. static FromRotationMatrix(matrix: Matrix): Quaternion;
  5076. static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void;
  5077. static Inverse(q: Quaternion): Quaternion;
  5078. static Identity(): Quaternion;
  5079. static RotationAxis(axis: Vector3, angle: number): Quaternion;
  5080. static RotationAxisToRef(axis: Vector3, angle: number, result: Quaternion): Quaternion;
  5081. static FromArray(array: number[], offset?: number): Quaternion;
  5082. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
  5083. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
  5084. static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion;
  5085. static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void;
  5086. static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
  5087. }
  5088. class Matrix {
  5089. private static _tempQuaternion;
  5090. private static _xAxis;
  5091. private static _yAxis;
  5092. private static _zAxis;
  5093. m: Float32Array;
  5094. isIdentity(): boolean;
  5095. determinant(): number;
  5096. toArray(): Float32Array;
  5097. asArray(): Float32Array;
  5098. invert(): Matrix;
  5099. reset(): Matrix;
  5100. add(other: Matrix): Matrix;
  5101. addToRef(other: Matrix, result: Matrix): Matrix;
  5102. addToSelf(other: Matrix): Matrix;
  5103. invertToRef(other: Matrix): Matrix;
  5104. setTranslation(vector3: Vector3): Matrix;
  5105. getTranslation(): Vector3;
  5106. multiply(other: Matrix): Matrix;
  5107. copyFrom(other: Matrix): Matrix;
  5108. copyToArray(array: Float32Array, offset?: number): Matrix;
  5109. multiplyToRef(other: Matrix, result: Matrix): Matrix;
  5110. multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix;
  5111. equals(value: Matrix): boolean;
  5112. clone(): Matrix;
  5113. getClassName(): string;
  5114. getHashCode(): number;
  5115. decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean;
  5116. static FromArray(array: number[], offset?: number): Matrix;
  5117. static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
  5118. static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void;
  5119. 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;
  5120. getRow(index: number): Vector4;
  5121. setRow(index: number, row: Vector4): Matrix;
  5122. 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;
  5123. static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
  5124. static Identity(): Matrix;
  5125. static IdentityToRef(result: Matrix): void;
  5126. static Zero(): Matrix;
  5127. static RotationX(angle: number): Matrix;
  5128. static Invert(source: Matrix): Matrix;
  5129. static RotationXToRef(angle: number, result: Matrix): void;
  5130. static RotationY(angle: number): Matrix;
  5131. static RotationYToRef(angle: number, result: Matrix): void;
  5132. static RotationZ(angle: number): Matrix;
  5133. static RotationZToRef(angle: number, result: Matrix): void;
  5134. static RotationAxis(axis: Vector3, angle: number): Matrix;
  5135. static RotationAxisToRef(axis: Vector3, angle: number, result: Matrix): void;
  5136. static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
  5137. static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void;
  5138. static Scaling(x: number, y: number, z: number): Matrix;
  5139. static ScalingToRef(x: number, y: number, z: number, result: Matrix): void;
  5140. static Translation(x: number, y: number, z: number): Matrix;
  5141. static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
  5142. static Lerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  5143. static DecomposeLerp(startValue: Matrix, endValue: Matrix, gradient: number): Matrix;
  5144. static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  5145. static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  5146. static LookAtRH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
  5147. static LookAtRHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
  5148. static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
  5149. static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void;
  5150. static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  5151. static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  5152. static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
  5153. static OrthoOffCenterRHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
  5154. static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
  5155. static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  5156. static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5157. static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
  5158. static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5159. static PerspectiveFovWebVRToRef(fov: any, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void;
  5160. static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix;
  5161. static GetAsMatrix2x2(matrix: Matrix): Float32Array;
  5162. static GetAsMatrix3x3(matrix: Matrix): Float32Array;
  5163. static Transpose(matrix: Matrix): Matrix;
  5164. static Reflection(plane: Plane): Matrix;
  5165. static ReflectionToRef(plane: Plane, result: Matrix): void;
  5166. static FromXYZAxesToRef(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, mat: Matrix): void;
  5167. static FromQuaternionToRef(quat: Quaternion, result: Matrix): void;
  5168. }
  5169. class Plane {
  5170. normal: Vector3;
  5171. d: number;
  5172. constructor(a: number, b: number, c: number, d: number);
  5173. asArray(): number[];
  5174. clone(): Plane;
  5175. getClassName(): string;
  5176. getHashCode(): number;
  5177. normalize(): Plane;
  5178. transform(transformation: Matrix): Plane;
  5179. dotCoordinate(point: any): number;
  5180. copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
  5181. isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
  5182. signedDistanceTo(point: Vector3): number;
  5183. static FromArray(array: number[]): Plane;
  5184. static FromPoints(point1: any, point2: any, point3: any): Plane;
  5185. static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
  5186. static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
  5187. }
  5188. class Viewport {
  5189. x: number;
  5190. y: number;
  5191. width: number;
  5192. height: number;
  5193. constructor(x: number, y: number, width: number, height: number);
  5194. toGlobal(renderWidth: number, renderHeight: number): Viewport;
  5195. }
  5196. class Frustum {
  5197. static GetPlanes(transform: Matrix): Plane[];
  5198. static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void;
  5199. }
  5200. enum Space {
  5201. LOCAL = 0,
  5202. WORLD = 1,
  5203. }
  5204. class Axis {
  5205. static X: Vector3;
  5206. static Y: Vector3;
  5207. static Z: Vector3;
  5208. }
  5209. class BezierCurve {
  5210. static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number;
  5211. }
  5212. enum Orientation {
  5213. CW = 0,
  5214. CCW = 1,
  5215. }
  5216. class Angle {
  5217. private _radians;
  5218. constructor(radians: number);
  5219. degrees: () => number;
  5220. radians: () => number;
  5221. static BetweenTwoPoints(a: Vector2, b: Vector2): Angle;
  5222. static FromRadians(radians: number): Angle;
  5223. static FromDegrees(degrees: number): Angle;
  5224. }
  5225. class Arc2 {
  5226. startPoint: Vector2;
  5227. midPoint: Vector2;
  5228. endPoint: Vector2;
  5229. centerPoint: Vector2;
  5230. radius: number;
  5231. angle: Angle;
  5232. startAngle: Angle;
  5233. orientation: Orientation;
  5234. constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2);
  5235. }
  5236. class Path2 {
  5237. private _points;
  5238. private _length;
  5239. closed: boolean;
  5240. constructor(x: number, y: number);
  5241. addLineTo(x: number, y: number): Path2;
  5242. addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2;
  5243. close(): Path2;
  5244. length(): number;
  5245. getPoints(): Vector2[];
  5246. getPointAtLengthPosition(normalizedLengthPosition: number): Vector2;
  5247. static StartingAt(x: number, y: number): Path2;
  5248. }
  5249. class Path3D {
  5250. path: Vector3[];
  5251. private _curve;
  5252. private _distances;
  5253. private _tangents;
  5254. private _normals;
  5255. private _binormals;
  5256. private _raw;
  5257. /**
  5258. * new Path3D(path, normal, raw)
  5259. * Creates a Path3D. A Path3D is a logical math object, so not a mesh.
  5260. * please read the description in the tutorial : http://doc.babylonjs.com/tutorials/How_to_use_Path3D
  5261. * path : an array of Vector3, the curve axis of the Path3D
  5262. * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.
  5263. * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.
  5264. */
  5265. constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean);
  5266. /**
  5267. * Returns the Path3D array of successive Vector3 designing its curve.
  5268. */
  5269. getCurve(): Vector3[];
  5270. /**
  5271. * Returns an array populated with tangent vectors on each Path3D curve point.
  5272. */
  5273. getTangents(): Vector3[];
  5274. /**
  5275. * Returns an array populated with normal vectors on each Path3D curve point.
  5276. */
  5277. getNormals(): Vector3[];
  5278. /**
  5279. * Returns an array populated with binormal vectors on each Path3D curve point.
  5280. */
  5281. getBinormals(): Vector3[];
  5282. /**
  5283. * Returns an array populated with distances (float) of the i-th point from the first curve point.
  5284. */
  5285. getDistances(): number[];
  5286. /**
  5287. * Forces the Path3D tangent, normal, binormal and distance recomputation.
  5288. * Returns the same object updated.
  5289. */
  5290. update(path: Vector3[], firstNormal?: Vector3): Path3D;
  5291. private _compute(firstNormal);
  5292. private _getFirstNonNullVector(index);
  5293. private _getLastNonNullVector(index);
  5294. private _normalVector(v0, vt, va);
  5295. }
  5296. class Curve3 {
  5297. private _points;
  5298. private _length;
  5299. /**
  5300. * Returns a Curve3 object along a Quadratic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#quadratic-bezier-curve
  5301. * @param v0 (Vector3) the origin point of the Quadratic Bezier
  5302. * @param v1 (Vector3) the control point
  5303. * @param v2 (Vector3) the end point of the Quadratic Bezier
  5304. * @param nbPoints (integer) the wanted number of points in the curve
  5305. */
  5306. static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3;
  5307. /**
  5308. * Returns a Curve3 object along a Cubic Bezier curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#cubic-bezier-curve
  5309. * @param v0 (Vector3) the origin point of the Cubic Bezier
  5310. * @param v1 (Vector3) the first control point
  5311. * @param v2 (Vector3) the second control point
  5312. * @param v3 (Vector3) the end point of the Cubic Bezier
  5313. * @param nbPoints (integer) the wanted number of points in the curve
  5314. */
  5315. static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3;
  5316. /**
  5317. * Returns a Curve3 object along a Hermite Spline curve : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#hermite-spline
  5318. * @param p1 (Vector3) the origin point of the Hermite Spline
  5319. * @param t1 (Vector3) the tangent vector at the origin point
  5320. * @param p2 (Vector3) the end point of the Hermite Spline
  5321. * @param t2 (Vector3) the tangent vector at the end point
  5322. * @param nbPoints (integer) the wanted number of points in the curve
  5323. */
  5324. static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3;
  5325. /**
  5326. * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.
  5327. * A Curve3 is designed from a series of successive Vector3.
  5328. * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
  5329. */
  5330. constructor(points: Vector3[]);
  5331. /**
  5332. * Returns the Curve3 stored array of successive Vector3
  5333. */
  5334. getPoints(): Vector3[];
  5335. /**
  5336. * Returns the computed length (float) of the curve.
  5337. */
  5338. length(): number;
  5339. /**
  5340. * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);
  5341. * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.
  5342. * curveA and curveB keep unchanged.
  5343. */
  5344. continue(curve: Curve3): Curve3;
  5345. private _computeLength(path);
  5346. }
  5347. class SphericalHarmonics {
  5348. L00: Vector3;
  5349. L1_1: Vector3;
  5350. L10: Vector3;
  5351. L11: Vector3;
  5352. L2_2: Vector3;
  5353. L2_1: Vector3;
  5354. L20: Vector3;
  5355. L21: Vector3;
  5356. L22: Vector3;
  5357. addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void;
  5358. scale(scale: number): void;
  5359. }
  5360. class SphericalPolynomial {
  5361. x: Vector3;
  5362. y: Vector3;
  5363. z: Vector3;
  5364. xx: Vector3;
  5365. yy: Vector3;
  5366. zz: Vector3;
  5367. xy: Vector3;
  5368. yz: Vector3;
  5369. zx: Vector3;
  5370. addAmbient(color: Color3): void;
  5371. static getSphericalPolynomialFromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial;
  5372. }
  5373. class PositionNormalVertex {
  5374. position: Vector3;
  5375. normal: Vector3;
  5376. constructor(position?: Vector3, normal?: Vector3);
  5377. clone(): PositionNormalVertex;
  5378. }
  5379. class PositionNormalTextureVertex {
  5380. position: Vector3;
  5381. normal: Vector3;
  5382. uv: Vector2;
  5383. constructor(position?: Vector3, normal?: Vector3, uv?: Vector2);
  5384. clone(): PositionNormalTextureVertex;
  5385. }
  5386. class Tmp {
  5387. static Color3: Color3[];
  5388. static Vector2: Vector2[];
  5389. static Vector3: Vector3[];
  5390. static Vector4: Vector4[];
  5391. static Quaternion: Quaternion[];
  5392. static Matrix: Matrix[];
  5393. }
  5394. }
  5395. declare module BABYLON {
  5396. class Collider {
  5397. radius: Vector3;
  5398. retry: number;
  5399. velocity: Vector3;
  5400. basePoint: Vector3;
  5401. epsilon: number;
  5402. collisionFound: boolean;
  5403. velocityWorldLength: number;
  5404. basePointWorld: Vector3;
  5405. velocityWorld: Vector3;
  5406. normalizedVelocity: Vector3;
  5407. initialVelocity: Vector3;
  5408. initialPosition: Vector3;
  5409. nearestDistance: number;
  5410. intersectionPoint: Vector3;
  5411. collidedMesh: AbstractMesh;
  5412. private _collisionPoint;
  5413. private _planeIntersectionPoint;
  5414. private _tempVector;
  5415. private _tempVector2;
  5416. private _tempVector3;
  5417. private _tempVector4;
  5418. private _edge;
  5419. private _baseToVertex;
  5420. private _destinationPoint;
  5421. private _slidePlaneNormal;
  5422. private _displacementVector;
  5423. _initialize(source: Vector3, dir: Vector3, e: number): void;
  5424. _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
  5425. _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
  5426. _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
  5427. _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: number[] | Int32Array, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
  5428. _getResponse(pos: Vector3, vel: Vector3): void;
  5429. }
  5430. }
  5431. declare module BABYLON {
  5432. var CollisionWorker: string;
  5433. interface ICollisionCoordinator {
  5434. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  5435. init(scene: Scene): void;
  5436. destroy(): void;
  5437. onMeshAdded(mesh: AbstractMesh): any;
  5438. onMeshUpdated(mesh: AbstractMesh): any;
  5439. onMeshRemoved(mesh: AbstractMesh): any;
  5440. onGeometryAdded(geometry: Geometry): any;
  5441. onGeometryUpdated(geometry: Geometry): any;
  5442. onGeometryDeleted(geometry: Geometry): any;
  5443. }
  5444. interface SerializedMesh {
  5445. id: string;
  5446. name: string;
  5447. uniqueId: number;
  5448. geometryId: string;
  5449. sphereCenter: Array<number>;
  5450. sphereRadius: number;
  5451. boxMinimum: Array<number>;
  5452. boxMaximum: Array<number>;
  5453. worldMatrixFromCache: any;
  5454. subMeshes: Array<SerializedSubMesh>;
  5455. checkCollisions: boolean;
  5456. }
  5457. interface SerializedSubMesh {
  5458. position: number;
  5459. verticesStart: number;
  5460. verticesCount: number;
  5461. indexStart: number;
  5462. indexCount: number;
  5463. hasMaterial: boolean;
  5464. sphereCenter: Array<number>;
  5465. sphereRadius: number;
  5466. boxMinimum: Array<number>;
  5467. boxMaximum: Array<number>;
  5468. }
  5469. interface SerializedGeometry {
  5470. id: string;
  5471. positions: Float32Array;
  5472. indices: Int32Array;
  5473. normals: Float32Array;
  5474. }
  5475. interface BabylonMessage {
  5476. taskType: WorkerTaskType;
  5477. payload: InitPayload | CollidePayload | UpdatePayload;
  5478. }
  5479. interface SerializedColliderToWorker {
  5480. position: Array<number>;
  5481. velocity: Array<number>;
  5482. radius: Array<number>;
  5483. }
  5484. enum WorkerTaskType {
  5485. INIT = 0,
  5486. UPDATE = 1,
  5487. COLLIDE = 2,
  5488. }
  5489. interface WorkerReply {
  5490. error: WorkerReplyType;
  5491. taskType: WorkerTaskType;
  5492. payload?: any;
  5493. }
  5494. interface CollisionReplyPayload {
  5495. newPosition: Array<number>;
  5496. collisionId: number;
  5497. collidedMeshUniqueId: number;
  5498. }
  5499. interface InitPayload {
  5500. }
  5501. interface CollidePayload {
  5502. collisionId: number;
  5503. collider: SerializedColliderToWorker;
  5504. maximumRetry: number;
  5505. excludedMeshUniqueId?: number;
  5506. }
  5507. interface UpdatePayload {
  5508. updatedMeshes: {
  5509. [n: number]: SerializedMesh;
  5510. };
  5511. updatedGeometries: {
  5512. [s: string]: SerializedGeometry;
  5513. };
  5514. removedMeshes: Array<number>;
  5515. removedGeometries: Array<string>;
  5516. }
  5517. enum WorkerReplyType {
  5518. SUCCESS = 0,
  5519. UNKNOWN_ERROR = 1,
  5520. }
  5521. class CollisionCoordinatorWorker implements ICollisionCoordinator {
  5522. private _scene;
  5523. private _scaledPosition;
  5524. private _scaledVelocity;
  5525. private _collisionsCallbackArray;
  5526. private _init;
  5527. private _runningUpdated;
  5528. private _runningCollisionTask;
  5529. private _worker;
  5530. private _addUpdateMeshesList;
  5531. private _addUpdateGeometriesList;
  5532. private _toRemoveMeshesArray;
  5533. private _toRemoveGeometryArray;
  5534. constructor();
  5535. static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
  5536. static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
  5537. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  5538. init(scene: Scene): void;
  5539. destroy(): void;
  5540. onMeshAdded(mesh: AbstractMesh): void;
  5541. onMeshUpdated: (mesh: AbstractMesh) => void;
  5542. onMeshRemoved(mesh: AbstractMesh): void;
  5543. onGeometryAdded(geometry: Geometry): void;
  5544. onGeometryUpdated: (geometry: Geometry) => void;
  5545. onGeometryDeleted(geometry: Geometry): void;
  5546. private _afterRender;
  5547. private _onMessageFromWorker;
  5548. }
  5549. class CollisionCoordinatorLegacy implements ICollisionCoordinator {
  5550. private _scene;
  5551. private _scaledPosition;
  5552. private _scaledVelocity;
  5553. private _finalPosition;
  5554. getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
  5555. init(scene: Scene): void;
  5556. destroy(): void;
  5557. onMeshAdded(mesh: AbstractMesh): void;
  5558. onMeshUpdated(mesh: AbstractMesh): void;
  5559. onMeshRemoved(mesh: AbstractMesh): void;
  5560. onGeometryAdded(geometry: Geometry): void;
  5561. onGeometryUpdated(geometry: Geometry): void;
  5562. onGeometryDeleted(geometry: Geometry): void;
  5563. private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
  5564. }
  5565. }
  5566. declare module BABYLON {
  5567. var WorkerIncluded: boolean;
  5568. class CollisionCache {
  5569. private _meshes;
  5570. private _geometries;
  5571. getMeshes(): {
  5572. [n: number]: SerializedMesh;
  5573. };
  5574. getGeometries(): {
  5575. [s: number]: SerializedGeometry;
  5576. };
  5577. getMesh(id: any): SerializedMesh;
  5578. addMesh(mesh: SerializedMesh): void;
  5579. removeMesh(uniqueId: number): void;
  5580. getGeometry(id: string): SerializedGeometry;
  5581. addGeometry(geometry: SerializedGeometry): void;
  5582. removeGeometry(id: string): void;
  5583. }
  5584. class CollideWorker {
  5585. collider: Collider;
  5586. private _collisionCache;
  5587. private finalPosition;
  5588. private collisionsScalingMatrix;
  5589. private collisionTranformationMatrix;
  5590. constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
  5591. collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
  5592. private checkCollision(mesh);
  5593. private processCollisionsForSubMeshes(transformMatrix, mesh);
  5594. private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
  5595. private checkSubmeshCollision(subMesh);
  5596. }
  5597. interface ICollisionDetector {
  5598. onInit(payload: InitPayload): void;
  5599. onUpdate(payload: UpdatePayload): void;
  5600. onCollision(payload: CollidePayload): void;
  5601. }
  5602. class CollisionDetectorTransferable implements ICollisionDetector {
  5603. private _collisionCache;
  5604. onInit(payload: InitPayload): void;
  5605. onUpdate(payload: UpdatePayload): void;
  5606. onCollision(payload: CollidePayload): void;
  5607. }
  5608. }
  5609. declare module BABYLON {
  5610. class IntersectionInfo {
  5611. bu: number;
  5612. bv: number;
  5613. distance: number;
  5614. faceId: number;
  5615. subMeshId: number;
  5616. constructor(bu: number, bv: number, distance: number);
  5617. }
  5618. class PickingInfo {
  5619. hit: boolean;
  5620. distance: number;
  5621. pickedPoint: Vector3;
  5622. pickedMesh: AbstractMesh;
  5623. bu: number;
  5624. bv: number;
  5625. faceId: number;
  5626. subMeshId: number;
  5627. pickedSprite: Sprite;
  5628. getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
  5629. getTextureCoordinates(): Vector2;
  5630. }
  5631. }
  5632. declare module BABYLON {
  5633. class AbstractMesh extends Node implements IDisposable, ICullable {
  5634. private static _BILLBOARDMODE_NONE;
  5635. private static _BILLBOARDMODE_X;
  5636. private static _BILLBOARDMODE_Y;
  5637. private static _BILLBOARDMODE_Z;
  5638. private static _BILLBOARDMODE_ALL;
  5639. static BILLBOARDMODE_NONE: number;
  5640. static BILLBOARDMODE_X: number;
  5641. static BILLBOARDMODE_Y: number;
  5642. static BILLBOARDMODE_Z: number;
  5643. static BILLBOARDMODE_ALL: number;
  5644. /**
  5645. * An event triggered when this mesh collides with another one
  5646. * @type {BABYLON.Observable}
  5647. */
  5648. onCollideObservable: Observable<AbstractMesh>;
  5649. private _onCollideObserver;
  5650. onCollide: () => void;
  5651. /**
  5652. * An event triggered when the collision's position changes
  5653. * @type {BABYLON.Observable}
  5654. */
  5655. onCollisionPositionChangeObservable: Observable<Vector3>;
  5656. private _onCollisionPositionChangeObserver;
  5657. onCollisionPositionChange: () => void;
  5658. /**
  5659. * An event triggered after the world matrix is updated
  5660. * @type {BABYLON.Observable}
  5661. */
  5662. onAfterWorldMatrixUpdateObservable: Observable<AbstractMesh>;
  5663. definedFacingForward: boolean;
  5664. position: Vector3;
  5665. private _rotation;
  5666. _rotationQuaternion: Quaternion;
  5667. private _scaling;
  5668. billboardMode: number;
  5669. visibility: number;
  5670. alphaIndex: number;
  5671. infiniteDistance: boolean;
  5672. isVisible: boolean;
  5673. isPickable: boolean;
  5674. showBoundingBox: boolean;
  5675. showSubMeshesBoundingBox: boolean;
  5676. isBlocker: boolean;
  5677. renderingGroupId: number;
  5678. material: Material;
  5679. receiveShadows: boolean;
  5680. renderOutline: boolean;
  5681. outlineColor: Color3;
  5682. outlineWidth: number;
  5683. renderOverlay: boolean;
  5684. overlayColor: Color3;
  5685. overlayAlpha: number;
  5686. hasVertexAlpha: boolean;
  5687. useVertexColors: boolean;
  5688. applyFog: boolean;
  5689. computeBonesUsingShaders: boolean;
  5690. scalingDeterminant: number;
  5691. numBoneInfluencers: number;
  5692. useOctreeForRenderingSelection: boolean;
  5693. useOctreeForPicking: boolean;
  5694. useOctreeForCollisions: boolean;
  5695. layerMask: number;
  5696. alwaysSelectAsActiveMesh: boolean;
  5697. /**
  5698. * This scene's action manager
  5699. * @type {BABYLON.ActionManager}
  5700. */
  5701. actionManager: ActionManager;
  5702. physicsImpostor: BABYLON.PhysicsImpostor;
  5703. onPhysicsCollide: (collidedMesh: AbstractMesh, contact: any) => void;
  5704. private _checkCollisions;
  5705. ellipsoid: Vector3;
  5706. ellipsoidOffset: Vector3;
  5707. private _collider;
  5708. private _oldPositionForCollisions;
  5709. private _diffPositionForCollisions;
  5710. private _newPositionForCollisions;
  5711. private _meshToBoneReferal;
  5712. edgesWidth: number;
  5713. edgesColor: Color4;
  5714. _edgesRenderer: EdgesRenderer;
  5715. private _localWorld;
  5716. _worldMatrix: Matrix;
  5717. private _rotateYByPI;
  5718. private _absolutePosition;
  5719. private _collisionsTransformMatrix;
  5720. private _collisionsScalingMatrix;
  5721. _positions: Vector3[];
  5722. private _isDirty;
  5723. _masterMesh: AbstractMesh;
  5724. _materialDefines: MaterialDefines;
  5725. _boundingInfo: BoundingInfo;
  5726. private _pivotMatrix;
  5727. _isDisposed: boolean;
  5728. _renderId: number;
  5729. subMeshes: SubMesh[];
  5730. _submeshesOctree: Octree<SubMesh>;
  5731. _intersectionsInProgress: AbstractMesh[];
  5732. private _isWorldMatrixFrozen;
  5733. _unIndexed: boolean;
  5734. _poseMatrix: Matrix;
  5735. _waitingActions: any;
  5736. _waitingFreezeWorldMatrix: boolean;
  5737. private _skeleton;
  5738. _bonesTransformMatrices: Float32Array;
  5739. skeleton: Skeleton;
  5740. constructor(name: string, scene: Scene);
  5741. /**
  5742. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  5743. */
  5744. toString(fullDetails?: boolean): string;
  5745. /**
  5746. * Getting the rotation object.
  5747. * If rotation quaternion is set, this vector will (almost always) be the Zero vector!
  5748. */
  5749. rotation: Vector3;
  5750. scaling: Vector3;
  5751. rotationQuaternion: Quaternion;
  5752. updatePoseMatrix(matrix: Matrix): void;
  5753. getPoseMatrix(): Matrix;
  5754. disableEdgesRendering(): void;
  5755. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void;
  5756. isBlocked: boolean;
  5757. getLOD(camera: Camera): AbstractMesh;
  5758. getTotalVertices(): number;
  5759. getIndices(): number[] | Int32Array;
  5760. getVerticesData(kind: string): number[] | Float32Array;
  5761. isVerticesDataPresent(kind: string): boolean;
  5762. getBoundingInfo(): BoundingInfo;
  5763. setBoundingInfo(boundingInfo: BoundingInfo): void;
  5764. useBones: boolean;
  5765. _preActivate(): void;
  5766. _preActivateForIntermediateRendering(renderId: number): void;
  5767. _activate(renderId: number): void;
  5768. getWorldMatrix(): Matrix;
  5769. worldMatrixFromCache: Matrix;
  5770. absolutePosition: Vector3;
  5771. freezeWorldMatrix(): void;
  5772. unfreezeWorldMatrix(): void;
  5773. isWorldMatrixFrozen: boolean;
  5774. private static _rotationAxisCache;
  5775. rotate(axis: Vector3, amount: number, space?: Space): void;
  5776. translate(axis: Vector3, distance: number, space?: Space): void;
  5777. getAbsolutePosition(): Vector3;
  5778. setAbsolutePosition(absolutePosition: Vector3): void;
  5779. /**
  5780. * Perform relative position change from the point of view of behind the front of the mesh.
  5781. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5782. * Supports definition of mesh facing forward or backward.
  5783. * @param {number} amountRight
  5784. * @param {number} amountUp
  5785. * @param {number} amountForward
  5786. */
  5787. movePOV(amountRight: number, amountUp: number, amountForward: number): void;
  5788. /**
  5789. * Calculate relative position change from the point of view of behind the front of the mesh.
  5790. * This is performed taking into account the meshes current rotation, so you do not have to care.
  5791. * Supports definition of mesh facing forward or backward.
  5792. * @param {number} amountRight
  5793. * @param {number} amountUp
  5794. * @param {number} amountForward
  5795. */
  5796. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  5797. /**
  5798. * Perform relative rotation change from the point of view of behind the front of the mesh.
  5799. * Supports definition of mesh facing forward or backward.
  5800. * @param {number} flipBack
  5801. * @param {number} twirlClockwise
  5802. * @param {number} tiltRight
  5803. */
  5804. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void;
  5805. /**
  5806. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  5807. * Supports definition of mesh facing forward or backward.
  5808. * @param {number} flipBack
  5809. * @param {number} twirlClockwise
  5810. * @param {number} tiltRight
  5811. */
  5812. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  5813. setPivotMatrix(matrix: Matrix): void;
  5814. getPivotMatrix(): Matrix;
  5815. _isSynchronized(): boolean;
  5816. _initCache(): void;
  5817. markAsDirty(property: string): void;
  5818. _updateBoundingInfo(): void;
  5819. _updateSubMeshesBoundingInfo(matrix: Matrix): void;
  5820. computeWorldMatrix(force?: boolean): Matrix;
  5821. /**
  5822. * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated
  5823. * @param func: callback function to add
  5824. */
  5825. registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5826. unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void;
  5827. setPositionWithLocalVector(vector3: Vector3): void;
  5828. getPositionExpressedInLocalSpace(): Vector3;
  5829. locallyTranslate(vector3: Vector3): void;
  5830. private static _lookAtVectorCache;
  5831. lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): void;
  5832. attachToBone(bone: Bone, affectedMesh: AbstractMesh): void;
  5833. detachFromBone(): void;
  5834. isInFrustum(frustumPlanes: Plane[]): boolean;
  5835. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  5836. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean): boolean;
  5837. intersectsPoint(point: Vector3): boolean;
  5838. /**
  5839. * @Deprecated. Use new PhysicsImpostor instead.
  5840. * */
  5841. setPhysicsState(impostor?: any, options?: PhysicsImpostorParameters): any;
  5842. getPhysicsImpostor(): PhysicsImpostor;
  5843. /**
  5844. * @Deprecated. Use getPhysicsImpostor().getParam("mass");
  5845. */
  5846. getPhysicsMass(): number;
  5847. /**
  5848. * @Deprecated. Use getPhysicsImpostor().getParam("friction");
  5849. */
  5850. getPhysicsFriction(): number;
  5851. /**
  5852. * @Deprecated. Use getPhysicsImpostor().getParam("restitution");
  5853. */
  5854. getPhysicsRestitution(): number;
  5855. getPositionInCameraSpace(camera?: Camera): Vector3;
  5856. getDistanceToCamera(camera?: Camera): number;
  5857. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  5858. setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void;
  5859. /**
  5860. * @Deprecated
  5861. */
  5862. updatePhysicsBodyPosition(): void;
  5863. /**
  5864. * @Deprecated
  5865. * Calling this function is not needed anymore.
  5866. * The physics engine takes care of transofmration automatically.
  5867. */
  5868. updatePhysicsBody(): void;
  5869. checkCollisions: boolean;
  5870. moveWithCollisions(velocity: Vector3): void;
  5871. private _onCollisionPositionChange;
  5872. /**
  5873. * This function will create an octree to help select the right submeshes for rendering, picking and collisions
  5874. * Please note that you must have a decent number of submeshes to get performance improvements when using octree
  5875. */
  5876. createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree<SubMesh>;
  5877. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void;
  5878. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void;
  5879. _checkCollision(collider: Collider): void;
  5880. _generatePointsArray(): boolean;
  5881. intersects(ray: Ray, fastCheck?: boolean): PickingInfo;
  5882. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh;
  5883. releaseSubMeshes(): void;
  5884. dispose(doNotRecurse?: boolean): void;
  5885. getDirection(localAxis: Vector3): Vector3;
  5886. getDirectionToRef(localAxis: Vector3, result: Vector3): void;
  5887. }
  5888. }
  5889. declare module BABYLON {
  5890. class Buffer {
  5891. private _engine;
  5892. private _buffer;
  5893. private _data;
  5894. private _updatable;
  5895. private _strideSize;
  5896. private _instanced;
  5897. constructor(engine: any, data: number[] | Float32Array, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced?: boolean);
  5898. createVertexBuffer(kind: string, offset: number, size: number, stride?: number): VertexBuffer;
  5899. isUpdatable(): boolean;
  5900. getData(): number[] | Float32Array;
  5901. getBuffer(): WebGLBuffer;
  5902. getStrideSize(): number;
  5903. getIsInstanced(): boolean;
  5904. create(data?: number[] | Float32Array): void;
  5905. update(data: number[] | Float32Array): void;
  5906. updateDirectly(data: Float32Array, offset: number, vertexCount?: number): void;
  5907. dispose(): void;
  5908. }
  5909. }
  5910. declare module BABYLON {
  5911. class CSG {
  5912. private polygons;
  5913. matrix: Matrix;
  5914. position: Vector3;
  5915. rotation: Vector3;
  5916. rotationQuaternion: Quaternion;
  5917. scaling: Vector3;
  5918. static FromMesh(mesh: Mesh): CSG;
  5919. private static FromPolygons(polygons);
  5920. clone(): CSG;
  5921. private toPolygons();
  5922. union(csg: CSG): CSG;
  5923. unionInPlace(csg: CSG): void;
  5924. subtract(csg: CSG): CSG;
  5925. subtractInPlace(csg: CSG): void;
  5926. intersect(csg: CSG): CSG;
  5927. intersectInPlace(csg: CSG): void;
  5928. inverse(): CSG;
  5929. inverseInPlace(): void;
  5930. copyTransformAttributes(csg: CSG): CSG;
  5931. buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh;
  5932. toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh;
  5933. }
  5934. }
  5935. declare module BABYLON {
  5936. class Geometry implements IGetSetVerticesData {
  5937. id: string;
  5938. delayLoadState: number;
  5939. delayLoadingFile: string;
  5940. onGeometryUpdated: (geometry: Geometry, kind?: string) => void;
  5941. private _scene;
  5942. private _engine;
  5943. private _meshes;
  5944. private _totalVertices;
  5945. private _indices;
  5946. private _vertexBuffers;
  5947. private _isDisposed;
  5948. private _extend;
  5949. private _boundingBias;
  5950. _delayInfo: any;
  5951. private _indexBuffer;
  5952. _boundingInfo: BoundingInfo;
  5953. _delayLoadingFunction: (any: any, geometry: Geometry) => void;
  5954. _softwareSkinningRenderId: number;
  5955. /**
  5956. * The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
  5957. * @returns The Bias Vector
  5958. */
  5959. boundingBias: Vector2;
  5960. constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh);
  5961. extend: {
  5962. minimum: Vector3;
  5963. maximum: Vector3;
  5964. };
  5965. getScene(): Scene;
  5966. getEngine(): Engine;
  5967. isReady(): boolean;
  5968. doNotSerialize: boolean;
  5969. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  5970. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  5971. setVerticesBuffer(buffer: VertexBuffer): void;
  5972. updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void;
  5973. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void;
  5974. private updateBoundingInfo(updateExtends, data);
  5975. getTotalVertices(): number;
  5976. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  5977. getVertexBuffer(kind: string): VertexBuffer;
  5978. getVertexBuffers(): {
  5979. [key: string]: VertexBuffer;
  5980. };
  5981. isVerticesDataPresent(kind: string): boolean;
  5982. getVerticesDataKinds(): string[];
  5983. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  5984. getTotalIndices(): number;
  5985. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  5986. getIndexBuffer(): WebGLBuffer;
  5987. releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void;
  5988. applyToMesh(mesh: Mesh): void;
  5989. private updateExtend(data?, stride?);
  5990. private _applyToMesh(mesh);
  5991. private notifyUpdate(kind?);
  5992. load(scene: Scene, onLoaded?: () => void): void;
  5993. private _queueLoad(scene, onLoaded?);
  5994. /**
  5995. * Invert the geometry to move from a right handed system to a left handed one.
  5996. */
  5997. toLeftHanded(): void;
  5998. isDisposed(): boolean;
  5999. dispose(): void;
  6000. copy(id: string): Geometry;
  6001. serialize(): any;
  6002. serializeVerticeData(): any;
  6003. static ExtractFromMesh(mesh: Mesh, id: string): Geometry;
  6004. /**
  6005. * You should now use Tools.RandomId(), this method is still here for legacy reasons.
  6006. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  6007. * Be aware Math.random() could cause collisions, but:
  6008. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  6009. */
  6010. static RandomId(): string;
  6011. static ImportGeometry(parsedGeometry: any, mesh: Mesh): void;
  6012. static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Geometry;
  6013. }
  6014. module Geometry.Primitives {
  6015. class _Primitive extends Geometry {
  6016. private _canBeRegenerated;
  6017. private _beingRegenerated;
  6018. constructor(id: string, scene: Scene, _canBeRegenerated?: boolean, mesh?: Mesh);
  6019. canBeRegenerated(): boolean;
  6020. regenerate(): void;
  6021. asNewGeometry(id: string): Geometry;
  6022. setAllVerticesData(vertexData: VertexData, updatable?: boolean): void;
  6023. setVerticesData(kind: string, data: number[] | Int32Array | Float32Array, updatable?: boolean): void;
  6024. _regenerateVertexData(): VertexData;
  6025. copy(id: string): Geometry;
  6026. serialize(): any;
  6027. }
  6028. class Ribbon extends _Primitive {
  6029. pathArray: Vector3[][];
  6030. closeArray: boolean;
  6031. closePath: boolean;
  6032. offset: number;
  6033. side: number;
  6034. constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6035. _regenerateVertexData(): VertexData;
  6036. copy(id: string): Geometry;
  6037. }
  6038. class Box extends _Primitive {
  6039. size: number;
  6040. side: number;
  6041. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6042. _regenerateVertexData(): VertexData;
  6043. copy(id: string): Geometry;
  6044. serialize(): any;
  6045. static Parse(parsedBox: any, scene: Scene): Box;
  6046. }
  6047. class Sphere extends _Primitive {
  6048. segments: number;
  6049. diameter: number;
  6050. side: number;
  6051. constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6052. _regenerateVertexData(): VertexData;
  6053. copy(id: string): Geometry;
  6054. serialize(): any;
  6055. static Parse(parsedSphere: any, scene: Scene): Geometry.Primitives.Sphere;
  6056. }
  6057. class Disc extends _Primitive {
  6058. radius: number;
  6059. tessellation: number;
  6060. side: number;
  6061. constructor(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6062. _regenerateVertexData(): VertexData;
  6063. copy(id: string): Geometry;
  6064. }
  6065. class Cylinder extends _Primitive {
  6066. height: number;
  6067. diameterTop: number;
  6068. diameterBottom: number;
  6069. tessellation: number;
  6070. subdivisions: number;
  6071. side: number;
  6072. constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6073. _regenerateVertexData(): VertexData;
  6074. copy(id: string): Geometry;
  6075. serialize(): any;
  6076. static Parse(parsedCylinder: any, scene: Scene): Geometry.Primitives.Cylinder;
  6077. }
  6078. class Torus extends _Primitive {
  6079. diameter: number;
  6080. thickness: number;
  6081. tessellation: number;
  6082. side: number;
  6083. constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6084. _regenerateVertexData(): VertexData;
  6085. copy(id: string): Geometry;
  6086. serialize(): any;
  6087. static Parse(parsedTorus: any, scene: Scene): Geometry.Primitives.Torus;
  6088. }
  6089. class Ground extends _Primitive {
  6090. width: number;
  6091. height: number;
  6092. subdivisions: number;
  6093. constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh);
  6094. _regenerateVertexData(): VertexData;
  6095. copy(id: string): Geometry;
  6096. serialize(): any;
  6097. static Parse(parsedGround: any, scene: Scene): Geometry.Primitives.Ground;
  6098. }
  6099. class TiledGround extends _Primitive {
  6100. xmin: number;
  6101. zmin: number;
  6102. xmax: number;
  6103. zmax: number;
  6104. subdivisions: {
  6105. w: number;
  6106. h: number;
  6107. };
  6108. precision: {
  6109. w: number;
  6110. h: number;
  6111. };
  6112. constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6113. w: number;
  6114. h: number;
  6115. }, precision: {
  6116. w: number;
  6117. h: number;
  6118. }, canBeRegenerated?: boolean, mesh?: Mesh);
  6119. _regenerateVertexData(): VertexData;
  6120. copy(id: string): Geometry;
  6121. }
  6122. class Plane extends _Primitive {
  6123. size: number;
  6124. side: number;
  6125. constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6126. _regenerateVertexData(): VertexData;
  6127. copy(id: string): Geometry;
  6128. serialize(): any;
  6129. static Parse(parsedPlane: any, scene: Scene): Geometry.Primitives.Plane;
  6130. }
  6131. class TorusKnot extends _Primitive {
  6132. radius: number;
  6133. tube: number;
  6134. radialSegments: number;
  6135. tubularSegments: number;
  6136. p: number;
  6137. q: number;
  6138. side: number;
  6139. constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number);
  6140. _regenerateVertexData(): VertexData;
  6141. copy(id: string): Geometry;
  6142. serialize(): any;
  6143. static Parse(parsedTorusKnot: any, scene: Scene): Geometry.Primitives.TorusKnot;
  6144. }
  6145. }
  6146. }
  6147. declare module BABYLON {
  6148. class GroundMesh extends Mesh {
  6149. generateOctree: boolean;
  6150. private _worldInverse;
  6151. private _heightQuads;
  6152. _subdivisionsX: number;
  6153. _subdivisionsY: number;
  6154. _width: number;
  6155. _height: number;
  6156. _minX: number;
  6157. _maxX: number;
  6158. _minZ: number;
  6159. _maxZ: number;
  6160. constructor(name: string, scene: Scene);
  6161. subdivisions: number;
  6162. subdivisionsX: number;
  6163. subdivisionsY: number;
  6164. optimize(chunksCount: number, octreeBlocksSize?: number): void;
  6165. /**
  6166. * Returns a height (y) value in the Worl system :
  6167. * the ground altitude at the coordinates (x, z) expressed in the World system.
  6168. * Returns the ground y position if (x, z) are outside the ground surface.
  6169. * Not pertinent if the ground is rotated.
  6170. */
  6171. getHeightAtCoordinates(x: number, z: number): number;
  6172. /**
  6173. * Returns a normalized vector (Vector3) orthogonal to the ground
  6174. * at the ground coordinates (x, z) expressed in the World system.
  6175. * Returns Vector3(0, 1, 0) if (x, z) are outside the ground surface.
  6176. * Not pertinent if the ground is rotated.
  6177. */
  6178. getNormalAtCoordinates(x: number, z: number): Vector3;
  6179. /**
  6180. * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground
  6181. * at the ground coordinates (x, z) expressed in the World system.
  6182. * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.
  6183. * Not pertinent if the ground is rotated.
  6184. */
  6185. getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): void;
  6186. /**
  6187. * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()
  6188. * if the ground has been updated.
  6189. * This can be used in the render loop
  6190. */
  6191. updateCoordinateHeights(): void;
  6192. private _getFacetAt(x, z);
  6193. private _initHeightQuads();
  6194. private _computeHeightQuads();
  6195. }
  6196. }
  6197. declare module BABYLON {
  6198. /**
  6199. * Creates an instance based on a source mesh.
  6200. */
  6201. class InstancedMesh extends AbstractMesh {
  6202. private _sourceMesh;
  6203. private _currentLOD;
  6204. constructor(name: string, source: Mesh);
  6205. receiveShadows: boolean;
  6206. material: Material;
  6207. visibility: number;
  6208. skeleton: Skeleton;
  6209. renderingGroupId: number;
  6210. getTotalVertices(): number;
  6211. sourceMesh: Mesh;
  6212. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  6213. isVerticesDataPresent(kind: string): boolean;
  6214. getIndices(): number[] | Int32Array;
  6215. _positions: Vector3[];
  6216. refreshBoundingInfo(): void;
  6217. _preActivate(): void;
  6218. _activate(renderId: number): void;
  6219. getLOD(camera: Camera): AbstractMesh;
  6220. _syncSubMeshes(): void;
  6221. _generatePointsArray(): boolean;
  6222. clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh;
  6223. dispose(doNotRecurse?: boolean): void;
  6224. }
  6225. }
  6226. declare module BABYLON {
  6227. class LinesMesh extends Mesh {
  6228. color: Color3;
  6229. alpha: number;
  6230. private _positionBuffer;
  6231. /**
  6232. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6233. * This margin is expressed in world space coordinates, so its value may vary.
  6234. * Default value is 0.1
  6235. * @returns the intersection Threshold value.
  6236. */
  6237. /**
  6238. * The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray.
  6239. * This margin is expressed in world space coordinates, so its value may vary.
  6240. * @param value the new threshold to apply
  6241. */
  6242. intersectionThreshold: number;
  6243. private _intersectionThreshold;
  6244. private _colorShader;
  6245. constructor(name: string, scene: Scene, parent?: Node, source?: LinesMesh, doNotCloneChildren?: boolean);
  6246. material: Material;
  6247. checkCollisions: boolean;
  6248. createInstance(name: string): InstancedMesh;
  6249. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  6250. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  6251. dispose(doNotRecurse?: boolean): void;
  6252. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh;
  6253. }
  6254. }
  6255. declare module BABYLON {
  6256. class _InstancesBatch {
  6257. mustReturn: boolean;
  6258. visibleInstances: InstancedMesh[][];
  6259. renderSelf: boolean[];
  6260. }
  6261. class Mesh extends AbstractMesh implements IGetSetVerticesData {
  6262. static _FRONTSIDE: number;
  6263. static _BACKSIDE: number;
  6264. static _DOUBLESIDE: number;
  6265. static _DEFAULTSIDE: number;
  6266. static _NO_CAP: number;
  6267. static _CAP_START: number;
  6268. static _CAP_END: number;
  6269. static _CAP_ALL: number;
  6270. /**
  6271. * Mesh side orientation : usually the external or front surface
  6272. */
  6273. static FRONTSIDE: number;
  6274. /**
  6275. * Mesh side orientation : usually the internal or back surface
  6276. */
  6277. static BACKSIDE: number;
  6278. /**
  6279. * Mesh side orientation : both internal and external or front and back surfaces
  6280. */
  6281. static DOUBLESIDE: number;
  6282. /**
  6283. * Mesh side orientation : by default, `FRONTSIDE`
  6284. */
  6285. static DEFAULTSIDE: number;
  6286. /**
  6287. * Mesh cap setting : no cap
  6288. */
  6289. static NO_CAP: number;
  6290. /**
  6291. * Mesh cap setting : one cap at the beginning of the mesh
  6292. */
  6293. static CAP_START: number;
  6294. /**
  6295. * Mesh cap setting : one cap at the end of the mesh
  6296. */
  6297. static CAP_END: number;
  6298. /**
  6299. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  6300. */
  6301. static CAP_ALL: number;
  6302. /**
  6303. * An event triggered before rendering the mesh
  6304. * @type {BABYLON.Observable}
  6305. */
  6306. onBeforeRenderObservable: Observable<Mesh>;
  6307. /**
  6308. * An event triggered after rendering the mesh
  6309. * @type {BABYLON.Observable}
  6310. */
  6311. onAfterRenderObservable: Observable<Mesh>;
  6312. /**
  6313. * An event triggered before drawing the mesh
  6314. * @type {BABYLON.Observable}
  6315. */
  6316. onBeforeDrawObservable: Observable<Mesh>;
  6317. private _onBeforeDrawObserver;
  6318. onBeforeDraw: () => void;
  6319. delayLoadState: number;
  6320. instances: InstancedMesh[];
  6321. delayLoadingFile: string;
  6322. _binaryInfo: any;
  6323. private _LODLevels;
  6324. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
  6325. _geometry: Geometry;
  6326. _delayInfo: any;
  6327. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  6328. _visibleInstances: any;
  6329. private _renderIdForInstances;
  6330. private _batchCache;
  6331. private _instancesBufferSize;
  6332. private _instancesBuffer;
  6333. private _instancesData;
  6334. private _overridenInstanceCount;
  6335. _shouldGenerateFlatShading: boolean;
  6336. private _preActivateId;
  6337. private _sideOrientation;
  6338. private _areNormalsFrozen;
  6339. private _sourcePositions;
  6340. private _sourceNormals;
  6341. /**
  6342. * @constructor
  6343. * @param {string} name The value used by scene.getMeshByName() to do a lookup.
  6344. * @param {Scene} scene The scene to add this mesh to.
  6345. * @param {Node} parent The parent of this mesh, if it has one
  6346. * @param {Mesh} source An optional Mesh from which geometry is shared, cloned.
  6347. * @param {boolean} doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  6348. * When false, achieved by calling a clone(), also passing False.
  6349. * This will make creation of children, recursive.
  6350. */
  6351. constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  6352. /**
  6353. * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
  6354. */
  6355. toString(fullDetails?: boolean): string;
  6356. hasLODLevels: boolean;
  6357. private _sortLODLevels();
  6358. /**
  6359. * Add a mesh as LOD level triggered at the given distance.
  6360. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6361. * @param {number} distance The distance from the center of the object to show this level
  6362. * @param {Mesh} mesh The mesh to be added as LOD level
  6363. * @return {Mesh} This mesh (for chaining)
  6364. */
  6365. addLODLevel(distance: number, mesh: Mesh): Mesh;
  6366. /**
  6367. * Returns the LOD level mesh at the passed distance or null if not found.
  6368. * It is related to the method `addLODLevel(distance, mesh)`.
  6369. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6370. */
  6371. getLODLevelAtDistance(distance: number): Mesh;
  6372. /**
  6373. * Remove a mesh from the LOD array
  6374. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6375. * @param {Mesh} mesh The mesh to be removed.
  6376. * @return {Mesh} This mesh (for chaining)
  6377. */
  6378. removeLODLevel(mesh: Mesh): Mesh;
  6379. /**
  6380. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  6381. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_LOD
  6382. */
  6383. getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh;
  6384. /**
  6385. * Returns the mesh internal Geometry object.
  6386. */
  6387. geometry: Geometry;
  6388. /**
  6389. * Returns a positive integer : the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  6390. */
  6391. getTotalVertices(): number;
  6392. /**
  6393. * Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
  6394. * If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  6395. * Returns null if the mesh has no geometry or no vertex buffer.
  6396. * Possible `kind` values :
  6397. * - BABYLON.VertexBuffer.PositionKind
  6398. * - BABYLON.VertexBuffer.UVKind
  6399. * - BABYLON.VertexBuffer.UV2Kind
  6400. * - BABYLON.VertexBuffer.UV3Kind
  6401. * - BABYLON.VertexBuffer.UV4Kind
  6402. * - BABYLON.VertexBuffer.UV5Kind
  6403. * - BABYLON.VertexBuffer.UV6Kind
  6404. * - BABYLON.VertexBuffer.ColorKind
  6405. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6406. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6407. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6408. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6409. */
  6410. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
  6411. /**
  6412. * Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
  6413. * Returns `undefined` if the mesh has no geometry.
  6414. * Possible `kind` values :
  6415. * - BABYLON.VertexBuffer.PositionKind
  6416. * - BABYLON.VertexBuffer.UVKind
  6417. * - BABYLON.VertexBuffer.UV2Kind
  6418. * - BABYLON.VertexBuffer.UV3Kind
  6419. * - BABYLON.VertexBuffer.UV4Kind
  6420. * - BABYLON.VertexBuffer.UV5Kind
  6421. * - BABYLON.VertexBuffer.UV6Kind
  6422. * - BABYLON.VertexBuffer.ColorKind
  6423. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6424. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6425. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6426. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6427. */
  6428. getVertexBuffer(kind: any): VertexBuffer;
  6429. /**
  6430. * Returns a boolean depending on the existence of the Vertex Data for the requested `kind`.
  6431. * Possible `kind` values :
  6432. * - BABYLON.VertexBuffer.PositionKind
  6433. * - BABYLON.VertexBuffer.UVKind
  6434. * - BABYLON.VertexBuffer.UV2Kind
  6435. * - BABYLON.VertexBuffer.UV3Kind
  6436. * - BABYLON.VertexBuffer.UV4Kind
  6437. * - BABYLON.VertexBuffer.UV5Kind
  6438. * - BABYLON.VertexBuffer.UV6Kind
  6439. * - BABYLON.VertexBuffer.ColorKind
  6440. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6441. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6442. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6443. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6444. */
  6445. isVerticesDataPresent(kind: string): boolean;
  6446. /**
  6447. * Returns a string : the list of existing `kinds` of Vertex Data for this mesh.
  6448. * Possible `kind` values :
  6449. * - BABYLON.VertexBuffer.PositionKind
  6450. * - BABYLON.VertexBuffer.UVKind
  6451. * - BABYLON.VertexBuffer.UV2Kind
  6452. * - BABYLON.VertexBuffer.UV3Kind
  6453. * - BABYLON.VertexBuffer.UV4Kind
  6454. * - BABYLON.VertexBuffer.UV5Kind
  6455. * - BABYLON.VertexBuffer.UV6Kind
  6456. * - BABYLON.VertexBuffer.ColorKind
  6457. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6458. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6459. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6460. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6461. */
  6462. getVerticesDataKinds(): string[];
  6463. /**
  6464. * Returns a positive integer : the total number of indices in this mesh geometry.
  6465. * Returns zero if the mesh has no geometry.
  6466. */
  6467. getTotalIndices(): number;
  6468. /**
  6469. * Returns an array of integers or a Int32Array populated with the mesh indices.
  6470. * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  6471. * Returns an empty array if the mesh has no geometry.
  6472. */
  6473. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  6474. isBlocked: boolean;
  6475. /**
  6476. * Boolean : true once the mesh is ready after all the delayed process (loading, etc) are complete.
  6477. */
  6478. isReady(): boolean;
  6479. /**
  6480. * Boolean : true if the mesh has been disposed.
  6481. */
  6482. isDisposed(): boolean;
  6483. /**
  6484. * Sets the mesh side orientation : BABYLON.Mesh.FRONTSIDE, BABYLON.Mesh.BACKSIDE, BABYLON.Mesh.DOUBLESIDE or BABYLON.Mesh.DEFAULTSIDE
  6485. * tuto : http://doc.babylonjs.com/tutorials/Discover_Basic_Elements#side-orientation
  6486. */
  6487. sideOrientation: number;
  6488. /**
  6489. * Boolean : true if the normals aren't to be recomputed on next mesh `positions` array update.
  6490. * This property is pertinent only for updatable parametric shapes.
  6491. */
  6492. areNormalsFrozen: boolean;
  6493. /**
  6494. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6495. * It has no effect at all on other shapes.
  6496. * It prevents the mesh normals from being recomputed on next `positions` array update.
  6497. */
  6498. freezeNormals(): void;
  6499. /**
  6500. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc.
  6501. * It has no effect at all on other shapes.
  6502. * It reactivates the mesh normals computation if it was previously frozen.
  6503. */
  6504. unfreezeNormals(): void;
  6505. /**
  6506. * Overrides instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  6507. */
  6508. overridenInstanceCount: number;
  6509. _preActivate(): void;
  6510. _preActivateForIntermediateRendering(renderId: number): void;
  6511. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void;
  6512. /**
  6513. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  6514. * This means the mesh underlying bounding box and sphere are recomputed.
  6515. */
  6516. refreshBoundingInfo(): void;
  6517. _createGlobalSubMesh(): SubMesh;
  6518. subdivide(count: number): void;
  6519. /**
  6520. * Sets the vertex data of the mesh geometry for the requested `kind`.
  6521. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  6522. * The `data` are either a numeric array either a Float32Array.
  6523. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
  6524. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
  6525. * Note that a new underlying VertexBuffer object is created each call.
  6526. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  6527. *
  6528. * Possible `kind` values :
  6529. * - BABYLON.VertexBuffer.PositionKind
  6530. * - BABYLON.VertexBuffer.UVKind
  6531. * - BABYLON.VertexBuffer.UV2Kind
  6532. * - BABYLON.VertexBuffer.UV3Kind
  6533. * - BABYLON.VertexBuffer.UV4Kind
  6534. * - BABYLON.VertexBuffer.UV5Kind
  6535. * - BABYLON.VertexBuffer.UV6Kind
  6536. * - BABYLON.VertexBuffer.ColorKind
  6537. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6538. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6539. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6540. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6541. */
  6542. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void;
  6543. setVerticesBuffer(buffer: VertexBuffer): void;
  6544. /**
  6545. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  6546. * If the mesh has no geometry, it is simply returned as it is.
  6547. * The `data` are either a numeric array either a Float32Array.
  6548. * No new underlying VertexBuffer object is created.
  6549. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  6550. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
  6551. *
  6552. * Possible `kind` values :
  6553. * - BABYLON.VertexBuffer.PositionKind
  6554. * - BABYLON.VertexBuffer.UVKind
  6555. * - BABYLON.VertexBuffer.UV2Kind
  6556. * - BABYLON.VertexBuffer.UV3Kind
  6557. * - BABYLON.VertexBuffer.UV4Kind
  6558. * - BABYLON.VertexBuffer.UV5Kind
  6559. * - BABYLON.VertexBuffer.UV6Kind
  6560. * - BABYLON.VertexBuffer.ColorKind
  6561. * - BABYLON.VertexBuffer.MatricesIndicesKind
  6562. * - BABYLON.VertexBuffer.MatricesIndicesExtraKind
  6563. * - BABYLON.VertexBuffer.MatricesWeightsKind
  6564. * - BABYLON.VertexBuffer.MatricesWeightsExtraKind
  6565. */
  6566. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  6567. /**
  6568. * Deprecated since BabylonJS v2.3
  6569. */
  6570. updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void;
  6571. /**
  6572. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  6573. * tuto : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions
  6574. * The parameter `positionFunction` is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything.
  6575. * The parameter `computeNormals` is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update.
  6576. */
  6577. updateMeshPositions(positionFunction: any, computeNormals?: boolean): void;
  6578. makeGeometryUnique(): void;
  6579. /**
  6580. * Sets the mesh indices.
  6581. * Expects an array populated with integers or a Int32Array.
  6582. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  6583. * This method creates a new index buffer each call.
  6584. */
  6585. setIndices(indices: number[] | Int32Array, totalVertices?: number): void;
  6586. /**
  6587. * Invert the geometry to move from a right handed system to a left handed one.
  6588. */
  6589. toLeftHanded(): void;
  6590. _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void;
  6591. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void;
  6592. /**
  6593. * Registers for this mesh a javascript function called just before the rendering process.
  6594. * This function is passed the current mesh and doesn't return anything.
  6595. */
  6596. registerBeforeRender(func: (mesh: AbstractMesh) => void): void;
  6597. /**
  6598. * Disposes a previously registered javascript function called before the rendering.
  6599. * This function is passed the current mesh and doesn't return anything.
  6600. */
  6601. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void;
  6602. /**
  6603. * Registers for this mesh a javascript function called just after the rendering is complete.
  6604. * This function is passed the current mesh and doesn't return anything.
  6605. */
  6606. registerAfterRender(func: (mesh: AbstractMesh) => void): void;
  6607. /**
  6608. * Disposes a previously registered javascript function called after the rendering.
  6609. * This function is passed the current mesh and doesn't return anything.
  6610. */
  6611. unregisterAfterRender(func: (mesh: AbstractMesh) => void): void;
  6612. _getInstancesRenderList(subMeshId: number): _InstancesBatch;
  6613. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void;
  6614. _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix, effectiveMaterial?: Material) => void, effectiveMaterial?: Material): void;
  6615. /**
  6616. * Triggers the draw call for the mesh.
  6617. * Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager.
  6618. */
  6619. render(subMesh: SubMesh, enableAlphaMode: boolean): void;
  6620. private _onBeforeDraw(isInstance, world, effectiveMaterial);
  6621. /**
  6622. * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
  6623. */
  6624. getEmittedParticleSystems(): ParticleSystem[];
  6625. /**
  6626. * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
  6627. */
  6628. getHierarchyEmittedParticleSystems(): ParticleSystem[];
  6629. _checkDelayState(): void;
  6630. private _queueLoad(mesh, scene);
  6631. /**
  6632. * Boolean, true is the mesh in the frustum defined by the Plane objects from the `frustumPlanes` array parameter.
  6633. */
  6634. isInFrustum(frustumPlanes: Plane[]): boolean;
  6635. /**
  6636. * Sets the mesh material by the material or multiMaterial `id` property.
  6637. * The material `id` is a string identifying the material or the multiMaterial.
  6638. * This method returns nothing.
  6639. */
  6640. setMaterialByID(id: string): void;
  6641. /**
  6642. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  6643. */
  6644. getAnimatables(): IAnimatable[];
  6645. /**
  6646. * Modifies the mesh geometry according to the passed transformation matrix.
  6647. * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.
  6648. * The mesh normals are modified accordingly the same transformation.
  6649. * tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6650. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6651. */
  6652. bakeTransformIntoVertices(transform: Matrix): void;
  6653. /**
  6654. * Modifies the mesh geometry according to its own current World Matrix.
  6655. * The mesh World Matrix is then reset.
  6656. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  6657. * tuto : tuto : http://doc.babylonjs.com/tutorials/How_Rotations_and_Translations_Work#baking-transform
  6658. * Note that, under the hood, this method sets a new VertexBuffer each call.
  6659. */
  6660. bakeCurrentTransformIntoVertices(): void;
  6661. _resetPointsArrayCache(): void;
  6662. _generatePointsArray(): boolean;
  6663. /**
  6664. * Returns a new Mesh object generated from the current mesh properties.
  6665. * This method must not get confused with createInstance().
  6666. * The parameter `name` is a string, the name given to the new mesh.
  6667. * The optional parameter `newParent` can be any Node object (default `null`).
  6668. * The optional parameter `doNotCloneChildren` (default `false`) allows/denies the recursive cloning of the original mesh children if any.
  6669. * The parameter `clonePhysicsImpostor` (default `true`) allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any.
  6670. */
  6671. clone(name: string, newParent?: Node, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  6672. /**
  6673. * Disposes the mesh.
  6674. * This also frees the memory allocated under the hood to all the buffers used by WebGL.
  6675. */
  6676. dispose(doNotRecurse?: boolean): void;
  6677. /**
  6678. * Modifies the mesh geometry according to a displacement map.
  6679. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  6680. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6681. * This method returns nothing.
  6682. * The parameter `url` is a string, the URL from the image file is to be downloaded.
  6683. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6684. * The parameter `onSuccess` is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
  6685. */
  6686. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void;
  6687. /**
  6688. * Modifies the mesh geometry according to a displacementMap buffer.
  6689. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  6690. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  6691. * This method returns nothing.
  6692. * The parameter `buffer` is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
  6693. * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.
  6694. * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
  6695. */
  6696. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void;
  6697. /**
  6698. * Modify the mesh to get a flat shading rendering.
  6699. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  6700. * This method returns nothing.
  6701. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  6702. */
  6703. convertToFlatShadedMesh(): void;
  6704. /**
  6705. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  6706. * In other words, more vertices, no more indices and a single bigger VBO.
  6707. * This method returns nothing.
  6708. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  6709. *
  6710. */
  6711. convertToUnIndexedMesh(): void;
  6712. /**
  6713. * Inverses facet orientations and inverts also the normals with `flipNormals` (default `false`) if true.
  6714. * This method returns nothing.
  6715. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  6716. */
  6717. flipFaces(flipNormals?: boolean): void;
  6718. /**
  6719. * Creates a new InstancedMesh object from the mesh model.
  6720. * An instance shares the same properties and the same material than its model.
  6721. * Only these properties of each instance can then be set individually :
  6722. * - position
  6723. * - rotation
  6724. * - rotationQuaternion
  6725. * - setPivotMatrix
  6726. * - scaling
  6727. * tuto : http://doc.babylonjs.com/tutorials/How_to_use_Instances
  6728. * Warning : this method is not supported for Line mesh and LineSystem
  6729. */
  6730. createInstance(name: string): InstancedMesh;
  6731. /**
  6732. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  6733. * After this call, all the mesh instances have the same submeshes than the current mesh.
  6734. * This method returns nothing.
  6735. */
  6736. synchronizeInstances(): void;
  6737. /**
  6738. * Simplify the mesh according to the given array of settings.
  6739. * Function will return immediately and will simplify async. It returns nothing.
  6740. * @param settings a collection of simplification settings.
  6741. * @param parallelProcessing should all levels calculate parallel or one after the other.
  6742. * @param type the type of simplification to run.
  6743. * @param successCallback optional success callback to be called after the simplification finished processing all settings.
  6744. */
  6745. simplify(settings: Array<ISimplificationSettings>, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void;
  6746. /**
  6747. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  6748. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  6749. * This should be used together with the simplification to avoid disappearing triangles.
  6750. * @param successCallback an optional success callback to be called after the optimization finished.
  6751. */
  6752. optimizeIndices(successCallback?: (mesh?: Mesh) => void): void;
  6753. /**
  6754. * Returns a new Mesh object what is a deep copy of the passed mesh.
  6755. * The parameter `parsedMesh` is the mesh to be copied.
  6756. * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
  6757. */
  6758. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  6759. /**
  6760. * Creates a ribbon mesh.
  6761. * Please consider using the same method from the MeshBuilder class instead.
  6762. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6763. *
  6764. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  6765. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  6766. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  6767. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  6768. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  6769. * It's the offset to join together the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  6770. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  6771. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6772. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6773. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6774. */
  6775. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6776. /**
  6777. * Creates a plane polygonal mesh. By default, this is a disc.
  6778. * Please consider using the same method from the MeshBuilder class instead.
  6779. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  6780. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  6781. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6782. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6783. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6784. */
  6785. static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6786. /**
  6787. * Creates a box mesh.
  6788. * Please consider using the same method from the MeshBuilder class instead.
  6789. * The parameter `size` sets the size (float) of each box side (default 1).
  6790. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6791. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6792. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6793. */
  6794. static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6795. /**
  6796. * Creates a sphere mesh.
  6797. * Please consider using the same method from the MeshBuilder class instead.
  6798. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  6799. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  6800. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6801. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6802. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6803. */
  6804. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6805. /**
  6806. * Creates a cylinder or a cone mesh.
  6807. * Please consider using the same method from the MeshBuilder class instead.
  6808. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  6809. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  6810. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  6811. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  6812. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  6813. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6814. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6815. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6816. */
  6817. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh;
  6818. /**
  6819. * Creates a torus mesh.
  6820. * Please consider using the same method from the MeshBuilder class instead.
  6821. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  6822. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  6823. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  6824. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6825. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6826. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6827. */
  6828. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6829. /**
  6830. * Creates a torus knot mesh.
  6831. * Please consider using the same method from the MeshBuilder class instead.
  6832. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  6833. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  6834. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  6835. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  6836. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6837. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6838. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6839. */
  6840. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6841. /**
  6842. * Creates a line mesh.
  6843. * Please consider using the same method from the MeshBuilder class instead.
  6844. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6845. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6846. * The parameter `points` is an array successive Vector3.
  6847. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6848. * When updating an instance, remember that only point positions can change, not the number of points.
  6849. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6850. */
  6851. static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6852. /**
  6853. * Creates a dashed line mesh.
  6854. * Please consider using the same method from the MeshBuilder class instead.
  6855. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  6856. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  6857. * The parameter `points` is an array successive Vector3.
  6858. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  6859. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  6860. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  6861. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  6862. * When updating an instance, remember that only point positions can change, not the number of points.
  6863. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6864. */
  6865. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  6866. /**
  6867. * Creates an extruded shape mesh.
  6868. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6869. * Please consider using the same method from the MeshBuilder class instead.
  6870. *
  6871. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6872. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6873. * extruded along the Z axis.
  6874. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6875. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  6876. * The parameter `scale` (float, default 1) is the value to scale the shape.
  6877. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6878. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6879. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6880. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6881. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6882. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6883. */
  6884. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6885. /**
  6886. * Creates an custom extruded shape mesh.
  6887. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6888. * Please consider using the same method from the MeshBuilder class instead.
  6889. *
  6890. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  6891. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  6892. * extruded along the Z axis.
  6893. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  6894. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6895. * and the distance of this point from the begining of the path :
  6896. * ```javascript
  6897. * var rotationFunction = function(i, distance) {
  6898. * // do things
  6899. * return rotationValue; }
  6900. * ```
  6901. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  6902. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  6903. * and the distance of this point from the begining of the path :
  6904. * ```javascript
  6905. * var scaleFunction = function(i, distance) {
  6906. * // do things
  6907. * return scaleValue;}
  6908. * ```
  6909. * It must returns a float value that will be the scale value applied to the shape on each path point.
  6910. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  6911. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  6912. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  6913. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  6914. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  6915. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6916. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6917. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6918. */
  6919. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: Function, rotationFunction: Function, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  6920. /**
  6921. * Creates lathe mesh.
  6922. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  6923. * Please consider using the same method from the MeshBuilder class instead.
  6924. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  6925. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  6926. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  6927. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  6928. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6929. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6930. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6931. */
  6932. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6933. /**
  6934. * Creates a plane mesh.
  6935. * Please consider using the same method from the MeshBuilder class instead.
  6936. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  6937. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  6938. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  6939. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6940. */
  6941. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  6942. /**
  6943. * Creates a ground mesh.
  6944. * Please consider using the same method from the MeshBuilder class instead.
  6945. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  6946. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  6947. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6948. */
  6949. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
  6950. /**
  6951. * Creates a tiled ground mesh.
  6952. * Please consider using the same method from the MeshBuilder class instead.
  6953. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  6954. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  6955. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  6956. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  6957. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  6958. * numbers of subdivisions on the ground width and height of each tile.
  6959. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6960. */
  6961. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  6962. w: number;
  6963. h: number;
  6964. }, precision: {
  6965. w: number;
  6966. h: number;
  6967. }, scene: Scene, updatable?: boolean): Mesh;
  6968. /**
  6969. * Creates a ground mesh from a height map.
  6970. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  6971. * Please consider using the same method from the MeshBuilder class instead.
  6972. * The parameter `url` sets the URL of the height map image resource.
  6973. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  6974. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  6975. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  6976. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  6977. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  6978. * This function is passed the newly built mesh :
  6979. * ```javascript
  6980. * function(mesh) { // do things
  6981. * return; }
  6982. * ```
  6983. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  6984. */
  6985. static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh;
  6986. /**
  6987. * Creates a tube mesh.
  6988. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  6989. * Please consider using the same method from the MeshBuilder class instead.
  6990. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  6991. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  6992. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  6993. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  6994. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  6995. * It must return a radius value (positive float) :
  6996. * ```javascript
  6997. * var radiusFunction = function(i, distance) {
  6998. * // do things
  6999. * return radius; }
  7000. * ```
  7001. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  7002. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  7003. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7004. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7005. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7006. */
  7007. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  7008. (i: number, distance: number): number;
  7009. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  7010. /**
  7011. * Creates a polyhedron mesh.
  7012. * Please consider using the same method from the MeshBuilder class instead.
  7013. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  7014. * to choose the wanted type.
  7015. * The parameter `size` (positive float, default 1) sets the polygon size.
  7016. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  7017. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  7018. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  7019. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  7020. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7021. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  7022. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7023. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7024. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7025. */
  7026. static CreatePolyhedron(name: string, options: {
  7027. type?: number;
  7028. size?: number;
  7029. sizeX?: number;
  7030. sizeY?: number;
  7031. sizeZ?: number;
  7032. custom?: any;
  7033. faceUV?: Vector4[];
  7034. faceColors?: Color4[];
  7035. updatable?: boolean;
  7036. sideOrientation?: number;
  7037. }, scene: Scene): Mesh;
  7038. /**
  7039. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  7040. * Please consider using the same method from the MeshBuilder class instead.
  7041. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  7042. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  7043. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  7044. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  7045. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7046. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7047. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7048. */
  7049. static CreateIcoSphere(name: string, options: {
  7050. radius?: number;
  7051. flat?: boolean;
  7052. subdivisions?: number;
  7053. sideOrientation?: number;
  7054. updatable?: boolean;
  7055. }, scene: Scene): Mesh;
  7056. /**
  7057. * Creates a decal mesh.
  7058. * Please consider using the same method from the MeshBuilder class instead.
  7059. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  7060. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  7061. * The parameter `normal` (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates.
  7062. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  7063. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  7064. */
  7065. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  7066. /**
  7067. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  7068. */
  7069. setPositionsForCPUSkinning(): Float32Array;
  7070. /**
  7071. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  7072. */
  7073. setNormalsForCPUSkinning(): Float32Array;
  7074. /**
  7075. * Update the vertex buffers by applying transformation from the bones
  7076. * @param {skeleton} skeleton to apply
  7077. */
  7078. applySkeleton(skeleton: Skeleton): Mesh;
  7079. /**
  7080. * Returns an object `{min:` Vector3`, max:` Vector3`}`
  7081. * This min and max Vector3 are the minimum and maximum vectors of each mesh bounding box from the passed array, in the World system
  7082. */
  7083. static MinMax(meshes: AbstractMesh[]): {
  7084. min: Vector3;
  7085. max: Vector3;
  7086. };
  7087. /**
  7088. * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
  7089. */
  7090. static Center(meshesOrMinMaxVector: any): Vector3;
  7091. /**
  7092. * Merge the array of meshes into a single mesh for performance reasons.
  7093. * @param {Array<Mesh>} meshes - The vertices source. They should all be of the same material. Entries can empty
  7094. * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
  7095. * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
  7096. * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
  7097. */
  7098. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh;
  7099. }
  7100. }
  7101. declare module BABYLON {
  7102. interface IGetSetVerticesData {
  7103. isVerticesDataPresent(kind: string): boolean;
  7104. getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Int32Array | Float32Array;
  7105. getIndices(copyWhenShared?: boolean): number[] | Int32Array;
  7106. setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
  7107. updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
  7108. setIndices(indices: number[] | Int32Array): void;
  7109. }
  7110. class VertexData {
  7111. positions: number[] | Float32Array;
  7112. normals: number[] | Float32Array;
  7113. uvs: number[] | Float32Array;
  7114. uvs2: number[] | Float32Array;
  7115. uvs3: number[] | Float32Array;
  7116. uvs4: number[] | Float32Array;
  7117. uvs5: number[] | Float32Array;
  7118. uvs6: number[] | Float32Array;
  7119. colors: number[] | Float32Array;
  7120. matricesIndices: number[] | Float32Array;
  7121. matricesWeights: number[] | Float32Array;
  7122. matricesIndicesExtra: number[] | Float32Array;
  7123. matricesWeightsExtra: number[] | Float32Array;
  7124. indices: number[] | Int32Array;
  7125. set(data: number[] | Float32Array, kind: string): void;
  7126. applyToMesh(mesh: Mesh, updatable?: boolean): void;
  7127. applyToGeometry(geometry: Geometry, updatable?: boolean): void;
  7128. updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void;
  7129. updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void;
  7130. private _applyTo(meshOrGeometry, updatable?);
  7131. private _update(meshOrGeometry, updateExtends?, makeItUnique?);
  7132. transform(matrix: Matrix): void;
  7133. merge(other: VertexData): void;
  7134. private _mergeElement(source, other);
  7135. serialize(): any;
  7136. static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData;
  7137. static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData;
  7138. private static _ExtractFrom(meshOrGeometry, copyWhenShared?);
  7139. static CreateRibbon(options: {
  7140. pathArray: Vector3[][];
  7141. closeArray?: boolean;
  7142. closePath?: boolean;
  7143. offset?: number;
  7144. sideOrientation?: number;
  7145. invertUV?: boolean;
  7146. }): VertexData;
  7147. static CreateBox(options: {
  7148. size?: number;
  7149. width?: number;
  7150. height?: number;
  7151. depth?: number;
  7152. faceUV?: Vector4[];
  7153. faceColors?: Color4[];
  7154. sideOrientation?: number;
  7155. }): VertexData;
  7156. static CreateSphere(options: {
  7157. segments?: number;
  7158. diameter?: number;
  7159. diameterX?: number;
  7160. diameterY?: number;
  7161. diameterZ?: number;
  7162. arc?: number;
  7163. slice?: number;
  7164. sideOrientation?: number;
  7165. }): VertexData;
  7166. static CreateCylinder(options: {
  7167. height?: number;
  7168. diameterTop?: number;
  7169. diameterBottom?: number;
  7170. diameter?: number;
  7171. tessellation?: number;
  7172. subdivisions?: number;
  7173. arc?: number;
  7174. faceColors?: Color4[];
  7175. faceUV?: Vector4[];
  7176. hasRings?: boolean;
  7177. enclose?: boolean;
  7178. sideOrientation?: number;
  7179. }): VertexData;
  7180. static CreateTorus(options: {
  7181. diameter?: number;
  7182. thickness?: number;
  7183. tessellation?: number;
  7184. sideOrientation?: number;
  7185. }): VertexData;
  7186. static CreateLineSystem(options: {
  7187. lines: Vector3[][];
  7188. }): VertexData;
  7189. static CreateDashedLines(options: {
  7190. points: Vector3[];
  7191. dashSize?: number;
  7192. gapSize?: number;
  7193. dashNb?: number;
  7194. }): VertexData;
  7195. static CreateGround(options: {
  7196. width?: number;
  7197. height?: number;
  7198. subdivisions?: number;
  7199. subdivisionsX?: number;
  7200. subdivisionsY?: number;
  7201. }): VertexData;
  7202. static CreateTiledGround(options: {
  7203. xmin: number;
  7204. zmin: number;
  7205. xmax: number;
  7206. zmax: number;
  7207. subdivisions?: {
  7208. w: number;
  7209. h: number;
  7210. };
  7211. precision?: {
  7212. w: number;
  7213. h: number;
  7214. };
  7215. }): VertexData;
  7216. static CreateGroundFromHeightMap(options: {
  7217. width: number;
  7218. height: number;
  7219. subdivisions: number;
  7220. minHeight: number;
  7221. maxHeight: number;
  7222. buffer: Uint8Array;
  7223. bufferWidth: number;
  7224. bufferHeight: number;
  7225. }): VertexData;
  7226. static CreatePlane(options: {
  7227. size?: number;
  7228. width?: number;
  7229. height?: number;
  7230. sideOrientation?: number;
  7231. }): VertexData;
  7232. static CreateDisc(options: {
  7233. radius?: number;
  7234. tessellation?: number;
  7235. arc?: number;
  7236. sideOrientation?: number;
  7237. }): VertexData;
  7238. static CreateIcoSphere(options: {
  7239. radius?: number;
  7240. radiusX?: number;
  7241. radiusY?: number;
  7242. radiusZ?: number;
  7243. flat?: boolean;
  7244. subdivisions?: number;
  7245. sideOrientation?: number;
  7246. }): VertexData;
  7247. static CreatePolyhedron(options: {
  7248. type?: number;
  7249. size?: number;
  7250. sizeX?: number;
  7251. sizeY?: number;
  7252. sizeZ?: number;
  7253. custom?: any;
  7254. faceUV?: Vector4[];
  7255. faceColors?: Color4[];
  7256. flat?: boolean;
  7257. sideOrientation?: number;
  7258. }): VertexData;
  7259. static CreateTorusKnot(options: {
  7260. radius?: number;
  7261. tube?: number;
  7262. radialSegments?: number;
  7263. tubularSegments?: number;
  7264. p?: number;
  7265. q?: number;
  7266. sideOrientation?: number;
  7267. }): VertexData;
  7268. /**
  7269. * @param {any} - positions (number[] or Float32Array)
  7270. * @param {any} - indices (number[] or Uint16Array)
  7271. * @param {any} - normals (number[] or Float32Array)
  7272. */
  7273. static ComputeNormals(positions: any, indices: any, normals: any): void;
  7274. private static _ComputeSides(sideOrientation, positions, indices, normals, uvs);
  7275. static ImportVertexData(parsedVertexData: any, geometry: Geometry): void;
  7276. }
  7277. }
  7278. declare module BABYLON {
  7279. class MeshBuilder {
  7280. private static updateSideOrientation(orientation, scene);
  7281. /**
  7282. * Creates a box mesh.
  7283. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#box
  7284. * The parameter `size` sets the size (float) of each box side (default 1).
  7285. * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value than `size`).
  7286. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
  7287. * Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7288. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7289. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7290. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7291. */
  7292. static CreateBox(name: string, options: {
  7293. size?: number;
  7294. width?: number;
  7295. height?: number;
  7296. depth?: number;
  7297. faceUV?: Vector4[];
  7298. faceColors?: Color4[];
  7299. sideOrientation?: number;
  7300. updatable?: boolean;
  7301. }, scene: Scene): Mesh;
  7302. /**
  7303. * Creates a sphere mesh.
  7304. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#sphere
  7305. * The parameter `diameter` sets the diameter size (float) of the sphere (default 1).
  7306. * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value than `diameter`).
  7307. * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32).
  7308. * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  7309. * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
  7310. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7311. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7312. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7313. */
  7314. static CreateSphere(name: string, options: {
  7315. segments?: number;
  7316. diameter?: number;
  7317. diameterX?: number;
  7318. diameterY?: number;
  7319. diameterZ?: number;
  7320. arc?: number;
  7321. slice?: number;
  7322. sideOrientation?: number;
  7323. updatable?: boolean;
  7324. }, scene: any): Mesh;
  7325. /**
  7326. * Creates a plane polygonal mesh. By default, this is a disc.
  7327. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#disc
  7328. * The parameter `radius` sets the radius size (float) of the polygon (default 0.5).
  7329. * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
  7330. * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
  7331. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7332. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7333. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7334. */
  7335. static CreateDisc(name: string, options: {
  7336. radius?: number;
  7337. tessellation?: number;
  7338. arc?: number;
  7339. updatable?: boolean;
  7340. sideOrientation?: number;
  7341. }, scene: Scene): Mesh;
  7342. /**
  7343. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided.
  7344. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#icosphere
  7345. * The parameter `radius` sets the radius size (float) of the icosphere (default 1).
  7346. * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`).
  7347. * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
  7348. * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
  7349. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7350. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7351. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7352. */
  7353. static CreateIcoSphere(name: string, options: {
  7354. radius?: number;
  7355. radiusX?: number;
  7356. radiusY?: number;
  7357. radiusZ?: number;
  7358. flat?: boolean;
  7359. subdivisions?: number;
  7360. sideOrientation?: number;
  7361. updatable?: boolean;
  7362. }, scene: Scene): Mesh;
  7363. /**
  7364. * Creates a ribbon mesh.
  7365. * The ribbon is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  7366. *
  7367. * Please read this full tutorial to understand how to design a ribbon : http://doc.babylonjs.com/tutorials/Ribbon_Tutorial
  7368. * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  7369. * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
  7370. * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
  7371. * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path.
  7372. * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
  7373. * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
  7374. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7375. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7376. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7377. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7378. */
  7379. static CreateRibbon(name: string, options: {
  7380. pathArray: Vector3[][];
  7381. closeArray?: boolean;
  7382. closePath?: boolean;
  7383. offset?: number;
  7384. updatable?: boolean;
  7385. sideOrientation?: number;
  7386. instance?: Mesh;
  7387. invertUV?: boolean;
  7388. }, scene?: Scene): Mesh;
  7389. /**
  7390. * Creates a cylinder or a cone mesh.
  7391. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#cylinder-or-cone
  7392. * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).
  7393. * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).
  7394. * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
  7395. * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
  7396. * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).
  7397. * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
  7398. * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
  7399. * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
  7400. * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).
  7401. * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
  7402. * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
  7403. * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
  7404. * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
  7405. * If `enclose` is false, a ring surface is one element.
  7406. * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
  7407. * Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
  7408. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7409. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7410. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7411. */
  7412. static CreateCylinder(name: string, options: {
  7413. height?: number;
  7414. diameterTop?: number;
  7415. diameterBottom?: number;
  7416. diameter?: number;
  7417. tessellation?: number;
  7418. subdivisions?: number;
  7419. arc?: number;
  7420. faceColors?: Color4[];
  7421. faceUV?: Vector4[];
  7422. updatable?: boolean;
  7423. hasRings?: boolean;
  7424. enclose?: boolean;
  7425. sideOrientation?: number;
  7426. }, scene: any): Mesh;
  7427. /**
  7428. * Creates a torus mesh.
  7429. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus
  7430. * The parameter `diameter` sets the diameter size (float) of the torus (default 1).
  7431. * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
  7432. * The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
  7433. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7434. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7435. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7436. */
  7437. static CreateTorus(name: string, options: {
  7438. diameter?: number;
  7439. thickness?: number;
  7440. tessellation?: number;
  7441. updatable?: boolean;
  7442. sideOrientation?: number;
  7443. }, scene: any): Mesh;
  7444. /**
  7445. * Creates a torus knot mesh.
  7446. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#torus-knot
  7447. * The parameter `radius` sets the global radius size (float) of the torus knot (default 2).
  7448. * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32).
  7449. * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
  7450. * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
  7451. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7452. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7453. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7454. */
  7455. static CreateTorusKnot(name: string, options: {
  7456. radius?: number;
  7457. tube?: number;
  7458. radialSegments?: number;
  7459. tubularSegments?: number;
  7460. p?: number;
  7461. q?: number;
  7462. updatable?: boolean;
  7463. sideOrientation?: number;
  7464. }, scene: any): Mesh;
  7465. /**
  7466. * Creates a line system mesh.
  7467. * A line system is a pool of many lines gathered in a single mesh.
  7468. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#linesystem
  7469. * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter.
  7470. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function.
  7471. * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
  7472. * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
  7473. * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  7474. * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
  7475. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7476. */
  7477. static CreateLineSystem(name: string, options: {
  7478. lines: Vector3[][];
  7479. updatable: boolean;
  7480. instance?: LinesMesh;
  7481. }, scene: Scene): LinesMesh;
  7482. /**
  7483. * Creates a line mesh.
  7484. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lines
  7485. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  7486. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7487. * The parameter `points` is an array successive Vector3.
  7488. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  7489. * When updating an instance, remember that only point positions can change, not the number of points.
  7490. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7491. */
  7492. static CreateLines(name: string, options: {
  7493. points: Vector3[];
  7494. updatable?: boolean;
  7495. instance?: LinesMesh;
  7496. }, scene: Scene): LinesMesh;
  7497. /**
  7498. * Creates a dashed line mesh.
  7499. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#dashed-lines
  7500. * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter.
  7501. * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function.
  7502. * The parameter `points` is an array successive Vector3.
  7503. * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200).
  7504. * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3).
  7505. * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1).
  7506. * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
  7507. * When updating an instance, remember that only point positions can change, not the number of points.
  7508. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7509. */
  7510. static CreateDashedLines(name: string, options: {
  7511. points: Vector3[];
  7512. dashSize?: number;
  7513. gapSize?: number;
  7514. dashNb?: number;
  7515. updatable?: boolean;
  7516. instance?: LinesMesh;
  7517. }, scene: Scene): LinesMesh;
  7518. /**
  7519. * Creates an extruded shape mesh.
  7520. * The extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  7521. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#extruded-shapes
  7522. *
  7523. * Please read this full tutorial to understand how to design an extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7524. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  7525. * extruded along the Z axis.
  7526. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7527. * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
  7528. * The parameter `scale` (float, default 1) is the value to scale the shape.
  7529. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  7530. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  7531. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7532. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7533. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7534. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7535. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7536. */
  7537. static ExtrudeShape(name: string, options: {
  7538. shape: Vector3[];
  7539. path: Vector3[];
  7540. scale?: number;
  7541. rotation?: number;
  7542. cap?: number;
  7543. updatable?: boolean;
  7544. sideOrientation?: number;
  7545. instance?: Mesh;
  7546. invertUV?: boolean;
  7547. }, scene: Scene): Mesh;
  7548. /**
  7549. * Creates an custom extruded shape mesh.
  7550. * The custom extrusion is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  7551. * tuto :http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#custom-extruded-shapes
  7552. *
  7553. * Please read this full tutorial to understand how to design a custom extruded shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusion
  7554. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be
  7555. * extruded along the Z axis.
  7556. * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.
  7557. * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  7558. * and the distance of this point from the begining of the path :
  7559. * ```javascript
  7560. * var rotationFunction = function(i, distance) {
  7561. * // do things
  7562. * return rotationValue; }
  7563. * ```
  7564. * It must returns a float value that will be the rotation in radians applied to the shape on each path point.
  7565. * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path
  7566. * and the distance of this point from the begining of the path :
  7567. * ```javascript
  7568. * var scaleFunction = function(i, distance) {
  7569. * // do things
  7570. * return scaleValue;}
  7571. * ```
  7572. * It must returns a float value that will be the scale value applied to the shape on each path point.
  7573. * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`.
  7574. * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`.
  7575. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  7576. * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
  7577. * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
  7578. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7579. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7580. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7581. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7582. */
  7583. static ExtrudeShapeCustom(name: string, options: {
  7584. shape: Vector3[];
  7585. path: Vector3[];
  7586. scaleFunction?: any;
  7587. rotationFunction?: any;
  7588. ribbonCloseArray?: boolean;
  7589. ribbonClosePath?: boolean;
  7590. cap?: number;
  7591. updatable?: boolean;
  7592. sideOrientation?: number;
  7593. instance?: Mesh;
  7594. invertUV?: boolean;
  7595. }, scene: Scene): Mesh;
  7596. /**
  7597. * Creates lathe mesh.
  7598. * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
  7599. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
  7600. *
  7601. * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
  7602. * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
  7603. * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
  7604. * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
  7605. * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
  7606. * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
  7607. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  7608. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7609. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7610. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7611. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7612. */
  7613. static CreateLathe(name: string, options: {
  7614. shape: Vector3[];
  7615. radius?: number;
  7616. tessellation?: number;
  7617. arc?: number;
  7618. closed?: boolean;
  7619. updatable?: boolean;
  7620. sideOrientation?: number;
  7621. cap?: number;
  7622. invertUV?: boolean;
  7623. }, scene: Scene): Mesh;
  7624. /**
  7625. * Creates a plane mesh.
  7626. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7627. * The parameter `size` sets the size (float) of both sides of the plane at once (default 1).
  7628. * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
  7629. * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
  7630. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7631. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7632. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7633. */
  7634. static CreatePlane(name: string, options: {
  7635. size?: number;
  7636. width?: number;
  7637. height?: number;
  7638. sideOrientation?: number;
  7639. updatable?: boolean;
  7640. sourcePlane?: Plane;
  7641. }, scene: Scene): Mesh;
  7642. /**
  7643. * Creates a ground mesh.
  7644. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#plane
  7645. * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground.
  7646. * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side.
  7647. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7648. */
  7649. static CreateGround(name: string, options: {
  7650. width?: number;
  7651. height?: number;
  7652. subdivisions?: number;
  7653. subdivisionsX?: number;
  7654. subdivisionsY?: number;
  7655. updatable?: boolean;
  7656. }, scene: any): Mesh;
  7657. /**
  7658. * Creates a tiled ground mesh.
  7659. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tiled-ground
  7660. * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates.
  7661. * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates.
  7662. * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the
  7663. * numbers of subdivisions on the ground width and height. Each subdivision is called a tile.
  7664. * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the
  7665. * numbers of subdivisions on the ground width and height of each tile.
  7666. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7667. */
  7668. static CreateTiledGround(name: string, options: {
  7669. xmin: number;
  7670. zmin: number;
  7671. xmax: number;
  7672. zmax: number;
  7673. subdivisions?: {
  7674. w: number;
  7675. h: number;
  7676. };
  7677. precision?: {
  7678. w: number;
  7679. h: number;
  7680. };
  7681. updatable?: boolean;
  7682. }, scene: Scene): Mesh;
  7683. /**
  7684. * Creates a ground mesh from a height map.
  7685. * tuto : http://doc.babylonjs.com/tutorials/14._Height_Map
  7686. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#ground-from-a-height-map
  7687. * The parameter `url` sets the URL of the height map image resource.
  7688. * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.
  7689. * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.
  7690. * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.
  7691. * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.
  7692. * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
  7693. * This function is passed the newly built mesh :
  7694. * ```javascript
  7695. * function(mesh) { // do things
  7696. * return; }
  7697. * ```
  7698. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7699. */
  7700. static CreateGroundFromHeightMap(name: string, url: string, options: {
  7701. width?: number;
  7702. height?: number;
  7703. subdivisions?: number;
  7704. minHeight?: number;
  7705. maxHeight?: number;
  7706. updatable?: boolean;
  7707. onReady?: (mesh: GroundMesh) => void;
  7708. }, scene: Scene): GroundMesh;
  7709. /**
  7710. * Creates a tube mesh.
  7711. * The tube is a parametric shape : http://doc.babylonjs.com/tutorials/Parametric_Shapes. It has no predefined shape. Its final shape will depend on the input parameters.
  7712. *
  7713. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
  7714. * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube.
  7715. * The parameter `radius` (positive float, default 1) sets the tube radius size.
  7716. * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
  7717. * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
  7718. * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
  7719. * It must return a radius value (positive float) :
  7720. * ```javascript
  7721. * var radiusFunction = function(i, distance) {
  7722. * // do things
  7723. * return radius; }
  7724. * ```
  7725. * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
  7726. * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  7727. * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
  7728. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7729. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7730. * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
  7731. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7732. */
  7733. static CreateTube(name: string, options: {
  7734. path: Vector3[];
  7735. radius?: number;
  7736. tessellation?: number;
  7737. radiusFunction?: {
  7738. (i: number, distance: number): number;
  7739. };
  7740. cap?: number;
  7741. arc?: number;
  7742. updatable?: boolean;
  7743. sideOrientation?: number;
  7744. instance?: Mesh;
  7745. invertUV?: boolean;
  7746. }, scene: Scene): Mesh;
  7747. /**
  7748. * Creates a polyhedron mesh.
  7749. *
  7750. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
  7751. * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
  7752. * to choose the wanted type.
  7753. * The parameter `size` (positive float, default 1) sets the polygon size.
  7754. * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
  7755. * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
  7756. * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
  7757. * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`).
  7758. * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
  7759. * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
  7760. * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  7761. * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
  7762. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  7763. */
  7764. static CreatePolyhedron(name: string, options: {
  7765. type?: number;
  7766. size?: number;
  7767. sizeX?: number;
  7768. sizeY?: number;
  7769. sizeZ?: number;
  7770. custom?: any;
  7771. faceUV?: Vector4[];
  7772. faceColors?: Color4[];
  7773. flat?: boolean;
  7774. updatable?: boolean;
  7775. sideOrientation?: number;
  7776. }, scene: Scene): Mesh;
  7777. /**
  7778. * Creates a decal mesh.
  7779. * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
  7780. * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
  7781. * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
  7782. * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
  7783. * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling.
  7784. * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
  7785. */
  7786. static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {
  7787. position?: Vector3;
  7788. normal?: Vector3;
  7789. size?: Vector3;
  7790. angle?: number;
  7791. }): Mesh;
  7792. private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV);
  7793. }
  7794. }
  7795. declare module BABYLON.Internals {
  7796. class MeshLODLevel {
  7797. distance: number;
  7798. mesh: Mesh;
  7799. constructor(distance: number, mesh: Mesh);
  7800. }
  7801. }
  7802. declare module BABYLON {
  7803. /**
  7804. * A simplifier interface for future simplification implementations.
  7805. */
  7806. interface ISimplifier {
  7807. /**
  7808. * Simplification of a given mesh according to the given settings.
  7809. * Since this requires computation, it is assumed that the function runs async.
  7810. * @param settings The settings of the simplification, including quality and distance
  7811. * @param successCallback A callback that will be called after the mesh was simplified.
  7812. * @param errorCallback in case of an error, this callback will be called. optional.
  7813. */
  7814. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void;
  7815. }
  7816. /**
  7817. * Expected simplification settings.
  7818. * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
  7819. */
  7820. interface ISimplificationSettings {
  7821. quality: number;
  7822. distance: number;
  7823. optimizeMesh?: boolean;
  7824. }
  7825. class SimplificationSettings implements ISimplificationSettings {
  7826. quality: number;
  7827. distance: number;
  7828. optimizeMesh: boolean;
  7829. constructor(quality: number, distance: number, optimizeMesh?: boolean);
  7830. }
  7831. interface ISimplificationTask {
  7832. settings: Array<ISimplificationSettings>;
  7833. simplificationType: SimplificationType;
  7834. mesh: Mesh;
  7835. successCallback?: () => void;
  7836. parallelProcessing: boolean;
  7837. }
  7838. class SimplificationQueue {
  7839. private _simplificationArray;
  7840. running: any;
  7841. constructor();
  7842. addTask(task: ISimplificationTask): void;
  7843. executeNext(): void;
  7844. runSimplification(task: ISimplificationTask): void;
  7845. private getSimplifier(task);
  7846. }
  7847. /**
  7848. * The implemented types of simplification.
  7849. * At the moment only Quadratic Error Decimation is implemented.
  7850. */
  7851. enum SimplificationType {
  7852. QUADRATIC = 0,
  7853. }
  7854. class DecimationTriangle {
  7855. vertices: Array<DecimationVertex>;
  7856. normal: Vector3;
  7857. error: Array<number>;
  7858. deleted: boolean;
  7859. isDirty: boolean;
  7860. borderFactor: number;
  7861. deletePending: boolean;
  7862. originalOffset: number;
  7863. constructor(vertices: Array<DecimationVertex>);
  7864. }
  7865. class DecimationVertex {
  7866. position: Vector3;
  7867. id: any;
  7868. q: QuadraticMatrix;
  7869. isBorder: boolean;
  7870. triangleStart: number;
  7871. triangleCount: number;
  7872. originalOffsets: Array<number>;
  7873. constructor(position: Vector3, id: any);
  7874. updatePosition(newPosition: Vector3): void;
  7875. }
  7876. class QuadraticMatrix {
  7877. data: Array<number>;
  7878. constructor(data?: Array<number>);
  7879. det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number;
  7880. addInPlace(matrix: QuadraticMatrix): void;
  7881. addArrayInPlace(data: Array<number>): void;
  7882. add(matrix: QuadraticMatrix): QuadraticMatrix;
  7883. static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix;
  7884. static DataFromNumbers(a: number, b: number, c: number, d: number): number[];
  7885. }
  7886. class Reference {
  7887. vertexId: number;
  7888. triangleId: number;
  7889. constructor(vertexId: number, triangleId: number);
  7890. }
  7891. /**
  7892. * An implementation of the Quadratic Error simplification algorithm.
  7893. * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
  7894. * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
  7895. * @author RaananW
  7896. */
  7897. class QuadraticErrorSimplification implements ISimplifier {
  7898. private _mesh;
  7899. private triangles;
  7900. private vertices;
  7901. private references;
  7902. private initialized;
  7903. private _reconstructedMesh;
  7904. syncIterations: number;
  7905. aggressiveness: number;
  7906. decimationIterations: number;
  7907. boundingBoxEpsilon: number;
  7908. constructor(_mesh: Mesh);
  7909. simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void;
  7910. private isTriangleOnBoundingBox(triangle);
  7911. private runDecimation(settings, submeshIndex, successCallback);
  7912. private initWithMesh(submeshIndex, callback, optimizeMesh?);
  7913. private init(callback);
  7914. private reconstructMesh(submeshIndex);
  7915. private initDecimatedMesh();
  7916. private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr);
  7917. private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles);
  7918. private identifyBorder();
  7919. private updateMesh(identifyBorders?);
  7920. private vertexError(q, point);
  7921. private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?);
  7922. }
  7923. }
  7924. declare module BABYLON {
  7925. class Polygon {
  7926. static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
  7927. static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
  7928. static Parse(input: string): Vector2[];
  7929. static StartingAt(x: number, y: number): Path2;
  7930. }
  7931. class PolygonMeshBuilder {
  7932. private _points;
  7933. private _outlinepoints;
  7934. private _holes;
  7935. private _name;
  7936. private _scene;
  7937. private _epoints;
  7938. private _eholes;
  7939. private _addToepoint(points);
  7940. constructor(name: string, contours: Path2, scene: Scene);
  7941. constructor(name: string, contours: Vector2[], scene: Scene);
  7942. addHole(hole: Vector2[]): PolygonMeshBuilder;
  7943. build(updatable?: boolean, depth?: number): Mesh;
  7944. private addSide(positions, normals, uvs, indices, bounds, points, depth, flip);
  7945. }
  7946. }
  7947. declare module BABYLON {
  7948. class SubMesh implements ICullable {
  7949. materialIndex: number;
  7950. verticesStart: number;
  7951. verticesCount: number;
  7952. indexStart: any;
  7953. indexCount: number;
  7954. linesIndexCount: number;
  7955. private _mesh;
  7956. private _renderingMesh;
  7957. private _boundingInfo;
  7958. private _linesIndexBuffer;
  7959. _lastColliderWorldVertices: Vector3[];
  7960. _trianglePlanes: Plane[];
  7961. _lastColliderTransformMatrix: Matrix;
  7962. _renderId: number;
  7963. _alphaIndex: number;
  7964. _distanceToCamera: number;
  7965. _id: number;
  7966. constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean);
  7967. IsGlobal: boolean;
  7968. getBoundingInfo(): BoundingInfo;
  7969. getMesh(): AbstractMesh;
  7970. getRenderingMesh(): Mesh;
  7971. getMaterial(): Material;
  7972. refreshBoundingInfo(): void;
  7973. _checkCollision(collider: Collider): boolean;
  7974. updateBoundingInfo(world: Matrix): void;
  7975. isInFrustum(frustumPlanes: Plane[]): boolean;
  7976. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  7977. render(enableAlphaMode: boolean): void;
  7978. getLinesIndexBuffer(indices: number[] | Int32Array, engine: Engine): WebGLBuffer;
  7979. canIntersects(ray: Ray): boolean;
  7980. intersects(ray: Ray, positions: Vector3[], indices: number[] | Int32Array, fastCheck?: boolean): IntersectionInfo;
  7981. clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh;
  7982. dispose(): void;
  7983. static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh;
  7984. }
  7985. }
  7986. declare module BABYLON {
  7987. class VertexBuffer {
  7988. private _buffer;
  7989. private _kind;
  7990. private _offset;
  7991. private _size;
  7992. private _stride;
  7993. private _ownsBuffer;
  7994. constructor(engine: any, data: number[] | Float32Array | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number);
  7995. getKind(): string;
  7996. isUpdatable(): boolean;
  7997. getData(): number[] | Float32Array;
  7998. getBuffer(): WebGLBuffer;
  7999. getStrideSize(): number;
  8000. getOffset(): number;
  8001. getSize(): number;
  8002. getIsInstanced(): boolean;
  8003. create(data?: number[] | Float32Array): void;
  8004. update(data: number[] | Float32Array): void;
  8005. updateDirectly(data: Float32Array, offset: number): void;
  8006. dispose(): void;
  8007. private static _PositionKind;
  8008. private static _NormalKind;
  8009. private static _UVKind;
  8010. private static _UV2Kind;
  8011. private static _UV3Kind;
  8012. private static _UV4Kind;
  8013. private static _UV5Kind;
  8014. private static _UV6Kind;
  8015. private static _ColorKind;
  8016. private static _MatricesIndicesKind;
  8017. private static _MatricesWeightsKind;
  8018. private static _MatricesIndicesExtraKind;
  8019. private static _MatricesWeightsExtraKind;
  8020. static PositionKind: string;
  8021. static NormalKind: string;
  8022. static UVKind: string;
  8023. static UV2Kind: string;
  8024. static UV3Kind: string;
  8025. static UV4Kind: string;
  8026. static UV5Kind: string;
  8027. static UV6Kind: string;
  8028. static ColorKind: string;
  8029. static MatricesIndicesKind: string;
  8030. static MatricesWeightsKind: string;
  8031. static MatricesIndicesExtraKind: string;
  8032. static MatricesWeightsExtraKind: string;
  8033. }
  8034. }
  8035. declare module BABYLON {
  8036. class Particle {
  8037. position: Vector3;
  8038. direction: Vector3;
  8039. color: Color4;
  8040. colorStep: Color4;
  8041. lifeTime: number;
  8042. age: number;
  8043. size: number;
  8044. angle: number;
  8045. angularSpeed: number;
  8046. copyTo(other: Particle): void;
  8047. }
  8048. }
  8049. declare module BABYLON {
  8050. class ParticleSystem implements IDisposable, IAnimatable {
  8051. name: string;
  8052. static BLENDMODE_ONEONE: number;
  8053. static BLENDMODE_STANDARD: number;
  8054. animations: Animation[];
  8055. id: string;
  8056. renderingGroupId: number;
  8057. emitter: any;
  8058. emitRate: number;
  8059. manualEmitCount: number;
  8060. updateSpeed: number;
  8061. targetStopDuration: number;
  8062. disposeOnStop: boolean;
  8063. minEmitPower: number;
  8064. maxEmitPower: number;
  8065. minLifeTime: number;
  8066. maxLifeTime: number;
  8067. minSize: number;
  8068. maxSize: number;
  8069. minAngularSpeed: number;
  8070. maxAngularSpeed: number;
  8071. particleTexture: Texture;
  8072. layerMask: number;
  8073. /**
  8074. * An event triggered when the system is disposed.
  8075. * @type {BABYLON.Observable}
  8076. */
  8077. onDisposeObservable: Observable<ParticleSystem>;
  8078. private _onDisposeObserver;
  8079. onDispose: () => void;
  8080. updateFunction: (particles: Particle[]) => void;
  8081. blendMode: number;
  8082. forceDepthWrite: boolean;
  8083. gravity: Vector3;
  8084. direction1: Vector3;
  8085. direction2: Vector3;
  8086. minEmitBox: Vector3;
  8087. maxEmitBox: Vector3;
  8088. color1: Color4;
  8089. color2: Color4;
  8090. colorDead: Color4;
  8091. textureMask: Color4;
  8092. startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle) => void;
  8093. startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle) => void;
  8094. private particles;
  8095. private _capacity;
  8096. private _scene;
  8097. private _stockParticles;
  8098. private _newPartsExcess;
  8099. private _vertexData;
  8100. private _vertexBuffer;
  8101. private _vertexBuffers;
  8102. private _indexBuffer;
  8103. private _effect;
  8104. private _customEffect;
  8105. private _cachedDefines;
  8106. private _scaledColorStep;
  8107. private _colorDiff;
  8108. private _scaledDirection;
  8109. private _scaledGravity;
  8110. private _currentRenderId;
  8111. private _alive;
  8112. private _started;
  8113. private _stopped;
  8114. private _actualFrame;
  8115. private _scaledUpdateSpeed;
  8116. constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
  8117. recycleParticle(particle: Particle): void;
  8118. getCapacity(): number;
  8119. isAlive(): boolean;
  8120. isStarted(): boolean;
  8121. start(): void;
  8122. stop(): void;
  8123. _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
  8124. private _update(newParticles);
  8125. private _getEffect();
  8126. animate(): void;
  8127. render(): number;
  8128. dispose(): void;
  8129. clone(name: string, newEmitter: any): ParticleSystem;
  8130. serialize(): any;
  8131. static Parse(parsedParticleSystem: any, scene: Scene, rootUrl: string): ParticleSystem;
  8132. }
  8133. }
  8134. declare module BABYLON {
  8135. class SolidParticle {
  8136. idx: number;
  8137. color: Color4;
  8138. position: Vector3;
  8139. rotation: Vector3;
  8140. rotationQuaternion: Quaternion;
  8141. scaling: Vector3;
  8142. uvs: Vector4;
  8143. velocity: Vector3;
  8144. alive: boolean;
  8145. isVisible: boolean;
  8146. _pos: number;
  8147. _model: ModelShape;
  8148. shapeId: number;
  8149. idxInShape: number;
  8150. _modelBoundingInfo: BoundingInfo;
  8151. _boundingInfo: BoundingInfo;
  8152. _sps: SolidParticleSystem;
  8153. /**
  8154. * Creates a Solid Particle object.
  8155. * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
  8156. * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
  8157. * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
  8158. * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
  8159. * `shapeId` (integer) is the model shape identifier in the SPS.
  8160. * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
  8161. * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
  8162. */
  8163. constructor(particleIndex: number, positionIndex: number, model: ModelShape, shapeId: number, idxInShape: number, sps: SolidParticleSystem, modelBoundingInfo?: BoundingInfo);
  8164. /**
  8165. * legacy support, changed scale to scaling
  8166. */
  8167. scale: Vector3;
  8168. /**
  8169. * legacy support, changed quaternion to rotationQuaternion
  8170. */
  8171. quaternion: Quaternion;
  8172. /**
  8173. * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
  8174. * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
  8175. * `target` is the object (solid particle or mesh) what the intersection is computed against.
  8176. */
  8177. intersectsMesh(target: Mesh | SolidParticle): boolean;
  8178. }
  8179. class ModelShape {
  8180. shapeID: number;
  8181. _shape: Vector3[];
  8182. _shapeUV: number[];
  8183. _positionFunction: (particle: SolidParticle, i: number, s: number) => void;
  8184. _vertexFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void;
  8185. /**
  8186. * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.
  8187. * SPS internal tool, don't use it manually.
  8188. */
  8189. constructor(id: number, shape: Vector3[], shapeUV: number[], posFunction: (particle: SolidParticle, i: number, s: number) => void, vtxFunction: (particle: SolidParticle, vertex: Vector3, i: number) => void);
  8190. }
  8191. }
  8192. declare module BABYLON {
  8193. /**
  8194. * Full documentation here : http://doc.babylonjs.com/overviews/Solid_Particle_System
  8195. */
  8196. class SolidParticleSystem implements IDisposable {
  8197. /**
  8198. * The SPS array of Solid Particle objects. Just access each particle as with any classic array.
  8199. * Example : var p = SPS.particles[i];
  8200. */
  8201. particles: SolidParticle[];
  8202. /**
  8203. * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.
  8204. */
  8205. nbParticles: number;
  8206. /**
  8207. * If the particles must ever face the camera (default false). Useful for planar particles.
  8208. */
  8209. billboard: boolean;
  8210. /**
  8211. * Recompute normals when adding a shape
  8212. */
  8213. recomputeNormals: boolean;
  8214. /**
  8215. * This a counter ofr your own usage. It's not set by any SPS functions.
  8216. */
  8217. counter: number;
  8218. /**
  8219. * The SPS name. This name is also given to the underlying mesh.
  8220. */
  8221. name: string;
  8222. /**
  8223. * The SPS mesh. It's a standard BJS Mesh, so all the methods from the Mesh class are avalaible.
  8224. */
  8225. mesh: Mesh;
  8226. /**
  8227. * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.
  8228. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#garbage-collector-concerns
  8229. */
  8230. vars: any;
  8231. /**
  8232. * This array is populated when the SPS is set as 'pickable'.
  8233. * Each key of this array is a `faceId` value that you can get from a pickResult object.
  8234. * Each element of this array is an object `{idx: int, faceId: int}`.
  8235. * `idx` is the picked particle index in the `SPS.particles` array
  8236. * `faceId` is the picked face index counted within this particle.
  8237. * Please read : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles
  8238. */
  8239. pickedParticles: {
  8240. idx: number;
  8241. faceId: number;
  8242. }[];
  8243. private _scene;
  8244. private _positions;
  8245. private _indices;
  8246. private _normals;
  8247. private _colors;
  8248. private _uvs;
  8249. private _positions32;
  8250. private _normals32;
  8251. private _fixedNormal32;
  8252. private _colors32;
  8253. private _uvs32;
  8254. private _index;
  8255. private _updatable;
  8256. private _pickable;
  8257. private _isVisibilityBoxLocked;
  8258. private _alwaysVisible;
  8259. private _shapeCounter;
  8260. private _copy;
  8261. private _shape;
  8262. private _shapeUV;
  8263. private _color;
  8264. private _computeParticleColor;
  8265. private _computeParticleTexture;
  8266. private _computeParticleRotation;
  8267. private _computeParticleVertex;
  8268. private _computeBoundingBox;
  8269. private _cam_axisZ;
  8270. private _cam_axisY;
  8271. private _cam_axisX;
  8272. private _axisX;
  8273. private _axisY;
  8274. private _axisZ;
  8275. private _camera;
  8276. private _particle;
  8277. private _camDir;
  8278. private _rotMatrix;
  8279. private _invertMatrix;
  8280. private _rotated;
  8281. private _quaternion;
  8282. private _vertex;
  8283. private _normal;
  8284. private _yaw;
  8285. private _pitch;
  8286. private _roll;
  8287. private _halfroll;
  8288. private _halfpitch;
  8289. private _halfyaw;
  8290. private _sinRoll;
  8291. private _cosRoll;
  8292. private _sinPitch;
  8293. private _cosPitch;
  8294. private _sinYaw;
  8295. private _cosYaw;
  8296. private _w;
  8297. private _minimum;
  8298. private _maximum;
  8299. private _scale;
  8300. private _translation;
  8301. private _minBbox;
  8302. private _maxBbox;
  8303. private _particlesIntersect;
  8304. _bSphereOnly: boolean;
  8305. _bSphereRadiusFactor: number;
  8306. /**
  8307. * Creates a SPS (Solid Particle System) object.
  8308. * `name` (String) is the SPS name, this will be the underlying mesh name.
  8309. * `scene` (Scene) is the scene in which the SPS is added.
  8310. * `updatable` (optional boolean, default true) : if the SPS must be updatable or immutable.
  8311. * `isPickable` (optional boolean, default false) : if the solid particles must be pickable.
  8312. * `particleIntersection` (optional boolean, default false) : if the solid particle intersections must be computed.
  8313. * `boundingSphereOnly` (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
  8314. * `bSphereRadiusFactor` (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
  8315. * Example : bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
  8316. */
  8317. constructor(name: string, scene: Scene, options?: {
  8318. updatable?: boolean;
  8319. isPickable?: boolean;
  8320. particleIntersection?: boolean;
  8321. boundingSphereOnly?: boolean;
  8322. bSphereRadiusFactor?: number;
  8323. });
  8324. /**
  8325. * Builds the SPS underlying mesh. Returns a standard Mesh.
  8326. * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
  8327. */
  8328. buildMesh(): Mesh;
  8329. /**
  8330. * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
  8331. * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
  8332. * Thus the particles generated from `digest()` have their property `position` set yet.
  8333. * `mesh` ( Mesh ) is the mesh to be digested
  8334. * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
  8335. * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
  8336. * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
  8337. */
  8338. digest(mesh: Mesh, options?: {
  8339. facetNb?: number;
  8340. number?: number;
  8341. delta?: number;
  8342. }): SolidParticleSystem;
  8343. private _resetCopy();
  8344. private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options);
  8345. private _posToShape(positions);
  8346. private _uvsToShapeUV(uvs);
  8347. private _addParticle(idx, idxpos, model, shapeId, idxInShape, bInfo?);
  8348. /**
  8349. * Adds some particles to the SPS from the model shape. Returns the shape id.
  8350. * Please read the doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#create-an-immutable-sps
  8351. * `mesh` is any Mesh object that will be used as a model for the solid particles.
  8352. * `nb` (positive integer) the number of particles to be created from this model
  8353. * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
  8354. * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
  8355. */
  8356. addShape(mesh: Mesh, nb: number, options?: {
  8357. positionFunction?: any;
  8358. vertexFunction?: any;
  8359. }): number;
  8360. private _rebuildParticle(particle);
  8361. /**
  8362. * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.
  8363. */
  8364. rebuildMesh(): void;
  8365. /**
  8366. * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
  8367. * This method calls `updateParticle()` for each particle of the SPS.
  8368. * For an animated SPS, it is usually called within the render loop.
  8369. * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_
  8370. * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_
  8371. * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_
  8372. */
  8373. setParticles(start?: number, end?: number, update?: boolean): void;
  8374. private _quaternionRotationYPR();
  8375. private _quaternionToRotationMatrix();
  8376. /**
  8377. * Disposes the SPS
  8378. */
  8379. dispose(): void;
  8380. /**
  8381. * Visibilty helper : Recomputes the visible size according to the mesh bounding box
  8382. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8383. */
  8384. refreshVisibleSize(): void;
  8385. /**
  8386. * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
  8387. * @param size the size (float) of the visibility box
  8388. * note : this doesn't lock the SPS mesh bounding box.
  8389. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8390. */
  8391. setVisibilityBox(size: number): void;
  8392. /**
  8393. * Sets the SPS as always visible or not
  8394. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8395. */
  8396. isAlwaysVisible: boolean;
  8397. /**
  8398. * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.
  8399. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility
  8400. */
  8401. isVisibilityBoxLocked: boolean;
  8402. /**
  8403. * Tells to `setParticles()` to compute the particle rotations or not.
  8404. * Default value : true. The SPS is faster when it's set to false.
  8405. * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
  8406. */
  8407. computeParticleRotation: boolean;
  8408. /**
  8409. * Tells to `setParticles()` to compute the particle colors or not.
  8410. * Default value : true. The SPS is faster when it's set to false.
  8411. * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
  8412. */
  8413. computeParticleColor: boolean;
  8414. /**
  8415. * Tells to `setParticles()` to compute the particle textures or not.
  8416. * Default value : true. The SPS is faster when it's set to false.
  8417. * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
  8418. */
  8419. computeParticleTexture: boolean;
  8420. /**
  8421. * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
  8422. * Default value : false. The SPS is faster when it's set to false.
  8423. * Note : the particle custom vertex positions aren't stored values.
  8424. */
  8425. computeParticleVertex: boolean;
  8426. /**
  8427. * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
  8428. */
  8429. computeBoundingBox: boolean;
  8430. /**
  8431. * This function does nothing. It may be overwritten to set all the particle first values.
  8432. * The SPS doesn't call this function, you may have to call it by your own.
  8433. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8434. */
  8435. initParticles(): void;
  8436. /**
  8437. * This function does nothing. It may be overwritten to recycle a particle.
  8438. * The SPS doesn't call this function, you may have to call it by your own.
  8439. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8440. */
  8441. recycleParticle(particle: SolidParticle): SolidParticle;
  8442. /**
  8443. * Updates a particle : this function should be overwritten by the user.
  8444. * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
  8445. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#particle-management
  8446. * ex : just set a particle position or velocity and recycle conditions
  8447. */
  8448. updateParticle(particle: SolidParticle): SolidParticle;
  8449. /**
  8450. * Updates a vertex of a particle : it can be overwritten by the user.
  8451. * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
  8452. * @param particle the current particle
  8453. * @param vertex the current index of the current particle
  8454. * @param pt the index of the current vertex in the particle shape
  8455. * doc : http://doc.babylonjs.com/overviews/Solid_Particle_System#update-each-particle-shape
  8456. * ex : just set a vertex particle position
  8457. */
  8458. updateParticleVertex(particle: SolidParticle, vertex: Vector3, pt: number): Vector3;
  8459. /**
  8460. * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
  8461. * This does nothing and may be overwritten by the user.
  8462. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8463. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8464. * @param update the boolean update value actually passed to setParticles()
  8465. */
  8466. beforeUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  8467. /**
  8468. * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.
  8469. * This will be passed three parameters.
  8470. * This does nothing and may be overwritten by the user.
  8471. * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8472. * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
  8473. * @param update the boolean update value actually passed to setParticles()
  8474. */
  8475. afterUpdateParticles(start?: number, stop?: number, update?: boolean): void;
  8476. }
  8477. }
  8478. declare module BABYLON {
  8479. interface PhysicsImpostorJoint {
  8480. mainImpostor: PhysicsImpostor;
  8481. connectedImpostor: PhysicsImpostor;
  8482. joint: PhysicsJoint;
  8483. }
  8484. class PhysicsEngine {
  8485. private _physicsPlugin;
  8486. gravity: Vector3;
  8487. constructor(gravity?: Vector3, _physicsPlugin?: IPhysicsEnginePlugin);
  8488. setGravity(gravity: Vector3): void;
  8489. /**
  8490. * Set the time step of the physics engine.
  8491. * default is 1/60.
  8492. * To slow it down, enter 1/600 for example.
  8493. * To speed it up, 1/30
  8494. * @param {number} newTimeStep the new timestep to apply to this world.
  8495. */
  8496. setTimeStep(newTimeStep?: number): void;
  8497. dispose(): void;
  8498. getPhysicsPluginName(): string;
  8499. /**
  8500. * @Deprecated
  8501. *
  8502. */
  8503. static NoImpostor: number;
  8504. static SphereImpostor: number;
  8505. static BoxImpostor: number;
  8506. static PlaneImpostor: number;
  8507. static MeshImpostor: number;
  8508. static CylinderImpostor: number;
  8509. static HeightmapImpostor: number;
  8510. static CapsuleImpostor: number;
  8511. static ConeImpostor: number;
  8512. static ConvexHullImpostor: number;
  8513. static Epsilon: number;
  8514. private _impostors;
  8515. private _joints;
  8516. /**
  8517. * Adding a new impostor for the impostor tracking.
  8518. * This will be done by the impostor itself.
  8519. * @param {PhysicsImpostor} impostor the impostor to add
  8520. */
  8521. addImpostor(impostor: PhysicsImpostor): void;
  8522. /**
  8523. * Remove an impostor from the engine.
  8524. * This impostor and its mesh will not longer be updated by the physics engine.
  8525. * @param {PhysicsImpostor} impostor the impostor to remove
  8526. */
  8527. removeImpostor(impostor: PhysicsImpostor): void;
  8528. /**
  8529. * Add a joint to the physics engine
  8530. * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
  8531. * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
  8532. * @param {PhysicsJoint} the joint that will connect both impostors.
  8533. */
  8534. addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8535. removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8536. /**
  8537. * Called by the scene. no need to call it.
  8538. */
  8539. _step(delta: number): void;
  8540. getPhysicsPlugin(): IPhysicsEnginePlugin;
  8541. getImpostorForPhysicsObject(object: IPhysicsEnabledObject): PhysicsImpostor;
  8542. getImpostorWithPhysicsBody(body: any): PhysicsImpostor;
  8543. }
  8544. interface IPhysicsEnginePlugin {
  8545. world: any;
  8546. name: string;
  8547. setGravity(gravity: Vector3): any;
  8548. setTimeStep(timeStep: number): any;
  8549. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  8550. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  8551. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): any;
  8552. generatePhysicsBody(impostor: PhysicsImpostor): any;
  8553. removePhysicsBody(impostor: PhysicsImpostor): any;
  8554. generateJoint(joint: PhysicsImpostorJoint): any;
  8555. removeJoint(joint: PhysicsImpostorJoint): any;
  8556. isSupported(): boolean;
  8557. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): any;
  8558. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): any;
  8559. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  8560. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): any;
  8561. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  8562. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  8563. setBodyMass(impostor: PhysicsImpostor, mass: number): any;
  8564. sleepBody(impostor: PhysicsImpostor): any;
  8565. wakeUpBody(impostor: PhysicsImpostor): any;
  8566. updateDistanceJoint(joint: DistanceJoint, maxDistance: number, minDistance?: number): any;
  8567. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): any;
  8568. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  8569. dispose(): any;
  8570. }
  8571. }
  8572. declare module BABYLON {
  8573. interface PhysicsImpostorParameters {
  8574. mass: number;
  8575. friction?: number;
  8576. restitution?: number;
  8577. nativeOptions?: any;
  8578. }
  8579. interface IPhysicsEnabledObject {
  8580. position: Vector3;
  8581. rotationQuaternion: Quaternion;
  8582. scaling: Vector3;
  8583. rotation?: Vector3;
  8584. parent?: any;
  8585. getBoundingInfo?(): BoundingInfo;
  8586. computeWorldMatrix?(force: boolean): void;
  8587. getChildMeshes?(): Array<AbstractMesh>;
  8588. getVerticesData?(kind: string): Array<number> | Float32Array;
  8589. getIndices?(): Array<number> | Int32Array;
  8590. getScene?(): Scene;
  8591. }
  8592. class PhysicsImpostor {
  8593. object: IPhysicsEnabledObject;
  8594. type: number;
  8595. private _options;
  8596. private _scene;
  8597. static DEFAULT_OBJECT_SIZE: Vector3;
  8598. private _physicsEngine;
  8599. private _physicsBody;
  8600. private _bodyUpdateRequired;
  8601. private _onBeforePhysicsStepCallbacks;
  8602. private _onAfterPhysicsStepCallbacks;
  8603. private _onPhysicsCollideCallbacks;
  8604. private _deltaPosition;
  8605. private _deltaRotation;
  8606. private _deltaRotationConjugated;
  8607. private _parent;
  8608. uniqueId: number;
  8609. private _joints;
  8610. constructor(object: IPhysicsEnabledObject, type: number, _options?: PhysicsImpostorParameters, _scene?: Scene);
  8611. /**
  8612. * This function will completly initialize this impostor.
  8613. * It will create a new body - but only if this mesh has no parent.
  8614. * If it has, this impostor will not be used other than to define the impostor
  8615. * of the child mesh.
  8616. */
  8617. _init(): void;
  8618. private _getPhysicsParent();
  8619. /**
  8620. * Should a new body be generated.
  8621. */
  8622. isBodyInitRequired(): boolean;
  8623. setScalingUpdated(updated: boolean): void;
  8624. /**
  8625. * Force a regeneration of this or the parent's impostor's body.
  8626. * Use under cautious - This will remove all joints already implemented.
  8627. */
  8628. forceUpdate(): void;
  8629. /**
  8630. * Gets the body that holds this impostor. Either its own, or its parent.
  8631. */
  8632. /**
  8633. * Set the physics body. Used mainly by the physics engine/plugin
  8634. */
  8635. physicsBody: any;
  8636. parent: PhysicsImpostor;
  8637. resetUpdateFlags(): void;
  8638. getObjectExtendSize(): Vector3;
  8639. getObjectCenter(): Vector3;
  8640. /**
  8641. * Get a specific parametes from the options parameter.
  8642. */
  8643. getParam(paramName: string): any;
  8644. /**
  8645. * Sets a specific parameter in the options given to the physics plugin
  8646. */
  8647. setParam(paramName: string, value: number): void;
  8648. /**
  8649. * Specifically change the body's mass option. Won't recreate the physics body object
  8650. */
  8651. setMass(mass: number): void;
  8652. getLinearVelocity(): Vector3;
  8653. /**
  8654. * Set the body's linear velocity.
  8655. */
  8656. setLinearVelocity(velocity: Vector3): void;
  8657. getAngularVelocity(): Vector3;
  8658. /**
  8659. * Set the body's linear velocity.
  8660. */
  8661. setAngularVelocity(velocity: Vector3): void;
  8662. /**
  8663. * Execute a function with the physics plugin native code.
  8664. * Provide a function the will have two variables - the world object and the physics body object.
  8665. */
  8666. executeNativeFunction(func: (world: any, physicsBody: any) => void): void;
  8667. /**
  8668. * Register a function that will be executed before the physics world is stepping forward.
  8669. */
  8670. registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8671. unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8672. /**
  8673. * Register a function that will be executed after the physics step
  8674. */
  8675. registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8676. unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void;
  8677. /**
  8678. * register a function that will be executed when this impostor collides against a different body.
  8679. */
  8680. registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void;
  8681. unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void;
  8682. private _tmpPositionWithDelta;
  8683. private _tmpRotationWithDelta;
  8684. /**
  8685. * this function is executed by the physics engine.
  8686. */
  8687. beforeStep: () => void;
  8688. /**
  8689. * this function is executed by the physics engine.
  8690. */
  8691. afterStep: () => void;
  8692. onCollide: (e: {
  8693. body: any;
  8694. }) => void;
  8695. /**
  8696. * Apply a force
  8697. */
  8698. applyForce(force: Vector3, contactPoint: Vector3): void;
  8699. /**
  8700. * Apply an impulse
  8701. */
  8702. applyImpulse(force: Vector3, contactPoint: Vector3): void;
  8703. /**
  8704. * A help function to create a joint.
  8705. */
  8706. createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): void;
  8707. /**
  8708. * Add a joint to this impostor with a different impostor.
  8709. */
  8710. addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
  8711. /**
  8712. * Will keep this body still, in a sleep mode.
  8713. */
  8714. sleep(): void;
  8715. /**
  8716. * Wake the body up.
  8717. */
  8718. wakeUp(): void;
  8719. clone(newObject: IPhysicsEnabledObject): PhysicsImpostor;
  8720. dispose(): void;
  8721. setDeltaPosition(position: Vector3): void;
  8722. setDeltaRotation(rotation: Quaternion): void;
  8723. static NoImpostor: number;
  8724. static SphereImpostor: number;
  8725. static BoxImpostor: number;
  8726. static PlaneImpostor: number;
  8727. static MeshImpostor: number;
  8728. static CylinderImpostor: number;
  8729. static ParticleImpostor: number;
  8730. static HeightmapImpostor: number;
  8731. }
  8732. }
  8733. declare module BABYLON {
  8734. interface PhysicsJointData {
  8735. mainPivot?: Vector3;
  8736. connectedPivot?: Vector3;
  8737. mainAxis?: Vector3;
  8738. connectedAxis?: Vector3;
  8739. collision?: boolean;
  8740. nativeParams?: any;
  8741. }
  8742. /**
  8743. * This is a holder class for the physics joint created by the physics plugin.
  8744. * It holds a set of functions to control the underlying joint.
  8745. */
  8746. class PhysicsJoint {
  8747. type: number;
  8748. jointData: PhysicsJointData;
  8749. private _physicsJoint;
  8750. protected _physicsPlugin: IPhysicsEnginePlugin;
  8751. constructor(type: number, jointData: PhysicsJointData);
  8752. physicsJoint: any;
  8753. physicsPlugin: IPhysicsEnginePlugin;
  8754. /**
  8755. * Execute a function that is physics-plugin specific.
  8756. * @param {Function} func the function that will be executed.
  8757. * It accepts two parameters: the physics world and the physics joint.
  8758. */
  8759. executeNativeFunction(func: (world: any, physicsJoint: any) => void): void;
  8760. static DistanceJoint: number;
  8761. static HingeJoint: number;
  8762. static BallAndSocketJoint: number;
  8763. static WheelJoint: number;
  8764. static SliderJoint: number;
  8765. static PrismaticJoint: number;
  8766. static UniversalJoint: number;
  8767. static Hinge2Joint: number;
  8768. static PointToPointJoint: number;
  8769. static SpringJoint: number;
  8770. static LockJoint: number;
  8771. }
  8772. /**
  8773. * A class representing a physics distance joint.
  8774. */
  8775. class DistanceJoint extends PhysicsJoint {
  8776. constructor(jointData: DistanceJointData);
  8777. /**
  8778. * Update the predefined distance.
  8779. */
  8780. updateDistance(maxDistance: number, minDistance?: number): void;
  8781. }
  8782. class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {
  8783. constructor(type: number, jointData: PhysicsJointData);
  8784. /**
  8785. * Set the motor values.
  8786. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8787. * @param {number} force the force to apply
  8788. * @param {number} maxForce max force for this motor.
  8789. */
  8790. setMotor(force?: number, maxForce?: number): void;
  8791. /**
  8792. * Set the motor's limits.
  8793. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8794. */
  8795. setLimit(upperLimit: number, lowerLimit?: number): void;
  8796. }
  8797. /**
  8798. * This class represents a single hinge physics joint
  8799. */
  8800. class HingeJoint extends MotorEnabledJoint {
  8801. constructor(jointData: PhysicsJointData);
  8802. /**
  8803. * Set the motor values.
  8804. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8805. * @param {number} force the force to apply
  8806. * @param {number} maxForce max force for this motor.
  8807. */
  8808. setMotor(force?: number, maxForce?: number): void;
  8809. /**
  8810. * Set the motor's limits.
  8811. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8812. */
  8813. setLimit(upperLimit: number, lowerLimit?: number): void;
  8814. }
  8815. /**
  8816. * This class represents a dual hinge physics joint (same as wheel joint)
  8817. */
  8818. class Hinge2Joint extends MotorEnabledJoint {
  8819. constructor(jointData: PhysicsJointData);
  8820. /**
  8821. * Set the motor values.
  8822. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8823. * @param {number} force the force to apply
  8824. * @param {number} maxForce max force for this motor.
  8825. * @param {motorIndex} the motor's index, 0 or 1.
  8826. */
  8827. setMotor(force?: number, maxForce?: number, motorIndex?: number): void;
  8828. /**
  8829. * Set the motor limits.
  8830. * Attention, this function is plugin specific. Engines won't react 100% the same.
  8831. * @param {number} upperLimit the upper limit
  8832. * @param {number} lowerLimit lower limit
  8833. * @param {motorIndex} the motor's index, 0 or 1.
  8834. */
  8835. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  8836. }
  8837. interface IMotorEnabledJoint {
  8838. physicsJoint: any;
  8839. setMotor(force?: number, maxForce?: number, motorIndex?: number): any;
  8840. setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): any;
  8841. }
  8842. interface DistanceJointData extends PhysicsJointData {
  8843. maxDistance: number;
  8844. }
  8845. interface SpringJointData extends PhysicsJointData {
  8846. length: number;
  8847. stiffness: number;
  8848. damping: number;
  8849. }
  8850. }
  8851. declare module BABYLON {
  8852. class AnaglyphPostProcess extends PostProcess {
  8853. private _passedProcess;
  8854. constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
  8855. }
  8856. }
  8857. declare module BABYLON {
  8858. class BlackAndWhitePostProcess extends PostProcess {
  8859. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8860. }
  8861. }
  8862. declare module BABYLON {
  8863. class BlurPostProcess extends PostProcess {
  8864. direction: Vector2;
  8865. blurWidth: number;
  8866. constructor(name: string, direction: Vector2, blurWidth: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8867. }
  8868. }
  8869. declare module BABYLON {
  8870. class ColorCorrectionPostProcess extends PostProcess {
  8871. private _colorTableTexture;
  8872. constructor(name: string, colorTableUrl: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8873. }
  8874. }
  8875. declare module BABYLON {
  8876. class ConvolutionPostProcess extends PostProcess {
  8877. kernel: number[];
  8878. constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8879. static EdgeDetect0Kernel: number[];
  8880. static EdgeDetect1Kernel: number[];
  8881. static EdgeDetect2Kernel: number[];
  8882. static SharpenKernel: number[];
  8883. static EmbossKernel: number[];
  8884. static GaussianKernel: number[];
  8885. }
  8886. }
  8887. declare module BABYLON {
  8888. class DisplayPassPostProcess extends PostProcess {
  8889. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8890. }
  8891. }
  8892. declare module BABYLON {
  8893. class FilterPostProcess extends PostProcess {
  8894. kernelMatrix: Matrix;
  8895. constructor(name: string, kernelMatrix: Matrix, options: number | PostProcessOptions, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8896. }
  8897. }
  8898. declare module BABYLON {
  8899. class FxaaPostProcess extends PostProcess {
  8900. texelWidth: number;
  8901. texelHeight: number;
  8902. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  8903. }
  8904. }
  8905. declare module BABYLON {
  8906. class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
  8907. /**
  8908. * Public members
  8909. */
  8910. /**
  8911. * Gaussian blur coefficient
  8912. * @type {number}
  8913. */
  8914. gaussCoeff: number;
  8915. /**
  8916. * Gaussian blur mean
  8917. * @type {number}
  8918. */
  8919. gaussMean: number;
  8920. /**
  8921. * Gaussian blur standard deviation
  8922. * @type {number}
  8923. */
  8924. gaussStandDev: number;
  8925. /**
  8926. * Gaussian blur multiplier. Multiplies the blur effect
  8927. * @type {number}
  8928. */
  8929. gaussMultiplier: number;
  8930. /**
  8931. * Exposure, controls the overall intensity of the pipeline
  8932. * @type {number}
  8933. */
  8934. exposure: number;
  8935. /**
  8936. * Minimum luminance that the post-process can output. Luminance is >= 0
  8937. * @type {number}
  8938. */
  8939. minimumLuminance: number;
  8940. /**
  8941. * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
  8942. * @type {number}
  8943. */
  8944. maximumLuminance: number;
  8945. /**
  8946. * Increase rate for luminance: eye adaptation speed to dark
  8947. * @type {number}
  8948. */
  8949. luminanceIncreaserate: number;
  8950. /**
  8951. * Decrease rate for luminance: eye adaptation speed to bright
  8952. * @type {number}
  8953. */
  8954. luminanceDecreaseRate: number;
  8955. /**
  8956. * Minimum luminance needed to compute HDR
  8957. * @type {number}
  8958. */
  8959. brightThreshold: number;
  8960. /**
  8961. * Private members
  8962. */
  8963. private _guassianBlurHPostProcess;
  8964. private _guassianBlurVPostProcess;
  8965. private _brightPassPostProcess;
  8966. private _textureAdderPostProcess;
  8967. private _downSampleX4PostProcess;
  8968. private _originalPostProcess;
  8969. private _hdrPostProcess;
  8970. private _hdrCurrentLuminance;
  8971. private _hdrOutputLuminance;
  8972. static LUM_STEPS: number;
  8973. private _downSamplePostProcesses;
  8974. private _scene;
  8975. private _needUpdate;
  8976. /**
  8977. * @constructor
  8978. * @param {string} name - The rendering pipeline name
  8979. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  8980. * @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)
  8981. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  8982. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  8983. */
  8984. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  8985. /**
  8986. * Tells the pipeline to update its post-processes
  8987. */
  8988. update(): void;
  8989. /**
  8990. * Returns the current calculated luminance
  8991. */
  8992. getCurrentLuminance(): number;
  8993. /**
  8994. * Returns the currently drawn luminance
  8995. */
  8996. getOutputLuminance(): number;
  8997. /**
  8998. * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
  8999. */
  9000. dispose(): void;
  9001. /**
  9002. * Creates the HDR post-process and computes the luminance adaptation
  9003. */
  9004. private _createHDRPostProcess(scene, ratio);
  9005. /**
  9006. * Texture Adder post-process
  9007. */
  9008. private _createTextureAdderPostProcess(scene, ratio);
  9009. /**
  9010. * Down sample X4 post-process
  9011. */
  9012. private _createDownSampleX4PostProcess(scene, ratio);
  9013. /**
  9014. * Bright pass post-process
  9015. */
  9016. private _createBrightPassPostProcess(scene, ratio);
  9017. /**
  9018. * Luminance generator. Creates the luminance post-process and down sample post-processes
  9019. */
  9020. private _createLuminanceGeneratorPostProcess(scene);
  9021. /**
  9022. * Gaussian blur post-processes. Horizontal and Vertical
  9023. */
  9024. private _createGaussianBlurPostProcess(scene, ratio);
  9025. }
  9026. }
  9027. declare module BABYLON {
  9028. class LensRenderingPipeline extends PostProcessRenderPipeline {
  9029. /**
  9030. * The chromatic aberration PostProcess id in the pipeline
  9031. * @type {string}
  9032. */
  9033. LensChromaticAberrationEffect: string;
  9034. /**
  9035. * The highlights enhancing PostProcess id in the pipeline
  9036. * @type {string}
  9037. */
  9038. HighlightsEnhancingEffect: string;
  9039. /**
  9040. * The depth-of-field PostProcess id in the pipeline
  9041. * @type {string}
  9042. */
  9043. LensDepthOfFieldEffect: string;
  9044. private _scene;
  9045. private _depthTexture;
  9046. private _grainTexture;
  9047. private _chromaticAberrationPostProcess;
  9048. private _highlightsPostProcess;
  9049. private _depthOfFieldPostProcess;
  9050. private _edgeBlur;
  9051. private _grainAmount;
  9052. private _chromaticAberration;
  9053. private _distortion;
  9054. private _highlightsGain;
  9055. private _highlightsThreshold;
  9056. private _dofDistance;
  9057. private _dofAperture;
  9058. private _dofDarken;
  9059. private _dofPentagon;
  9060. private _blurNoise;
  9061. /**
  9062. * @constructor
  9063. *
  9064. * Effect parameters are as follow:
  9065. * {
  9066. * chromatic_aberration: number; // from 0 to x (1 for realism)
  9067. * edge_blur: number; // from 0 to x (1 for realism)
  9068. * distortion: number; // from 0 to x (1 for realism)
  9069. * grain_amount: number; // from 0 to 1
  9070. * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise
  9071. * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)
  9072. * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)
  9073. * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)
  9074. * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect
  9075. * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)
  9076. * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)
  9077. * blur_noise: boolean; // add a little bit of noise to the blur (default: true)
  9078. * }
  9079. * Note: if an effect parameter is unset, effect is disabled
  9080. *
  9081. * @param {string} name - The rendering pipeline name
  9082. * @param {object} parameters - An object containing all parameters (see above)
  9083. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9084. * @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)
  9085. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9086. */
  9087. constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]);
  9088. setEdgeBlur(amount: number): void;
  9089. disableEdgeBlur(): void;
  9090. setGrainAmount(amount: number): void;
  9091. disableGrain(): void;
  9092. setChromaticAberration(amount: number): void;
  9093. disableChromaticAberration(): void;
  9094. setEdgeDistortion(amount: number): void;
  9095. disableEdgeDistortion(): void;
  9096. setFocusDistance(amount: number): void;
  9097. disableDepthOfField(): void;
  9098. setAperture(amount: number): void;
  9099. setDarkenOutOfFocus(amount: number): void;
  9100. enablePentagonBokeh(): void;
  9101. disablePentagonBokeh(): void;
  9102. enableNoiseBlur(): void;
  9103. disableNoiseBlur(): void;
  9104. setHighlightsGain(amount: number): void;
  9105. setHighlightsThreshold(amount: number): void;
  9106. disableHighlights(): void;
  9107. /**
  9108. * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
  9109. */
  9110. dispose(disableDepthRender?: boolean): void;
  9111. private _createChromaticAberrationPostProcess(ratio);
  9112. private _createHighlightsPostProcess(ratio);
  9113. private _createDepthOfFieldPostProcess(ratio);
  9114. private _createGrainTexture();
  9115. }
  9116. }
  9117. declare module BABYLON {
  9118. class PassPostProcess extends PostProcess {
  9119. constructor(name: string, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9120. }
  9121. }
  9122. declare module BABYLON {
  9123. type PostProcessOptions = {
  9124. width: number;
  9125. height: number;
  9126. };
  9127. class PostProcess {
  9128. name: string;
  9129. width: number;
  9130. height: number;
  9131. renderTargetSamplingMode: number;
  9132. clearColor: Color4;
  9133. enablePixelPerfectMode: boolean;
  9134. private _camera;
  9135. private _scene;
  9136. private _engine;
  9137. private _options;
  9138. private _reusable;
  9139. private _textureType;
  9140. _textures: SmartArray<WebGLTexture>;
  9141. _currentRenderTextureInd: number;
  9142. private _effect;
  9143. private _samplers;
  9144. private _fragmentUrl;
  9145. private _parameters;
  9146. private _scaleRatio;
  9147. /**
  9148. * An event triggered when the postprocess is activated.
  9149. * @type {BABYLON.Observable}
  9150. */
  9151. onActivateObservable: Observable<Camera>;
  9152. private _onActivateObserver;
  9153. onActivate: (camera: Camera) => void;
  9154. /**
  9155. * An event triggered when the postprocess changes its size.
  9156. * @type {BABYLON.Observable}
  9157. */
  9158. onSizeChangedObservable: Observable<PostProcess>;
  9159. private _onSizeChangedObserver;
  9160. onSizeChanged: (postProcess: PostProcess) => void;
  9161. /**
  9162. * An event triggered when the postprocess applies its effect.
  9163. * @type {BABYLON.Observable}
  9164. */
  9165. onApplyObservable: Observable<Effect>;
  9166. private _onApplyObserver;
  9167. onApply: (effect: Effect) => void;
  9168. /**
  9169. * An event triggered before rendering the postprocess
  9170. * @type {BABYLON.Observable}
  9171. */
  9172. onBeforeRenderObservable: Observable<Effect>;
  9173. private _onBeforeRenderObserver;
  9174. onBeforeRender: (effect: Effect) => void;
  9175. /**
  9176. * An event triggered after rendering the postprocess
  9177. * @type {BABYLON.Observable}
  9178. */
  9179. onAfterRenderObservable: Observable<Effect>;
  9180. private _onAfterRenderObserver;
  9181. onAfterRender: (efect: Effect) => void;
  9182. constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number);
  9183. updateEffect(defines?: string): void;
  9184. isReusable(): boolean;
  9185. /** invalidate frameBuffer to hint the postprocess to create a depth buffer */
  9186. markTextureDirty(): void;
  9187. activate(camera: Camera, sourceTexture?: WebGLTexture): void;
  9188. isSupported: boolean;
  9189. apply(): Effect;
  9190. dispose(camera?: Camera): void;
  9191. }
  9192. }
  9193. declare module BABYLON {
  9194. class PostProcessManager {
  9195. private _scene;
  9196. private _indexBuffer;
  9197. private _vertexBuffers;
  9198. constructor(scene: Scene);
  9199. private _prepareBuffers();
  9200. _prepareFrame(sourceTexture?: WebGLTexture): boolean;
  9201. directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void;
  9202. _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, faceIndex?: number, postProcesses?: PostProcess[]): void;
  9203. dispose(): void;
  9204. }
  9205. }
  9206. declare module BABYLON {
  9207. class RefractionPostProcess extends PostProcess {
  9208. color: Color3;
  9209. depth: number;
  9210. colorLevel: number;
  9211. private _refRexture;
  9212. constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, options: number | PostProcessOptions, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9213. dispose(camera: Camera): void;
  9214. }
  9215. }
  9216. declare module BABYLON {
  9217. class SSAORenderingPipeline extends PostProcessRenderPipeline {
  9218. /**
  9219. * The PassPostProcess id in the pipeline that contains the original scene color
  9220. * @type {string}
  9221. */
  9222. SSAOOriginalSceneColorEffect: string;
  9223. /**
  9224. * The SSAO PostProcess id in the pipeline
  9225. * @type {string}
  9226. */
  9227. SSAORenderEffect: string;
  9228. /**
  9229. * The horizontal blur PostProcess id in the pipeline
  9230. * @type {string}
  9231. */
  9232. SSAOBlurHRenderEffect: string;
  9233. /**
  9234. * The vertical blur PostProcess id in the pipeline
  9235. * @type {string}
  9236. */
  9237. SSAOBlurVRenderEffect: string;
  9238. /**
  9239. * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)
  9240. * @type {string}
  9241. */
  9242. SSAOCombineRenderEffect: string;
  9243. /**
  9244. * The output strength of the SSAO post-process. Default value is 1.0.
  9245. * @type {number}
  9246. */
  9247. totalStrength: number;
  9248. /**
  9249. * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006
  9250. * @type {number}
  9251. */
  9252. radius: number;
  9253. /**
  9254. * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel
  9255. * Must not be equal to fallOff and superior to fallOff.
  9256. * Default value is 0.975
  9257. * @type {number}
  9258. */
  9259. area: number;
  9260. /**
  9261. * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel
  9262. * Must not be equal to area and inferior to area.
  9263. * Default value is 0.0
  9264. * @type {number}
  9265. */
  9266. fallOff: number;
  9267. /**
  9268. * The base color of the SSAO post-process
  9269. * The final result is "base + ssao" between [0, 1]
  9270. * @type {number}
  9271. */
  9272. base: number;
  9273. private _scene;
  9274. private _depthTexture;
  9275. private _randomTexture;
  9276. private _originalColorPostProcess;
  9277. private _ssaoPostProcess;
  9278. private _blurHPostProcess;
  9279. private _blurVPostProcess;
  9280. private _ssaoCombinePostProcess;
  9281. private _firstUpdate;
  9282. private _ratio;
  9283. /**
  9284. * @constructor
  9285. * @param {string} name - The rendering pipeline name
  9286. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9287. * @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 }
  9288. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9289. */
  9290. constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]);
  9291. /**
  9292. * Returns the horizontal blur PostProcess
  9293. * @return {BABYLON.BlurPostProcess} The horizontal blur post-process
  9294. */
  9295. getBlurHPostProcess(): BlurPostProcess;
  9296. /**
  9297. * Returns the vertical blur PostProcess
  9298. * @return {BABYLON.BlurPostProcess} The vertical blur post-process
  9299. */
  9300. getBlurVPostProcess(): BlurPostProcess;
  9301. /**
  9302. * Removes the internal pipeline assets and detatches the pipeline from the scene cameras
  9303. */
  9304. dispose(disableDepthRender?: boolean): void;
  9305. private _createBlurPostProcess(ratio);
  9306. private _createSSAOPostProcess(ratio);
  9307. private _createSSAOCombinePostProcess(ratio);
  9308. private _createRandomTexture();
  9309. }
  9310. }
  9311. declare module BABYLON {
  9312. class StandardRenderingPipeline extends PostProcessRenderPipeline implements IDisposable, IAnimatable {
  9313. /**
  9314. * Public members
  9315. */
  9316. originalPostProcess: PostProcess;
  9317. downSampleX4PostProcess: PostProcess;
  9318. brightPassPostProcess: PostProcess;
  9319. gaussianBlurHPostProcesses: PostProcess[];
  9320. gaussianBlurVPostProcesses: PostProcess[];
  9321. textureAdderPostProcess: PostProcess;
  9322. textureAdderFinalPostProcess: PostProcess;
  9323. lensFlarePostProcess: PostProcess;
  9324. lensFlareComposePostProcess: PostProcess;
  9325. depthOfFieldPostProcess: PostProcess;
  9326. brightThreshold: number;
  9327. blurWidth: number;
  9328. gaussianCoefficient: number;
  9329. gaussianMean: number;
  9330. gaussianStandardDeviation: number;
  9331. exposure: number;
  9332. lensTexture: Texture;
  9333. lensColorTexture: Texture;
  9334. lensFlareStrength: number;
  9335. lensFlareGhostDispersal: number;
  9336. lensFlareHaloWidth: number;
  9337. lensFlareDistortionStrength: number;
  9338. lensStarTexture: Texture;
  9339. lensFlareDirtTexture: Texture;
  9340. depthOfFieldDistance: number;
  9341. animations: Animation[];
  9342. /**
  9343. * Private members
  9344. */
  9345. private _scene;
  9346. private _depthRenderer;
  9347. private _depthOfFieldEnabled;
  9348. private _lensFlareEnabled;
  9349. DepthOfFieldEnabled: boolean;
  9350. LensFlareEnabled: boolean;
  9351. /**
  9352. * @constructor
  9353. * @param {string} name - The rendering pipeline name
  9354. * @param {BABYLON.Scene} scene - The scene linked to this pipeline
  9355. * @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)
  9356. * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
  9357. * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
  9358. */
  9359. constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]);
  9360. private _createDownSampleX4PostProcess(scene, ratio);
  9361. private _createBrightPassPostProcess(scene, ratio);
  9362. private _createGaussianBlurPostProcesses(scene, ratio, indice);
  9363. private _createTextureAdderPostProcess(scene, ratio);
  9364. private _createLensFlarePostProcess(scene, ratio);
  9365. private _createDepthOfFieldPostProcess(scene, ratio);
  9366. dispose(): void;
  9367. }
  9368. }
  9369. declare module BABYLON {
  9370. class StereoscopicInterlacePostProcess extends PostProcess {
  9371. private _stepSize;
  9372. private _passedProcess;
  9373. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean);
  9374. }
  9375. }
  9376. declare module BABYLON {
  9377. enum TonemappingOperator {
  9378. Hable = 0,
  9379. Reinhard = 1,
  9380. HejiDawson = 2,
  9381. Photographic = 3,
  9382. }
  9383. class TonemapPostProcess extends PostProcess {
  9384. private _operator;
  9385. exposureAdjustment: number;
  9386. constructor(name: string, _operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number);
  9387. }
  9388. }
  9389. declare module BABYLON {
  9390. class VolumetricLightScatteringPostProcess extends PostProcess {
  9391. private _volumetricLightScatteringPass;
  9392. private _volumetricLightScatteringRTT;
  9393. private _viewPort;
  9394. private _screenCoordinates;
  9395. private _cachedDefines;
  9396. /**
  9397. * If not undefined, the mesh position is computed from the attached node position
  9398. * @type {{position: Vector3}}
  9399. */
  9400. attachedNode: {
  9401. position: Vector3;
  9402. };
  9403. /**
  9404. * Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"
  9405. * @type {Vector3}
  9406. */
  9407. customMeshPosition: Vector3;
  9408. /**
  9409. * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)
  9410. * @type {boolean}
  9411. */
  9412. useCustomMeshPosition: boolean;
  9413. /**
  9414. * If the post-process should inverse the light scattering direction
  9415. * @type {boolean}
  9416. */
  9417. invert: boolean;
  9418. /**
  9419. * The internal mesh used by the post-process
  9420. * @type {boolean}
  9421. */
  9422. mesh: Mesh;
  9423. useDiffuseColor: boolean;
  9424. /**
  9425. * Array containing the excluded meshes not rendered in the internal pass
  9426. */
  9427. excludedMeshes: AbstractMesh[];
  9428. /**
  9429. * Controls the overall intensity of the post-process
  9430. * @type {number}
  9431. */
  9432. exposure: number;
  9433. /**
  9434. * Dissipates each sample's contribution in range [0, 1]
  9435. * @type {number}
  9436. */
  9437. decay: number;
  9438. /**
  9439. * Controls the overall intensity of each sample
  9440. * @type {number}
  9441. */
  9442. weight: number;
  9443. /**
  9444. * Controls the density of each sample
  9445. * @type {number}
  9446. */
  9447. density: number;
  9448. /**
  9449. * @constructor
  9450. * @param {string} name - The post-process name
  9451. * @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)
  9452. * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to
  9453. * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering
  9454. * @param {number} samples - The post-process quality, default 100
  9455. * @param {number} samplingMode - The post-process filtering mode
  9456. * @param {BABYLON.Engine} engine - The babylon engine
  9457. * @param {boolean} reusable - If the post-process is reusable
  9458. * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided
  9459. */
  9460. constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene);
  9461. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9462. /**
  9463. * Sets the new light position for light scattering effect
  9464. * @param {BABYLON.Vector3} The new custom light position
  9465. */
  9466. setCustomMeshPosition(position: Vector3): void;
  9467. /**
  9468. * Returns the light position for light scattering effect
  9469. * @return {BABYLON.Vector3} The custom light position
  9470. */
  9471. getCustomMeshPosition(): Vector3;
  9472. /**
  9473. * Disposes the internal assets and detaches the post-process from the camera
  9474. */
  9475. dispose(camera: Camera): void;
  9476. /**
  9477. * Returns the render target texture used by the post-process
  9478. * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process
  9479. */
  9480. getPass(): RenderTargetTexture;
  9481. private _meshExcluded(mesh);
  9482. private _createPass(scene, ratio);
  9483. private _updateMeshScreenCoordinates(scene);
  9484. /**
  9485. * Creates a default mesh for the Volumeric Light Scattering post-process
  9486. * @param {string} The mesh name
  9487. * @param {BABYLON.Scene} The scene where to create the mesh
  9488. * @return {BABYLON.Mesh} the default mesh
  9489. */
  9490. static CreateDefaultMesh(name: string, scene: Scene): Mesh;
  9491. }
  9492. }
  9493. declare module BABYLON {
  9494. class VRDistortionCorrectionPostProcess extends PostProcess {
  9495. aspectRatio: number;
  9496. private _isRightEye;
  9497. private _distortionFactors;
  9498. private _postProcessScaleFactor;
  9499. private _lensCenterOffset;
  9500. private _scaleIn;
  9501. private _scaleFactor;
  9502. private _lensCenter;
  9503. constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics);
  9504. }
  9505. }
  9506. declare module BABYLON {
  9507. class ReflectionProbe {
  9508. name: string;
  9509. private _scene;
  9510. private _renderTargetTexture;
  9511. private _projectionMatrix;
  9512. private _viewMatrix;
  9513. private _target;
  9514. private _add;
  9515. private _attachedMesh;
  9516. invertYAxis: boolean;
  9517. position: Vector3;
  9518. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  9519. refreshRate: number;
  9520. getScene(): Scene;
  9521. cubeTexture: RenderTargetTexture;
  9522. renderList: AbstractMesh[];
  9523. attachToMesh(mesh: AbstractMesh): void;
  9524. dispose(): void;
  9525. }
  9526. }
  9527. declare module BABYLON {
  9528. class BoundingBoxRenderer {
  9529. frontColor: Color3;
  9530. backColor: Color3;
  9531. showBackLines: boolean;
  9532. renderList: SmartArray<BoundingBox>;
  9533. private _scene;
  9534. private _colorShader;
  9535. private _vertexBuffers;
  9536. private _indexBuffer;
  9537. constructor(scene: Scene);
  9538. private _prepareRessources();
  9539. reset(): void;
  9540. render(): void;
  9541. dispose(): void;
  9542. }
  9543. }
  9544. declare module BABYLON {
  9545. class DepthRenderer {
  9546. private _scene;
  9547. private _depthMap;
  9548. private _effect;
  9549. private _viewMatrix;
  9550. private _projectionMatrix;
  9551. private _transformMatrix;
  9552. private _worldViewProjection;
  9553. private _cachedDefines;
  9554. constructor(scene: Scene, type?: number);
  9555. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9556. getDepthMap(): RenderTargetTexture;
  9557. dispose(): void;
  9558. }
  9559. }
  9560. declare module BABYLON {
  9561. class EdgesRenderer {
  9562. edgesWidthScalerForOrthographic: number;
  9563. edgesWidthScalerForPerspective: number;
  9564. private _source;
  9565. private _linesPositions;
  9566. private _linesNormals;
  9567. private _linesIndices;
  9568. private _epsilon;
  9569. private _indicesCount;
  9570. private _lineShader;
  9571. private _ib;
  9572. private _buffers;
  9573. private _checkVerticesInsteadOfIndices;
  9574. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  9575. private _prepareRessources();
  9576. dispose(): void;
  9577. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  9578. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  9579. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  9580. _generateEdgesLines(): void;
  9581. render(): void;
  9582. }
  9583. }
  9584. declare module BABYLON {
  9585. class OutlineRenderer {
  9586. private _scene;
  9587. private _effect;
  9588. private _cachedDefines;
  9589. constructor(scene: Scene);
  9590. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  9591. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  9592. }
  9593. }
  9594. declare module BABYLON {
  9595. class RenderingGroup {
  9596. index: number;
  9597. private _scene;
  9598. private _opaqueSubMeshes;
  9599. private _transparentSubMeshes;
  9600. private _alphaTestSubMeshes;
  9601. private _activeVertices;
  9602. private _opaqueSortCompareFn;
  9603. private _alphaTestSortCompareFn;
  9604. private _transparentSortCompareFn;
  9605. private _renderOpaque;
  9606. private _renderAlphaTest;
  9607. private _renderTransparent;
  9608. onBeforeTransparentRendering: () => void;
  9609. /**
  9610. * Set the opaque sort comparison function.
  9611. * If null the sub meshes will be render in the order they were created
  9612. */
  9613. opaqueSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9614. /**
  9615. * Set the alpha test sort comparison function.
  9616. * If null the sub meshes will be render in the order they were created
  9617. */
  9618. alphaTestSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9619. /**
  9620. * Set the transparent sort comparison function.
  9621. * If null the sub meshes will be render in the order they were created
  9622. */
  9623. transparentSortCompareFn: (a: SubMesh, b: SubMesh) => number;
  9624. /**
  9625. * Creates a new rendering group.
  9626. * @param index The rendering group index
  9627. * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied
  9628. * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied
  9629. * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied
  9630. */
  9631. constructor(index: number, scene: Scene, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number);
  9632. /**
  9633. * Render all the sub meshes contained in the group.
  9634. * @param customRenderFunction Used to override the default render behaviour of the group.
  9635. * @returns true if rendered some submeshes.
  9636. */
  9637. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void): boolean;
  9638. /**
  9639. * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
  9640. * @param subMeshes The submeshes to render
  9641. */
  9642. private renderOpaqueSorted(subMeshes);
  9643. /**
  9644. * Renders the opaque submeshes in the order from the alphatestSortCompareFn.
  9645. * @param subMeshes The submeshes to render
  9646. */
  9647. private renderAlphaTestSorted(subMeshes);
  9648. /**
  9649. * Renders the opaque submeshes in the order from the transparentSortCompareFn.
  9650. * @param subMeshes The submeshes to render
  9651. */
  9652. private renderTransparentSorted(subMeshes);
  9653. /**
  9654. * Renders the submeshes in a specified order.
  9655. * @param subMeshes The submeshes to sort before render
  9656. * @param sortCompareFn The comparison function use to sort
  9657. * @param cameraPosition The camera position use to preprocess the submeshes to help sorting
  9658. * @param transparent Specifies to activate blending if true
  9659. */
  9660. private static renderSorted(subMeshes, sortCompareFn, cameraPosition, transparent);
  9661. /**
  9662. * Renders the submeshes in the order they were dispatched (no sort applied).
  9663. * @param subMeshes The submeshes to render
  9664. */
  9665. private static renderUnsorted(subMeshes);
  9666. /**
  9667. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9668. * are rendered back to front if in the same alpha index.
  9669. *
  9670. * @param a The first submesh
  9671. * @param b The second submesh
  9672. * @returns The result of the comparison
  9673. */
  9674. static defaultTransparentSortCompare(a: SubMesh, b: SubMesh): number;
  9675. /**
  9676. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9677. * are rendered back to front.
  9678. *
  9679. * @param a The first submesh
  9680. * @param b The second submesh
  9681. * @returns The result of the comparison
  9682. */
  9683. static backToFrontSortCompare(a: SubMesh, b: SubMesh): number;
  9684. /**
  9685. * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)
  9686. * are rendered front to back (prevent overdraw).
  9687. *
  9688. * @param a The first submesh
  9689. * @param b The second submesh
  9690. * @returns The result of the comparison
  9691. */
  9692. static frontToBackSortCompare(a: SubMesh, b: SubMesh): number;
  9693. /**
  9694. * Resets the different lists of submeshes to prepare a new frame.
  9695. */
  9696. prepare(): void;
  9697. /**
  9698. * Inserts the submesh in its correct queue depending on its material.
  9699. * @param subMesh The submesh to dispatch
  9700. */
  9701. dispatch(subMesh: SubMesh): void;
  9702. }
  9703. }
  9704. declare module BABYLON {
  9705. class RenderingManager {
  9706. /**
  9707. * The max id used for rendering groups (not included)
  9708. */
  9709. static MAX_RENDERINGGROUPS: number;
  9710. /**
  9711. * The min id used for rendering groups (included)
  9712. */
  9713. static MIN_RENDERINGGROUPS: number;
  9714. private _scene;
  9715. private _renderingGroups;
  9716. private _depthStencilBufferAlreadyCleaned;
  9717. private _currentIndex;
  9718. private _currentActiveMeshes;
  9719. private _currentRenderParticles;
  9720. private _currentRenderSprites;
  9721. private _autoClearDepthStencil;
  9722. private _customOpaqueSortCompareFn;
  9723. private _customAlphaTestSortCompareFn;
  9724. private _customTransparentSortCompareFn;
  9725. private _renderinGroupInfo;
  9726. constructor(scene: Scene);
  9727. private _renderParticles(index, activeMeshes);
  9728. private _renderSprites(index);
  9729. private _clearDepthStencilBuffer();
  9730. private _renderSpritesAndParticles();
  9731. render(customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void;
  9732. reset(): void;
  9733. dispatch(subMesh: SubMesh): void;
  9734. /**
  9735. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  9736. * This allowed control for front to back rendering or reversly depending of the special needs.
  9737. *
  9738. * @param renderingGroupId The rendering group id corresponding to its index
  9739. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  9740. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  9741. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  9742. */
  9743. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  9744. /**
  9745. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  9746. *
  9747. * @param renderingGroupId The rendering group id corresponding to its index
  9748. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  9749. */
  9750. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  9751. }
  9752. }
  9753. declare module BABYLON {
  9754. class Sprite {
  9755. name: string;
  9756. position: Vector3;
  9757. color: Color4;
  9758. width: number;
  9759. height: number;
  9760. angle: number;
  9761. cellIndex: number;
  9762. invertU: number;
  9763. invertV: number;
  9764. disposeWhenFinishedAnimating: boolean;
  9765. animations: Animation[];
  9766. isPickable: boolean;
  9767. actionManager: ActionManager;
  9768. private _animationStarted;
  9769. private _loopAnimation;
  9770. private _fromIndex;
  9771. private _toIndex;
  9772. private _delay;
  9773. private _direction;
  9774. private _frameCount;
  9775. private _manager;
  9776. private _time;
  9777. private _onAnimationEnd;
  9778. size: number;
  9779. constructor(name: string, manager: SpriteManager);
  9780. playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void;
  9781. stopAnimation(): void;
  9782. _animate(deltaTime: number): void;
  9783. dispose(): void;
  9784. }
  9785. }
  9786. declare module BABYLON {
  9787. class SpriteManager {
  9788. name: string;
  9789. sprites: Sprite[];
  9790. renderingGroupId: number;
  9791. layerMask: number;
  9792. fogEnabled: boolean;
  9793. isPickable: boolean;
  9794. cellWidth: number;
  9795. cellHeight: number;
  9796. /**
  9797. * An event triggered when the manager is disposed.
  9798. * @type {BABYLON.Observable}
  9799. */
  9800. onDisposeObservable: Observable<SpriteManager>;
  9801. private _onDisposeObserver;
  9802. onDispose: () => void;
  9803. private _capacity;
  9804. private _spriteTexture;
  9805. private _epsilon;
  9806. private _scene;
  9807. private _vertexData;
  9808. private _buffer;
  9809. private _vertexBuffers;
  9810. private _indexBuffer;
  9811. private _effectBase;
  9812. private _effectFog;
  9813. texture: Texture;
  9814. constructor(name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon?: number, samplingMode?: number);
  9815. private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize);
  9816. intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): PickingInfo;
  9817. render(): void;
  9818. dispose(): void;
  9819. }
  9820. }
  9821. declare module BABYLON.Internals {
  9822. class _AlphaState {
  9823. private _isAlphaBlendDirty;
  9824. private _isBlendFunctionParametersDirty;
  9825. private _alphaBlend;
  9826. private _blendFunctionParameters;
  9827. /**
  9828. * Initializes the state.
  9829. */
  9830. constructor();
  9831. isDirty: boolean;
  9832. alphaBlend: boolean;
  9833. setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
  9834. reset(): void;
  9835. apply(gl: WebGLRenderingContext): void;
  9836. }
  9837. }
  9838. declare module BABYLON.Internals {
  9839. class _DepthCullingState {
  9840. private _isDepthTestDirty;
  9841. private _isDepthMaskDirty;
  9842. private _isDepthFuncDirty;
  9843. private _isCullFaceDirty;
  9844. private _isCullDirty;
  9845. private _isZOffsetDirty;
  9846. private _depthTest;
  9847. private _depthMask;
  9848. private _depthFunc;
  9849. private _cull;
  9850. private _cullFace;
  9851. private _zOffset;
  9852. /**
  9853. * Initializes the state.
  9854. */
  9855. constructor();
  9856. isDirty: boolean;
  9857. zOffset: number;
  9858. cullFace: number;
  9859. cull: boolean;
  9860. depthFunc: number;
  9861. depthMask: boolean;
  9862. depthTest: boolean;
  9863. reset(): void;
  9864. apply(gl: WebGLRenderingContext): void;
  9865. }
  9866. }
  9867. declare module BABYLON.Internals {
  9868. class _StencilState {
  9869. private _isStencilTestDirty;
  9870. private _isStencilMaskDirty;
  9871. private _isStencilFuncDirty;
  9872. private _isStencilOpDirty;
  9873. private _stencilTest;
  9874. private _stencilMask;
  9875. private _stencilFunc;
  9876. private _stencilFuncRef;
  9877. private _stencilFuncMask;
  9878. private _stencilOpStencilFail;
  9879. private _stencilOpDepthFail;
  9880. private _stencilOpStencilDepthPass;
  9881. isDirty: boolean;
  9882. stencilFunc: number;
  9883. stencilFuncRef: number;
  9884. stencilFuncMask: number;
  9885. stencilOpStencilFail: number;
  9886. stencilOpDepthFail: number;
  9887. stencilOpStencilDepthPass: number;
  9888. stencilMask: number;
  9889. stencilTest: boolean;
  9890. constructor();
  9891. reset(): void;
  9892. apply(gl: WebGLRenderingContext): void;
  9893. }
  9894. }
  9895. declare module BABYLON.Internals {
  9896. class AndOrNotEvaluator {
  9897. static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
  9898. private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
  9899. private static _SimplifyNegation(booleanString);
  9900. }
  9901. }
  9902. declare module BABYLON {
  9903. interface IAssetTask {
  9904. onSuccess: (task: IAssetTask) => void;
  9905. onError: (task: IAssetTask) => void;
  9906. isCompleted: boolean;
  9907. run(scene: Scene, onSuccess: () => void, onError: () => void): any;
  9908. }
  9909. class MeshAssetTask implements IAssetTask {
  9910. name: string;
  9911. meshesNames: any;
  9912. rootUrl: string;
  9913. sceneFilename: string;
  9914. loadedMeshes: Array<AbstractMesh>;
  9915. loadedParticleSystems: Array<ParticleSystem>;
  9916. loadedSkeletons: Array<Skeleton>;
  9917. onSuccess: (task: IAssetTask) => void;
  9918. onError: (task: IAssetTask) => void;
  9919. isCompleted: boolean;
  9920. constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string);
  9921. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9922. }
  9923. class TextFileAssetTask implements IAssetTask {
  9924. name: string;
  9925. url: string;
  9926. onSuccess: (task: IAssetTask) => void;
  9927. onError: (task: IAssetTask) => void;
  9928. isCompleted: boolean;
  9929. text: string;
  9930. constructor(name: string, url: string);
  9931. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9932. }
  9933. class BinaryFileAssetTask implements IAssetTask {
  9934. name: string;
  9935. url: string;
  9936. onSuccess: (task: IAssetTask) => void;
  9937. onError: (task: IAssetTask) => void;
  9938. isCompleted: boolean;
  9939. data: ArrayBuffer;
  9940. constructor(name: string, url: string);
  9941. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9942. }
  9943. class ImageAssetTask implements IAssetTask {
  9944. name: string;
  9945. url: string;
  9946. onSuccess: (task: IAssetTask) => void;
  9947. onError: (task: IAssetTask) => void;
  9948. isCompleted: boolean;
  9949. image: HTMLImageElement;
  9950. constructor(name: string, url: string);
  9951. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9952. }
  9953. interface ITextureAssetTask extends IAssetTask {
  9954. onSuccess: (task: ITextureAssetTask) => void;
  9955. onError: (task: ITextureAssetTask) => void;
  9956. texture: Texture;
  9957. }
  9958. class TextureAssetTask implements ITextureAssetTask {
  9959. name: string;
  9960. url: string;
  9961. noMipmap: boolean;
  9962. invertY: boolean;
  9963. samplingMode: number;
  9964. onSuccess: (task: ITextureAssetTask) => void;
  9965. onError: (task: ITextureAssetTask) => void;
  9966. isCompleted: boolean;
  9967. texture: Texture;
  9968. constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number);
  9969. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9970. }
  9971. class CubeTextureAssetTask implements IAssetTask {
  9972. name: string;
  9973. url: string;
  9974. extensions: string[];
  9975. noMipmap: boolean;
  9976. files: string[];
  9977. onSuccess: (task: IAssetTask) => void;
  9978. onError: (task: IAssetTask) => void;
  9979. isCompleted: boolean;
  9980. texture: CubeTexture;
  9981. constructor(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]);
  9982. run(scene: Scene, onSuccess: () => void, onError: () => void): void;
  9983. }
  9984. class AssetsManager {
  9985. private _scene;
  9986. protected tasks: IAssetTask[];
  9987. protected waitingTasksCount: number;
  9988. onFinish: (tasks: IAssetTask[]) => void;
  9989. onTaskSuccess: (task: IAssetTask) => void;
  9990. onTaskError: (task: IAssetTask) => void;
  9991. useDefaultLoadingScreen: boolean;
  9992. constructor(scene: Scene);
  9993. addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask;
  9994. addTextFileTask(taskName: string, url: string): IAssetTask;
  9995. addBinaryFileTask(taskName: string, url: string): IAssetTask;
  9996. addImageTask(taskName: string, url: string): IAssetTask;
  9997. addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): ITextureAssetTask;
  9998. private _decreaseWaitingTasksCount();
  9999. private _runTask(task);
  10000. reset(): AssetsManager;
  10001. load(): AssetsManager;
  10002. }
  10003. }
  10004. declare module BABYLON {
  10005. class Database {
  10006. private callbackManifestChecked;
  10007. private currentSceneUrl;
  10008. private db;
  10009. private enableSceneOffline;
  10010. private enableTexturesOffline;
  10011. private manifestVersionFound;
  10012. private mustUpdateRessources;
  10013. private hasReachedQuota;
  10014. private isSupported;
  10015. private idbFactory;
  10016. static IsUASupportingBlobStorage: boolean;
  10017. static IDBStorageEnabled: boolean;
  10018. constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any);
  10019. static parseURL: (url: string) => string;
  10020. static ReturnFullUrlLocation: (url: string) => string;
  10021. checkManifestFile(): void;
  10022. openAsync(successCallback: any, errorCallback: any): void;
  10023. loadImageFromDB(url: string, image: HTMLImageElement): void;
  10024. private _loadImageFromDBAsync(url, image, notInDBCallback);
  10025. private _saveImageIntoDBAsync(url, image);
  10026. private _checkVersionFromDB(url, versionLoaded);
  10027. private _loadVersionFromDBAsync(url, callback, updateInDBCallback);
  10028. private _saveVersionIntoDBAsync(url, callback);
  10029. private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?);
  10030. private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?);
  10031. private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?);
  10032. }
  10033. }
  10034. declare module BABYLON {
  10035. function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10036. function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10037. function serializeAsColor3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10038. function serializeAsFresnelParameters(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10039. function serializeAsVector2(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10040. function serializeAsVector3(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10041. function serializeAsMeshReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10042. function serializeAsColorCurves(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
  10043. class SerializationHelper {
  10044. static Serialize<T>(entity: T, serializationObject?: any): any;
  10045. static Parse<T>(creationFunction: () => T, source: any, scene: Scene, rootUrl?: string): T;
  10046. static Clone<T>(creationFunction: () => T, source: T): T;
  10047. }
  10048. }
  10049. declare module BABYLON {
  10050. class DynamicFloatArrayElementInfo {
  10051. offset: number;
  10052. }
  10053. /**
  10054. * The purpose of this class is to store float32 based elements of a given size (defined by the stride argument) in a dynamic fashion, that is, you can add/free elements. You can then access to a defragmented/packed version of the underlying Float32Array by calling the pack() method.
  10055. * The intent is to maintain through time data that will be bound to a WebGlBuffer with the ability to change add/remove elements.
  10056. * It was first built to efficiently maintain the WebGlBuffer that contain instancing based data.
  10057. * Allocating an Element will return a instance of DynamicFloatArrayElement which contains the offset into the Float32Array of where the element starts, you are then responsible to copy your data using this offset.
  10058. * Beware, calling pack() may change the offset of some Entries because this method will defragment the Float32Array to replace empty elements by moving allocated ones at their location.
  10059. * This method will return an ArrayBufferView on the existing Float32Array that describes the used elements. Use this View to update the WebGLBuffer and NOT the "buffer" field of the class. The pack() method won't shrink/reallocate the buffer to keep it GC friendly, all the empty space will be put at the end of the buffer, the method just ensure there are no "free holes".
  10060. */
  10061. class DynamicFloatArray {
  10062. /**
  10063. * Construct an instance of the dynamic float array
  10064. * @param stride size of one element in float (i.e. not bytes!)
  10065. * @param initialElementCount the number of available entries at construction
  10066. */
  10067. constructor(stride: number, initialElementCount: number);
  10068. /**
  10069. * Allocate an element in the array.
  10070. * @return the element info instance that contains the offset into the main buffer of the element's location.
  10071. * Beware, this offset may change when you call pack()
  10072. */
  10073. allocElement(): DynamicFloatArrayElementInfo;
  10074. /**
  10075. * Free the element corresponding to the given element info
  10076. * @param elInfo the element that describe the allocated element
  10077. */
  10078. freeElement(elInfo: DynamicFloatArrayElementInfo): void;
  10079. /**
  10080. * This method will pack all the used elements into a linear sequence and put all the free space at the end.
  10081. * Instances of DynamicFloatArrayElement may have their 'offset' member changed as data could be copied from one location to another, so be sure to read/write your data based on the value inside this member after you called pack().
  10082. * @return the subArray that is the view of the used elements area, you can use it as a source to update a WebGLBuffer
  10083. */
  10084. pack(): Float32Array;
  10085. private _moveElement(element, destOffset);
  10086. private _growBuffer();
  10087. /**
  10088. * This is the main buffer, all elements are stored inside, you use the DynamicFloatArrayElement instance of a given element to know its location into this buffer, then you have the responsibility to perform write operations in this buffer at the right location!
  10089. * Don't use this buffer for a WebGL bufferSubData() operation, but use the one returned by the pack() method.
  10090. */
  10091. buffer: Float32Array;
  10092. /**
  10093. * Get the total count of entries that can fit in the current buffer
  10094. * @returns the elements count
  10095. */
  10096. totalElementCount: number;
  10097. /**
  10098. * Get the count of free entries that can still be allocated without resizing the buffer
  10099. * @returns the free elements count
  10100. */
  10101. freeElementCount: number;
  10102. /**
  10103. * Get the count of allocated elements
  10104. * @returns the allocated elements count
  10105. */
  10106. usedElementCount: number;
  10107. /**
  10108. * Return the size of one element in float
  10109. * @returns the size in float
  10110. */
  10111. stride: number;
  10112. compareValueOffset: number;
  10113. sortingAscending: boolean;
  10114. sort(): boolean;
  10115. private _allEntries;
  10116. private _freeEntries;
  10117. private _stride;
  10118. private _lastUsed;
  10119. private _firstFree;
  10120. private _sortTable;
  10121. private _sortedTable;
  10122. }
  10123. }
  10124. declare module Earcut {
  10125. /**
  10126. * The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
  10127. * @param data is a flat array of vertice coordinates like [x0, y0, x1, y1, x2, y2, ...].
  10128. * @param holeIndices is an array of hole indices if any (e.g. [5, 8] for a 12- vertice input would mean one hole with vertices 5–7 and another with 8–11).
  10129. * @param dim is the number of coordinates per vertice in the input array (2 by default).
  10130. */
  10131. function earcut(data: number[], holeIndices: number[], dim: number): any[];
  10132. /**
  10133. * return a percentage difference between the polygon area and its triangulation area;
  10134. * used to verify correctness of triangulation
  10135. */
  10136. function deviation(data: number[], holeIndices: number[], dim: number, triangles: number[]): number;
  10137. /**
  10138. * turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
  10139. */
  10140. function flatten(data: number[][][]): {
  10141. vertices: any[];
  10142. holes: any[];
  10143. dimensions: number;
  10144. };
  10145. }
  10146. declare module BABYLON {
  10147. class FilesInput {
  10148. private _engine;
  10149. private _currentScene;
  10150. private _canvas;
  10151. private _sceneLoadedCallback;
  10152. private _progressCallback;
  10153. private _additionnalRenderLoopLogicCallback;
  10154. private _textureLoadingCallback;
  10155. private _startingProcessingFilesCallback;
  10156. private _elementToMonitor;
  10157. static FilesTextures: any[];
  10158. static FilesToLoad: any[];
  10159. private _sceneFileToLoad;
  10160. private _filesToLoad;
  10161. 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);
  10162. monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void;
  10163. private renderFunction();
  10164. private drag(e);
  10165. private drop(eventDrop);
  10166. loadFiles(event: any): void;
  10167. reload(): void;
  10168. }
  10169. }
  10170. declare module BABYLON {
  10171. class Gamepads {
  10172. private babylonGamepads;
  10173. private oneGamepadConnected;
  10174. private isMonitoring;
  10175. private gamepadEventSupported;
  10176. private gamepadSupportAvailable;
  10177. private _callbackGamepadConnected;
  10178. private _onGamepadConnectedEvent;
  10179. private _onGamepadDisonnectedEvent;
  10180. private static gamepadDOMInfo;
  10181. constructor(ongamedpadconnected: (gamepad: Gamepad) => void);
  10182. dispose(): void;
  10183. private _onGamepadConnected(evt);
  10184. private _addNewGamepad(gamepad);
  10185. private _onGamepadDisconnected(evt);
  10186. private _startMonitoringGamepads();
  10187. private _stopMonitoringGamepads();
  10188. private _checkGamepadsStatus();
  10189. private _updateGamepadObjects();
  10190. }
  10191. class StickValues {
  10192. x: any;
  10193. y: any;
  10194. constructor(x: any, y: any);
  10195. }
  10196. class Gamepad {
  10197. id: string;
  10198. index: number;
  10199. browserGamepad: any;
  10200. private _leftStick;
  10201. private _rightStick;
  10202. private _onleftstickchanged;
  10203. private _onrightstickchanged;
  10204. constructor(id: string, index: number, browserGamepad: any);
  10205. onleftstickchanged(callback: (values: StickValues) => void): void;
  10206. onrightstickchanged(callback: (values: StickValues) => void): void;
  10207. leftStick: StickValues;
  10208. rightStick: StickValues;
  10209. update(): void;
  10210. }
  10211. class GenericPad extends Gamepad {
  10212. id: string;
  10213. index: number;
  10214. gamepad: any;
  10215. private _buttons;
  10216. private _onbuttondown;
  10217. private _onbuttonup;
  10218. onbuttondown(callback: (buttonPressed: number) => void): void;
  10219. onbuttonup(callback: (buttonReleased: number) => void): void;
  10220. constructor(id: string, index: number, gamepad: any);
  10221. private _setButtonValue(newValue, currentValue, buttonIndex);
  10222. update(): void;
  10223. }
  10224. enum Xbox360Button {
  10225. A = 0,
  10226. B = 1,
  10227. X = 2,
  10228. Y = 3,
  10229. Start = 4,
  10230. Back = 5,
  10231. LB = 6,
  10232. RB = 7,
  10233. LeftStick = 8,
  10234. RightStick = 9,
  10235. }
  10236. enum Xbox360Dpad {
  10237. Up = 0,
  10238. Down = 1,
  10239. Left = 2,
  10240. Right = 3,
  10241. }
  10242. class Xbox360Pad extends Gamepad {
  10243. private _leftTrigger;
  10244. private _rightTrigger;
  10245. private _onlefttriggerchanged;
  10246. private _onrighttriggerchanged;
  10247. private _onbuttondown;
  10248. private _onbuttonup;
  10249. private _ondpaddown;
  10250. private _ondpadup;
  10251. private _buttonA;
  10252. private _buttonB;
  10253. private _buttonX;
  10254. private _buttonY;
  10255. private _buttonBack;
  10256. private _buttonStart;
  10257. private _buttonLB;
  10258. private _buttonRB;
  10259. private _buttonLeftStick;
  10260. private _buttonRightStick;
  10261. private _dPadUp;
  10262. private _dPadDown;
  10263. private _dPadLeft;
  10264. private _dPadRight;
  10265. onlefttriggerchanged(callback: (value: number) => void): void;
  10266. onrighttriggerchanged(callback: (value: number) => void): void;
  10267. leftTrigger: number;
  10268. rightTrigger: number;
  10269. onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void;
  10270. onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void;
  10271. ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void;
  10272. ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void;
  10273. private _setButtonValue(newValue, currentValue, buttonType);
  10274. private _setDPadValue(newValue, currentValue, buttonType);
  10275. buttonA: number;
  10276. buttonB: number;
  10277. buttonX: number;
  10278. buttonY: number;
  10279. buttonStart: number;
  10280. buttonBack: number;
  10281. buttonLB: number;
  10282. buttonRB: number;
  10283. buttonLeftStick: number;
  10284. buttonRightStick: number;
  10285. dPadUp: number;
  10286. dPadDown: number;
  10287. dPadLeft: number;
  10288. dPadRight: number;
  10289. update(): void;
  10290. }
  10291. }
  10292. interface Navigator {
  10293. getGamepads(func?: any): any;
  10294. webkitGetGamepads(func?: any): any;
  10295. msGetGamepads(func?: any): any;
  10296. webkitGamepads(func?: any): any;
  10297. }
  10298. declare module BABYLON {
  10299. interface ILoadingScreen {
  10300. displayLoadingUI: () => void;
  10301. hideLoadingUI: () => void;
  10302. loadingUIBackgroundColor: string;
  10303. loadingUIText: string;
  10304. }
  10305. class DefaultLoadingScreen implements ILoadingScreen {
  10306. private _renderingCanvas;
  10307. private _loadingText;
  10308. private _loadingDivBackgroundColor;
  10309. private _loadingDiv;
  10310. private _loadingTextDiv;
  10311. constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
  10312. displayLoadingUI(): void;
  10313. hideLoadingUI(): void;
  10314. loadingUIText: string;
  10315. loadingUIBackgroundColor: string;
  10316. private _resizeLoadingUI;
  10317. }
  10318. }
  10319. declare module BABYLON {
  10320. /**
  10321. * A class serves as a medium between the observable and its observers
  10322. */
  10323. class EventState {
  10324. /**
  10325. * If the callback of a given Observer set skipNextObservers to true the following observers will be ignored
  10326. */
  10327. constructor(mask: number, skipNextObservers?: boolean);
  10328. initalize(mask: number, skipNextObservers?: boolean): EventState;
  10329. /**
  10330. * An Observer can set this property to true to prevent subsequent observers of being notified
  10331. */
  10332. skipNextObservers: boolean;
  10333. /**
  10334. * Get the mask value that were used to trigger the event corresponding to this EventState object
  10335. */
  10336. mask: number;
  10337. }
  10338. /**
  10339. * Represent an Observer registered to a given Observable object.
  10340. */
  10341. class Observer<T> {
  10342. callback: (eventData: T, eventState: EventState) => void;
  10343. mask: number;
  10344. constructor(callback: (eventData: T, eventState: EventState) => void, mask: number);
  10345. }
  10346. /**
  10347. * The Observable class is a simple implementation of the Observable pattern.
  10348. * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.
  10349. * This enable a more fine grained execution without having to rely on multiple different Observable objects.
  10350. * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).
  10351. * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.
  10352. */
  10353. class Observable<T> {
  10354. _observers: Observer<T>[];
  10355. private _eventState;
  10356. constructor();
  10357. /**
  10358. * Create a new Observer with the specified callback
  10359. * @param callback the callback that will be executed for that Observer
  10360. * @param mask the mask used to filter observers
  10361. * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
  10362. */
  10363. add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean): Observer<T>;
  10364. /**
  10365. * Remove an Observer from the Observable object
  10366. * @param observer the instance of the Observer to remove. If it doesn't belong to this Observable, false will be returned.
  10367. */
  10368. remove(observer: Observer<T>): boolean;
  10369. /**
  10370. * Remove a callback from the Observable object
  10371. * @param callback the callback to remove. If it doesn't belong to this Observable, false will be returned.
  10372. */
  10373. removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
  10374. /**
  10375. * Notify all Observers by calling their respective callback with the given data
  10376. * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute
  10377. * @param eventData
  10378. * @param mask
  10379. */
  10380. notifyObservers(eventData: T, mask?: number): boolean;
  10381. /**
  10382. * return true is the Observable has at least one Observer registered
  10383. */
  10384. hasObservers(): boolean;
  10385. /**
  10386. * Clear the list of observers
  10387. */
  10388. clear(): void;
  10389. /**
  10390. * Clone the current observable
  10391. */
  10392. clone(): Observable<T>;
  10393. }
  10394. }
  10395. declare module BABYLON {
  10396. /**
  10397. * This class describe a rectangle that were added to the map.
  10398. * You have access to its coordinates either in pixel or normalized (UV)
  10399. */
  10400. class PackedRect {
  10401. constructor(root: PackedRect, parent: PackedRect, pos: Vector2, size: Size);
  10402. /**
  10403. * @returns the position of this node into the map
  10404. */
  10405. pos: Vector2;
  10406. /**
  10407. * @returns the size of the rectangle this node handles
  10408. */
  10409. contentSize: Size;
  10410. /**
  10411. * Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
  10412. * @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
  10413. */
  10414. UVs: Vector2[];
  10415. /**
  10416. * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations) and then using only a part of the PackRect.
  10417. * This method will return the UVs for this part by given the custom size of what you really use
  10418. * @param customSize must be less/equal to the allocated size, UV will be compute from this
  10419. */
  10420. getUVsForCustomSize(customSize: Size): Vector2[];
  10421. /**
  10422. * Free this rectangle from the map.
  10423. * Call this method when you no longer need the rectangle to be in the map.
  10424. */
  10425. freeContent(): void;
  10426. protected isUsed: boolean;
  10427. protected findAndSplitNode(contentSize: Size): PackedRect;
  10428. private findNode(size);
  10429. private splitNode(contentSize);
  10430. private attemptDefrag();
  10431. private clearNode();
  10432. private isRecursiveFree;
  10433. protected evalFreeSize(size: number): number;
  10434. protected _root: PackedRect;
  10435. protected _parent: PackedRect;
  10436. private _contentSize;
  10437. private _initialSize;
  10438. private _leftNode;
  10439. private _rightNode;
  10440. private _bottomNode;
  10441. private _pos;
  10442. protected _size: Size;
  10443. }
  10444. /**
  10445. * The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
  10446. * This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
  10447. * Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
  10448. */
  10449. class RectPackingMap extends PackedRect {
  10450. /**
  10451. * Create an instance of the object with a dimension using the given size
  10452. * @param size The dimension of the rectangle that will contain all the sub ones.
  10453. */
  10454. constructor(size: Size);
  10455. /**
  10456. * Add a rectangle, finding the best location to store it into the map
  10457. * @param size the dimension of the rectangle to store
  10458. * @return the Node containing the rectangle information, or null if we couldn't find a free spot
  10459. */
  10460. addRect(size: Size): PackedRect;
  10461. /**
  10462. * Return the current space free normalized between [0;1]
  10463. * @returns {}
  10464. */
  10465. freeSpace: number;
  10466. }
  10467. }
  10468. declare module BABYLON {
  10469. class SceneOptimization {
  10470. priority: number;
  10471. apply: (scene: Scene) => boolean;
  10472. constructor(priority?: number);
  10473. }
  10474. class TextureOptimization extends SceneOptimization {
  10475. priority: number;
  10476. maximumSize: number;
  10477. constructor(priority?: number, maximumSize?: number);
  10478. apply: (scene: Scene) => boolean;
  10479. }
  10480. class HardwareScalingOptimization extends SceneOptimization {
  10481. priority: number;
  10482. maximumScale: number;
  10483. private _currentScale;
  10484. constructor(priority?: number, maximumScale?: number);
  10485. apply: (scene: Scene) => boolean;
  10486. }
  10487. class ShadowsOptimization extends SceneOptimization {
  10488. apply: (scene: Scene) => boolean;
  10489. }
  10490. class PostProcessesOptimization extends SceneOptimization {
  10491. apply: (scene: Scene) => boolean;
  10492. }
  10493. class LensFlaresOptimization extends SceneOptimization {
  10494. apply: (scene: Scene) => boolean;
  10495. }
  10496. class ParticlesOptimization extends SceneOptimization {
  10497. apply: (scene: Scene) => boolean;
  10498. }
  10499. class RenderTargetsOptimization extends SceneOptimization {
  10500. apply: (scene: Scene) => boolean;
  10501. }
  10502. class MergeMeshesOptimization extends SceneOptimization {
  10503. static _UpdateSelectionTree: boolean;
  10504. static UpdateSelectionTree: boolean;
  10505. private _canBeMerged;
  10506. apply: (scene: Scene, updateSelectionTree?: boolean) => boolean;
  10507. }
  10508. class SceneOptimizerOptions {
  10509. targetFrameRate: number;
  10510. trackerDuration: number;
  10511. optimizations: SceneOptimization[];
  10512. constructor(targetFrameRate?: number, trackerDuration?: number);
  10513. static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10514. static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10515. static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions;
  10516. }
  10517. class SceneOptimizer {
  10518. static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void;
  10519. static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void;
  10520. }
  10521. }
  10522. declare module BABYLON {
  10523. class SceneSerializer {
  10524. static ClearCache(): void;
  10525. static Serialize(scene: Scene): any;
  10526. static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any;
  10527. }
  10528. }
  10529. declare module BABYLON {
  10530. class SmartArray<T> {
  10531. data: Array<T>;
  10532. length: number;
  10533. private _id;
  10534. private _duplicateId;
  10535. constructor(capacity: number);
  10536. push(value: any): void;
  10537. pushNoDuplicate(value: any): boolean;
  10538. sort(compareFn: any): void;
  10539. reset(): void;
  10540. concat(array: any): void;
  10541. concatWithNoDuplicate(array: any): void;
  10542. indexOf(value: any): number;
  10543. private static _GlobalId;
  10544. }
  10545. }
  10546. declare module BABYLON {
  10547. /**
  10548. * This class implement a typical dictionary using a string as key and the generic type T as value.
  10549. * The underlying implementation relies on an associative array to ensure the best performances.
  10550. * The value can be anything including 'null' but except 'undefined'
  10551. */
  10552. class StringDictionary<T> {
  10553. /**
  10554. * This will clear this dictionary and copy the content from the 'source' one.
  10555. * If the T value is a custom object, it won't be copied/cloned, the same object will be used
  10556. * @param source the dictionary to take the content from and copy to this dictionary
  10557. */
  10558. copyFrom(source: StringDictionary<T>): void;
  10559. /**
  10560. * Get a value based from its key
  10561. * @param key the given key to get the matching value from
  10562. * @return the value if found, otherwise undefined is returned
  10563. */
  10564. get(key: string): T;
  10565. /**
  10566. * Get a value from its key or add it if it doesn't exist.
  10567. * This method will ensure you that a given key/data will be present in the dictionary.
  10568. * @param key the given key to get the matching value from
  10569. * @param factory the factory that will create the value if the key is not present in the dictionary.
  10570. * The factory will only be invoked if there's no data for the given key.
  10571. * @return the value corresponding to the key.
  10572. */
  10573. getOrAddWithFactory(key: string, factory: (key: string) => T): T;
  10574. /**
  10575. * Get a value from its key if present in the dictionary otherwise add it
  10576. * @param key the key to get the value from
  10577. * @param val if there's no such key/value pair in the dictionary add it with this value
  10578. * @return the value corresponding to the key
  10579. */
  10580. getOrAdd(key: string, val: T): T;
  10581. /**
  10582. * Check if there's a given key in the dictionary
  10583. * @param key the key to check for
  10584. * @return true if the key is present, false otherwise
  10585. */
  10586. contains(key: any): boolean;
  10587. /**
  10588. * Add a new key and its corresponding value
  10589. * @param key the key to add
  10590. * @param value the value corresponding to the key
  10591. * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary
  10592. */
  10593. add(key: string, value: T): boolean;
  10594. set(key: string, value: T): boolean;
  10595. /**
  10596. * Get the element of the given key and remove it from the dictionary
  10597. * @param key
  10598. */
  10599. getAndRemove(key: string): T;
  10600. /**
  10601. * Remove a key/value from the dictionary.
  10602. * @param key the key to remove
  10603. * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary
  10604. */
  10605. remove(key: string): boolean;
  10606. /**
  10607. * Clear the whole content of the dictionary
  10608. */
  10609. clear(): void;
  10610. count: number;
  10611. /**
  10612. * Execute a callback on each key/val of the dictionary.
  10613. * Note that you can remove any element in this dictionary in the callback implementation
  10614. * @param callback the callback to execute on a given key/value pair
  10615. */
  10616. forEach(callback: (key: string, val: T) => void): void;
  10617. /**
  10618. * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.
  10619. * If the callback returns null or undefined the method will iterate to the next key/value pair
  10620. * Note that you can remove any element in this dictionary in the callback implementation
  10621. * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned
  10622. */
  10623. first<TRes>(callback: (key: string, val: T) => TRes): TRes;
  10624. private _count;
  10625. private _data;
  10626. }
  10627. }
  10628. declare module BABYLON {
  10629. class Tags {
  10630. static EnableFor(obj: any): void;
  10631. static DisableFor(obj: any): void;
  10632. static HasTags(obj: any): boolean;
  10633. static GetTags(obj: any, asString?: boolean): any;
  10634. static AddTagsTo(obj: any, tagsString: string): void;
  10635. static _AddTagTo(obj: any, tag: string): void;
  10636. static RemoveTagsFrom(obj: any, tagsString: string): void;
  10637. static _RemoveTagFrom(obj: any, tag: string): void;
  10638. static MatchesQuery(obj: any, tagsQuery: string): boolean;
  10639. }
  10640. }
  10641. declare module BABYLON.Internals {
  10642. interface DDSInfo {
  10643. width: number;
  10644. height: number;
  10645. mipmapCount: number;
  10646. isFourCC: boolean;
  10647. isRGB: boolean;
  10648. isLuminance: boolean;
  10649. isCube: boolean;
  10650. }
  10651. class DDSTools {
  10652. static GetDDSInfo(arrayBuffer: any): DDSInfo;
  10653. private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10654. private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10655. private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
  10656. static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void;
  10657. }
  10658. }
  10659. declare module BABYLON.Internals {
  10660. class TGATools {
  10661. private static _TYPE_NO_DATA;
  10662. private static _TYPE_INDEXED;
  10663. private static _TYPE_RGB;
  10664. private static _TYPE_GREY;
  10665. private static _TYPE_RLE_INDEXED;
  10666. private static _TYPE_RLE_RGB;
  10667. private static _TYPE_RLE_GREY;
  10668. private static _ORIGIN_MASK;
  10669. private static _ORIGIN_SHIFT;
  10670. private static _ORIGIN_BL;
  10671. private static _ORIGIN_BR;
  10672. private static _ORIGIN_UL;
  10673. private static _ORIGIN_UR;
  10674. static GetTGAHeader(data: Uint8Array): any;
  10675. static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void;
  10676. 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;
  10677. 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;
  10678. 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;
  10679. 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;
  10680. 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;
  10681. 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;
  10682. }
  10683. }
  10684. declare module BABYLON {
  10685. interface IAnimatable {
  10686. animations: Array<Animation>;
  10687. }
  10688. class Tools {
  10689. static BaseUrl: string;
  10690. static CorsBehavior: any;
  10691. static UseFallbackTexture: boolean;
  10692. static Instantiate(className: string): any;
  10693. static SetImmediate(action: () => void): void;
  10694. static IsExponentOfTwo(value: number): boolean;
  10695. static GetExponentOfTwo(value: number, max: number): number;
  10696. static GetFilename(path: string): string;
  10697. static GetDOMTextContent(element: HTMLElement): string;
  10698. static ToDegrees(angle: number): number;
  10699. static ToRadians(angle: number): number;
  10700. static EncodeArrayBufferTobase64(buffer: ArrayBuffer): string;
  10701. static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[] | Int32Array, indexStart: number, indexCount: number, bias?: Vector2): {
  10702. minimum: Vector3;
  10703. maximum: Vector3;
  10704. };
  10705. static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number, bias?: Vector2, stride?: number): {
  10706. minimum: Vector3;
  10707. maximum: Vector3;
  10708. };
  10709. static Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): (i) => Vector2;
  10710. static ExtractMinAndMaxVector2(feeder: (index: number) => Vector2, bias?: Vector2): {
  10711. minimum: Vector2;
  10712. maximum: Vector2;
  10713. };
  10714. static MakeArray(obj: any, allowsNullUndefined?: boolean): Array<any>;
  10715. static GetPointerPrefix(): string;
  10716. /**
  10717. * @param func - the function to be called
  10718. * @param requester - the object that will request the next frame. Falls back to window.
  10719. */
  10720. static QueueNewFrame(func: any, requester?: any): void;
  10721. static RequestFullscreen(element: any): void;
  10722. static ExitFullscreen(): void;
  10723. static SetCorsBehavior(url: string, img: HTMLImageElement): string;
  10724. static CleanUrl(url: string): string;
  10725. static LoadImage(url: any, onload: any, onerror: any, database: any): HTMLImageElement;
  10726. static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void;
  10727. static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void;
  10728. static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void;
  10729. static FileAsURL(content: string): string;
  10730. static Format(value: number, decimals?: number): string;
  10731. static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
  10732. static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void;
  10733. static IsEmpty(obj: any): boolean;
  10734. static RegisterTopRootEvents(events: {
  10735. name: string;
  10736. handler: EventListener;
  10737. }[]): void;
  10738. static UnregisterTopRootEvents(events: {
  10739. name: string;
  10740. handler: EventListener;
  10741. }[]): void;
  10742. static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: string) => void, mimeType?: string): void;
  10743. static EncodeScreenshotCanvasData(successCallback?: (data: string) => void, mimeType?: string): void;
  10744. static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  10745. static CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: (data: string) => void, mimeType?: string): void;
  10746. static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean;
  10747. /**
  10748. * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
  10749. * Be aware Math.random() could cause collisions, but:
  10750. * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
  10751. */
  10752. static RandomId(): string;
  10753. private static _NoneLogLevel;
  10754. private static _MessageLogLevel;
  10755. private static _WarningLogLevel;
  10756. private static _ErrorLogLevel;
  10757. private static _LogCache;
  10758. static errorsCount: number;
  10759. static OnNewCacheEntry: (entry: string) => void;
  10760. static NoneLogLevel: number;
  10761. static MessageLogLevel: number;
  10762. static WarningLogLevel: number;
  10763. static ErrorLogLevel: number;
  10764. static AllLogLevel: number;
  10765. private static _AddLogEntry(entry);
  10766. private static _FormatMessage(message);
  10767. static Log: (message: string) => void;
  10768. private static _LogDisabled(message);
  10769. private static _LogEnabled(message);
  10770. static Warn: (message: string) => void;
  10771. private static _WarnDisabled(message);
  10772. private static _WarnEnabled(message);
  10773. static Error: (message: string) => void;
  10774. private static _ErrorDisabled(message);
  10775. private static _ErrorEnabled(message);
  10776. static LogCache: string;
  10777. static ClearLogCache(): void;
  10778. static LogLevels: number;
  10779. private static _PerformanceNoneLogLevel;
  10780. private static _PerformanceUserMarkLogLevel;
  10781. private static _PerformanceConsoleLogLevel;
  10782. private static _performance;
  10783. static PerformanceNoneLogLevel: number;
  10784. static PerformanceUserMarkLogLevel: number;
  10785. static PerformanceConsoleLogLevel: number;
  10786. static PerformanceLogLevel: number;
  10787. static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  10788. static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void;
  10789. static _StartUserMark(counterName: string, condition?: boolean): void;
  10790. static _EndUserMark(counterName: string, condition?: boolean): void;
  10791. static _StartPerformanceConsole(counterName: string, condition?: boolean): void;
  10792. static _EndPerformanceConsole(counterName: string, condition?: boolean): void;
  10793. static StartPerformanceCounter: (counterName: string, condition?: boolean) => void;
  10794. static EndPerformanceCounter: (counterName: string, condition?: boolean) => void;
  10795. static Now: number;
  10796. /**
  10797. * This method will return the name of the class used to create the instance of the given object.
  10798. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.
  10799. * @param object the object to get the class name from
  10800. * @return the name of the class, will be "object" for a custom data type not using the @className decorator
  10801. */
  10802. static getClassName(object: any, isType?: boolean): string;
  10803. static first<T>(array: Array<T>, predicate: (item) => boolean): T;
  10804. /**
  10805. * This method will return the name of the full name of the class, including its owning module (if any).
  10806. * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).
  10807. * @param object the object to get the class name from
  10808. * @return a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.
  10809. */
  10810. static getFullClassName(object: any, isType?: boolean): string;
  10811. /**
  10812. * This method can be used with hashCodeFromStream when your input is an array of values that are either: number, string, boolean or custom type implementing the getHashCode():number method.
  10813. * @param array
  10814. */
  10815. static arrayOrStringFeeder(array: any): (i) => number;
  10816. /**
  10817. * Compute the hashCode of a stream of number
  10818. * To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.
  10819. * @param feeder a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.
  10820. * @return the hash code computed
  10821. */
  10822. static hashCodeFromStream(feeder: (index: number) => number): number;
  10823. }
  10824. /**
  10825. * This class is used to track a performance counter which is number based.
  10826. * The user has access to many properties which give statistics of different nature
  10827. *
  10828. * The implementer can track two kinds of Performance Counter: time and count
  10829. * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
  10830. * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
  10831. */
  10832. class PerfCounter {
  10833. /**
  10834. * Returns the smallest value ever
  10835. */
  10836. min: number;
  10837. /**
  10838. * Returns the biggest value ever
  10839. */
  10840. max: number;
  10841. /**
  10842. * Returns the average value since the performance counter is running
  10843. */
  10844. average: number;
  10845. /**
  10846. * Returns the average value of the last second the counter was monitored
  10847. */
  10848. lastSecAverage: number;
  10849. /**
  10850. * Returns the current value
  10851. */
  10852. current: number;
  10853. total: number;
  10854. constructor();
  10855. /**
  10856. * Call this method to start monitoring a new frame.
  10857. * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
  10858. */
  10859. fetchNewFrame(): void;
  10860. /**
  10861. * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
  10862. * @param newCount the count value to add to the monitored count
  10863. * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
  10864. */
  10865. addCount(newCount: number, fetchResult: boolean): void;
  10866. /**
  10867. * Start monitoring this performance counter
  10868. */
  10869. beginMonitoring(): void;
  10870. /**
  10871. * Compute the time lapsed since the previous beginMonitoring() call.
  10872. * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
  10873. */
  10874. endMonitoring(newFrame?: boolean): void;
  10875. private _fetchResult();
  10876. private _startMonitoringTime;
  10877. private _min;
  10878. private _max;
  10879. private _average;
  10880. private _current;
  10881. private _totalValueCount;
  10882. private _totalAccumulated;
  10883. private _lastSecAverage;
  10884. private _lastSecAccumulated;
  10885. private _lastSecTime;
  10886. private _lastSecValueCount;
  10887. }
  10888. /**
  10889. * Use this className as a decorator on a given class definition to add it a name and optionally its module.
  10890. * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
  10891. * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified
  10892. * @param name The name of the class, case should be preserved
  10893. * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.
  10894. */
  10895. function className(name: string, module?: string): (target: Object) => void;
  10896. /**
  10897. * An implementation of a loop for asynchronous functions.
  10898. */
  10899. class AsyncLoop {
  10900. iterations: number;
  10901. private _fn;
  10902. private _successCallback;
  10903. index: number;
  10904. private _done;
  10905. /**
  10906. * Constroctor.
  10907. * @param iterations the number of iterations.
  10908. * @param _fn the function to run each iteration
  10909. * @param _successCallback the callback that will be called upon succesful execution
  10910. * @param offset starting offset.
  10911. */
  10912. constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number);
  10913. /**
  10914. * Execute the next iteration. Must be called after the last iteration was finished.
  10915. */
  10916. executeNext(): void;
  10917. /**
  10918. * Break the loop and run the success callback.
  10919. */
  10920. breakLoop(): void;
  10921. /**
  10922. * Helper function
  10923. */
  10924. static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop;
  10925. /**
  10926. * A for-loop that will run a given number of iterations synchronous and the rest async.
  10927. * @param iterations total number of iterations
  10928. * @param syncedIterations number of synchronous iterations in each async iteration.
  10929. * @param fn the function to call each iteration.
  10930. * @param callback a success call back that will be called when iterating stops.
  10931. * @param breakFunction a break condition (optional)
  10932. * @param timeout timeout settings for the setTimeout function. default - 0.
  10933. * @constructor
  10934. */
  10935. static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void;
  10936. }
  10937. }
  10938. declare module BABYLON {
  10939. enum JoystickAxis {
  10940. X = 0,
  10941. Y = 1,
  10942. Z = 2,
  10943. }
  10944. class VirtualJoystick {
  10945. reverseLeftRight: boolean;
  10946. reverseUpDown: boolean;
  10947. deltaPosition: Vector3;
  10948. pressed: boolean;
  10949. private static _globalJoystickIndex;
  10950. private static vjCanvas;
  10951. private static vjCanvasContext;
  10952. private static vjCanvasWidth;
  10953. private static vjCanvasHeight;
  10954. private static halfWidth;
  10955. private static halfHeight;
  10956. private _action;
  10957. private _axisTargetedByLeftAndRight;
  10958. private _axisTargetedByUpAndDown;
  10959. private _joystickSensibility;
  10960. private _inversedSensibility;
  10961. private _rotationSpeed;
  10962. private _inverseRotationSpeed;
  10963. private _rotateOnAxisRelativeToMesh;
  10964. private _joystickPointerID;
  10965. private _joystickColor;
  10966. private _joystickPointerPos;
  10967. private _joystickPreviousPointerPos;
  10968. private _joystickPointerStartPos;
  10969. private _deltaJoystickVector;
  10970. private _leftJoystick;
  10971. private _joystickIndex;
  10972. private _touches;
  10973. private _onPointerDownHandlerRef;
  10974. private _onPointerMoveHandlerRef;
  10975. private _onPointerUpHandlerRef;
  10976. private _onPointerOutHandlerRef;
  10977. private _onResize;
  10978. constructor(leftJoystick?: boolean);
  10979. setJoystickSensibility(newJoystickSensibility: number): void;
  10980. private _onPointerDown(e);
  10981. private _onPointerMove(e);
  10982. private _onPointerUp(e);
  10983. /**
  10984. * Change the color of the virtual joystick
  10985. * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
  10986. */
  10987. setJoystickColor(newColor: string): void;
  10988. setActionOnTouch(action: () => any): void;
  10989. setAxisForLeftRight(axis: JoystickAxis): void;
  10990. setAxisForUpDown(axis: JoystickAxis): void;
  10991. private _clearCanvas();
  10992. private _drawVirtualJoystick();
  10993. releaseCanvas(): void;
  10994. }
  10995. }
  10996. declare module BABYLON {
  10997. interface IOctreeContainer<T> {
  10998. blocks: Array<OctreeBlock<T>>;
  10999. }
  11000. class Octree<T> {
  11001. maxDepth: number;
  11002. blocks: Array<OctreeBlock<T>>;
  11003. dynamicContent: T[];
  11004. private _maxBlockCapacity;
  11005. private _selectionContent;
  11006. private _creationFunc;
  11007. constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, maxDepth?: number);
  11008. update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void;
  11009. addMesh(entry: T): void;
  11010. select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T>;
  11011. intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T>;
  11012. intersectsRay(ray: Ray): SmartArray<T>;
  11013. 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;
  11014. static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>) => void;
  11015. static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock<SubMesh>) => void;
  11016. }
  11017. }
  11018. declare module BABYLON {
  11019. class OctreeBlock<T> {
  11020. entries: T[];
  11021. blocks: Array<OctreeBlock<T>>;
  11022. private _depth;
  11023. private _maxDepth;
  11024. private _capacity;
  11025. private _minPoint;
  11026. private _maxPoint;
  11027. private _boundingVectors;
  11028. private _creationFunc;
  11029. constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void);
  11030. capacity: number;
  11031. minPoint: Vector3;
  11032. maxPoint: Vector3;
  11033. addEntry(entry: T): void;
  11034. addEntries(entries: T[]): void;
  11035. select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void;
  11036. intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void;
  11037. intersectsRay(ray: Ray, selection: SmartArray<T>): void;
  11038. createInnerBlocks(): void;
  11039. }
  11040. }
  11041. declare module BABYLON {
  11042. class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
  11043. camera: ArcRotateCamera;
  11044. gamepad: Gamepad;
  11045. private _gamepads;
  11046. gamepadRotationSensibility: number;
  11047. gamepadMoveSensibility: number;
  11048. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11049. detachControl(element: HTMLElement): void;
  11050. checkInputs(): void;
  11051. private _onNewGameConnected(gamepad);
  11052. getTypeName(): string;
  11053. getSimpleName(): string;
  11054. }
  11055. }
  11056. declare module BABYLON {
  11057. class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
  11058. camera: ArcRotateCamera;
  11059. private _keys;
  11060. private _onKeyDown;
  11061. private _onKeyUp;
  11062. private _onLostFocus;
  11063. keysUp: number[];
  11064. keysDown: number[];
  11065. keysLeft: number[];
  11066. keysRight: number[];
  11067. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11068. detachControl(element: HTMLElement): void;
  11069. checkInputs(): void;
  11070. getTypeName(): string;
  11071. getSimpleName(): string;
  11072. }
  11073. }
  11074. declare module BABYLON {
  11075. class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  11076. camera: ArcRotateCamera;
  11077. private _wheel;
  11078. private _observer;
  11079. wheelPrecision: number;
  11080. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11081. detachControl(element: HTMLElement): void;
  11082. getTypeName(): string;
  11083. getSimpleName(): string;
  11084. }
  11085. }
  11086. declare module BABYLON {
  11087. class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
  11088. camera: ArcRotateCamera;
  11089. buttons: number[];
  11090. angularSensibilityX: number;
  11091. angularSensibilityY: number;
  11092. pinchPrecision: number;
  11093. panningSensibility: number;
  11094. private _isPanClick;
  11095. pinchInwards: boolean;
  11096. private _pointerInput;
  11097. private _observer;
  11098. private _onKeyDown;
  11099. private _onKeyUp;
  11100. private _onMouseMove;
  11101. private _onGestureStart;
  11102. private _onGesture;
  11103. private _MSGestureHandler;
  11104. private _onLostFocus;
  11105. private _onContextMenu;
  11106. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11107. detachControl(element: HTMLElement): void;
  11108. getTypeName(): string;
  11109. getSimpleName(): string;
  11110. }
  11111. }
  11112. declare module BABYLON {
  11113. class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  11114. camera: ArcRotateCamera;
  11115. alphaCorrection: number;
  11116. betaCorrection: number;
  11117. gammaCorrection: number;
  11118. private _alpha;
  11119. private _beta;
  11120. private _gamma;
  11121. private _dirty;
  11122. private _offsetOrientation;
  11123. private _deviceOrientationHandler;
  11124. constructor();
  11125. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11126. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  11127. checkInputs(): void;
  11128. detachControl(element: HTMLElement): void;
  11129. getTypeName(): string;
  11130. getSimpleName(): string;
  11131. }
  11132. }
  11133. declare module BABYLON {
  11134. class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera> {
  11135. private _camera;
  11136. private _screenOrientationAngle;
  11137. private _constantTranform;
  11138. private _screenQuaternion;
  11139. private _alpha;
  11140. private _beta;
  11141. private _gamma;
  11142. constructor();
  11143. camera: FreeCamera;
  11144. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11145. private _orientationChanged;
  11146. private _deviceOrientation;
  11147. detachControl(element: HTMLElement): void;
  11148. checkInputs(): void;
  11149. getTypeName(): string;
  11150. getSimpleName(): string;
  11151. }
  11152. }
  11153. declare module BABYLON {
  11154. class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  11155. camera: FreeCamera;
  11156. gamepad: Gamepad;
  11157. private _gamepads;
  11158. gamepadAngularSensibility: number;
  11159. gamepadMoveSensibility: number;
  11160. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11161. detachControl(element: HTMLElement): void;
  11162. checkInputs(): void;
  11163. private _onNewGameConnected(gamepad);
  11164. getTypeName(): string;
  11165. getSimpleName(): string;
  11166. }
  11167. }
  11168. declare module BABYLON {
  11169. class FreeCameraKeyboardMoveInput implements ICameraInput<FreeCamera> {
  11170. camera: FreeCamera;
  11171. private _keys;
  11172. private _onKeyDown;
  11173. private _onKeyUp;
  11174. keysUp: number[];
  11175. keysDown: number[];
  11176. keysLeft: number[];
  11177. keysRight: number[];
  11178. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11179. detachControl(element: HTMLElement): void;
  11180. checkInputs(): void;
  11181. getTypeName(): string;
  11182. _onLostFocus(e: FocusEvent): void;
  11183. getSimpleName(): string;
  11184. }
  11185. }
  11186. declare module BABYLON {
  11187. class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  11188. touchEnabled: boolean;
  11189. camera: FreeCamera;
  11190. buttons: number[];
  11191. angularSensibility: number;
  11192. private _pointerInput;
  11193. private _onMouseMove;
  11194. private _observer;
  11195. private previousPosition;
  11196. constructor(touchEnabled?: boolean);
  11197. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11198. detachControl(element: HTMLElement): void;
  11199. getTypeName(): string;
  11200. getSimpleName(): string;
  11201. }
  11202. }
  11203. declare module BABYLON {
  11204. class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  11205. camera: FreeCamera;
  11206. private _offsetX;
  11207. private _offsetY;
  11208. private _pointerCount;
  11209. private _pointerPressed;
  11210. private _pointerInput;
  11211. private _observer;
  11212. private _onLostFocus;
  11213. touchAngularSensibility: number;
  11214. touchMoveSensibility: number;
  11215. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11216. detachControl(element: HTMLElement): void;
  11217. checkInputs(): void;
  11218. getTypeName(): string;
  11219. getSimpleName(): string;
  11220. }
  11221. }
  11222. declare module BABYLON {
  11223. class FreeCameraVirtualJoystickInput implements ICameraInput<FreeCamera> {
  11224. camera: FreeCamera;
  11225. private _leftjoystick;
  11226. private _rightjoystick;
  11227. getLeftJoystick(): VirtualJoystick;
  11228. getRightJoystick(): VirtualJoystick;
  11229. checkInputs(): void;
  11230. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11231. detachControl(element: HTMLElement): void;
  11232. getTypeName(): string;
  11233. getSimpleName(): string;
  11234. }
  11235. }
  11236. declare module BABYLON {
  11237. class VRCameraMetrics {
  11238. hResolution: number;
  11239. vResolution: number;
  11240. hScreenSize: number;
  11241. vScreenSize: number;
  11242. vScreenCenter: number;
  11243. eyeToScreenDistance: number;
  11244. lensSeparationDistance: number;
  11245. interpupillaryDistance: number;
  11246. distortionK: number[];
  11247. chromaAbCorrection: number[];
  11248. postProcessScaleFactor: number;
  11249. lensCenterOffset: number;
  11250. compensateDistortion: boolean;
  11251. aspectRatio: number;
  11252. aspectRatioFov: number;
  11253. leftHMatrix: Matrix;
  11254. rightHMatrix: Matrix;
  11255. leftPreViewMatrix: Matrix;
  11256. rightPreViewMatrix: Matrix;
  11257. static GetDefault(): VRCameraMetrics;
  11258. }
  11259. }
  11260. declare module BABYLON {
  11261. class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
  11262. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  11263. getTypeName(): string;
  11264. }
  11265. class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
  11266. constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion?: boolean, vrCameraMetrics?: VRCameraMetrics);
  11267. getTypeName(): string;
  11268. }
  11269. }
  11270. declare var HMDVRDevice: any;
  11271. declare var VRDisplay: any;
  11272. declare var VRFrameData: any;
  11273. declare module BABYLON {
  11274. interface WebVROptions {
  11275. trackPosition?: boolean;
  11276. positionScale?: number;
  11277. displayName?: string;
  11278. }
  11279. class WebVRFreeCamera extends FreeCamera {
  11280. private webVROptions;
  11281. _vrDevice: any;
  11282. private _cacheState;
  11283. private _vrEnabled;
  11284. private _attached;
  11285. private _oldSize;
  11286. private _oldHardwareScaleFactor;
  11287. private _frameData;
  11288. private _quaternionCache;
  11289. private _positionOffset;
  11290. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion?: boolean, webVROptions?: WebVROptions);
  11291. _checkInputs(): void;
  11292. attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
  11293. detachControl(element: HTMLElement): void;
  11294. requestVRFullscreen(requestPointerlock: boolean): void;
  11295. getTypeName(): string;
  11296. resetToCurrentRotation(): void;
  11297. /**
  11298. *
  11299. * Set the position offset of the VR camera
  11300. * The offset will be added to the WebVR pose, after scaling it (if set).
  11301. *
  11302. * @param {Vector3} [newPosition] an optional new position. if not provided, the current camera position will be used.
  11303. *
  11304. * @memberOf WebVRFreeCamera
  11305. */
  11306. setPositionOffset(newPosition?: Vector3): void;
  11307. }
  11308. }
  11309. declare module BABYLON {
  11310. interface IShadowGenerator {
  11311. getShadowMap(): RenderTargetTexture;
  11312. dispose(): void;
  11313. }
  11314. class ShadowGenerator implements IShadowGenerator {
  11315. private static _FILTER_NONE;
  11316. private static _FILTER_VARIANCESHADOWMAP;
  11317. private static _FILTER_POISSONSAMPLING;
  11318. private static _FILTER_BLURVARIANCESHADOWMAP;
  11319. static FILTER_NONE: number;
  11320. static FILTER_VARIANCESHADOWMAP: number;
  11321. static FILTER_POISSONSAMPLING: number;
  11322. static FILTER_BLURVARIANCESHADOWMAP: number;
  11323. private _filter;
  11324. blurScale: number;
  11325. private _blurBoxOffset;
  11326. private _bias;
  11327. private _lightDirection;
  11328. forceBackFacesOnly: boolean;
  11329. bias: number;
  11330. blurBoxOffset: number;
  11331. filter: number;
  11332. useVarianceShadowMap: boolean;
  11333. usePoissonSampling: boolean;
  11334. useBlurVarianceShadowMap: boolean;
  11335. private _light;
  11336. private _scene;
  11337. private _shadowMap;
  11338. private _shadowMap2;
  11339. private _darkness;
  11340. private _transparencyShadow;
  11341. private _effect;
  11342. private _viewMatrix;
  11343. private _projectionMatrix;
  11344. private _transformMatrix;
  11345. private _worldViewProjection;
  11346. private _cachedPosition;
  11347. private _cachedDirection;
  11348. private _cachedDefines;
  11349. private _currentRenderID;
  11350. private _downSamplePostprocess;
  11351. private _boxBlurPostprocess;
  11352. private _mapSize;
  11353. private _currentFaceIndex;
  11354. private _currentFaceIndexCache;
  11355. private _useFullFloat;
  11356. constructor(mapSize: number, light: IShadowLight);
  11357. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  11358. getShadowMap(): RenderTargetTexture;
  11359. getShadowMapForRendering(): RenderTargetTexture;
  11360. getLight(): IShadowLight;
  11361. getTransformMatrix(): Matrix;
  11362. getDarkness(): number;
  11363. setDarkness(darkness: number): void;
  11364. setTransparencyShadow(hasShadow: boolean): void;
  11365. private _packHalf(depth);
  11366. dispose(): void;
  11367. serialize(): any;
  11368. static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator;
  11369. }
  11370. }
  11371. declare module BABYLON.Internals {
  11372. }
  11373. declare module BABYLON {
  11374. class BaseTexture {
  11375. name: string;
  11376. hasAlpha: boolean;
  11377. getAlphaFromRGB: boolean;
  11378. level: number;
  11379. coordinatesIndex: number;
  11380. coordinatesMode: number;
  11381. wrapU: number;
  11382. wrapV: number;
  11383. anisotropicFilteringLevel: number;
  11384. isCube: boolean;
  11385. isRenderTarget: boolean;
  11386. uid: string;
  11387. toString(): string;
  11388. animations: Animation[];
  11389. /**
  11390. * An event triggered when the texture is disposed.
  11391. * @type {BABYLON.Observable}
  11392. */
  11393. onDisposeObservable: Observable<BaseTexture>;
  11394. private _onDisposeObserver;
  11395. onDispose: () => void;
  11396. delayLoadState: number;
  11397. _cachedAnisotropicFilteringLevel: number;
  11398. private _scene;
  11399. _texture: WebGLTexture;
  11400. private _uid;
  11401. constructor(scene: Scene);
  11402. getScene(): Scene;
  11403. getTextureMatrix(): Matrix;
  11404. getReflectionTextureMatrix(): Matrix;
  11405. getInternalTexture(): WebGLTexture;
  11406. isReady(): boolean;
  11407. getSize(): ISize;
  11408. getBaseSize(): ISize;
  11409. scale(ratio: number): void;
  11410. canRescale: boolean;
  11411. _removeFromCache(url: string, noMipmap: boolean): void;
  11412. _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture;
  11413. delayLoad(): void;
  11414. clone(): BaseTexture;
  11415. releaseInternalTexture(): void;
  11416. dispose(): void;
  11417. serialize(): any;
  11418. }
  11419. }
  11420. declare module BABYLON {
  11421. /**
  11422. * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
  11423. * It can help converting any input color in a desired output one. This can then be used to create effects
  11424. * from sepia, black and white to sixties or futuristic rendering...
  11425. *
  11426. * The only supported format is currently 3dl.
  11427. * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
  11428. */
  11429. class ColorGradingTexture extends BaseTexture {
  11430. /**
  11431. * The current internal texture size.
  11432. */
  11433. private _size;
  11434. /**
  11435. * The current texture matrix. (will always be identity in color grading texture)
  11436. */
  11437. private _textureMatrix;
  11438. /**
  11439. * The texture URL.
  11440. */
  11441. url: string;
  11442. /**
  11443. * Empty line regex stored for GC.
  11444. */
  11445. private static _noneEmptyLineRegex;
  11446. /**
  11447. * Instantiates a ColorGradingTexture from the following parameters.
  11448. *
  11449. * @param url The location of the color gradind data (currently only supporting 3dl)
  11450. * @param scene The scene the texture will be used in
  11451. */
  11452. constructor(url: string, scene: Scene);
  11453. /**
  11454. * Returns the texture matrix used in most of the material.
  11455. * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
  11456. */
  11457. getTextureMatrix(): Matrix;
  11458. /**
  11459. * Occurs when the file being loaded is a .3dl LUT file.
  11460. */
  11461. private load3dlTexture();
  11462. /**
  11463. * Starts the loading process of the texture.
  11464. */
  11465. private loadTexture();
  11466. /**
  11467. * Clones the color gradind texture.
  11468. */
  11469. clone(): ColorGradingTexture;
  11470. /**
  11471. * Called during delayed load for textures.
  11472. */
  11473. delayLoad(): void;
  11474. /**
  11475. * Binds the color grading to the shader.
  11476. * @param colorGrading The texture to bind
  11477. * @param effect The effect to bind to
  11478. */
  11479. static Bind(colorGrading: BaseTexture, effect: Effect): void;
  11480. /**
  11481. * Prepare the list of uniforms associated with the ColorGrading effects.
  11482. * @param uniformsList The list of uniforms used in the effect
  11483. * @param samplersList The list of samplers used in the effect
  11484. */
  11485. static PrepareUniformsAndSamplers(uniformsList: string[], samplersList: string[]): void;
  11486. /**
  11487. * Parses a color grading texture serialized by Babylon.
  11488. * @param parsedTexture The texture information being parsedTexture
  11489. * @param scene The scene to load the texture in
  11490. * @param rootUrl The root url of the data assets to load
  11491. * @return A color gradind texture
  11492. */
  11493. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): ColorGradingTexture;
  11494. /**
  11495. * Serializes the LUT texture to json format.
  11496. */
  11497. serialize(): any;
  11498. }
  11499. }
  11500. declare module BABYLON {
  11501. class CubeTexture extends BaseTexture {
  11502. url: string;
  11503. coordinatesMode: number;
  11504. private _noMipmap;
  11505. private _files;
  11506. private _extensions;
  11507. private _textureMatrix;
  11508. static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture;
  11509. constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean, files?: string[], onLoad?: () => void, onError?: () => void);
  11510. delayLoad(): void;
  11511. getReflectionTextureMatrix(): Matrix;
  11512. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture;
  11513. clone(): CubeTexture;
  11514. }
  11515. }
  11516. declare module BABYLON {
  11517. class DynamicTexture extends Texture {
  11518. private _generateMipMaps;
  11519. private _canvas;
  11520. private _context;
  11521. constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number);
  11522. canRescale: boolean;
  11523. scale(ratio: number): void;
  11524. getContext(): CanvasRenderingContext2D;
  11525. clear(): void;
  11526. update(invertY?: boolean): void;
  11527. drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void;
  11528. clone(): DynamicTexture;
  11529. }
  11530. }
  11531. declare module BABYLON {
  11532. /**
  11533. * This class given information about a given character.
  11534. */
  11535. class CharInfo {
  11536. /**
  11537. * The normalized ([0;1]) top/left position of the character in the texture
  11538. */
  11539. topLeftUV: Vector2;
  11540. /**
  11541. * The normalized ([0;1]) right/bottom position of the character in the texture
  11542. */
  11543. bottomRightUV: Vector2;
  11544. charWidth: number;
  11545. }
  11546. class FontTexture extends Texture {
  11547. private _canvas;
  11548. private _context;
  11549. private _lineHeight;
  11550. private _lineHeightSuper;
  11551. private _xMargin;
  11552. private _yMargin;
  11553. private _offset;
  11554. private _currentFreePosition;
  11555. private _charInfos;
  11556. private _curCharCount;
  11557. private _lastUpdateCharCount;
  11558. private _spaceWidth;
  11559. private _spaceWidthSuper;
  11560. private _usedCounter;
  11561. private _superSample;
  11562. private _sdfCanvas;
  11563. private _sdfContext;
  11564. private _signedDistanceField;
  11565. private _cachedFontId;
  11566. private _sdfScale;
  11567. isSuperSampled: boolean;
  11568. isSignedDistanceField: boolean;
  11569. spaceWidth: number;
  11570. lineHeight: number;
  11571. static GetCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): FontTexture;
  11572. static ReleaseCachedFontTexture(scene: Scene, fontName: string, supersample?: boolean, signedDistanceField?: boolean): void;
  11573. /**
  11574. * Create a new instance of the FontTexture class
  11575. * @param name the name of the texture
  11576. * @param font the font to use, use the W3C CSS notation
  11577. * @param scene the scene that owns the texture
  11578. * @param maxCharCount the approximative maximum count of characters that could fit in the texture. This is an approximation because most of the fonts are proportional (each char has its own Width). The 'W' character's width is used to compute the size of the texture based on the given maxCharCount
  11579. * @param samplingMode the texture sampling mode
  11580. * @param superSample if true the FontTexture will be created with a font of a size twice bigger than the given one but all properties (lineHeight, charWidth, etc.) will be according to the original size. This is made to improve the text quality.
  11581. */
  11582. constructor(name: string, font: string, scene: Scene, maxCharCount?: number, samplingMode?: number, superSample?: boolean, signedDistanceField?: boolean);
  11583. /**
  11584. * Make sure the given char is present in the font map.
  11585. * @param char the character to get or add
  11586. * @return the CharInfo instance corresponding to the given character
  11587. */
  11588. getChar(char: string): CharInfo;
  11589. private _computeSDFChar(source);
  11590. measureText(text: string, tabulationSize?: number): Size;
  11591. private getSuperSampleFont(font);
  11592. private getFontHeight(font);
  11593. canRescale: boolean;
  11594. getContext(): CanvasRenderingContext2D;
  11595. /**
  11596. * Call this method when you've call getChar() at least one time, this will update the texture if needed.
  11597. * Don't be afraid to call it, if no new character was added, this method simply does nothing.
  11598. */
  11599. update(): void;
  11600. clone(): FontTexture;
  11601. /**
  11602. * For FontTexture retrieved using GetCachedFontTexture, use this method when you transfer this object's lifetime to another party in order to share this resource.
  11603. * When the other party is done with this object, decCachedFontTextureCounter must be called.
  11604. */
  11605. incCachedFontTextureCounter(): void;
  11606. /**
  11607. * Use this method only in conjunction with incCachedFontTextureCounter, call it when you no longer need to use this shared resource.
  11608. */
  11609. decCachedFontTextureCounter(): void;
  11610. }
  11611. }
  11612. declare module BABYLON {
  11613. /**
  11614. * This represents a texture coming from an HDR input.
  11615. *
  11616. * The only supported format is currently panorama picture stored in RGBE format.
  11617. * Example of such files can be found on HDRLib: http://hdrlib.com/
  11618. */
  11619. class HDRCubeTexture extends BaseTexture {
  11620. private static _facesMapping;
  11621. private _useInGammaSpace;
  11622. private _generateHarmonics;
  11623. private _noMipmap;
  11624. private _extensions;
  11625. private _textureMatrix;
  11626. private _size;
  11627. private _usePMREMGenerator;
  11628. private _isBABYLONPreprocessed;
  11629. /**
  11630. * The texture URL.
  11631. */
  11632. url: string;
  11633. /**
  11634. * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
  11635. */
  11636. coordinatesMode: number;
  11637. /**
  11638. * The spherical polynomial data extracted from the texture.
  11639. */
  11640. sphericalPolynomial: SphericalPolynomial;
  11641. /**
  11642. * Specifies wether the texture has been generated through the PMREMGenerator tool.
  11643. * This is usefull at run time to apply the good shader.
  11644. */
  11645. isPMREM: boolean;
  11646. /**
  11647. * Instantiates an HDRTexture from the following parameters.
  11648. *
  11649. * @param url The location of the HDR raw data (Panorama stored in RGBE format)
  11650. * @param scene The scene the texture will be used in
  11651. * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
  11652. * @param noMipmap Forces to not generate the mipmap if true
  11653. * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
  11654. * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
  11655. * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
  11656. */
  11657. constructor(url: string, scene: Scene, size?: number, noMipmap?: boolean, generateHarmonics?: boolean, useInGammaSpace?: boolean, usePMREMGenerator?: boolean);
  11658. /**
  11659. * Occurs when the file is a preprocessed .babylon.hdr file.
  11660. */
  11661. private loadBabylonTexture();
  11662. /**
  11663. * Occurs when the file is raw .hdr file.
  11664. */
  11665. private loadHDRTexture();
  11666. /**
  11667. * Starts the loading process of the texture.
  11668. */
  11669. private loadTexture();
  11670. clone(): HDRCubeTexture;
  11671. delayLoad(): void;
  11672. getReflectionTextureMatrix(): Matrix;
  11673. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): HDRCubeTexture;
  11674. serialize(): any;
  11675. /**
  11676. * Saves as a file the data contained in the texture in a binary format.
  11677. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  11678. * as the spherical used in the lighting.
  11679. * @param url The HDR file url.
  11680. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  11681. * @param onError Method called if any error happens during download.
  11682. * @return The packed binary data.
  11683. */
  11684. static generateBabylonHDROnDisk(url: string, size: number, onError?: (() => void)): void;
  11685. /**
  11686. * Serializes the data contained in the texture in a binary format.
  11687. * This can be used to prevent the long loading tie associated with creating the seamless texture as well
  11688. * as the spherical used in the lighting.
  11689. * @param url The HDR file url.
  11690. * @param size The size of the texture data to generate (one of the cubemap face desired width).
  11691. * @param onError Method called if any error happens during download.
  11692. * @return The packed binary data.
  11693. */
  11694. static generateBabylonHDR(url: string, size: number, callback: ((ArrayBuffer) => void), onError?: (() => void)): void;
  11695. }
  11696. }
  11697. declare module BABYLON {
  11698. class MapTexture extends Texture {
  11699. private _rectPackingMap;
  11700. private _size;
  11701. private _replacedViewport;
  11702. constructor(name: string, scene: Scene, size: ISize, samplingMode?: number, useMipMap?: boolean);
  11703. /**
  11704. * Allocate a rectangle of a given size in the texture map
  11705. * @param size the size of the rectangle to allocation
  11706. * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
  11707. */
  11708. allocateRect(size: Size): PackedRect;
  11709. /**
  11710. * Free a given rectangle from the texture map
  11711. * @param rectInfo the instance corresponding to the rect to free.
  11712. */
  11713. freeRect(rectInfo: PackedRect): void;
  11714. /**
  11715. * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
  11716. * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
  11717. * @returns {}
  11718. */
  11719. freeSpace: number;
  11720. /**
  11721. * Bind the texture to the rendering engine to render in the zone of a given rectangle.
  11722. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  11723. * Don't forget to call unbindTexture when you're done rendering
  11724. * @param rect the zone to render to
  11725. * @param clear true to clear the portion's color/depth data
  11726. */
  11727. bindTextureForRect(rect: PackedRect, clear: boolean): void;
  11728. /**
  11729. * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
  11730. * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
  11731. * Don't forget to call unbindTexture when you're done rendering
  11732. * @param pos the position into the texture
  11733. * @param size the portion to fit the clip space to
  11734. * @param clear true to clear the portion's color/depth data
  11735. */
  11736. bindTextureForPosSize(pos: Vector2, size: Size, clear: boolean): void;
  11737. /**
  11738. * Unbind the texture map from the rendering engine.
  11739. * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
  11740. * @param dumpForDebug if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.
  11741. */
  11742. unbindTexture(dumpForDebug?: boolean): void;
  11743. canRescale: boolean;
  11744. clone(): MapTexture;
  11745. }
  11746. }
  11747. declare module BABYLON {
  11748. class MirrorTexture extends RenderTargetTexture {
  11749. mirrorPlane: Plane;
  11750. private _transformMatrix;
  11751. private _mirrorMatrix;
  11752. private _savedViewMatrix;
  11753. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  11754. clone(): MirrorTexture;
  11755. serialize(): any;
  11756. }
  11757. }
  11758. declare module BABYLON {
  11759. class RawTexture extends Texture {
  11760. format: number;
  11761. constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  11762. update(data: ArrayBufferView): void;
  11763. static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11764. static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11765. static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11766. static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11767. static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
  11768. }
  11769. }
  11770. declare module BABYLON {
  11771. /**
  11772. * Creates a refraction texture used by refraction channel of the standard material.
  11773. * @param name the texture name
  11774. * @param size size of the underlying texture
  11775. * @param scene root scene
  11776. */
  11777. class RefractionTexture extends RenderTargetTexture {
  11778. refractionPlane: Plane;
  11779. depth: number;
  11780. constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
  11781. clone(): RefractionTexture;
  11782. serialize(): any;
  11783. }
  11784. }
  11785. declare module BABYLON {
  11786. class RenderTargetTexture extends Texture {
  11787. isCube: boolean;
  11788. static _REFRESHRATE_RENDER_ONCE: number;
  11789. static _REFRESHRATE_RENDER_ONEVERYFRAME: number;
  11790. static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  11791. static REFRESHRATE_RENDER_ONCE: number;
  11792. static REFRESHRATE_RENDER_ONEVERYFRAME: number;
  11793. static REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number;
  11794. /**
  11795. * Use this predicate to dynamically define the list of mesh you want to render.
  11796. * If set, the renderList property will be overwritten.
  11797. */
  11798. renderListPredicate: (AbstractMesh) => boolean;
  11799. /**
  11800. * Use this list to define the list of mesh you want to render.
  11801. */
  11802. renderList: AbstractMesh[];
  11803. renderParticles: boolean;
  11804. renderSprites: boolean;
  11805. coordinatesMode: number;
  11806. activeCamera: Camera;
  11807. customRenderFunction: (opaqueSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, beforeTransparents?: () => void) => void;
  11808. useCameraPostProcesses: boolean;
  11809. /**
  11810. * An event triggered when the texture is unbind.
  11811. * @type {BABYLON.Observable}
  11812. */
  11813. onAfterUnbindObservable: Observable<RenderTargetTexture>;
  11814. private _onAfterUnbindObserver;
  11815. onAfterUnbind: () => void;
  11816. /**
  11817. * An event triggered before rendering the texture
  11818. * @type {BABYLON.Observable}
  11819. */
  11820. onBeforeRenderObservable: Observable<number>;
  11821. private _onBeforeRenderObserver;
  11822. onBeforeRender: (faceIndex: number) => void;
  11823. /**
  11824. * An event triggered after rendering the texture
  11825. * @type {BABYLON.Observable}
  11826. */
  11827. onAfterRenderObservable: Observable<number>;
  11828. private _onAfterRenderObserver;
  11829. onAfterRender: (faceIndex: number) => void;
  11830. /**
  11831. * An event triggered after the texture clear
  11832. * @type {BABYLON.Observable}
  11833. */
  11834. onClearObservable: Observable<Engine>;
  11835. private _onClearObserver;
  11836. onClear: (Engine: Engine) => void;
  11837. private _size;
  11838. _generateMipMaps: boolean;
  11839. private _renderingManager;
  11840. _waitingRenderList: string[];
  11841. private _doNotChangeAspectRatio;
  11842. private _currentRefreshId;
  11843. private _refreshRate;
  11844. private _textureMatrix;
  11845. constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean);
  11846. resetRefreshCounter(): void;
  11847. refreshRate: number;
  11848. _shouldRender(): boolean;
  11849. isReady(): boolean;
  11850. getRenderSize(): number;
  11851. canRescale: boolean;
  11852. scale(ratio: number): void;
  11853. getReflectionTextureMatrix(): Matrix;
  11854. resize(size: any, generateMipMaps?: boolean): void;
  11855. render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void;
  11856. renderToTarget(faceIndex: number, currentRenderList: AbstractMesh[], currentRenderListLength: number, useCameraPostProcess: boolean, dumpForDebug: boolean): void;
  11857. /**
  11858. * Overrides the default sort function applied in the renderging group to prepare the meshes.
  11859. * This allowed control for front to back rendering or reversly depending of the special needs.
  11860. *
  11861. * @param renderingGroupId The rendering group id corresponding to its index
  11862. * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
  11863. * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
  11864. * @param transparentSortCompareFn The transparent queue comparison function use to sort.
  11865. */
  11866. setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: (a: SubMesh, b: SubMesh) => number, alphaTestSortCompareFn?: (a: SubMesh, b: SubMesh) => number, transparentSortCompareFn?: (a: SubMesh, b: SubMesh) => number): void;
  11867. /**
  11868. * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
  11869. *
  11870. * @param renderingGroupId The rendering group id corresponding to its index
  11871. * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
  11872. */
  11873. setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
  11874. clone(): RenderTargetTexture;
  11875. serialize(): any;
  11876. }
  11877. }
  11878. declare module BABYLON {
  11879. class Texture extends BaseTexture {
  11880. static NEAREST_SAMPLINGMODE: number;
  11881. static BILINEAR_SAMPLINGMODE: number;
  11882. static TRILINEAR_SAMPLINGMODE: number;
  11883. static EXPLICIT_MODE: number;
  11884. static SPHERICAL_MODE: number;
  11885. static PLANAR_MODE: number;
  11886. static CUBIC_MODE: number;
  11887. static PROJECTION_MODE: number;
  11888. static SKYBOX_MODE: number;
  11889. static INVCUBIC_MODE: number;
  11890. static EQUIRECTANGULAR_MODE: number;
  11891. static FIXED_EQUIRECTANGULAR_MODE: number;
  11892. static CLAMP_ADDRESSMODE: number;
  11893. static WRAP_ADDRESSMODE: number;
  11894. static MIRROR_ADDRESSMODE: number;
  11895. url: string;
  11896. uOffset: number;
  11897. vOffset: number;
  11898. uScale: number;
  11899. vScale: number;
  11900. uAng: number;
  11901. vAng: number;
  11902. wAng: number;
  11903. noMipmap: boolean;
  11904. private _noMipmap;
  11905. _invertY: boolean;
  11906. private _rowGenerationMatrix;
  11907. private _cachedTextureMatrix;
  11908. private _projectionModeMatrix;
  11909. private _t0;
  11910. private _t1;
  11911. private _t2;
  11912. private _cachedUOffset;
  11913. private _cachedVOffset;
  11914. private _cachedUScale;
  11915. private _cachedVScale;
  11916. private _cachedUAng;
  11917. private _cachedVAng;
  11918. private _cachedWAng;
  11919. private _cachedCoordinatesMode;
  11920. _samplingMode: number;
  11921. private _buffer;
  11922. private _deleteBuffer;
  11923. private _delayedOnLoad;
  11924. private _delayedOnError;
  11925. private _onLoadObservarble;
  11926. private _delayReloadData;
  11927. constructor(urlOrList: string | Array<string>, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean);
  11928. delayLoad(): void;
  11929. updateSamplingMode(samplingMode: number): void;
  11930. private _prepareRowForTextureGeneration(x, y, z, t);
  11931. getTextureMatrix(): Matrix;
  11932. getReflectionTextureMatrix(): Matrix;
  11933. clone(): Texture;
  11934. onLoadObservable: Observable<boolean>;
  11935. static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  11936. static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BaseTexture;
  11937. static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture;
  11938. }
  11939. }
  11940. declare module BABYLON {
  11941. class VideoTexture extends Texture {
  11942. video: HTMLVideoElement;
  11943. private _autoLaunch;
  11944. private _lastUpdate;
  11945. private _generateMipMaps;
  11946. /**
  11947. * Creates a video texture.
  11948. * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
  11949. * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
  11950. * @param {BABYLON.Scene} scene is obviously the current scene.
  11951. * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
  11952. * @param {boolean} invertY is false by default but can be used to invert video on Y axis
  11953. * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
  11954. */
  11955. constructor(name: string, urlsOrVideo: string[] | HTMLVideoElement, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
  11956. private _createTexture();
  11957. update(): boolean;
  11958. }
  11959. }
  11960. declare module BABYLON {
  11961. class CannonJSPlugin implements IPhysicsEnginePlugin {
  11962. private _useDeltaForWorldStep;
  11963. world: any;
  11964. name: string;
  11965. private _physicsMaterials;
  11966. private _fixedTimeStep;
  11967. private _currentCollisionGroup;
  11968. constructor(_useDeltaForWorldStep?: boolean, iterations?: number);
  11969. setGravity(gravity: Vector3): void;
  11970. setTimeStep(timeStep: number): void;
  11971. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  11972. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11973. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  11974. generatePhysicsBody(impostor: PhysicsImpostor): void;
  11975. private _processChildMeshes(mainImpostor);
  11976. removePhysicsBody(impostor: PhysicsImpostor): void;
  11977. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  11978. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  11979. private _addMaterial(name, friction, restitution);
  11980. private _checkWithEpsilon(value);
  11981. private _createShape(impostor);
  11982. private _createHeightmap(object, pointDepth?);
  11983. private _minus90X;
  11984. private _plus90X;
  11985. private _tmpPosition;
  11986. private _tmpQuaternion;
  11987. private _tmpDeltaPosition;
  11988. private _tmpDeltaRotation;
  11989. private _tmpUnityRotation;
  11990. private _updatePhysicsBodyTransformation(impostor);
  11991. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  11992. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  11993. isSupported(): boolean;
  11994. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11995. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  11996. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  11997. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  11998. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  11999. sleepBody(impostor: PhysicsImpostor): void;
  12000. wakeUpBody(impostor: PhysicsImpostor): void;
  12001. updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
  12002. private enableMotor(joint, motorIndex?);
  12003. private disableMotor(joint, motorIndex?);
  12004. setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number): void;
  12005. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number): void;
  12006. dispose(): void;
  12007. }
  12008. }
  12009. declare module BABYLON {
  12010. class OimoJSPlugin {
  12011. world: any;
  12012. name: string;
  12013. constructor(iterations?: number);
  12014. setGravity(gravity: Vector3): void;
  12015. setTimeStep(timeStep: number): void;
  12016. private _tmpImpostorsArray;
  12017. executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
  12018. applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  12019. applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
  12020. generatePhysicsBody(impostor: PhysicsImpostor): void;
  12021. private _tmpPositionVector;
  12022. removePhysicsBody(impostor: PhysicsImpostor): void;
  12023. generateJoint(impostorJoint: PhysicsImpostorJoint): void;
  12024. removeJoint(impostorJoint: PhysicsImpostorJoint): void;
  12025. isSupported(): boolean;
  12026. setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
  12027. setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
  12028. private _getLastShape(body);
  12029. setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  12030. setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
  12031. getLinearVelocity(impostor: PhysicsImpostor): Vector3;
  12032. getAngularVelocity(impostor: PhysicsImpostor): Vector3;
  12033. setBodyMass(impostor: PhysicsImpostor, mass: number): void;
  12034. sleepBody(impostor: PhysicsImpostor): void;
  12035. wakeUpBody(impostor: PhysicsImpostor): void;
  12036. updateDistanceJoint(joint: IMotorEnabledJoint, maxDistance: number, minDistance?: number): void;
  12037. setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
  12038. setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
  12039. dispose(): void;
  12040. }
  12041. }
  12042. declare module BABYLON {
  12043. class PostProcessRenderEffect {
  12044. private _engine;
  12045. private _postProcesses;
  12046. private _getPostProcess;
  12047. private _singleInstance;
  12048. private _cameras;
  12049. private _indicesForCamera;
  12050. private _renderPasses;
  12051. private _renderEffectAsPasses;
  12052. _name: string;
  12053. applyParameters: (postProcess: PostProcess) => void;
  12054. constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean);
  12055. isSupported: boolean;
  12056. _update(): void;
  12057. addPass(renderPass: PostProcessRenderPass): void;
  12058. removePass(renderPass: PostProcessRenderPass): void;
  12059. addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void;
  12060. getPass(passName: string): void;
  12061. emptyPasses(): void;
  12062. _attachCameras(cameras: Camera): any;
  12063. _attachCameras(cameras: Camera[]): any;
  12064. _detachCameras(cameras: Camera): any;
  12065. _detachCameras(cameras: Camera[]): any;
  12066. _enable(cameras: Camera): any;
  12067. _enable(cameras: Camera[]): any;
  12068. _disable(cameras: Camera): any;
  12069. _disable(cameras: Camera[]): any;
  12070. getPostProcess(camera?: Camera): PostProcess;
  12071. private _linkParameters();
  12072. private _linkTextures(effect);
  12073. }
  12074. }
  12075. declare module BABYLON {
  12076. class PostProcessRenderPass {
  12077. private _enabled;
  12078. private _renderList;
  12079. private _renderTexture;
  12080. private _scene;
  12081. private _refCount;
  12082. _name: string;
  12083. constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void);
  12084. _incRefCount(): number;
  12085. _decRefCount(): number;
  12086. _update(): void;
  12087. setRenderList(renderList: Mesh[]): void;
  12088. getRenderTexture(): RenderTargetTexture;
  12089. }
  12090. }
  12091. declare module BABYLON {
  12092. class PostProcessRenderPipeline {
  12093. private _engine;
  12094. private _renderEffects;
  12095. private _renderEffectsForIsolatedPass;
  12096. private _cameras;
  12097. _name: string;
  12098. private static PASS_EFFECT_NAME;
  12099. private static PASS_SAMPLER_NAME;
  12100. constructor(engine: Engine, name: string);
  12101. isSupported: boolean;
  12102. addEffect(renderEffect: PostProcessRenderEffect): void;
  12103. _enableEffect(renderEffectName: string, cameras: Camera): any;
  12104. _enableEffect(renderEffectName: string, cameras: Camera[]): any;
  12105. _disableEffect(renderEffectName: string, cameras: Camera): any;
  12106. _disableEffect(renderEffectName: string, cameras: Camera[]): any;
  12107. _attachCameras(cameras: Camera, unique: boolean): any;
  12108. _attachCameras(cameras: Camera[], unique: boolean): any;
  12109. _detachCameras(cameras: Camera): any;
  12110. _detachCameras(cameras: Camera[]): any;
  12111. _enableDisplayOnlyPass(passName: any, cameras: Camera): any;
  12112. _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any;
  12113. _disableDisplayOnlyPass(cameras: Camera): any;
  12114. _disableDisplayOnlyPass(cameras: Camera[]): any;
  12115. _update(): void;
  12116. dispose(): void;
  12117. }
  12118. }
  12119. declare module BABYLON {
  12120. class PostProcessRenderPipelineManager {
  12121. private _renderPipelines;
  12122. constructor();
  12123. addPipeline(renderPipeline: PostProcessRenderPipeline): void;
  12124. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any;
  12125. attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any;
  12126. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any;
  12127. detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any;
  12128. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  12129. enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  12130. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any;
  12131. disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any;
  12132. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any;
  12133. enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any;
  12134. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any;
  12135. disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any;
  12136. update(): void;
  12137. }
  12138. }
  12139. declare module BABYLON.Internals {
  12140. /**
  12141. * Helper class dealing with the extraction of spherical polynomial dataArray
  12142. * from a cube map.
  12143. */
  12144. class CubeMapToSphericalPolynomialTools {
  12145. private static FileFaces;
  12146. /**
  12147. * Converts a cubemap to the according Spherical Polynomial data.
  12148. * This extracts the first 3 orders only as they are the only one used in the lighting.
  12149. *
  12150. * @param cubeInfo The Cube map to extract the information from.
  12151. * @return The Spherical Polynomial data.
  12152. */
  12153. static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial;
  12154. }
  12155. }
  12156. declare module BABYLON.Internals {
  12157. /**
  12158. * Header information of HDR texture files.
  12159. */
  12160. interface HDRInfo {
  12161. /**
  12162. * The height of the texture in pixels.
  12163. */
  12164. height: number;
  12165. /**
  12166. * The width of the texture in pixels.
  12167. */
  12168. width: number;
  12169. /**
  12170. * The index of the beginning of the data in the binary file.
  12171. */
  12172. dataPosition: number;
  12173. }
  12174. /**
  12175. * This groups tools to convert HDR texture to native colors array.
  12176. */
  12177. class HDRTools {
  12178. private static Ldexp(mantissa, exponent);
  12179. private static Rgbe2float(float32array, red, green, blue, exponent, index);
  12180. private static readStringLine(uint8array, startIndex);
  12181. /**
  12182. * Reads header information from an RGBE texture stored in a native array.
  12183. * More information on this format are available here:
  12184. * https://en.wikipedia.org/wiki/RGBE_image_format
  12185. *
  12186. * @param uint8array The binary file stored in native array.
  12187. * @return The header information.
  12188. */
  12189. static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo;
  12190. /**
  12191. * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.
  12192. * This RGBE texture needs to store the information as a panorama.
  12193. *
  12194. * More information on this format are available here:
  12195. * https://en.wikipedia.org/wiki/RGBE_image_format
  12196. *
  12197. * @param buffer The binary file stored in an array buffer.
  12198. * @param size The expected size of the extracted cubemap.
  12199. * @return The Cube Map information.
  12200. */
  12201. static GetCubeMapTextureData(buffer: ArrayBuffer, size: number): CubeMapInfo;
  12202. /**
  12203. * Returns the pixels data extracted from an RGBE texture.
  12204. * This pixels will be stored left to right up to down in the R G B order in one array.
  12205. *
  12206. * More information on this format are available here:
  12207. * https://en.wikipedia.org/wiki/RGBE_image_format
  12208. *
  12209. * @param uint8array The binary file stored in an array buffer.
  12210. * @param hdrInfo The header information of the file.
  12211. * @return The pixels data in RGB right to left up to down order.
  12212. */
  12213. static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array;
  12214. private static RGBE_ReadPixels_RLE(uint8array, hdrInfo);
  12215. }
  12216. }
  12217. declare module BABYLON.Internals {
  12218. /**
  12219. * CubeMap information grouping all the data for each faces as well as the cubemap size.
  12220. */
  12221. interface CubeMapInfo {
  12222. /**
  12223. * The pixel array for the front face.
  12224. * This is stored in RGB, left to right, up to down format.
  12225. */
  12226. front: Float32Array;
  12227. /**
  12228. * The pixel array for the back face.
  12229. * This is stored in RGB, left to right, up to down format.
  12230. */
  12231. back: Float32Array;
  12232. /**
  12233. * The pixel array for the left face.
  12234. * This is stored in RGB, left to right, up to down format.
  12235. */
  12236. left: Float32Array;
  12237. /**
  12238. * The pixel array for the right face.
  12239. * This is stored in RGB, left to right, up to down format.
  12240. */
  12241. right: Float32Array;
  12242. /**
  12243. * The pixel array for the up face.
  12244. * This is stored in RGB, left to right, up to down format.
  12245. */
  12246. up: Float32Array;
  12247. /**
  12248. * The pixel array for the down face.
  12249. * This is stored in RGB, left to right, up to down format.
  12250. */
  12251. down: Float32Array;
  12252. /**
  12253. * The size of the cubemap stored.
  12254. *
  12255. * Each faces will be size * size pixels.
  12256. */
  12257. size: number;
  12258. }
  12259. /**
  12260. * Helper class usefull to convert panorama picture to their cubemap representation in 6 faces.
  12261. */
  12262. class PanoramaToCubeMapTools {
  12263. private static FACE_FRONT;
  12264. private static FACE_BACK;
  12265. private static FACE_RIGHT;
  12266. private static FACE_LEFT;
  12267. private static FACE_DOWN;
  12268. private static FACE_UP;
  12269. /**
  12270. * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).
  12271. *
  12272. * @param float32Array The source data.
  12273. * @param inputWidth The width of the input panorama.
  12274. * @param inputhHeight The height of the input panorama.
  12275. * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
  12276. * @return The cubemap data
  12277. */
  12278. static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo;
  12279. private static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight);
  12280. private static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight);
  12281. }
  12282. }
  12283. declare namespace BABYLON.Internals {
  12284. /**
  12285. * Helper class to PreProcess a cubemap in order to generate mipmap according to the level of blur
  12286. * required by the glossinees of a material.
  12287. *
  12288. * This only supports the cosine drop power as well as Warp fixup generation method.
  12289. *
  12290. * This is using the process from CubeMapGen described here:
  12291. * https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/
  12292. */
  12293. class PMREMGenerator {
  12294. input: ArrayBufferView[];
  12295. inputSize: number;
  12296. outputSize: number;
  12297. maxNumMipLevels: number;
  12298. numChannels: number;
  12299. isFloat: boolean;
  12300. specularPower: number;
  12301. cosinePowerDropPerMip: number;
  12302. excludeBase: boolean;
  12303. fixup: boolean;
  12304. private static CP_MAX_MIPLEVELS;
  12305. private static CP_UDIR;
  12306. private static CP_VDIR;
  12307. private static CP_FACEAXIS;
  12308. private static CP_FACE_X_POS;
  12309. private static CP_FACE_X_NEG;
  12310. private static CP_FACE_Y_POS;
  12311. private static CP_FACE_Y_NEG;
  12312. private static CP_FACE_Z_POS;
  12313. private static CP_FACE_Z_NEG;
  12314. private static CP_EDGE_LEFT;
  12315. private static CP_EDGE_RIGHT;
  12316. private static CP_EDGE_TOP;
  12317. private static CP_EDGE_BOTTOM;
  12318. private static CP_CORNER_NNN;
  12319. private static CP_CORNER_NNP;
  12320. private static CP_CORNER_NPN;
  12321. private static CP_CORNER_NPP;
  12322. private static CP_CORNER_PNN;
  12323. private static CP_CORNER_PNP;
  12324. private static CP_CORNER_PPN;
  12325. private static CP_CORNER_PPP;
  12326. private static _vectorTemp;
  12327. private static _sgFace2DMapping;
  12328. private static _sgCubeNgh;
  12329. private static _sgCubeEdgeList;
  12330. private static _sgCubeCornerList;
  12331. private _outputSurface;
  12332. private _normCubeMap;
  12333. private _filterLUT;
  12334. private _numMipLevels;
  12335. /**
  12336. * Constructor of the generator.
  12337. *
  12338. * @param input The different faces data from the original cubemap in the order X+ X- Y+ Y- Z+ Z-
  12339. * @param inputSize The size of the cubemap faces
  12340. * @param outputSize The size of the output cubemap faces
  12341. * @param maxNumMipLevels The max number of mip map to generate (0 means all)
  12342. * @param numChannels The number of channels stored in the cubemap (3 for RBGE for instance)
  12343. * @param isFloat Specifies if the input texture is in float or int (hdr is usually in float)
  12344. * @param specularPower The max specular level of the desired cubemap
  12345. * @param cosinePowerDropPerMip The amount of drop the specular power will follow on each mip
  12346. * @param excludeBase Specifies wether to process the level 0 (original level) or not
  12347. * @param fixup Specifies wether to apply the edge fixup algorythm or not
  12348. */
  12349. constructor(input: ArrayBufferView[], inputSize: number, outputSize: number, maxNumMipLevels: number, numChannels: number, isFloat: boolean, specularPower: number, cosinePowerDropPerMip: number, excludeBase: boolean, fixup: boolean);
  12350. /**
  12351. * Launches the filter process and return the result.
  12352. *
  12353. * @return the filter cubemap in the form mip0 [faces1..6] .. mipN [faces1..6]
  12354. */
  12355. filterCubeMap(): ArrayBufferView[][];
  12356. private init();
  12357. private filterCubeMapMipChain();
  12358. private getBaseFilterAngle(cosinePower);
  12359. private precomputeFilterLookupTables(srcCubeMapWidth);
  12360. private buildNormalizerSolidAngleCubemap(size);
  12361. private texelCoordToVect(faceIdx, u, v, size, fixup);
  12362. private vectToTexelCoord(x, y, z, size);
  12363. private areaElement(x, y);
  12364. private texelCoordSolidAngle(faceIdx, u, v, size);
  12365. private filterCubeSurfaces(srcCubeMap, srcSize, dstCubeMap, dstSize, filterConeAngle, specularPower);
  12366. private clearFilterExtents(filterExtents);
  12367. private determineFilterExtents(centerTapDir, srcSize, bboxSize, filterExtents);
  12368. private processFilterExtents(centerTapDir, dotProdThresh, filterExtents, srcCubeMap, srcSize, specularPower);
  12369. private fixupCubeEdges(cubeMap, cubeMapSize);
  12370. }
  12371. }
  12372. declare module BABYLON {
  12373. class CustomProceduralTexture extends ProceduralTexture {
  12374. private _animate;
  12375. private _time;
  12376. private _config;
  12377. private _texturePath;
  12378. constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean);
  12379. private loadJson(jsonUrl);
  12380. isReady(): boolean;
  12381. render(useCameraPostProcess?: boolean): void;
  12382. updateTextures(): void;
  12383. updateShaderUniforms(): void;
  12384. animate: boolean;
  12385. }
  12386. }
  12387. declare module BABYLON {
  12388. class ProceduralTexture extends Texture {
  12389. isCube: boolean;
  12390. private _size;
  12391. _generateMipMaps: boolean;
  12392. isEnabled: boolean;
  12393. private _doNotChangeAspectRatio;
  12394. private _currentRefreshId;
  12395. private _refreshRate;
  12396. onGenerated: () => void;
  12397. private _vertexBuffers;
  12398. private _indexBuffer;
  12399. private _effect;
  12400. private _uniforms;
  12401. private _samplers;
  12402. private _fragment;
  12403. _textures: Texture[];
  12404. private _floats;
  12405. private _floatsArrays;
  12406. private _colors3;
  12407. private _colors4;
  12408. private _vectors2;
  12409. private _vectors3;
  12410. private _matrices;
  12411. private _fallbackTexture;
  12412. private _fallbackTextureUsed;
  12413. constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean, isCube?: boolean);
  12414. reset(): void;
  12415. isReady(): boolean;
  12416. resetRefreshCounter(): void;
  12417. setFragment(fragment: any): void;
  12418. refreshRate: number;
  12419. _shouldRender(): boolean;
  12420. getRenderSize(): number;
  12421. resize(size: any, generateMipMaps: any): void;
  12422. private _checkUniform(uniformName);
  12423. setTexture(name: string, texture: Texture): ProceduralTexture;
  12424. setFloat(name: string, value: number): ProceduralTexture;
  12425. setFloats(name: string, value: number[]): ProceduralTexture;
  12426. setColor3(name: string, value: Color3): ProceduralTexture;
  12427. setColor4(name: string, value: Color4): ProceduralTexture;
  12428. setVector2(name: string, value: Vector2): ProceduralTexture;
  12429. setVector3(name: string, value: Vector3): ProceduralTexture;
  12430. setMatrix(name: string, value: Matrix): ProceduralTexture;
  12431. render(useCameraPostProcess?: boolean): void;
  12432. clone(): ProceduralTexture;
  12433. dispose(): void;
  12434. }
  12435. }