init.lua 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774
  1. return {
  2. modules = {
  3. {
  4. name = "lovr",
  5. summary = "In the beginning, there was nothing.",
  6. description = "`lovr` is the single global table that is exposed to every LÖVR app. It contains a set of **modules** and a set of **callbacks**.",
  7. key = "lovr",
  8. objects = {
  9. {
  10. name = "Object",
  11. summary = "The base object.",
  12. description = "This is not a real object, but describes the behavior shared by all objects. Think of it as the superclass of all LÖVR objects.\n\nIn addition to the methods here, all objects have a `__tostring` metamethod that returns the name of the object's type. So to check if a LÖVR object is an instance of \"Blob\", you can do `tostring(object) == 'Blob'`.",
  13. key = "Object",
  14. module = "lovr",
  15. notes = "Note that the functions here don't apply to any vector objects, see `Vectors`.",
  16. methods = {
  17. {
  18. name = "release",
  19. summary = "Immediately release the Lua reference to an object.",
  20. description = "Immediately destroys Lua's reference to the object it's called on. After calling this function on an object, it is an error to do anything with the object from Lua (call methods on it, pass it to other functions, etc.). If nothing else is using the object, it will be destroyed immediately, which can be used to destroy something earlier than it would normally be garbage collected in order to reduce memory.",
  21. key = "Object:release",
  22. module = "lovr",
  23. notes = "The object may not be destroyed immediately if something else is referring to it (e.g. it is pushed to a Channel or exists in the payload of a pending event).",
  24. variants = {
  25. {
  26. arguments = {},
  27. returns = {}
  28. }
  29. }
  30. }
  31. }
  32. }
  33. },
  34. sections = {
  35. {
  36. name = "Modules",
  37. tag = "modules",
  38. description = "Modules are the **what** of your app; you can use the functions in modules to tell LÖVR to do things. For example, you can draw things on the screen, figure out what buttons on a controller are pressed, or load a 3D model from a file. Each module does what it says on the tin, so the `lovr.graphics` module deals with rendering graphics and `lovr.headset` allows you to interact with VR hardware."
  39. },
  40. {
  41. name = "Callbacks",
  42. tag = "callbacks",
  43. description = "Callbacks are the **when** of the application; you write code inside callbacks which LÖVR then calls at certain points in time. For example, the `lovr.load` callback is called once at startup, and `lovr.focus` is called when the VR application gains or loses input focus."
  44. },
  45. {
  46. name = "Version",
  47. tag = "version",
  48. description = "This function can be used to get the current version of LÖVR."
  49. }
  50. },
  51. enums = {},
  52. functions = {
  53. {
  54. name = "getVersion",
  55. tag = "version",
  56. summary = "Get the current version.",
  57. description = "Get the current major, minor, and patch version of LÖVR.",
  58. key = "lovr.getVersion",
  59. module = "lovr",
  60. variants = {
  61. {
  62. arguments = {},
  63. returns = {
  64. {
  65. name = "major",
  66. type = "number",
  67. description = "The major version."
  68. },
  69. {
  70. name = "minor",
  71. type = "number",
  72. description = "The minor version."
  73. },
  74. {
  75. name = "patch",
  76. type = "number",
  77. description = "The patch number."
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. },
  85. {
  86. name = "audio",
  87. tag = "modules",
  88. summary = "Plays sound.",
  89. description = "The `lovr.audio` module is responsible for playing sound effects and music. To play a sound, create a `Source` object and call `Source:play` on it. Currently ogg, wav, and mp3 audio formats are supported.",
  90. key = "lovr.audio",
  91. objects = {
  92. {
  93. name = "Source",
  94. summary = "A playable sound object.",
  95. description = "A Source is an object representing a single sound. Currently ogg, wav, and mp3 formats are supported.\n\nWhen a Source is playing, it will send audio to the speakers. Sources do not play automatically when they are created. Instead, the `play`, `pause`, and `stop` functions can be used to control when they should play.\n\n`Source:seek` and `Source:tell` can be used to control the playback position of the Source. A Source can be set to loop when it reaches the end using `Source:setLooping`.",
  96. key = "Source",
  97. module = "lovr.audio",
  98. constructors = {
  99. "lovr.audio.newSource",
  100. "Source:clone"
  101. },
  102. sections = {
  103. {
  104. name = "Playback",
  105. tag = "sourcePlayback"
  106. },
  107. {
  108. name = "Spatial Effects",
  109. tag = "sourceEffects"
  110. },
  111. {
  112. name = "Utility",
  113. tag = "sourceUtility"
  114. }
  115. },
  116. methods = {
  117. {
  118. name = "clone",
  119. tag = "sourceUtility",
  120. summary = "Create an identical copy of the Source.",
  121. description = "Creates a copy of the Source, referencing the same `Sound` object and inheriting all of the settings of this Source. However, it will be created in the stopped state and will be rewound to the beginning.",
  122. key = "Source:clone",
  123. module = "lovr.audio",
  124. notes = "This is a good way to create multiple Sources that play the same sound, since the audio data won't be loaded multiple times and can just be reused. You can also create multiple `Source` objects and pass in the same `Sound` object for each one, which will have the same effect.",
  125. related = {
  126. "lovr.audio.newSource"
  127. },
  128. variants = {
  129. {
  130. arguments = {},
  131. returns = {
  132. {
  133. name = "source",
  134. type = "Source",
  135. description = "A genetically identical copy of the Source."
  136. }
  137. }
  138. }
  139. }
  140. },
  141. {
  142. name = "getDirectivity",
  143. tag = "sourceEffects",
  144. summary = "Get the directivity of the Source.",
  145. description = "Returns the directivity settings for the Source.\n\nThe directivity is controlled by two parameters: the weight and the power.\n\nThe weight is a number between 0 and 1 controlling the general \"shape\" of the sound emitted. 0.0 results in a completely omnidirectional sound that can be heard from all directions. 1.0 results in a full dipole shape that can be heard only from the front and back. 0.5 results in a cardioid shape that can only be heard from one direction. Numbers in between will smoothly transition between these.\n\nThe power is a number that controls how \"focused\" or sharp the shape is. Lower power values can be heard from a wider set of angles. It is an exponent, so it can get arbitrarily large. Note that a power of zero will still result in an omnidirectional source, regardless of the weight.",
  146. key = "Source:getDirectivity",
  147. module = "lovr.audio",
  148. variants = {
  149. {
  150. arguments = {},
  151. returns = {
  152. {
  153. name = "weight",
  154. type = "number",
  155. description = "The dipole weight. 0.0 is omnidirectional, 1.0 is a dipole, 0.5 is cardioid."
  156. },
  157. {
  158. name = "power",
  159. type = "number",
  160. description = "The dipole power, controlling how focused the directivity shape is."
  161. }
  162. }
  163. }
  164. }
  165. },
  166. {
  167. name = "getDuration",
  168. tag = "sourcePlayback",
  169. summary = "Get the duration of the Source.",
  170. description = "Returns the duration of the Source.",
  171. key = "Source:getDuration",
  172. module = "lovr.audio",
  173. related = {
  174. "Sound:getDuration"
  175. },
  176. variants = {
  177. {
  178. arguments = {
  179. {
  180. name = "unit",
  181. type = "TimeUnit",
  182. description = "The unit to return.",
  183. default = "'seconds'"
  184. }
  185. },
  186. returns = {
  187. {
  188. name = "duration",
  189. type = "number",
  190. description = "The duration of the Source."
  191. }
  192. }
  193. }
  194. }
  195. },
  196. {
  197. name = "getOrientation",
  198. tag = "sourceEffects",
  199. summary = "Get the orientation of the Source.",
  200. description = "Returns the orientation of the Source, in angle/axis representation.",
  201. key = "Source:getOrientation",
  202. module = "lovr.audio",
  203. related = {
  204. "Source:getPosition",
  205. "Source:getPose",
  206. "Source:getCone",
  207. "lovr.audio.getOrientation"
  208. },
  209. variants = {
  210. {
  211. arguments = {},
  212. returns = {
  213. {
  214. name = "angle",
  215. type = "number",
  216. description = "The number of radians the Source is rotated around its axis of rotation."
  217. },
  218. {
  219. name = "ax",
  220. type = "number",
  221. description = "The x component of the axis of rotation."
  222. },
  223. {
  224. name = "ay",
  225. type = "number",
  226. description = "The y component of the axis of rotation."
  227. },
  228. {
  229. name = "az",
  230. type = "number",
  231. description = "The z component of the axis of rotation."
  232. }
  233. }
  234. }
  235. }
  236. },
  237. {
  238. name = "getPose",
  239. tag = "sourceEffects",
  240. summary = "Get the pose of the Source.",
  241. description = "Returns the position and orientation of the Source.",
  242. key = "Source:getPose",
  243. module = "lovr.audio",
  244. related = {
  245. "Source:getPosition",
  246. "Source:getOrientation",
  247. "Source:getCone",
  248. "lovr.audio.getPose"
  249. },
  250. variants = {
  251. {
  252. arguments = {},
  253. returns = {
  254. {
  255. name = "x",
  256. type = "number",
  257. description = "The x position of the Source, in meters."
  258. },
  259. {
  260. name = "y",
  261. type = "number",
  262. description = "The y position of the Source, in meters."
  263. },
  264. {
  265. name = "z",
  266. type = "number",
  267. description = "The z position of the Source, in meters."
  268. },
  269. {
  270. name = "angle",
  271. type = "number",
  272. description = "The number of radians the Source is rotated around its axis of rotation."
  273. },
  274. {
  275. name = "ax",
  276. type = "number",
  277. description = "The x component of the axis of rotation."
  278. },
  279. {
  280. name = "ay",
  281. type = "number",
  282. description = "The y component of the axis of rotation."
  283. },
  284. {
  285. name = "az",
  286. type = "number",
  287. description = "The z component of the axis of rotation."
  288. }
  289. }
  290. }
  291. }
  292. },
  293. {
  294. name = "getPosition",
  295. tag = "sourceEffects",
  296. summary = "Get the position of the Source.",
  297. description = "Returns the position of the Source, in meters. Setting the position will cause the Source to be distorted and attenuated based on its position relative to the listener.",
  298. key = "Source:getPosition",
  299. module = "lovr.audio",
  300. related = {
  301. "Source:getOrientation",
  302. "Source:getPose",
  303. "Source:getCone",
  304. "lovr.audio.getPosition"
  305. },
  306. variants = {
  307. {
  308. arguments = {},
  309. returns = {
  310. {
  311. name = "x",
  312. type = "number",
  313. description = "The x coordinate."
  314. },
  315. {
  316. name = "y",
  317. type = "number",
  318. description = "The y coordinate."
  319. },
  320. {
  321. name = "z",
  322. type = "number",
  323. description = "The z coordinate."
  324. }
  325. }
  326. }
  327. }
  328. },
  329. {
  330. name = "getRadius",
  331. tag = "sourceEffects",
  332. summary = "Get the radius of the Source.",
  333. description = "Returns the radius of the Source, in meters.\n\nThis does not control falloff or attenuation. It is only used for smoothing out occlusion. If a Source doesn't have a radius, then when it becomes occluded by a wall its volume will instantly drop. Giving the Source a radius that approximates its emitter's size will result in a smooth transition between audible and occluded, improving realism.",
  334. key = "Source:getRadius",
  335. module = "lovr.audio",
  336. variants = {
  337. {
  338. arguments = {},
  339. returns = {
  340. {
  341. name = "radius",
  342. type = "number",
  343. description = "The radius of the Source, in meters."
  344. }
  345. }
  346. }
  347. }
  348. },
  349. {
  350. name = "getSound",
  351. tag = "sourceUtility",
  352. summary = "Get the Sound object backing the Source.",
  353. description = "Returns the `Sound` object backing the Source. Multiple Sources can share one Sound, allowing its data to only be loaded once. An easy way to do this sharing is by using `Source:clone`.",
  354. key = "Source:getSound",
  355. module = "lovr.audio",
  356. related = {
  357. "Source:clone",
  358. "lovr.audio.newSource"
  359. },
  360. variants = {
  361. {
  362. arguments = {},
  363. returns = {
  364. {
  365. name = "sound",
  366. type = "Sound",
  367. description = "The Sound object."
  368. }
  369. }
  370. }
  371. }
  372. },
  373. {
  374. name = "getVolume",
  375. tag = "sourcePlayback",
  376. summary = "Get the volume of the Source.",
  377. description = "Returns the current volume factor for the Source.",
  378. key = "Source:getVolume",
  379. module = "lovr.audio",
  380. variants = {
  381. {
  382. arguments = {
  383. {
  384. name = "units",
  385. type = "VolumeUnit",
  386. description = "The units to return (linear or db).",
  387. default = "'linear'"
  388. }
  389. },
  390. returns = {
  391. {
  392. name = "volume",
  393. type = "number",
  394. description = "The volume of the Source."
  395. }
  396. }
  397. }
  398. }
  399. },
  400. {
  401. name = "isEffectEnabled",
  402. tag = "sourceEffects",
  403. summary = "Check if an effect is enabled.",
  404. description = "Returns whether a given `Effect` is enabled for the Source.",
  405. key = "Source:isEffectEnabled",
  406. module = "lovr.audio",
  407. notes = "The active spatializer will determine which effects are supported. If an unsupported effect is enabled on a Source, no error will be reported. Instead, it will be silently ignored. See `lovr.audio.getSpatializer` for a table showing the effects supported by each spatializer.\n\nCalling this function on a Source that was created with `{ effects = false }` will always return false.",
  408. variants = {
  409. {
  410. arguments = {
  411. {
  412. name = "effect",
  413. type = "Effect",
  414. description = "The effect."
  415. }
  416. },
  417. returns = {
  418. {
  419. name = "enabled",
  420. type = "boolean",
  421. description = "Whether the effect is enabled."
  422. }
  423. }
  424. }
  425. }
  426. },
  427. {
  428. name = "isLooping",
  429. tag = "sourcePlayback",
  430. summary = "Check if the Source is looping.",
  431. description = "Returns whether or not the Source will loop when it finishes.",
  432. key = "Source:isLooping",
  433. module = "lovr.audio",
  434. variants = {
  435. {
  436. arguments = {},
  437. returns = {
  438. {
  439. name = "looping",
  440. type = "boolean",
  441. description = "Whether or not the Source is looping."
  442. }
  443. }
  444. }
  445. }
  446. },
  447. {
  448. name = "isPlaying",
  449. tag = "sourcePlayback",
  450. summary = "Check if the Source is playing.",
  451. description = "Returns whether or not the Source is playing.",
  452. key = "Source:isPlaying",
  453. module = "lovr.audio",
  454. related = {
  455. "Source:play",
  456. "Source:pause",
  457. "Source:stop"
  458. },
  459. variants = {
  460. {
  461. arguments = {},
  462. returns = {
  463. {
  464. name = "playing",
  465. type = "boolean",
  466. description = "Whether the Source is playing."
  467. }
  468. }
  469. }
  470. }
  471. },
  472. {
  473. name = "pause",
  474. tag = "sourcePlayback",
  475. summary = "Pause the Source.",
  476. description = "Pauses the source. It can be resumed with `Source:resume` or `Source:play`. If a paused source is rewound, it will remain paused.",
  477. key = "Source:pause",
  478. module = "lovr.audio",
  479. variants = {
  480. {
  481. arguments = {},
  482. returns = {}
  483. }
  484. }
  485. },
  486. {
  487. name = "play",
  488. tag = "sourcePlayback",
  489. summary = "Play the Source.",
  490. description = "Plays the Source. This doesn't do anything if the Source is already playing.",
  491. key = "Source:play",
  492. module = "lovr.audio",
  493. notes = "There is a maximum of 64 Sources that can be playing at once. If 64 Sources are already playing, this function will return `false`.",
  494. variants = {
  495. {
  496. arguments = {},
  497. returns = {
  498. {
  499. name = "success",
  500. type = "boolean",
  501. description = "Whether the Source successfully started playing."
  502. }
  503. }
  504. }
  505. }
  506. },
  507. {
  508. name = "seek",
  509. tag = "sourcePlayback",
  510. summary = "Set the playback position of the Source.",
  511. description = "Seeks the Source to the specified position.",
  512. key = "Source:seek",
  513. module = "lovr.audio",
  514. notes = "Seeking a Source backed by a stream `Sound` has no meaningful effect.",
  515. variants = {
  516. {
  517. arguments = {
  518. {
  519. name = "position",
  520. type = "number",
  521. description = "The position to seek to."
  522. },
  523. {
  524. name = "unit",
  525. type = "TimeUnit",
  526. description = "The units for the seek position.",
  527. default = "'seconds'"
  528. }
  529. },
  530. returns = {}
  531. }
  532. }
  533. },
  534. {
  535. name = "setDirectivity",
  536. tag = "sourceEffects",
  537. summary = "Set the directivity of the Source.",
  538. description = "Sets the directivity settings for the Source.\n\nThe directivity is controlled by two parameters: the weight and the power.\n\nThe weight is a number between 0 and 1 controlling the general \"shape\" of the sound emitted. 0.0 results in a completely omnidirectional sound that can be heard from all directions. 1.0 results in a full dipole shape that can be heard only from the front and back. 0.5 results in a cardioid shape that can only be heard from one direction. Numbers in between will smoothly transition between these.\n\nThe power is a number that controls how \"focused\" or sharp the shape is. Lower power values can be heard from a wider set of angles. It is an exponent, so it can get arbitrarily large. Note that a power of zero will still result in an omnidirectional source, regardless of the weight.",
  539. key = "Source:setDirectivity",
  540. module = "lovr.audio",
  541. variants = {
  542. {
  543. arguments = {
  544. {
  545. name = "weight",
  546. type = "number",
  547. description = "The dipole weight. 0.0 is omnidirectional, 1.0 is a dipole, 0.5 is cardioid."
  548. },
  549. {
  550. name = "power",
  551. type = "number",
  552. description = "The dipole power, controlling how focused the directivity shape is."
  553. }
  554. },
  555. returns = {}
  556. }
  557. }
  558. },
  559. {
  560. name = "setEffectEnabled",
  561. tag = "sourceEffects",
  562. summary = "Enable or disable an effect.",
  563. description = "Enables or disables an effect on the Source.",
  564. key = "Source:setEffectEnabled",
  565. module = "lovr.audio",
  566. notes = "The active spatializer will determine which effects are supported. If an unsupported effect is enabled on a Source, no error will be reported. Instead, it will be silently ignored. See `lovr.audio.getSpatializer` for a table showing the effects supported by each spatializer.\n\nCalling this function on a Source that was created with `{ effects = false }` will throw an error.",
  567. variants = {
  568. {
  569. arguments = {
  570. {
  571. name = "effect",
  572. type = "Effect",
  573. description = "The effect."
  574. },
  575. {
  576. name = "enable",
  577. type = "boolean",
  578. description = "Whether the effect should be enabled."
  579. }
  580. },
  581. returns = {}
  582. }
  583. }
  584. },
  585. {
  586. name = "setLooping",
  587. tag = "sourcePlayback",
  588. summary = "Set whether or not the Source loops.",
  589. description = "Sets whether or not the Source loops.",
  590. key = "Source:setLooping",
  591. module = "lovr.audio",
  592. notes = "Attempting to loop a Source backed by a stream `Sound` will cause an error.",
  593. variants = {
  594. {
  595. arguments = {
  596. {
  597. name = "loop",
  598. type = "boolean",
  599. description = "Whether or not the Source will loop."
  600. }
  601. },
  602. returns = {}
  603. }
  604. }
  605. },
  606. {
  607. name = "setOrientation",
  608. tag = "sourceEffects",
  609. summary = "Set the orientation of the Source.",
  610. description = "Sets the orientation of the Source in angle/axis representation.",
  611. key = "Source:setOrientation",
  612. module = "lovr.audio",
  613. related = {
  614. "Source:setPosition",
  615. "Source:setPose",
  616. "Source:setCone",
  617. "lovr.audio.setOrientation"
  618. },
  619. variants = {
  620. {
  621. arguments = {
  622. {
  623. name = "angle",
  624. type = "number",
  625. description = "The number of radians the Source should be rotated around its rotation axis."
  626. },
  627. {
  628. name = "ax",
  629. type = "number",
  630. description = "The x component of the axis of rotation."
  631. },
  632. {
  633. name = "ay",
  634. type = "number",
  635. description = "The y component of the axis of rotation."
  636. },
  637. {
  638. name = "az",
  639. type = "number",
  640. description = "The z component of the axis of rotation."
  641. }
  642. },
  643. returns = {}
  644. }
  645. }
  646. },
  647. {
  648. name = "setPose",
  649. tag = "sourceEffects",
  650. summary = "Set the pose of the Source.",
  651. description = "Sets the position and orientation of the Source.",
  652. key = "Source:setPose",
  653. module = "lovr.audio",
  654. related = {
  655. "Source:setPosition",
  656. "Source:setOrientation",
  657. "lovr.audio.setPose"
  658. },
  659. variants = {
  660. {
  661. arguments = {
  662. {
  663. name = "x",
  664. type = "number",
  665. description = "The x position of the Source, in meters."
  666. },
  667. {
  668. name = "y",
  669. type = "number",
  670. description = "The y position of the Source, in meters."
  671. },
  672. {
  673. name = "z",
  674. type = "number",
  675. description = "The z position of the Source, in meters."
  676. },
  677. {
  678. name = "angle",
  679. type = "number",
  680. description = "The number of radians the Source is rotated around its axis of rotation."
  681. },
  682. {
  683. name = "ax",
  684. type = "number",
  685. description = "The x component of the axis of rotation."
  686. },
  687. {
  688. name = "ay",
  689. type = "number",
  690. description = "The y component of the axis of rotation."
  691. },
  692. {
  693. name = "az",
  694. type = "number",
  695. description = "The z component of the axis of rotation."
  696. }
  697. },
  698. returns = {}
  699. }
  700. }
  701. },
  702. {
  703. name = "setPosition",
  704. tag = "sourceEffects",
  705. summary = "Set the position of the Source.",
  706. description = "Sets the position of the Source, in meters. Setting the position will cause the Source to be distorted and attenuated based on its position relative to the listener.\n\nOnly mono sources can be positioned. Setting the position of a stereo Source will cause an error.",
  707. key = "Source:setPosition",
  708. module = "lovr.audio",
  709. variants = {
  710. {
  711. arguments = {
  712. {
  713. name = "x",
  714. type = "number",
  715. description = "The x coordinate."
  716. },
  717. {
  718. name = "y",
  719. type = "number",
  720. description = "The y coordinate."
  721. },
  722. {
  723. name = "z",
  724. type = "number",
  725. description = "The z coordinate."
  726. }
  727. },
  728. returns = {}
  729. }
  730. }
  731. },
  732. {
  733. name = "setRadius",
  734. tag = "sourceEffects",
  735. summary = "Set the radius of the Source.",
  736. description = "Sets the radius of the Source, in meters.\n\nThis does not control falloff or attenuation. It is only used for smoothing out occlusion. If a Source doesn't have a radius, then when it becomes occluded by a wall its volume will instantly drop. Giving the Source a radius that approximates its emitter's size will result in a smooth transition between audible and occluded, improving realism.",
  737. key = "Source:setRadius",
  738. module = "lovr.audio",
  739. variants = {
  740. {
  741. arguments = {
  742. {
  743. name = "radius",
  744. type = "number",
  745. description = "The new radius of the Source, in meters."
  746. }
  747. },
  748. returns = {}
  749. }
  750. }
  751. },
  752. {
  753. name = "setVolume",
  754. tag = "sourcePlayback",
  755. summary = "Set the volume of the Source.",
  756. description = "Sets the current volume factor for the Source.",
  757. key = "Source:setVolume",
  758. module = "lovr.audio",
  759. notes = "The volume will be clamped to a 0-1 range (0 dB).",
  760. variants = {
  761. {
  762. arguments = {
  763. {
  764. name = "volume",
  765. type = "number",
  766. description = "The new volume."
  767. },
  768. {
  769. name = "units",
  770. type = "VolumeUnit",
  771. description = "The units of the value.",
  772. default = "'linear'"
  773. }
  774. },
  775. returns = {}
  776. }
  777. }
  778. },
  779. {
  780. name = "stop",
  781. tag = "sourcePlayback",
  782. summary = "Stop the Source.",
  783. description = "Stops the source, also rewinding it to the beginning.",
  784. key = "Source:stop",
  785. module = "lovr.audio",
  786. related = {
  787. "Source:play",
  788. "Source:pause",
  789. "Source:isPlaying"
  790. },
  791. variants = {
  792. {
  793. arguments = {},
  794. returns = {}
  795. }
  796. }
  797. },
  798. {
  799. name = "tell",
  800. tag = "sourcePlayback",
  801. summary = "Get the playback position of the Source.",
  802. description = "Returns the current playback position of the Source.",
  803. key = "Source:tell",
  804. module = "lovr.audio",
  805. notes = "The return value for Sources backed by a stream `Sound` has no meaning.",
  806. variants = {
  807. {
  808. arguments = {
  809. {
  810. name = "unit",
  811. type = "TimeUnit",
  812. description = "The unit to return.",
  813. default = "'seconds'"
  814. }
  815. },
  816. returns = {
  817. {
  818. name = "position",
  819. type = "number",
  820. description = "The current playback position."
  821. }
  822. }
  823. }
  824. }
  825. }
  826. }
  827. }
  828. },
  829. functions = {
  830. {
  831. name = "getAbsorption",
  832. summary = "Get the absorption coefficients.",
  833. description = "Returns the global air absorption coefficients for the medium. This affects Sources that have the `absorption` effect enabled, causing audio volume to drop off with distance as it is absorbed by the medium it's traveling through (air, water, etc.). The difference between absorption and falloff is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones. This can be used to apply \"underwater\" effects and stuff.",
  834. key = "lovr.audio.getAbsorption",
  835. module = "lovr.audio",
  836. notes = "Absorption is currently only supported by the phonon spatializer.\n\nThe frequency bands correspond to `400Hz`, `2.5KHz`, and `15KHz`.\n\nThe default coefficients are `.0002`, `.0017`, and `.0182` for low, mid, and high.",
  837. variants = {
  838. {
  839. arguments = {},
  840. returns = {
  841. {
  842. name = "low",
  843. type = "number",
  844. description = "The absorption coefficient for the low frequency band."
  845. },
  846. {
  847. name = "mid",
  848. type = "number",
  849. description = "The absorption coefficient for the mid frequency band."
  850. },
  851. {
  852. name = "high",
  853. type = "number",
  854. description = "The absorption coefficient for the high frequency band."
  855. }
  856. }
  857. }
  858. }
  859. },
  860. {
  861. name = "getDevices",
  862. tag = "devices",
  863. summary = "Get a list of audio devices.",
  864. description = "Returns a list of playback or capture devices. Each device has an `id`, `name`, and a `default` flag indicating whether it's the default device.\n\nTo use a specific device id for playback or capture, pass it to `lovr.audio.setDevice`.",
  865. key = "lovr.audio.getDevices",
  866. module = "lovr.audio",
  867. related = {
  868. "lovr.audio.setDevice",
  869. "lovr.audio.start",
  870. "lovr.audio.stop"
  871. },
  872. variants = {
  873. {
  874. arguments = {
  875. {
  876. name = "type",
  877. type = "AudioType",
  878. description = "The type of devices to query (playback or capture).",
  879. default = "'playback'"
  880. }
  881. },
  882. returns = {
  883. {
  884. name = "devices",
  885. type = "table",
  886. description = "The list of devices.",
  887. table = {
  888. {
  889. name = "[].id",
  890. type = "userdata",
  891. description = "A unique, opaque id for the device."
  892. },
  893. {
  894. name = "[].name",
  895. type = "string",
  896. description = "A human readable name for the device."
  897. },
  898. {
  899. name = "[].default",
  900. type = "boolean",
  901. description = "Whether the device is the default audio device."
  902. }
  903. }
  904. }
  905. }
  906. }
  907. }
  908. },
  909. {
  910. name = "getOrientation",
  911. tag = "listener",
  912. summary = "Get the orientation of the listener.",
  913. description = "Returns the orientation of the virtual audio listener in angle/axis representation.",
  914. key = "lovr.audio.getOrientation",
  915. module = "lovr.audio",
  916. related = {
  917. "lovr.audio.getPosition",
  918. "lovr.audio.getPose",
  919. "Source:getOrientation"
  920. },
  921. variants = {
  922. {
  923. arguments = {},
  924. returns = {
  925. {
  926. name = "angle",
  927. type = "number",
  928. description = "The number of radians the listener is rotated around its axis of rotation."
  929. },
  930. {
  931. name = "ax",
  932. type = "number",
  933. description = "The x component of the axis of rotation."
  934. },
  935. {
  936. name = "ay",
  937. type = "number",
  938. description = "The y component of the axis of rotation."
  939. },
  940. {
  941. name = "az",
  942. type = "number",
  943. description = "The z component of the axis of rotation."
  944. }
  945. }
  946. }
  947. }
  948. },
  949. {
  950. name = "getPose",
  951. tag = "listener",
  952. summary = "Get the pose of the listener.",
  953. description = "Returns the position and orientation of the virtual audio listener.",
  954. key = "lovr.audio.getPose",
  955. module = "lovr.audio",
  956. related = {
  957. "lovr.audio.getPosition",
  958. "lovr.audio.getOrientation",
  959. "Source:getPose"
  960. },
  961. variants = {
  962. {
  963. arguments = {},
  964. returns = {
  965. {
  966. name = "x",
  967. type = "number",
  968. description = "The x position of the listener, in meters."
  969. },
  970. {
  971. name = "y",
  972. type = "number",
  973. description = "The y position of the listener, in meters."
  974. },
  975. {
  976. name = "z",
  977. type = "number",
  978. description = "The z position of the listener, in meters."
  979. },
  980. {
  981. name = "angle",
  982. type = "number",
  983. description = "The number of radians the listener is rotated around its axis of rotation."
  984. },
  985. {
  986. name = "ax",
  987. type = "number",
  988. description = "The x component of the axis of rotation."
  989. },
  990. {
  991. name = "ay",
  992. type = "number",
  993. description = "The y component of the axis of rotation."
  994. },
  995. {
  996. name = "az",
  997. type = "number",
  998. description = "The z component of the axis of rotation."
  999. }
  1000. }
  1001. }
  1002. }
  1003. },
  1004. {
  1005. name = "getPosition",
  1006. tag = "listener",
  1007. summary = "Get the position of the listener.",
  1008. description = "Returns the position of the virtual audio listener, in meters.",
  1009. key = "lovr.audio.getPosition",
  1010. module = "lovr.audio",
  1011. variants = {
  1012. {
  1013. arguments = {},
  1014. returns = {
  1015. {
  1016. name = "x",
  1017. type = "number",
  1018. description = "The x position of the listener."
  1019. },
  1020. {
  1021. name = "y",
  1022. type = "number",
  1023. description = "The y position of the listener."
  1024. },
  1025. {
  1026. name = "z",
  1027. type = "number",
  1028. description = "The z position of the listener."
  1029. }
  1030. }
  1031. }
  1032. }
  1033. },
  1034. {
  1035. name = "getSampleRate",
  1036. tag = "devices",
  1037. summary = "Get the playback device sample rate.",
  1038. description = "Returns the sample rate used by the playback device. This can be changed using `lovr.conf`.",
  1039. key = "lovr.audio.getSampleRate",
  1040. module = "lovr.audio",
  1041. related = {
  1042. "lovr.conf"
  1043. },
  1044. variants = {
  1045. {
  1046. arguments = {},
  1047. returns = {
  1048. {
  1049. name = "rate",
  1050. type = "number",
  1051. description = "The sample rate of the playback device, in Hz."
  1052. }
  1053. }
  1054. }
  1055. }
  1056. },
  1057. {
  1058. name = "getSpatializer",
  1059. tag = "listener",
  1060. summary = "Get the name of the active spatializer",
  1061. description = "Returns the name of the active spatializer (`simple`, `oculus`, or `phonon`).\n\nThe `t.audio.spatializer` setting in `lovr.conf` can be used to express a preference for a particular spatializer. If it's `nil`, all spatializers will be tried in the following order: `phonon`, `oculus`, `simple`.",
  1062. key = "lovr.audio.getSpatializer",
  1063. module = "lovr.audio",
  1064. notes = "Using a feature or effect that is not supported by the current spatializer will not error, it just won't do anything.\n\n<table>\n <thead>\n <tr>\n <td>Feature</td>\n <td>simple</td>\n <td>phonon</td>\n <td>oculus</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Effect: Spatialization</td>\n <td>x</td>\n <td>x</td>\n <td>x</td>\n </tr>\n <tr>\n <td>Effect: Attenuation</td>\n <td>x</td>\n <td>x</td>\n <td>x</td>\n </tr>\n <tr>\n <td>Effect: Absorption</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>Effect: Occlusion</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>Effect: Transmission</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>Effect: Reverb</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>lovr.audio.setGeometry</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>Source:setDirectivity</td>\n <td>x</td>\n <td>x</td>\n <td></td>\n </tr>\n <tr>\n <td>Source:setRadius</td>\n <td></td>\n <td>x</td>\n <td></td>\n </tr>\n </tbody> </table>",
  1065. related = {
  1066. "lovr.conf"
  1067. },
  1068. variants = {
  1069. {
  1070. arguments = {},
  1071. returns = {
  1072. {
  1073. name = "spatializer",
  1074. type = "string",
  1075. description = "The name of the active spatializer."
  1076. }
  1077. }
  1078. }
  1079. }
  1080. },
  1081. {
  1082. name = "getVolume",
  1083. tag = "listener",
  1084. summary = "Get the master volume.",
  1085. description = "Returns the master volume. All audio sent to the playback device has its volume multiplied by this factor.",
  1086. key = "lovr.audio.getVolume",
  1087. module = "lovr.audio",
  1088. notes = "The default volume is 1.0 (0 dB).",
  1089. variants = {
  1090. {
  1091. arguments = {
  1092. {
  1093. name = "units",
  1094. type = "VolumeUnit",
  1095. description = "The units to return (linear or db).",
  1096. default = "'linear'"
  1097. }
  1098. },
  1099. returns = {
  1100. {
  1101. name = "volume",
  1102. type = "number",
  1103. description = "The master volume."
  1104. }
  1105. }
  1106. }
  1107. }
  1108. },
  1109. {
  1110. name = "isStarted",
  1111. tag = "devices",
  1112. summary = "Check if an audio device is started.",
  1113. description = "Returns whether an audio device is started.",
  1114. key = "lovr.audio.isStarted",
  1115. module = "lovr.audio",
  1116. related = {
  1117. "lovr.audio.start",
  1118. "lovr.audio.stop"
  1119. },
  1120. variants = {
  1121. {
  1122. arguments = {
  1123. {
  1124. name = "type",
  1125. type = "AudioType",
  1126. description = "The type of device to check.",
  1127. default = "'playback'"
  1128. }
  1129. },
  1130. returns = {
  1131. {
  1132. name = "started",
  1133. type = "boolean",
  1134. description = "Whether the device is active."
  1135. }
  1136. }
  1137. }
  1138. }
  1139. },
  1140. {
  1141. name = "newSource",
  1142. tag = "sources",
  1143. summary = "Create a new Source.",
  1144. description = "Creates a new Source from an ogg, wav, or mp3 file.",
  1145. key = "lovr.audio.newSource",
  1146. module = "lovr.audio",
  1147. examples = {
  1148. {
  1149. code = "function lovr.load()\n sandstorm = lovr.audio.newSource('darude.ogg', {\n decode = false,\n effects = { 'spatialization', attenuation = false, reverb = true }\n })\n\n sandstorm:play()\nend"
  1150. }
  1151. },
  1152. related = {
  1153. "Source:clone"
  1154. },
  1155. variants = {
  1156. {
  1157. arguments = {
  1158. {
  1159. name = "filename",
  1160. type = "string",
  1161. description = "The filename of the sound to load."
  1162. },
  1163. {
  1164. name = "options",
  1165. type = "table",
  1166. description = "Optional options.",
  1167. table = {
  1168. {
  1169. name = "decode",
  1170. type = "boolean",
  1171. description = "Whether to immediately decode compressed sounds.",
  1172. default = "false"
  1173. },
  1174. {
  1175. name = "effects",
  1176. type = "table",
  1177. description = "A table of `Effect`s to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value `false` can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. `true` will enable all effects.",
  1178. default = "true"
  1179. }
  1180. }
  1181. }
  1182. },
  1183. returns = {
  1184. {
  1185. name = "source",
  1186. type = "Source",
  1187. description = "The new Source."
  1188. }
  1189. }
  1190. },
  1191. {
  1192. arguments = {
  1193. {
  1194. name = "blob",
  1195. type = "Blob",
  1196. description = "The Blob containing the Source data."
  1197. },
  1198. {
  1199. name = "options",
  1200. type = "table",
  1201. description = "Optional options.",
  1202. table = {
  1203. {
  1204. name = "decode",
  1205. type = "boolean",
  1206. description = "Whether to immediately decode compressed sounds.",
  1207. default = "false"
  1208. },
  1209. {
  1210. name = "effects",
  1211. type = "table",
  1212. description = "A table of `Effect`s to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value `false` can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. `true` will enable all effects.",
  1213. default = "true"
  1214. }
  1215. }
  1216. }
  1217. },
  1218. returns = {
  1219. {
  1220. name = "source",
  1221. type = "Source",
  1222. description = "The new Source."
  1223. }
  1224. }
  1225. },
  1226. {
  1227. arguments = {
  1228. {
  1229. name = "sound",
  1230. type = "Sound",
  1231. description = "The Sound containing raw audio samples to play."
  1232. },
  1233. {
  1234. name = "options",
  1235. type = "table",
  1236. description = "Optional options.",
  1237. table = {
  1238. {
  1239. name = "decode",
  1240. type = "boolean",
  1241. description = "Whether to immediately decode compressed sounds.",
  1242. default = "false"
  1243. },
  1244. {
  1245. name = "effects",
  1246. type = "table",
  1247. description = "A table of `Effect`s to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value `false` can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. `true` will enable all effects.",
  1248. default = "true"
  1249. }
  1250. }
  1251. }
  1252. },
  1253. returns = {
  1254. {
  1255. name = "source",
  1256. type = "Source",
  1257. description = "The new Source."
  1258. }
  1259. }
  1260. }
  1261. }
  1262. },
  1263. {
  1264. name = "setAbsorption",
  1265. summary = "Set the absorption coefficients.",
  1266. description = "Sets the global air absorption coefficients for the medium. This affects Sources that have the `absorption` effect enabled, causing audio volume to drop off with distance as it is absorbed by the medium it's traveling through (air, water, etc.). The difference between absorption and falloff is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones. This can be used to apply \"underwater\" effects and stuff.",
  1267. key = "lovr.audio.setAbsorption",
  1268. module = "lovr.audio",
  1269. notes = "Absorption is currently only supported by the phonon spatializer.\n\nThe frequency bands correspond to `400Hz`, `2.5KHz`, and `15KHz`.\n\nThe default coefficients are `.0002`, `.0017`, and `.0182` for low, mid, and high.",
  1270. variants = {
  1271. {
  1272. arguments = {
  1273. {
  1274. name = "low",
  1275. type = "number",
  1276. description = "The absorption coefficient for the low frequency band."
  1277. },
  1278. {
  1279. name = "mid",
  1280. type = "number",
  1281. description = "The absorption coefficient for the mid frequency band."
  1282. },
  1283. {
  1284. name = "high",
  1285. type = "number",
  1286. description = "The absorption coefficient for the high frequency band."
  1287. }
  1288. },
  1289. returns = {}
  1290. }
  1291. }
  1292. },
  1293. {
  1294. name = "setDevice",
  1295. tag = "devices",
  1296. summary = "Switch audio devices.",
  1297. description = "Switches either the playback or capture device to a new one.\n\nIf a device for the given type is already active, it will be stopped and destroyed. The new device will not be started automatically, use `lovr.audio.start` to start it.\n\nA device id (previously retrieved using `lovr.audio.getDevices`) can be given to use a specific audio device, or `nil` can be used for the id to use the default audio device.\n\nA sink can be also be provided when changing the device. A sink is an audio stream (`Sound` object with a `stream` type) that will receive all audio samples played (for playback) or all audio samples captured (for capture). When an audio device with a sink is started, be sure to periodically call `Sound:read` on the sink to read audio samples from it, otherwise it will overflow and discard old data. The sink can have any format, data will be converted as needed. Using a sink for the playback device will reduce performance, but this isn't the case for capture devices.\n\nAudio devices can be started in `shared` or `exclusive` mode. Exclusive devices may have lower latency than shared devices, but there's a higher chance that requesting exclusive access to an audio device will fail (either because it isn't supported or allowed). One strategy is to first try the device in exclusive mode, switching to shared if it doesn't work.",
  1298. key = "lovr.audio.setDevice",
  1299. module = "lovr.audio",
  1300. related = {
  1301. "lovr.audio.getDevices",
  1302. "lovr.audio.start",
  1303. "lovr.audio.stop"
  1304. },
  1305. variants = {
  1306. {
  1307. arguments = {
  1308. {
  1309. name = "type",
  1310. type = "AudioType",
  1311. description = "The device to switch.",
  1312. default = "'playback'"
  1313. },
  1314. {
  1315. name = "id",
  1316. type = "userdata",
  1317. description = "The id of the device to use, or `nil` to use the default device.",
  1318. default = "nil"
  1319. },
  1320. {
  1321. name = "sink",
  1322. type = "Sound",
  1323. description = "An optional audio stream to use as a sink for the device.",
  1324. default = "nil"
  1325. },
  1326. {
  1327. name = "mode",
  1328. type = "AudioShareMode",
  1329. description = "The sharing mode for the device.",
  1330. default = "shared"
  1331. }
  1332. },
  1333. returns = {
  1334. {
  1335. name = "success",
  1336. type = "boolean",
  1337. description = "Whether creating the audio device succeeded."
  1338. }
  1339. }
  1340. }
  1341. }
  1342. },
  1343. {
  1344. name = "setGeometry",
  1345. tag = "listener",
  1346. summary = "Set the geometry for audio effects.",
  1347. description = "Sets a mesh of triangles to use for modeling audio effects, using a table of vertices or a Model. When the appropriate effects are enabled, audio from `Source` objects will correctly be occluded by walls and bounce around to create realistic reverb.\n\nAn optional `AudioMaterial` may be provided to specify the acoustic properties of the geometry.",
  1348. key = "lovr.audio.setGeometry",
  1349. module = "lovr.audio",
  1350. notes = "This is currently only supported/used by the `phonon` spatializer.\n\nThe `Effect`s that use geometry are:\n\n- `occlusion`\n- `reverb`\n- `transmission`\n\nIf an existing geometry has been set, this function will replace it.\n\nThe triangles must use counterclockwise winding.",
  1351. related = {
  1352. "lovr.audio.getSpatializer",
  1353. "Source:setEffectEnabled"
  1354. },
  1355. variants = {
  1356. {
  1357. arguments = {
  1358. {
  1359. name = "vertices",
  1360. type = "table",
  1361. description = "A flat table of vertices. Each vertex is 3 numbers representing its x, y, and z position. The units used for audio coordinates are up to you, but meters are recommended."
  1362. },
  1363. {
  1364. name = "indices",
  1365. type = "table",
  1366. description = "A list of indices, indicating how the vertices are connected into triangles. Indices are 1-indexed and are 32 bits (they can be bigger than 65535)."
  1367. },
  1368. {
  1369. name = "material",
  1370. type = "AudioMaterial",
  1371. description = "The acoustic material to use.",
  1372. default = "'generic'"
  1373. }
  1374. },
  1375. returns = {
  1376. {
  1377. name = "success",
  1378. type = "boolean",
  1379. description = "Whether audio geometry is supported by the current spatializer and the geometry was loaded successfully."
  1380. }
  1381. }
  1382. },
  1383. {
  1384. arguments = {
  1385. {
  1386. name = "model",
  1387. type = "Model",
  1388. description = "A model to use for the audio geometry."
  1389. },
  1390. {
  1391. name = "material",
  1392. type = "AudioMaterial",
  1393. description = "The acoustic material to use.",
  1394. default = "'generic'"
  1395. }
  1396. },
  1397. returns = {
  1398. {
  1399. name = "success",
  1400. type = "boolean",
  1401. description = "Whether audio geometry is supported by the current spatializer and the geometry was loaded successfully."
  1402. }
  1403. }
  1404. }
  1405. }
  1406. },
  1407. {
  1408. name = "setOrientation",
  1409. tag = "listener",
  1410. summary = "Set the orientation of the listener.",
  1411. description = "Sets the orientation of the virtual audio listener in angle/axis representation.",
  1412. key = "lovr.audio.setOrientation",
  1413. module = "lovr.audio",
  1414. variants = {
  1415. {
  1416. arguments = {
  1417. {
  1418. name = "angle",
  1419. type = "number",
  1420. description = "The number of radians the listener should be rotated around its rotation axis."
  1421. },
  1422. {
  1423. name = "ax",
  1424. type = "number",
  1425. description = "The x component of the axis of rotation."
  1426. },
  1427. {
  1428. name = "ay",
  1429. type = "number",
  1430. description = "The y component of the axis of rotation."
  1431. },
  1432. {
  1433. name = "az",
  1434. type = "number",
  1435. description = "The z component of the axis of rotation."
  1436. }
  1437. },
  1438. returns = {}
  1439. }
  1440. }
  1441. },
  1442. {
  1443. name = "setPose",
  1444. tag = "listener",
  1445. summary = "Set the pose of the listener.",
  1446. description = "Sets the position and orientation of the virtual audio listener.",
  1447. key = "lovr.audio.setPose",
  1448. module = "lovr.audio",
  1449. related = {
  1450. "lovr.audio.setPosition",
  1451. "lovr.audio.setOrientation",
  1452. "Source:setPose"
  1453. },
  1454. variants = {
  1455. {
  1456. arguments = {
  1457. {
  1458. name = "x",
  1459. type = "number",
  1460. description = "The x position of the listener, in meters."
  1461. },
  1462. {
  1463. name = "y",
  1464. type = "number",
  1465. description = "The y position of the listener, in meters."
  1466. },
  1467. {
  1468. name = "z",
  1469. type = "number",
  1470. description = "The z position of the listener, in meters."
  1471. },
  1472. {
  1473. name = "angle",
  1474. type = "number",
  1475. description = "The number of radians the listener is rotated around its axis of rotation."
  1476. },
  1477. {
  1478. name = "ax",
  1479. type = "number",
  1480. description = "The x component of the axis of rotation."
  1481. },
  1482. {
  1483. name = "ay",
  1484. type = "number",
  1485. description = "The y component of the axis of rotation."
  1486. },
  1487. {
  1488. name = "az",
  1489. type = "number",
  1490. description = "The z component of the axis of rotation."
  1491. }
  1492. },
  1493. returns = {}
  1494. }
  1495. }
  1496. },
  1497. {
  1498. name = "setPosition",
  1499. tag = "listener",
  1500. summary = "Set the position of the listener.",
  1501. description = "Sets the position of the virtual audio listener, in meters.",
  1502. key = "lovr.audio.setPosition",
  1503. module = "lovr.audio",
  1504. variants = {
  1505. {
  1506. arguments = {
  1507. {
  1508. name = "x",
  1509. type = "number",
  1510. description = "The x position of the listener."
  1511. },
  1512. {
  1513. name = "y",
  1514. type = "number",
  1515. description = "The y position of the listener."
  1516. },
  1517. {
  1518. name = "z",
  1519. type = "number",
  1520. description = "The z position of the listener."
  1521. }
  1522. },
  1523. returns = {}
  1524. }
  1525. }
  1526. },
  1527. {
  1528. name = "setVolume",
  1529. tag = "listener",
  1530. summary = "Set the master volume.",
  1531. description = "Sets the master volume. All audio sent to the playback device has its volume multiplied by this factor.",
  1532. key = "lovr.audio.setVolume",
  1533. module = "lovr.audio",
  1534. notes = "The volume will be clamped to a 0-1 range (0 dB).",
  1535. variants = {
  1536. {
  1537. arguments = {
  1538. {
  1539. name = "volume",
  1540. type = "number",
  1541. description = "The master volume."
  1542. },
  1543. {
  1544. name = "units",
  1545. type = "VolumeUnit",
  1546. description = "The units of the value.",
  1547. default = "'linear'"
  1548. }
  1549. },
  1550. returns = {}
  1551. }
  1552. }
  1553. },
  1554. {
  1555. name = "start",
  1556. tag = "devices",
  1557. summary = "Start an audio device.",
  1558. description = "Starts the active playback or capture device. By default the playback device is initialized and started, but this can be controlled using the `t.audio.start` flag in `lovr.conf`.",
  1559. key = "lovr.audio.start",
  1560. module = "lovr.audio",
  1561. notes = "Starting an audio device may fail if:\n\n- The device is already started\n- No device was initialized with `lovr.audio.setDevice`\n- Lack of `audiocapture` permission on Android (see `lovr.system.requestPermission`)\n- Some other problem accessing the audio device",
  1562. related = {
  1563. "lovr.audio.getDevices",
  1564. "lovr.audio.setDevice",
  1565. "lovr.audio.stop",
  1566. "lovr.audio.isStarted",
  1567. "lovr.system.requestPermission",
  1568. "lovr.permission"
  1569. },
  1570. variants = {
  1571. {
  1572. arguments = {
  1573. {
  1574. name = "type",
  1575. type = "AudioType",
  1576. description = "The type of device to start.",
  1577. default = "'playback'"
  1578. }
  1579. },
  1580. returns = {
  1581. {
  1582. name = "started",
  1583. type = "boolean",
  1584. description = "Whether the device was successfully started."
  1585. }
  1586. }
  1587. }
  1588. }
  1589. },
  1590. {
  1591. name = "stop",
  1592. tag = "devices",
  1593. summary = "Stop an audio device.",
  1594. description = "Stops the active playback or capture device. This may fail if:\n\n- The device is not started\n- No device was initialized with `lovr.audio.setDevice`",
  1595. key = "lovr.audio.stop",
  1596. module = "lovr.audio",
  1597. notes = "Switching devices with `lovr.audio.setDevice` will stop the existing one.",
  1598. related = {
  1599. "lovr.audio.getDevices",
  1600. "lovr.audio.setDevice",
  1601. "lovr.audio.start",
  1602. "lovr.audio.isStarted"
  1603. },
  1604. variants = {
  1605. {
  1606. arguments = {
  1607. {
  1608. name = "type",
  1609. type = "AudioType",
  1610. description = "The type of device to stop.",
  1611. default = "'playback'"
  1612. }
  1613. },
  1614. returns = {
  1615. {
  1616. name = "stopped",
  1617. type = "boolean",
  1618. description = "Whether the device was successfully stopped."
  1619. }
  1620. }
  1621. }
  1622. }
  1623. }
  1624. },
  1625. enums = {
  1626. {
  1627. name = "AudioMaterial",
  1628. summary = "Different types of audio materials.",
  1629. description = "Different types of audio material presets, for use with `lovr.audio.setGeometry`.",
  1630. key = "AudioMaterial",
  1631. module = "lovr.audio",
  1632. values = {
  1633. {
  1634. name = "generic",
  1635. description = "Generic default audio material."
  1636. },
  1637. {
  1638. name = "brick",
  1639. description = "Brick."
  1640. },
  1641. {
  1642. name = "carpet",
  1643. description = "Carpet."
  1644. },
  1645. {
  1646. name = "ceramic",
  1647. description = "Ceramic."
  1648. },
  1649. {
  1650. name = "concrete",
  1651. description = "Concrete."
  1652. },
  1653. {
  1654. name = "glass",
  1655. descripion = "Glass."
  1656. },
  1657. {
  1658. name = "gravel",
  1659. descripion = "Gravel."
  1660. },
  1661. {
  1662. name = "metal",
  1663. descripion = "Metal."
  1664. },
  1665. {
  1666. name = "plaster",
  1667. descripion = "Plaster."
  1668. },
  1669. {
  1670. name = "rock",
  1671. descripion = "Rock."
  1672. },
  1673. {
  1674. name = "wood",
  1675. descripion = "Wood."
  1676. }
  1677. }
  1678. },
  1679. {
  1680. name = "AudioShareMode",
  1681. summary = "How audio devices are shared on the system.",
  1682. description = "Audio devices can be created in shared mode or exclusive mode. In exclusive mode, the audio device is the only one active on the system, which gives better performance and lower latency. However, exclusive devices aren't always supported and might not be allowed, so there is a higher chance that creating one will fail.",
  1683. key = "AudioShareMode",
  1684. module = "lovr.audio",
  1685. related = {
  1686. "lovr.audio.setDevice"
  1687. },
  1688. values = {
  1689. {
  1690. name = "shared",
  1691. description = "Shared mode."
  1692. },
  1693. {
  1694. name = "exclusive",
  1695. description = "Exclusive mode."
  1696. }
  1697. }
  1698. },
  1699. {
  1700. name = "AudioType",
  1701. summary = "Different types of audio devices",
  1702. description = "When referencing audio devices, this indicates whether it's the playback or capture device.",
  1703. key = "AudioType",
  1704. module = "lovr.audio",
  1705. related = {
  1706. "lovr.audio.getDevices",
  1707. "lovr.audio.setDevice",
  1708. "lovr.audio.start",
  1709. "lovr.audio.stop",
  1710. "lovr.audio.isStarted"
  1711. },
  1712. values = {
  1713. {
  1714. name = "playback",
  1715. description = "The playback device (speakers, headphones)."
  1716. },
  1717. {
  1718. name = "capture",
  1719. description = "The capture device (microphone)."
  1720. }
  1721. }
  1722. },
  1723. {
  1724. name = "Effect",
  1725. summary = "Different types of Source effects.",
  1726. description = "Different types of effects that can be applied with `Source:setEffectEnabled`.",
  1727. key = "Effect",
  1728. module = "lovr.audio",
  1729. values = {
  1730. {
  1731. name = "absorption",
  1732. description = "Models absorption as sound travels through the air, water, etc."
  1733. },
  1734. {
  1735. name = "falloff",
  1736. description = "Decreases audio volume with distance (1 / max(distance, 1))."
  1737. },
  1738. {
  1739. name = "occlusion",
  1740. description = "Causes audio to drop off when the Source is occluded by geometry."
  1741. },
  1742. {
  1743. name = "reverb",
  1744. description = "Models reverb caused by audio bouncing off of geometry."
  1745. },
  1746. {
  1747. name = "spatialization",
  1748. description = "Spatializes the Source using either simple panning or an HRTF."
  1749. },
  1750. {
  1751. name = "transmission",
  1752. description = "Causes audio to be heard through walls when occluded, based on audio materials."
  1753. }
  1754. },
  1755. notes = "The active spatializer will determine which effects are supported. If an unsupported effect is enabled on a Source, no error will be reported. Instead, it will be silently ignored.\n\nTODO: expose a table of supported effects for spatializers in docs or from Lua."
  1756. },
  1757. {
  1758. name = "TimeUnit",
  1759. summary = "Time units for sound samples.",
  1760. description = "When figuring out how long a Source is or seeking to a specific position in the sound file, units can be expressed in terms of seconds or in terms of frames. A frame is one set of samples for each channel (one sample for mono, two samples for stereo).",
  1761. key = "TimeUnit",
  1762. module = "lovr.audio",
  1763. values = {
  1764. {
  1765. name = "seconds",
  1766. description = "Seconds."
  1767. },
  1768. {
  1769. name = "frames",
  1770. description = "Frames."
  1771. }
  1772. }
  1773. },
  1774. {
  1775. name = "VolumeUnit",
  1776. summary = "Different units of volume.",
  1777. description = "When accessing the volume of Sources or the audio listener, this can be done in linear units with a 0 to 1 range, or in decibels with a range of -∞ to 0.",
  1778. key = "VolumeUnit",
  1779. module = "lovr.audio",
  1780. values = {
  1781. {
  1782. name = "linear",
  1783. description = "Linear volume range."
  1784. },
  1785. {
  1786. name = "db",
  1787. description = "Decibels."
  1788. }
  1789. }
  1790. }
  1791. },
  1792. sections = {
  1793. {
  1794. name = "Sources",
  1795. tag = "sources",
  1796. description = "Sources are objects that represent a single sound instance."
  1797. },
  1798. {
  1799. name = "Listener",
  1800. tag = "listener",
  1801. description = "The listener is a virtual object in 3D space that \"hears\" all the sounds that are playing. It can be positioned and oriented in 3D space, which controls how Sources in the world are heard. Usually this would be locked to the headset pose."
  1802. },
  1803. {
  1804. name = "Devices",
  1805. tag = "devices",
  1806. description = "It's possible to list the available audio devices on the system, and pick a specific device to use for either playback or capture. Devices can also be manually started and stopped. Other useful features of `lovr.audio.setDevice` include the ability to stream all audio data to a custom sink and the option to create a device in exclusive mode for higher performance. By default, the default playback device is automatically initialized and started, but this can be configured using `lovr.conf`."
  1807. }
  1808. }
  1809. },
  1810. {
  1811. name = "data",
  1812. tag = "modules",
  1813. summary = "Exposes low level functions for working with data.",
  1814. description = "The `lovr.data` module provides functions for accessing underlying data representations for several LÖVR objects.",
  1815. key = "lovr.data",
  1816. objects = {
  1817. {
  1818. name = "Blob",
  1819. summary = "A chunk of binary data.",
  1820. description = "A Blob is an object that holds binary data. It can be passed to most functions that take filename arguments, like `lovr.graphics.newModel` or `lovr.audio.newSource`. Blobs aren't usually necessary for simple projects, but they can be really helpful if:\n\n- You need to work with low level binary data, potentially using the LuaJIT FFI for increased\n performance.\n- You are working with data that isn't stored as a file, such as programmatically generated data\n or a string from a network request.\n- You want to load data from a file once and then use it to create many different objects.\n\nA Blob's size cannot be changed once it is created.",
  1821. key = "Blob",
  1822. module = "lovr.data",
  1823. constructors = {
  1824. "lovr.data.newBlob",
  1825. "lovr.filesystem.newBlob"
  1826. },
  1827. methods = {
  1828. {
  1829. name = "getName",
  1830. summary = "Get the label of the Blob.",
  1831. description = "Returns the filename the Blob was loaded from, or the custom name given to it when it was created. This label is also used in error messages.",
  1832. key = "Blob:getName",
  1833. module = "lovr.data",
  1834. variants = {
  1835. {
  1836. arguments = {},
  1837. returns = {
  1838. {
  1839. name = "name",
  1840. type = "string",
  1841. description = "The name of the Blob."
  1842. }
  1843. }
  1844. }
  1845. }
  1846. },
  1847. {
  1848. name = "getPointer",
  1849. summary = "Get a raw pointer to the Blob's data.",
  1850. description = "Returns a raw pointer to the Blob's data. This can be used to interface with other C libraries using the LuaJIT FFI. Use this only if you know what you're doing!",
  1851. key = "Blob:getPointer",
  1852. module = "lovr.data",
  1853. variants = {
  1854. {
  1855. arguments = {},
  1856. returns = {
  1857. {
  1858. name = "pointer",
  1859. type = "userdata",
  1860. description = "A pointer to the data."
  1861. }
  1862. }
  1863. }
  1864. }
  1865. },
  1866. {
  1867. name = "getSize",
  1868. summary = "Get the size of the Blob's data.",
  1869. description = "Returns the size of the Blob's contents, in bytes.",
  1870. key = "Blob:getSize",
  1871. module = "lovr.data",
  1872. variants = {
  1873. {
  1874. arguments = {},
  1875. returns = {
  1876. {
  1877. name = "bytes",
  1878. type = "number",
  1879. description = "The size of the Blob, in bytes."
  1880. }
  1881. }
  1882. }
  1883. }
  1884. },
  1885. {
  1886. name = "getString",
  1887. summary = "Get the Blob's contents as a string.",
  1888. description = "Returns a binary string containing the Blob's data.",
  1889. key = "Blob:getString",
  1890. module = "lovr.data",
  1891. variants = {
  1892. {
  1893. arguments = {},
  1894. returns = {
  1895. {
  1896. name = "data",
  1897. type = "string",
  1898. description = "The Blob's data."
  1899. }
  1900. }
  1901. }
  1902. },
  1903. examples = {
  1904. {
  1905. description = "Manually copy a file using Blobs:",
  1906. code = "blob = lovr.filesystem.newBlob('image.png')\nlovr.filesystem.write('copy.png', blob:getString())"
  1907. }
  1908. }
  1909. }
  1910. }
  1911. },
  1912. {
  1913. name = "Image",
  1914. summary = "An object that stores pixel data for Textures.",
  1915. description = "An Image stores raw 2D pixel info for `Texture`s. It has a width, height, and format. The Image can be initialized with the contents of an image file or it can be created with uninitialized contents. The supported image formats are `png`, `jpg`, `hdr`, `dds`, `ktx`, and `astc`.\n\nUsually you can just use Textures, but Image can be useful if you want to manipulate individual pixels, load Textures in a background thread, or use the FFI to efficiently access the raw image data.",
  1916. key = "Image",
  1917. module = "lovr.data",
  1918. constructors = {
  1919. "lovr.data.newImage"
  1920. },
  1921. methods = {
  1922. {
  1923. name = "encode",
  1924. summary = "Encode the Image as png.",
  1925. description = "Encodes the Image to an uncompressed png. This intended mainly for debugging.",
  1926. key = "Image:encode",
  1927. module = "lovr.data",
  1928. related = {
  1929. "lovr.filesystem.write"
  1930. },
  1931. variants = {
  1932. {
  1933. arguments = {},
  1934. returns = {
  1935. {
  1936. name = "blob",
  1937. type = "Blob",
  1938. description = "A new Blob containing the PNG image data."
  1939. }
  1940. }
  1941. }
  1942. }
  1943. },
  1944. {
  1945. name = "getBlob",
  1946. summary = "Get the bytes backing this Image as a `Blob`.",
  1947. description = "Returns a Blob containing the raw bytes of the Image.",
  1948. key = "Image:getBlob",
  1949. module = "lovr.data",
  1950. related = {
  1951. "Blob:getPointer",
  1952. "Sound:getBlob"
  1953. },
  1954. variants = {
  1955. {
  1956. arguments = {},
  1957. returns = {
  1958. {
  1959. name = "blob",
  1960. type = "Blob",
  1961. description = "The Blob instance containing the bytes for the `Image`."
  1962. }
  1963. }
  1964. }
  1965. }
  1966. },
  1967. {
  1968. name = "getDimensions",
  1969. summary = "Get the dimensions of the Image.",
  1970. description = "Returns the dimensions of the Image, in pixels.",
  1971. key = "Image:getDimensions",
  1972. module = "lovr.data",
  1973. related = {
  1974. "Image:getWidth",
  1975. "Image:getHeight",
  1976. "Texture:getDimensions"
  1977. },
  1978. variants = {
  1979. {
  1980. arguments = {},
  1981. returns = {
  1982. {
  1983. name = "width",
  1984. type = "number",
  1985. description = "The width of the Image, in pixels."
  1986. },
  1987. {
  1988. name = "height",
  1989. type = "number",
  1990. description = "The height of the Image, in pixels."
  1991. }
  1992. }
  1993. }
  1994. }
  1995. },
  1996. {
  1997. name = "getFormat",
  1998. summary = "Get the pixel format of the Image.",
  1999. description = "Returns the format of the Image.",
  2000. key = "Image:getFormat",
  2001. module = "lovr.data",
  2002. related = {
  2003. "TextureFormat",
  2004. "Texture:getFormat"
  2005. },
  2006. variants = {
  2007. {
  2008. arguments = {},
  2009. returns = {
  2010. {
  2011. name = "format",
  2012. type = "TextureFormat",
  2013. description = "The format of the pixels in the Image."
  2014. }
  2015. }
  2016. }
  2017. }
  2018. },
  2019. {
  2020. name = "getHeight",
  2021. summary = "Get the height of the Image.",
  2022. description = "Returns the height of the Image, in pixels.",
  2023. key = "Image:getHeight",
  2024. module = "lovr.data",
  2025. related = {
  2026. "Image:getWidth",
  2027. "Image:getDimensions",
  2028. "Texture:getHeight"
  2029. },
  2030. variants = {
  2031. {
  2032. arguments = {},
  2033. returns = {
  2034. {
  2035. name = "height",
  2036. type = "number",
  2037. description = "The height of the Image, in pixels."
  2038. }
  2039. }
  2040. }
  2041. }
  2042. },
  2043. {
  2044. name = "getPixel",
  2045. summary = "Get the value of a pixel of the Image.",
  2046. description = "Returns the value of a pixel of the Image.",
  2047. key = "Image:getPixel",
  2048. module = "lovr.data",
  2049. notes = "The following texture formats are supported: `rgba`, `rgb`, `r32f`, `rg32f`, and `rgba32f`.",
  2050. variants = {
  2051. {
  2052. arguments = {
  2053. {
  2054. name = "x",
  2055. type = "number",
  2056. description = "The x coordinate of the pixel to get (0-indexed)."
  2057. },
  2058. {
  2059. name = "y",
  2060. type = "number",
  2061. description = "The y coordinate of the pixel to get (0-indexed)."
  2062. }
  2063. },
  2064. returns = {
  2065. {
  2066. name = "r",
  2067. type = "number",
  2068. description = "The red component of the pixel, from 0.0 to 1.0."
  2069. },
  2070. {
  2071. name = "g",
  2072. type = "number",
  2073. description = "The green component of the pixel, from 0.0 to 1.0."
  2074. },
  2075. {
  2076. name = "b",
  2077. type = "number",
  2078. description = "The blue component of the pixel, from 0.0 to 1.0."
  2079. },
  2080. {
  2081. name = "a",
  2082. type = "number",
  2083. description = "The alpha component of the pixel, from 0.0 to 1.0."
  2084. }
  2085. }
  2086. }
  2087. },
  2088. related = {
  2089. "Image:setPixel",
  2090. "Texture:replacePixels",
  2091. "TextureFormat"
  2092. }
  2093. },
  2094. {
  2095. name = "getWidth",
  2096. summary = "Get the width of the Image.",
  2097. description = "Returns the width of the Image, in pixels.",
  2098. key = "Image:getWidth",
  2099. module = "lovr.data",
  2100. related = {
  2101. "Image:getHeight",
  2102. "Image:getDimensions",
  2103. "Texture:getWidth"
  2104. },
  2105. variants = {
  2106. {
  2107. arguments = {},
  2108. returns = {
  2109. {
  2110. name = "width",
  2111. type = "number",
  2112. description = "The width of the Image, in pixels."
  2113. }
  2114. }
  2115. }
  2116. }
  2117. },
  2118. {
  2119. name = "paste",
  2120. summary = "Copy pixels from another Image to this one.",
  2121. description = "Copies a rectangle of pixels from one Image to this one.",
  2122. key = "Image:paste",
  2123. module = "lovr.data",
  2124. notes = "The two Images must have the same pixel format.\n\nCompressed images cannot be copied.\n\nThe rectangle cannot go outside the dimensions of the source or destination textures.",
  2125. variants = {
  2126. {
  2127. arguments = {
  2128. {
  2129. name = "source",
  2130. type = "Image",
  2131. description = "The Image to copy pixels from."
  2132. },
  2133. {
  2134. name = "x",
  2135. type = "number",
  2136. description = "The x coordinate to paste to (0-indexed).",
  2137. default = "0"
  2138. },
  2139. {
  2140. name = "y",
  2141. type = "number",
  2142. description = "The y coordinate to paste to (0-indexed).",
  2143. default = "0"
  2144. },
  2145. {
  2146. name = "fromX",
  2147. type = "number",
  2148. description = "The x coordinate in the source to paste from (0-indexed).",
  2149. default = "0"
  2150. },
  2151. {
  2152. name = "fromY",
  2153. type = "number",
  2154. description = "The y coordinate in the source to paste from (0-indexed).",
  2155. default = "0"
  2156. },
  2157. {
  2158. name = "width",
  2159. type = "number",
  2160. description = "The width of the region to copy.",
  2161. default = "source:getWidth()"
  2162. },
  2163. {
  2164. name = "height",
  2165. type = "number",
  2166. description = "The height of the region to copy.",
  2167. default = "source:getHeight()"
  2168. }
  2169. },
  2170. returns = {}
  2171. }
  2172. },
  2173. related = {
  2174. "Texture:replacePixels",
  2175. "Image:getPixel",
  2176. "Image:setPixel"
  2177. }
  2178. },
  2179. {
  2180. name = "setPixel",
  2181. summary = "Set the value of a pixel of the Image.",
  2182. description = "Sets the value of a pixel of the Image.",
  2183. key = "Image:setPixel",
  2184. module = "lovr.data",
  2185. notes = "The following texture formats are supported: `rgba`, `rgb`, `r32f`, `rg32f`, and `rgba32f`.",
  2186. variants = {
  2187. {
  2188. arguments = {
  2189. {
  2190. name = "x",
  2191. type = "number",
  2192. description = "The x coordinate of the pixel to set (0-indexed)."
  2193. },
  2194. {
  2195. name = "y",
  2196. type = "number",
  2197. description = "The y coordinate of the pixel to set (0-indexed)."
  2198. },
  2199. {
  2200. name = "r",
  2201. type = "number",
  2202. description = "The red component of the pixel, from 0.0 to 1.0."
  2203. },
  2204. {
  2205. name = "g",
  2206. type = "number",
  2207. description = "The green component of the pixel, from 0.0 to 1.0."
  2208. },
  2209. {
  2210. name = "b",
  2211. type = "number",
  2212. description = "The blue component of the pixel, from 0.0 to 1.0."
  2213. },
  2214. {
  2215. name = "a",
  2216. type = "number",
  2217. description = "The alpha component of the pixel, from 0.0 to 1.0.",
  2218. default = "1.0"
  2219. }
  2220. },
  2221. returns = {}
  2222. }
  2223. },
  2224. related = {
  2225. "Image:getPixel",
  2226. "Texture:replacePixels",
  2227. "TextureFormat"
  2228. }
  2229. }
  2230. }
  2231. },
  2232. {
  2233. name = "ModelData",
  2234. summary = "An object that loads and stores data for 3D models.",
  2235. description = "A ModelData is a container object that loads and holds data contained in 3D model files. This can include a variety of things like the node structure of the asset, the vertex data it contains, contains, the `Image` and `Material` properties, and any included animations.\n\nThe current supported formats are OBJ, glTF, and STL.\n\nUsually you can just load a `Model` directly, but using a `ModelData` can be helpful if you want to load models in a thread or access more low-level information about the Model.",
  2236. key = "ModelData",
  2237. module = "lovr.data",
  2238. constructors = {
  2239. "lovr.data.newModelData"
  2240. },
  2241. methods = {
  2242. {
  2243. name = "getAnimationChannelCount",
  2244. summary = "Get the number of channels in an animation.",
  2245. description = "Returns the number of channels in an animation.\n\nA channel is a set of keyframes for a single property of a node.",
  2246. key = "ModelData:getAnimationChannelCount",
  2247. module = "lovr.data",
  2248. related = {
  2249. "ModelData:getAnimationNode",
  2250. "ModelData:getAnimationProperty"
  2251. },
  2252. variants = {
  2253. {
  2254. arguments = {
  2255. {
  2256. name = "index",
  2257. type = "number",
  2258. description = "The index of an animation."
  2259. }
  2260. },
  2261. returns = {
  2262. {
  2263. name = "count",
  2264. type = "number",
  2265. description = "The number of channels in the animation."
  2266. }
  2267. }
  2268. },
  2269. {
  2270. arguments = {
  2271. {
  2272. name = "name",
  2273. type = "string",
  2274. description = "The name of an animation."
  2275. }
  2276. },
  2277. returns = {
  2278. {
  2279. name = "count",
  2280. type = "number",
  2281. description = "The number of channels in the animation."
  2282. }
  2283. }
  2284. }
  2285. }
  2286. },
  2287. {
  2288. name = "getAnimationCount",
  2289. summary = "Get the number of animations in the model.",
  2290. description = "Returns the number of animations in the model.",
  2291. key = "ModelData:getAnimationCount",
  2292. module = "lovr.data",
  2293. related = {
  2294. "Model:getAnimationCount"
  2295. },
  2296. variants = {
  2297. {
  2298. arguments = {},
  2299. returns = {
  2300. {
  2301. name = "count",
  2302. type = "number",
  2303. description = "The number of animations in the model."
  2304. }
  2305. }
  2306. }
  2307. }
  2308. },
  2309. {
  2310. name = "getAnimationDuration",
  2311. summary = "Get the duration of an animation.",
  2312. description = "Returns the duration of an animation.",
  2313. key = "ModelData:getAnimationDuration",
  2314. module = "lovr.data",
  2315. notes = "The duration of the animation is calculated as the latest timestamp of all of its channels.",
  2316. variants = {
  2317. {
  2318. arguments = {
  2319. {
  2320. name = "index",
  2321. type = "number",
  2322. description = "The index of the animation."
  2323. }
  2324. },
  2325. returns = {
  2326. {
  2327. name = "duration",
  2328. type = "number",
  2329. description = "The duration of the animation, in seconds."
  2330. }
  2331. }
  2332. },
  2333. {
  2334. arguments = {
  2335. {
  2336. name = "name",
  2337. type = "string",
  2338. description = "The name of the animation."
  2339. }
  2340. },
  2341. returns = {
  2342. {
  2343. name = "duration",
  2344. type = "number",
  2345. description = "The duration of the animation, in seconds."
  2346. }
  2347. }
  2348. }
  2349. },
  2350. related = {
  2351. "Model:getAnimationDuration"
  2352. }
  2353. },
  2354. {
  2355. name = "getAnimationKeyframe",
  2356. summary = "Get a keyframe in a channel of an animation.",
  2357. description = "Returns a single keyframe in a channel of an animation.",
  2358. key = "ModelData:getAnimationKeyframe",
  2359. module = "lovr.data",
  2360. related = {
  2361. "ModelData:getAnimationSmoothMode",
  2362. "ModelData:getAnimationKeyframeCount"
  2363. },
  2364. variants = {
  2365. {
  2366. arguments = {
  2367. {
  2368. name = "index",
  2369. type = "number",
  2370. description = "The index of an animation."
  2371. },
  2372. {
  2373. name = "channel",
  2374. type = "number",
  2375. description = "The index of a channel in the animation."
  2376. },
  2377. {
  2378. name = "keyframe",
  2379. type = "number",
  2380. description = "The index of a keyframe in the channel."
  2381. }
  2382. },
  2383. returns = {
  2384. {
  2385. name = "time",
  2386. type = "number",
  2387. description = "The timestamp of the keyframe."
  2388. },
  2389. {
  2390. name = "...",
  2391. type = "number",
  2392. description = "The data for the keyframe (either 3 or 4 numbers depending on the property)."
  2393. }
  2394. }
  2395. },
  2396. {
  2397. arguments = {
  2398. {
  2399. name = "name",
  2400. type = "string",
  2401. description = "The name of an animation."
  2402. },
  2403. {
  2404. name = "channel",
  2405. type = "number",
  2406. description = "The index of a channel in the animation."
  2407. },
  2408. {
  2409. name = "keyframe",
  2410. type = "number",
  2411. description = "The index of a keyframe in the channel."
  2412. }
  2413. },
  2414. returns = {
  2415. {
  2416. name = "time",
  2417. type = "number",
  2418. description = "The timestamp of the keyframe."
  2419. },
  2420. {
  2421. name = "...",
  2422. type = "number",
  2423. description = "The data for the keyframe (either 3 or 4 numbers depending on the property)."
  2424. }
  2425. }
  2426. }
  2427. }
  2428. },
  2429. {
  2430. name = "getAnimationKeyframeCount",
  2431. summary = "Get the number of keyframes in a channel of an animation.",
  2432. description = "Returns the number of keyframes in a channel of an animation.",
  2433. key = "ModelData:getAnimationKeyframeCount",
  2434. module = "lovr.data",
  2435. related = {
  2436. "ModelData:getAnimationSmoothMode",
  2437. "ModelData:getAnimationKeyframe"
  2438. },
  2439. variants = {
  2440. {
  2441. arguments = {
  2442. {
  2443. name = "index",
  2444. type = "number",
  2445. description = "The index of an animation."
  2446. },
  2447. {
  2448. name = "channel",
  2449. type = "number",
  2450. description = "The index of a channel in the animation."
  2451. }
  2452. },
  2453. returns = {
  2454. {
  2455. name = "count",
  2456. type = "number",
  2457. description = "The number of keyframes in the channel."
  2458. }
  2459. }
  2460. },
  2461. {
  2462. arguments = {
  2463. {
  2464. name = "name",
  2465. type = "string",
  2466. description = "The name of an animation."
  2467. },
  2468. {
  2469. name = "channel",
  2470. type = "number",
  2471. description = "The index of a channel in the animation."
  2472. }
  2473. },
  2474. returns = {
  2475. {
  2476. name = "count",
  2477. type = "number",
  2478. description = "The number of keyframes in the channel."
  2479. }
  2480. }
  2481. }
  2482. }
  2483. },
  2484. {
  2485. name = "getAnimationName",
  2486. summary = "Get the name of an animation.",
  2487. description = "Returns the name of an animation.",
  2488. key = "ModelData:getAnimationName",
  2489. module = "lovr.data",
  2490. notes = "If the animation does not have a name, this function returns `nil`.",
  2491. variants = {
  2492. {
  2493. arguments = {
  2494. {
  2495. name = "index",
  2496. type = "number",
  2497. description = "The index of the animation."
  2498. }
  2499. },
  2500. returns = {
  2501. {
  2502. name = "name",
  2503. type = "string",
  2504. description = "The name of the animation."
  2505. }
  2506. }
  2507. }
  2508. },
  2509. related = {
  2510. "Model:getAnimationName"
  2511. }
  2512. },
  2513. {
  2514. name = "getAnimationNode",
  2515. summary = "Get the node targeted by the channel of an animation.",
  2516. description = "Returns the index of a node targeted by an animation's channel.",
  2517. key = "ModelData:getAnimationNode",
  2518. module = "lovr.data",
  2519. related = {
  2520. "ModelData:getAnimationNode",
  2521. "ModelData:getAnimationProperty"
  2522. },
  2523. variants = {
  2524. {
  2525. arguments = {
  2526. {
  2527. name = "index",
  2528. type = "number",
  2529. description = "The index of an animation."
  2530. },
  2531. {
  2532. name = "channel",
  2533. type = "number",
  2534. description = "The index of a channel in the animation."
  2535. }
  2536. },
  2537. returns = {
  2538. {
  2539. name = "node",
  2540. type = "number",
  2541. description = "The index of the node targeted by the channel."
  2542. }
  2543. }
  2544. },
  2545. {
  2546. arguments = {
  2547. {
  2548. name = "name",
  2549. type = "string",
  2550. description = "The name of an animation."
  2551. },
  2552. {
  2553. name = "channel",
  2554. type = "number",
  2555. description = "The index of a channel in the animation."
  2556. }
  2557. },
  2558. returns = {
  2559. {
  2560. name = "node",
  2561. type = "number",
  2562. description = "The index of the node targeted by the channel."
  2563. }
  2564. }
  2565. }
  2566. }
  2567. },
  2568. {
  2569. name = "getAnimationProperty",
  2570. summary = "Get the property targeted by the channel of an animation.",
  2571. description = "Returns the property targeted by an animation's channel.",
  2572. key = "ModelData:getAnimationProperty",
  2573. module = "lovr.data",
  2574. related = {
  2575. "ModelData:getAnimationNode",
  2576. "ModelData:getAnimationProperty",
  2577. "ModelData:getAnimationSmoothMode"
  2578. },
  2579. variants = {
  2580. {
  2581. arguments = {
  2582. {
  2583. name = "index",
  2584. type = "number",
  2585. description = "The index of an animation."
  2586. },
  2587. {
  2588. name = "channel",
  2589. type = "number",
  2590. description = "The index of a channel in the animation."
  2591. }
  2592. },
  2593. returns = {
  2594. {
  2595. name = "property",
  2596. type = "AnimationProperty",
  2597. description = "The property (translation, rotation, scale) affected by the keyframes."
  2598. }
  2599. }
  2600. },
  2601. {
  2602. arguments = {
  2603. {
  2604. name = "name",
  2605. type = "string",
  2606. description = "The name of an animation."
  2607. },
  2608. {
  2609. name = "channel",
  2610. type = "number",
  2611. description = "The index of a channel in the animation."
  2612. }
  2613. },
  2614. returns = {
  2615. {
  2616. name = "property",
  2617. type = "AnimationProperty",
  2618. description = "The property (translation, rotation, scale) affected by the keyframes."
  2619. }
  2620. }
  2621. }
  2622. }
  2623. },
  2624. {
  2625. name = "getAnimationSmoothMode",
  2626. summary = "Get the smooth mode of a channel in an animation.",
  2627. description = "Returns the smooth mode of a channel in an animation.",
  2628. key = "ModelData:getAnimationSmoothMode",
  2629. module = "lovr.data",
  2630. related = {
  2631. "ModelData:getAnimationNode",
  2632. "ModelData:getAnimationProperty"
  2633. },
  2634. variants = {
  2635. {
  2636. arguments = {
  2637. {
  2638. name = "index",
  2639. type = "number",
  2640. description = "The index of an animation."
  2641. },
  2642. {
  2643. name = "channel",
  2644. type = "number",
  2645. description = "The index of a channel in the animation."
  2646. }
  2647. },
  2648. returns = {
  2649. {
  2650. name = "smooth",
  2651. type = "SmoothMode",
  2652. description = "The smooth mode of the keyframes."
  2653. }
  2654. }
  2655. },
  2656. {
  2657. arguments = {
  2658. {
  2659. name = "name",
  2660. type = "string",
  2661. description = "The name of an animation."
  2662. },
  2663. {
  2664. name = "channel",
  2665. type = "number",
  2666. description = "The index of a channel in the animation."
  2667. }
  2668. },
  2669. returns = {
  2670. {
  2671. name = "smooth",
  2672. type = "SmoothMode",
  2673. description = "The smooth mode of the keyframes."
  2674. }
  2675. }
  2676. }
  2677. }
  2678. },
  2679. {
  2680. name = "getBlob",
  2681. summary = "Get a Blob in the model.",
  2682. description = "Returns one of the Blobs in the model, by index.",
  2683. key = "ModelData:getBlob",
  2684. module = "lovr.data",
  2685. related = {
  2686. "ModelData:getBlobCount",
  2687. "ModelData:getImage"
  2688. },
  2689. variants = {
  2690. {
  2691. arguments = {
  2692. {
  2693. name = "index",
  2694. type = "number",
  2695. description = "The index of the Blob to get."
  2696. }
  2697. },
  2698. returns = {
  2699. {
  2700. name = "blob",
  2701. type = "Blob",
  2702. description = "The Blob object."
  2703. }
  2704. }
  2705. }
  2706. }
  2707. },
  2708. {
  2709. name = "getBlobCount",
  2710. summary = "Get the number of Blobs stored in the model.",
  2711. description = "Returns the number of Blobs in the model.",
  2712. key = "ModelData:getBlobCount",
  2713. module = "lovr.data",
  2714. related = {
  2715. "ModelData:getBlob",
  2716. "ModelData:getImageCount"
  2717. },
  2718. variants = {
  2719. {
  2720. arguments = {},
  2721. returns = {
  2722. {
  2723. name = "count",
  2724. type = "number",
  2725. description = "The number of Blobs in the model."
  2726. }
  2727. }
  2728. }
  2729. }
  2730. },
  2731. {
  2732. name = "getBoundingBox",
  2733. summary = "Get the bounding box of the model.",
  2734. description = "Returns the 6 values of the model's axis-aligned bounding box.",
  2735. key = "ModelData:getBoundingBox",
  2736. module = "lovr.data",
  2737. related = {
  2738. "ModelData:getWidth",
  2739. "ModelData:getHeight",
  2740. "ModelData:getDepth",
  2741. "ModelData:getDimensions",
  2742. "ModelData:getCenter",
  2743. "ModelData:getBoundingSphere",
  2744. "Model:getBoundingBox"
  2745. },
  2746. variants = {
  2747. {
  2748. arguments = {},
  2749. returns = {
  2750. {
  2751. name = "minx",
  2752. type = "number",
  2753. description = "The minimum x coordinate of the vertices in the model."
  2754. },
  2755. {
  2756. name = "maxx",
  2757. type = "number",
  2758. description = "The maximum x coordinate of the vertices in the model."
  2759. },
  2760. {
  2761. name = "miny",
  2762. type = "number",
  2763. description = "The minimum y coordinate of the vertices in the model."
  2764. },
  2765. {
  2766. name = "maxy",
  2767. type = "number",
  2768. description = "The maximum y coordinate of the vertices in the model."
  2769. },
  2770. {
  2771. name = "minz",
  2772. type = "number",
  2773. description = "The minimum z coordinate of the vertices in the model."
  2774. },
  2775. {
  2776. name = "maxz",
  2777. type = "number",
  2778. description = "The maximum z coordinate of the vertices in the model."
  2779. }
  2780. }
  2781. }
  2782. }
  2783. },
  2784. {
  2785. name = "getBoundingSphere",
  2786. summary = "Get the bounding sphere of the model.",
  2787. description = "Returns a sphere approximately enclosing the vertices in the model.",
  2788. key = "ModelData:getBoundingSphere",
  2789. module = "lovr.data",
  2790. related = {
  2791. "ModelData:getWidth",
  2792. "ModelData:getHeight",
  2793. "ModelData:getDepth",
  2794. "ModelData:getDimensions",
  2795. "ModelData:getCenter",
  2796. "ModelData:getBoundingBox",
  2797. "Model:getBoundingSphere"
  2798. },
  2799. variants = {
  2800. {
  2801. arguments = {},
  2802. returns = {
  2803. {
  2804. name = "x",
  2805. type = "number",
  2806. description = "The x coordinate of the position of the sphere."
  2807. },
  2808. {
  2809. name = "y",
  2810. type = "number",
  2811. description = "The y coordinate of the position of the sphere."
  2812. },
  2813. {
  2814. name = "z",
  2815. type = "number",
  2816. description = "The z coordinate of the position of the sphere."
  2817. },
  2818. {
  2819. name = "radius",
  2820. type = "number",
  2821. description = "The radius of the bounding sphere."
  2822. }
  2823. }
  2824. }
  2825. }
  2826. },
  2827. {
  2828. name = "getCenter",
  2829. summary = "Get the center of the model's bounding box.",
  2830. description = "Returns the center of the model's axis-aligned bounding box, relative to the model's origin.",
  2831. key = "ModelData:getCenter",
  2832. module = "lovr.data",
  2833. related = {
  2834. "ModelData:getWidth",
  2835. "ModelData:getHeight",
  2836. "ModelData:getDepth",
  2837. "ModelData:getDimensions",
  2838. "ModelData:getBoundingBox",
  2839. "Model:getCenter"
  2840. },
  2841. variants = {
  2842. {
  2843. arguments = {},
  2844. returns = {
  2845. {
  2846. name = "x",
  2847. type = "number",
  2848. description = "The x offset of the center of the bounding box."
  2849. },
  2850. {
  2851. name = "y",
  2852. type = "number",
  2853. description = "The y offset of the center of the bounding box."
  2854. },
  2855. {
  2856. name = "z",
  2857. type = "number",
  2858. description = "The z offset of the center of the bounding box."
  2859. }
  2860. }
  2861. }
  2862. }
  2863. },
  2864. {
  2865. name = "getDepth",
  2866. summary = "Get the depth of the model.",
  2867. description = "Returns the depth of the model, computed from its axis-aligned bounding box.",
  2868. key = "ModelData:getDepth",
  2869. module = "lovr.data",
  2870. related = {
  2871. "ModelData:getWidth",
  2872. "ModelData:getHeight",
  2873. "ModelData:getDimensions",
  2874. "ModelData:getCenter",
  2875. "ModelData:getBoundingBox",
  2876. "Model:getDepth"
  2877. },
  2878. variants = {
  2879. {
  2880. arguments = {},
  2881. returns = {
  2882. {
  2883. name = "depth",
  2884. type = "number",
  2885. description = "The depth of the model."
  2886. }
  2887. }
  2888. }
  2889. }
  2890. },
  2891. {
  2892. name = "getDimensions",
  2893. summary = "Get the dimensions of the model.",
  2894. description = "Returns the width, height, and depth of the model, computed from its axis-aligned bounding box.",
  2895. key = "ModelData:getDimensions",
  2896. module = "lovr.data",
  2897. related = {
  2898. "ModelData:getWidth",
  2899. "ModelData:getHeight",
  2900. "ModelData:getDepth",
  2901. "ModelData:getCenter",
  2902. "ModelData:getBoundingBox",
  2903. "Model:getDimensions"
  2904. },
  2905. variants = {
  2906. {
  2907. arguments = {},
  2908. returns = {
  2909. {
  2910. name = "width",
  2911. type = "number",
  2912. description = "The width of the model."
  2913. },
  2914. {
  2915. name = "height",
  2916. type = "number",
  2917. description = "The height of the model."
  2918. },
  2919. {
  2920. name = "depth",
  2921. type = "number",
  2922. description = "The depth of the model."
  2923. }
  2924. }
  2925. }
  2926. }
  2927. },
  2928. {
  2929. name = "getHeight",
  2930. summary = "Get the height of the model.",
  2931. description = "Returns the height of the model, computed from its axis-aligned bounding box.",
  2932. key = "ModelData:getHeight",
  2933. module = "lovr.data",
  2934. related = {
  2935. "ModelData:getWidth",
  2936. "ModelData:getDepth",
  2937. "ModelData:getDimensions",
  2938. "ModelData:getCenter",
  2939. "ModelData:getBoundingBox",
  2940. "Model:getHeight"
  2941. },
  2942. variants = {
  2943. {
  2944. arguments = {},
  2945. returns = {
  2946. {
  2947. name = "height",
  2948. type = "number",
  2949. description = "The height of the model."
  2950. }
  2951. }
  2952. }
  2953. }
  2954. },
  2955. {
  2956. name = "getImage",
  2957. summary = "Get an Image in the model.",
  2958. description = "Returns one of the Images in the model, by index.",
  2959. key = "ModelData:getImage",
  2960. module = "lovr.data",
  2961. related = {
  2962. "ModelData:getImageCount",
  2963. "ModelData:getBlob"
  2964. },
  2965. variants = {
  2966. {
  2967. arguments = {
  2968. {
  2969. name = "index",
  2970. type = "number",
  2971. description = "The index of the Image to get."
  2972. }
  2973. },
  2974. returns = {
  2975. {
  2976. name = "image",
  2977. type = "Image",
  2978. description = "The Image object."
  2979. }
  2980. }
  2981. }
  2982. }
  2983. },
  2984. {
  2985. name = "getImageCount",
  2986. summary = "Get the number of Images stored in the model.",
  2987. description = "Returns the number of Images in the model.",
  2988. key = "ModelData:getImageCount",
  2989. module = "lovr.data",
  2990. related = {
  2991. "ModelData:getImage",
  2992. "ModelData:getBlobCount"
  2993. },
  2994. variants = {
  2995. {
  2996. arguments = {},
  2997. returns = {
  2998. {
  2999. name = "count",
  3000. type = "number",
  3001. description = "The number of Images in the model."
  3002. }
  3003. }
  3004. }
  3005. }
  3006. },
  3007. {
  3008. name = "getMaterial",
  3009. summary = "Get the material properties for a material in the model.",
  3010. description = "Returns a table with all of the properties of a material.",
  3011. key = "ModelData:getMaterial",
  3012. module = "lovr.data",
  3013. notes = "All images are optional and may be `nil`.",
  3014. variants = {
  3015. {
  3016. arguments = {
  3017. {
  3018. name = "index",
  3019. type = "number",
  3020. description = "The index of a material."
  3021. }
  3022. },
  3023. returns = {
  3024. {
  3025. name = "properties",
  3026. type = "table",
  3027. description = "The material properties.",
  3028. table = {
  3029. {
  3030. name = "color",
  3031. type = "table",
  3032. description = "The color of the material. The table contains the `r`, `g`, `b`, and `a` components of the color, from 0 to 1."
  3033. },
  3034. {
  3035. name = "glow",
  3036. type = "table",
  3037. description = "The glow color of the material (sometimes called emissive). The table contains the `r`, `g`, and `b` components of the color from 0 to 1, and a fourth number indicating the strength of the glow."
  3038. },
  3039. {
  3040. name = "uvShift",
  3041. type = "table",
  3042. description = "A table with 2 numbers indicating an offset to apply to UVs."
  3043. },
  3044. {
  3045. name = "uvScale",
  3046. type = "table",
  3047. description = "A table with 2 numbers indicating a scale to apply to UVs. By default, shaders apply the UV scale before the UV offset."
  3048. },
  3049. {
  3050. name = "metalness",
  3051. type = "number",
  3052. description = "The metalness parameter of the material. This is typically 0 or 1. By default, shaders multiply this property with the value from the metalness texture (when present) to get the final metalness used for shading."
  3053. },
  3054. {
  3055. name = "roughness",
  3056. type = "number",
  3057. description = "The roughness parameter of the material. By default, shaders multiply this property with the value from the roughness texture (when present) to get the final roughness used for shading."
  3058. },
  3059. {
  3060. name = "clearcoat",
  3061. type = "number",
  3062. description = "The clearcoat parameter of the material."
  3063. },
  3064. {
  3065. name = "clearcoatRoughness",
  3066. type = "number",
  3067. description = "The roughness of the clearcoat layer."
  3068. },
  3069. {
  3070. name = "occlusionStrength",
  3071. type = "number",
  3072. description = "A number multiplied by the value from the ambient occlusion texture to control how strong the occlusion effect is."
  3073. },
  3074. {
  3075. name = "normalScale",
  3076. type = "number",
  3077. description = "A number multiplied by the value from the normal texture to control how strong the normal mapping effect is."
  3078. },
  3079. {
  3080. name = "alphaCutoff",
  3081. type = "number",
  3082. description = "If a pixel has an alpha value less than the alpha cutoff, it will be discarded, which prevents it from occluding things behind it. This is sometimes called \"holepunch\" or \"cutout\" alpha. It's useful for textures with transparency."
  3083. },
  3084. {
  3085. name = "texture",
  3086. type = "number",
  3087. description = "The index of the Image used for the color texture."
  3088. },
  3089. {
  3090. name = "glowTexture",
  3091. type = "number",
  3092. description = "The index of the Image used for the glow texture."
  3093. },
  3094. {
  3095. name = "occlusionTexture",
  3096. type = "number",
  3097. description = "The index of the Image used for the ambient occlusion texture. The red channel of the texture is used for ambient occlusion, allowing multiple parameters to use the same texture."
  3098. },
  3099. {
  3100. name = "metalnessTexture",
  3101. type = "number",
  3102. description = "The index of the Image used for the metalness texture. The blue channel of the texture is used for metalness, allowing multiple parameters to use the same texture."
  3103. },
  3104. {
  3105. name = "roughnessTexture",
  3106. type = "number",
  3107. description = "The index of the Image to use for the roughness texture. The green channel of the texture is used for roughness, allowing multiple parameters to use the same texture."
  3108. },
  3109. {
  3110. name = "clearcoatTexture",
  3111. type = "number",
  3112. description = "The index of the Image to use for the clearcoat texture. The red channel of the texture is used for the clearcoat parameter, allowing multiple parameters to use the same texture."
  3113. },
  3114. {
  3115. name = "normalTexture",
  3116. type = "number",
  3117. description = "The index of the Image to use for the normal map."
  3118. }
  3119. }
  3120. }
  3121. }
  3122. },
  3123. {
  3124. arguments = {
  3125. {
  3126. name = "name",
  3127. type = "string",
  3128. description = "The name of a material."
  3129. }
  3130. },
  3131. returns = {
  3132. {
  3133. name = "properties",
  3134. type = "table",
  3135. description = "The material properties.",
  3136. table = {
  3137. {
  3138. name = "color",
  3139. type = "table",
  3140. description = "The color of the material. The table contains the `r`, `g`, `b`, and `a` components of the color, from 0 to 1."
  3141. },
  3142. {
  3143. name = "glow",
  3144. type = "table",
  3145. description = "The glow color of the material (sometimes called emissive). The table contains the `r`, `g`, and `b` components of the color from 0 to 1, and a fourth number indicating the strength of the glow."
  3146. },
  3147. {
  3148. name = "uvShift",
  3149. type = "table",
  3150. description = "A table with 2 numbers indicating an offset to apply to UVs."
  3151. },
  3152. {
  3153. name = "uvScale",
  3154. type = "table",
  3155. description = "A table with 2 numbers indicating a scale to apply to UVs. By default, shaders apply the UV scale before the UV offset."
  3156. },
  3157. {
  3158. name = "metalness",
  3159. type = "number",
  3160. description = "The metalness parameter of the material. This is typically 0 or 1. By default, shaders multiply this property with the value from the metalness texture (when present) to get the final metalness used for shading."
  3161. },
  3162. {
  3163. name = "roughness",
  3164. type = "number",
  3165. description = "The roughness parameter of the material. By default, shaders multiply this property with the value from the roughness texture (when present) to get the final roughness used for shading."
  3166. },
  3167. {
  3168. name = "clearcoat",
  3169. type = "number",
  3170. description = "The clearcoat parameter of the material."
  3171. },
  3172. {
  3173. name = "clearcoatRoughness",
  3174. type = "number",
  3175. description = "The roughness of the clearcoat layer."
  3176. },
  3177. {
  3178. name = "occlusionStrength",
  3179. type = "number",
  3180. description = "A number multiplied by the value from the ambient occlusion texture to control how strong the occlusion effect is."
  3181. },
  3182. {
  3183. name = "normalScale",
  3184. type = "number",
  3185. description = "A number multiplied by the value from the normal texture to control how strong the normal mapping effect is."
  3186. },
  3187. {
  3188. name = "alphaCutoff",
  3189. type = "number",
  3190. description = "If a pixel has an alpha value less than the alpha cutoff, it will be discarded, which prevents it from occluding things behind it. This is sometimes called \"holepunch\" or \"cutout\" alpha. It's useful for textures with transparency."
  3191. },
  3192. {
  3193. name = "texture",
  3194. type = "number",
  3195. description = "The index of the Image used for the color texture."
  3196. },
  3197. {
  3198. name = "glowTexture",
  3199. type = "number",
  3200. description = "The index of the Image used for the glow texture."
  3201. },
  3202. {
  3203. name = "occlusionTexture",
  3204. type = "number",
  3205. description = "The index of the Image used for the ambient occlusion texture. The red channel of the texture is used for ambient occlusion, allowing multiple parameters to use the same texture."
  3206. },
  3207. {
  3208. name = "metalnessTexture",
  3209. type = "number",
  3210. description = "The index of the Image used for the metalness texture. The blue channel of the texture is used for metalness, allowing multiple parameters to use the same texture."
  3211. },
  3212. {
  3213. name = "roughnessTexture",
  3214. type = "number",
  3215. description = "The index of the Image to use for the roughness texture. The green channel of the texture is used for roughness, allowing multiple parameters to use the same texture."
  3216. },
  3217. {
  3218. name = "clearcoatTexture",
  3219. type = "number",
  3220. description = "The index of the Image to use for the clearcoat texture. The red channel of the texture is used for the clearcoat parameter, allowing multiple parameters to use the same texture."
  3221. },
  3222. {
  3223. name = "normalTexture",
  3224. type = "number",
  3225. description = "The index of the Image to use for the normal map."
  3226. }
  3227. }
  3228. }
  3229. }
  3230. }
  3231. },
  3232. related = {
  3233. "ModelData:getMaterialCount",
  3234. "ModelData:getMeshMaterial",
  3235. "lovr.graphics.newMaterial",
  3236. "Model:getMaterial"
  3237. }
  3238. },
  3239. {
  3240. name = "getMaterialCount",
  3241. summary = "Get the number of materials in the model.",
  3242. description = "Returns the number of materials in the model.",
  3243. key = "ModelData:getMaterialCount",
  3244. module = "lovr.data",
  3245. related = {
  3246. "ModelData:getMaterialName",
  3247. "ModelData:getMeshMaterial",
  3248. "ModelData:getMaterial",
  3249. "Model:getMaterialCount"
  3250. },
  3251. variants = {
  3252. {
  3253. arguments = {},
  3254. returns = {
  3255. {
  3256. name = "count",
  3257. type = "number",
  3258. description = "The number of materials in the model."
  3259. }
  3260. }
  3261. }
  3262. }
  3263. },
  3264. {
  3265. name = "getMaterialName",
  3266. summary = "Get the name of a material in the model.",
  3267. description = "Returns the name of a material in the model.",
  3268. key = "ModelData:getMaterialName",
  3269. module = "lovr.data",
  3270. related = {
  3271. "ModelData:getMaterialCount",
  3272. "ModelData:getMeshMaterial",
  3273. "ModelData:getMaterial",
  3274. "Model:getMaterialName"
  3275. },
  3276. variants = {
  3277. {
  3278. arguments = {
  3279. {
  3280. name = "index",
  3281. type = "number",
  3282. description = "The index of a material."
  3283. }
  3284. },
  3285. returns = {
  3286. {
  3287. name = "name",
  3288. type = "string",
  3289. description = "The name of the material, or nil if the material does not have a name."
  3290. }
  3291. }
  3292. }
  3293. }
  3294. },
  3295. {
  3296. name = "getMeshCount",
  3297. summary = "Get the number of meshes in the model.",
  3298. description = "Returns the number of meshes in the model.",
  3299. key = "ModelData:getMeshCount",
  3300. module = "lovr.data",
  3301. related = {
  3302. "ModelData:getNodeMeshes"
  3303. },
  3304. variants = {
  3305. {
  3306. arguments = {},
  3307. returns = {
  3308. {
  3309. name = "count",
  3310. type = "number",
  3311. description = "The number of meshes in the model."
  3312. }
  3313. }
  3314. }
  3315. }
  3316. },
  3317. {
  3318. name = "getMeshDrawMode",
  3319. summary = "Get the draw mode of a mesh.",
  3320. description = "Returns the draw mode of a mesh. This controls how its vertices are connected together (points, lines, or triangles).",
  3321. key = "ModelData:getMeshDrawMode",
  3322. module = "lovr.data",
  3323. variants = {
  3324. {
  3325. arguments = {
  3326. {
  3327. name = "mesh",
  3328. type = "number",
  3329. description = "The index of a mesh."
  3330. }
  3331. },
  3332. returns = {
  3333. {
  3334. name = "mode",
  3335. type = "DrawMode",
  3336. description = "The draw mode of the mesh."
  3337. }
  3338. }
  3339. }
  3340. }
  3341. },
  3342. {
  3343. name = "getMeshIndex",
  3344. summary = "Get one of the vertex indices in a mesh.",
  3345. description = "Returns one of the vertex indices in a mesh. If a mesh has vertex indices, they define the order and connectivity of the vertices in the mesh, allowing a vertex to be reused multiple times without duplicating its data.",
  3346. key = "ModelData:getMeshIndex",
  3347. module = "lovr.data",
  3348. related = {
  3349. "ModelData:getMeshIndexFormat",
  3350. "ModelData:getMeshIndexCount",
  3351. "ModelData:getMeshVertex",
  3352. "ModelData:getTriangles"
  3353. },
  3354. variants = {
  3355. {
  3356. arguments = {
  3357. {
  3358. name = "mesh",
  3359. type = "number",
  3360. description = "The index of a mesh to get the vertex from."
  3361. },
  3362. {
  3363. name = "index",
  3364. type = "number",
  3365. description = "The index of a vertex index in the mesh to retrieve."
  3366. }
  3367. },
  3368. returns = {
  3369. {
  3370. name = "vertexindex",
  3371. type = "number",
  3372. description = "The vertex index. Like all indices in Lua, this is 1-indexed."
  3373. }
  3374. }
  3375. }
  3376. }
  3377. },
  3378. {
  3379. name = "getMeshIndexCount",
  3380. summary = "Get the number of vertex indices in a mesh.",
  3381. description = "Returns the number of vertex indices in a mesh. Vertex indices allow for vertices to be reused when defining triangles.",
  3382. key = "ModelData:getMeshIndexCount",
  3383. module = "lovr.data",
  3384. notes = "This may return zero if the mesh does not use indices.",
  3385. variants = {
  3386. {
  3387. arguments = {
  3388. {
  3389. name = "mesh",
  3390. type = "number",
  3391. description = "The index of a mesh."
  3392. }
  3393. },
  3394. returns = {
  3395. {
  3396. name = "count",
  3397. type = "number",
  3398. description = "The number of vertex indices in the mesh."
  3399. }
  3400. }
  3401. }
  3402. }
  3403. },
  3404. {
  3405. name = "getMeshIndexFormat",
  3406. summary = "Get the data format of vertex indices in a mesh.",
  3407. description = "Returns the data format of vertex indices in a mesh. If a mesh doesn't use vertex indices, this function returns nil.",
  3408. key = "ModelData:getMeshIndexFormat",
  3409. module = "lovr.data",
  3410. related = {
  3411. "ModelData:getMeshVertexFormat"
  3412. },
  3413. variants = {
  3414. {
  3415. arguments = {
  3416. {
  3417. name = "mesh",
  3418. type = "number",
  3419. description = "The index of a mesh."
  3420. }
  3421. },
  3422. returns = {
  3423. {
  3424. name = "type",
  3425. type = "AttributeType",
  3426. description = "The data type of each vertex index (always u16 or u32)."
  3427. },
  3428. {
  3429. name = "blob",
  3430. type = "number",
  3431. description = "The index of a Blob in the mesh where the binary data is stored."
  3432. },
  3433. {
  3434. name = "offset",
  3435. type = "number",
  3436. description = "A byte offset into the Blob's data where the index data starts."
  3437. },
  3438. {
  3439. name = "stride",
  3440. type = "number",
  3441. description = "The number of bytes between subsequent vertex indices. Indices are always tightly packed, so this will always be 2 or 4 depending on the data type."
  3442. }
  3443. }
  3444. }
  3445. }
  3446. },
  3447. {
  3448. name = "getMeshMaterial",
  3449. summary = "Get the index of the material applied to a mesh.",
  3450. description = "Returns the index of the material applied to a mesh.",
  3451. key = "ModelData:getMeshMaterial",
  3452. module = "lovr.data",
  3453. variants = {
  3454. {
  3455. arguments = {
  3456. {
  3457. name = "mesh",
  3458. type = "number",
  3459. description = "The index of a mesh."
  3460. }
  3461. },
  3462. returns = {
  3463. {
  3464. name = "material",
  3465. type = "number",
  3466. description = "The index of the material applied to the mesh, or nil if the mesh does not have a material."
  3467. }
  3468. }
  3469. }
  3470. }
  3471. },
  3472. {
  3473. name = "getMeshVertex",
  3474. summary = "Get the data for a single vertex in a mesh.",
  3475. description = "Returns the data for a single vertex in a mesh. The data returned depends on the vertex format of a mesh, which is given by `ModelData:getMeshVertexFormat`.",
  3476. key = "ModelData:getMeshVertex",
  3477. module = "lovr.data",
  3478. related = {
  3479. "ModelData:getMeshVertexFormat",
  3480. "ModelData:getMeshVertexCount",
  3481. "ModelData:getMeshIndex",
  3482. "ModelData:getTriangles"
  3483. },
  3484. variants = {
  3485. {
  3486. arguments = {
  3487. {
  3488. name = "mesh",
  3489. type = "number",
  3490. description = "The index of a mesh to get the vertex from."
  3491. },
  3492. {
  3493. name = "vertex",
  3494. type = "number",
  3495. description = "The index of a vertex in the mesh to retrieve."
  3496. }
  3497. },
  3498. returns = {
  3499. {
  3500. name = "...",
  3501. type = "number",
  3502. description = "The data for all of the attributes of the vertex."
  3503. }
  3504. }
  3505. }
  3506. }
  3507. },
  3508. {
  3509. name = "getMeshVertexCount",
  3510. summary = "Get the number of vertices in a mesh.",
  3511. description = "Returns the number of vertices in a mesh.",
  3512. key = "ModelData:getMeshVertexCount",
  3513. module = "lovr.data",
  3514. related = {
  3515. "ModelData:getMeshIndexCount"
  3516. },
  3517. variants = {
  3518. {
  3519. arguments = {
  3520. {
  3521. name = "mesh",
  3522. type = "number",
  3523. description = "The index of a mesh."
  3524. }
  3525. },
  3526. returns = {
  3527. {
  3528. name = "count",
  3529. type = "number",
  3530. description = "The number of vertices in the mesh."
  3531. }
  3532. }
  3533. }
  3534. }
  3535. },
  3536. {
  3537. name = "getMeshVertexFormat",
  3538. summary = "Get the vertex format of a mesh.",
  3539. description = "Returns the vertex format of a mesh. The vertex format defines the properties associated with each vertex (position, color, etc.), including their types and binary data layout.",
  3540. key = "ModelData:getMeshVertexFormat",
  3541. module = "lovr.data",
  3542. notes = "The format is given as a table of vertex attributes. Each attribute is a table containing the following:\n\n { name, type, components, blob, offset, stride }\n\n- The `name` will be a `DefaultAttribute`.\n- The `type` will be an `AttributeType`.\n- The `component` count will be 1-4.\n- The `blob` is an index of one of the Blobs in the model (see `ModelData:getBlob`).\n- The `offset` is a byte offset from the start of the Blob where the attribute's data starts.\n- The `stride` is the number of bytes between consecutive values.",
  3543. variants = {
  3544. {
  3545. arguments = {
  3546. {
  3547. name = "mesh",
  3548. type = "number",
  3549. description = "The index of a mesh."
  3550. }
  3551. },
  3552. returns = {
  3553. {
  3554. name = "format",
  3555. type = "table",
  3556. description = "The vertex format of the mesh."
  3557. }
  3558. }
  3559. }
  3560. },
  3561. related = {
  3562. "ModelData:getIndexFormat"
  3563. }
  3564. },
  3565. {
  3566. name = "getMetadata",
  3567. summary = "Get extra information from the model file.",
  3568. description = "Returns extra information stored in the model file. Currently this is only implemented for glTF models and returns the JSON string from the glTF or glb file. The metadata can be used to get application-specific data or add support for glTF extensions not supported by LÖVR.",
  3569. key = "ModelData:getMetadata",
  3570. module = "lovr.data",
  3571. related = {
  3572. "Model:getMetadata"
  3573. },
  3574. variants = {
  3575. {
  3576. arguments = {},
  3577. returns = {
  3578. {
  3579. name = "metadata",
  3580. type = "string",
  3581. description = "The metadata from the model file."
  3582. }
  3583. }
  3584. }
  3585. }
  3586. },
  3587. {
  3588. name = "getNodeChildren",
  3589. summary = "Get the children of a node.",
  3590. description = "Given a parent node, this function returns a table with the indices of its children.",
  3591. key = "ModelData:getNodeChildren",
  3592. module = "lovr.data",
  3593. notes = "If the node does not have any children, this function returns an empty table.",
  3594. variants = {
  3595. {
  3596. arguments = {
  3597. {
  3598. name = "index",
  3599. type = "number",
  3600. description = "The index of the parent node."
  3601. }
  3602. },
  3603. returns = {
  3604. {
  3605. name = "children",
  3606. type = "table",
  3607. description = "A table containing a node index for each child of the node."
  3608. }
  3609. }
  3610. },
  3611. {
  3612. arguments = {
  3613. {
  3614. name = "name",
  3615. type = "string",
  3616. description = "The name of the parent node."
  3617. }
  3618. },
  3619. returns = {
  3620. {
  3621. name = "children",
  3622. type = "table",
  3623. description = "A table containing a node index for each child of the node."
  3624. }
  3625. }
  3626. }
  3627. },
  3628. related = {
  3629. "ModelData:getNodeParent",
  3630. "ModelData:getRootNode",
  3631. "Model:getNodeChildren"
  3632. }
  3633. },
  3634. {
  3635. name = "getNodeCount",
  3636. summary = "Get the number of nodes in the model.",
  3637. description = "Returns the number of nodes in the model.",
  3638. key = "ModelData:getNodeCount",
  3639. module = "lovr.data",
  3640. related = {
  3641. "Model:getNodeCount"
  3642. },
  3643. variants = {
  3644. {
  3645. arguments = {},
  3646. returns = {
  3647. {
  3648. name = "count",
  3649. type = "number",
  3650. description = "The number of nodes in the model."
  3651. }
  3652. }
  3653. }
  3654. }
  3655. },
  3656. {
  3657. name = "getNodeMeshes",
  3658. summary = "Get the indices of meshes attached to a node.",
  3659. description = "Returns a table of mesh indices attached to a node. Meshes define the geometry and materials of a model, as opposed to the nodes which define the transforms and hierarchy. A node can have multiple meshes, and meshes can be reused in multiple nodes.",
  3660. key = "ModelData:getNodeMeshes",
  3661. module = "lovr.data",
  3662. related = {
  3663. "ModelData:getMeshCount"
  3664. },
  3665. variants = {
  3666. {
  3667. arguments = {
  3668. {
  3669. name = "index",
  3670. type = "number",
  3671. description = "The index of the node."
  3672. }
  3673. },
  3674. returns = {
  3675. {
  3676. name = "meshes",
  3677. type = "table",
  3678. description = "A table with the node's mesh indices."
  3679. }
  3680. }
  3681. },
  3682. {
  3683. arguments = {
  3684. {
  3685. name = "name",
  3686. type = "string",
  3687. description = "The name of the node."
  3688. }
  3689. },
  3690. returns = {
  3691. {
  3692. name = "meshes",
  3693. type = "table",
  3694. description = "A table with the node's mesh indices."
  3695. }
  3696. }
  3697. }
  3698. }
  3699. },
  3700. {
  3701. name = "getNodeName",
  3702. summary = "Get the name of a node.",
  3703. description = "Returns the name of a node.",
  3704. key = "ModelData:getNodeName",
  3705. module = "lovr.data",
  3706. notes = "If the node does not have a name, this function returns `nil`.",
  3707. variants = {
  3708. {
  3709. arguments = {
  3710. {
  3711. name = "index",
  3712. type = "number",
  3713. description = "The index of the node."
  3714. }
  3715. },
  3716. returns = {
  3717. {
  3718. name = "name",
  3719. type = "string",
  3720. description = "The name of the node."
  3721. }
  3722. }
  3723. }
  3724. },
  3725. related = {
  3726. "Model:getNodeName"
  3727. }
  3728. },
  3729. {
  3730. name = "getNodeOrientation",
  3731. summary = "Get the local orientation of a node.",
  3732. description = "Returns local orientation of a node, relative to its parent.",
  3733. key = "ModelData:getNodeOrientation",
  3734. module = "lovr.data",
  3735. related = {
  3736. "ModelData:getNodePosition",
  3737. "ModelData:getNodeScale",
  3738. "ModelData:getNodePose",
  3739. "ModelData:getNodeTransform"
  3740. },
  3741. variants = {
  3742. {
  3743. arguments = {
  3744. {
  3745. name = "index",
  3746. type = "number",
  3747. description = "The index of the node."
  3748. }
  3749. },
  3750. returns = {
  3751. {
  3752. name = "angle",
  3753. type = "number",
  3754. description = "The number of radians the node is rotated around its axis of rotation."
  3755. },
  3756. {
  3757. name = "ax",
  3758. type = "number",
  3759. description = "The x component of the axis of rotation."
  3760. },
  3761. {
  3762. name = "ay",
  3763. type = "number",
  3764. description = "The y component of the axis of rotation."
  3765. },
  3766. {
  3767. name = "az",
  3768. type = "number",
  3769. description = "The z component of the axis of rotation."
  3770. }
  3771. }
  3772. },
  3773. {
  3774. arguments = {
  3775. {
  3776. name = "name",
  3777. type = "string",
  3778. description = "The name of the node."
  3779. }
  3780. },
  3781. returns = {
  3782. {
  3783. name = "angle",
  3784. type = "number",
  3785. description = "The number of radians the node is rotated around its axis of rotation."
  3786. },
  3787. {
  3788. name = "ax",
  3789. type = "number",
  3790. description = "The x component of the axis of rotation."
  3791. },
  3792. {
  3793. name = "ay",
  3794. type = "number",
  3795. description = "The y component of the axis of rotation."
  3796. },
  3797. {
  3798. name = "az",
  3799. type = "number",
  3800. description = "The z component of the axis of rotation."
  3801. }
  3802. }
  3803. }
  3804. }
  3805. },
  3806. {
  3807. name = "getNodeParent",
  3808. summary = "Get the parent of a node.",
  3809. description = "Given a child node, this function returns the index of its parent.",
  3810. key = "ModelData:getNodeParent",
  3811. module = "lovr.data",
  3812. related = {
  3813. "ModelData:getNodeChildren",
  3814. "ModelData:getRootNode",
  3815. "Model:getNodeParent"
  3816. },
  3817. variants = {
  3818. {
  3819. arguments = {
  3820. {
  3821. name = "index",
  3822. type = "number",
  3823. description = "The index of the child node."
  3824. }
  3825. },
  3826. returns = {
  3827. {
  3828. name = "parent",
  3829. type = "number",
  3830. description = "The index of the parent."
  3831. }
  3832. }
  3833. },
  3834. {
  3835. arguments = {
  3836. {
  3837. name = "name",
  3838. type = "string",
  3839. description = "The name of the child node."
  3840. }
  3841. },
  3842. returns = {
  3843. {
  3844. name = "parent",
  3845. type = "number",
  3846. description = "The index of the parent."
  3847. }
  3848. }
  3849. }
  3850. }
  3851. },
  3852. {
  3853. name = "getNodePose",
  3854. summary = "Get the local pose of a node.",
  3855. description = "Returns local pose (position and orientation) of a node, relative to its parent.",
  3856. key = "ModelData:getNodePose",
  3857. module = "lovr.data",
  3858. related = {
  3859. "ModelData:getNodePosition",
  3860. "ModelData:getNodeOrientation",
  3861. "ModelData:getNodeScale",
  3862. "ModelData:getNodeTransform"
  3863. },
  3864. variants = {
  3865. {
  3866. arguments = {
  3867. {
  3868. name = "index",
  3869. type = "number",
  3870. description = "The index of the node."
  3871. }
  3872. },
  3873. returns = {
  3874. {
  3875. name = "x",
  3876. type = "number",
  3877. description = "The x coordinate."
  3878. },
  3879. {
  3880. name = "y",
  3881. type = "number",
  3882. description = "The y coordinate."
  3883. },
  3884. {
  3885. name = "z",
  3886. type = "number",
  3887. description = "The z coordinate."
  3888. },
  3889. {
  3890. name = "angle",
  3891. type = "number",
  3892. description = "The number of radians the node is rotated around its axis of rotation."
  3893. },
  3894. {
  3895. name = "ax",
  3896. type = "number",
  3897. description = "The x component of the axis of rotation."
  3898. },
  3899. {
  3900. name = "ay",
  3901. type = "number",
  3902. description = "The y component of the axis of rotation."
  3903. },
  3904. {
  3905. name = "az",
  3906. type = "number",
  3907. description = "The z component of the axis of rotation."
  3908. }
  3909. }
  3910. },
  3911. {
  3912. arguments = {
  3913. {
  3914. name = "name",
  3915. type = "string",
  3916. description = "The name of the node."
  3917. }
  3918. },
  3919. returns = {
  3920. {
  3921. name = "x",
  3922. type = "number",
  3923. description = "The x coordinate."
  3924. },
  3925. {
  3926. name = "y",
  3927. type = "number",
  3928. description = "The y coordinate."
  3929. },
  3930. {
  3931. name = "z",
  3932. type = "number",
  3933. description = "The z coordinate."
  3934. },
  3935. {
  3936. name = "angle",
  3937. type = "number",
  3938. description = "The number of radians the node is rotated around its axis of rotation."
  3939. },
  3940. {
  3941. name = "ax",
  3942. type = "number",
  3943. description = "The x component of the axis of rotation."
  3944. },
  3945. {
  3946. name = "ay",
  3947. type = "number",
  3948. description = "The y component of the axis of rotation."
  3949. },
  3950. {
  3951. name = "az",
  3952. type = "number",
  3953. description = "The z component of the axis of rotation."
  3954. }
  3955. }
  3956. }
  3957. }
  3958. },
  3959. {
  3960. name = "getNodePosition",
  3961. summary = "Get the local position of a node.",
  3962. description = "Returns local position of a node, relative to its parent.",
  3963. key = "ModelData:getNodePosition",
  3964. module = "lovr.data",
  3965. related = {
  3966. "ModelData:getNodeOrientation",
  3967. "ModelData:getNodeScale",
  3968. "ModelData:getNodePose",
  3969. "ModelData:getNodeTransform"
  3970. },
  3971. variants = {
  3972. {
  3973. arguments = {
  3974. {
  3975. name = "index",
  3976. type = "number",
  3977. description = "The index of the node."
  3978. }
  3979. },
  3980. returns = {
  3981. {
  3982. name = "x",
  3983. type = "number",
  3984. description = "The x coordinate."
  3985. },
  3986. {
  3987. name = "y",
  3988. type = "number",
  3989. description = "The y coordinate."
  3990. },
  3991. {
  3992. name = "z",
  3993. type = "number",
  3994. description = "The z coordinate."
  3995. }
  3996. }
  3997. },
  3998. {
  3999. arguments = {
  4000. {
  4001. name = "name",
  4002. type = "string",
  4003. description = "The name of the node."
  4004. }
  4005. },
  4006. returns = {
  4007. {
  4008. name = "x",
  4009. type = "number",
  4010. description = "The x coordinate."
  4011. },
  4012. {
  4013. name = "y",
  4014. type = "number",
  4015. description = "The y coordinate."
  4016. },
  4017. {
  4018. name = "z",
  4019. type = "number",
  4020. description = "The z coordinate."
  4021. }
  4022. }
  4023. }
  4024. }
  4025. },
  4026. {
  4027. name = "getNodeScale",
  4028. summary = "Get the local scale of a node.",
  4029. description = "Returns local scale of a node, relative to its parent.",
  4030. key = "ModelData:getNodeScale",
  4031. module = "lovr.data",
  4032. related = {
  4033. "ModelData:getNodePosition",
  4034. "ModelData:getNodeOrientation",
  4035. "ModelData:getNodePose",
  4036. "ModelData:getNodeTransform"
  4037. },
  4038. variants = {
  4039. {
  4040. arguments = {
  4041. {
  4042. name = "index",
  4043. type = "number",
  4044. description = "The index of the node."
  4045. }
  4046. },
  4047. returns = {
  4048. {
  4049. name = "sx",
  4050. type = "number",
  4051. description = "The x scale."
  4052. },
  4053. {
  4054. name = "sy",
  4055. type = "number",
  4056. description = "The y scale."
  4057. },
  4058. {
  4059. name = "sz",
  4060. type = "number",
  4061. description = "The z scale."
  4062. }
  4063. }
  4064. },
  4065. {
  4066. arguments = {
  4067. {
  4068. name = "name",
  4069. type = "string",
  4070. description = "The name of the node."
  4071. }
  4072. },
  4073. returns = {
  4074. {
  4075. name = "sx",
  4076. type = "number",
  4077. description = "The x scale."
  4078. },
  4079. {
  4080. name = "sy",
  4081. type = "number",
  4082. description = "The y scale."
  4083. },
  4084. {
  4085. name = "sz",
  4086. type = "number",
  4087. description = "The z scale."
  4088. }
  4089. }
  4090. }
  4091. }
  4092. },
  4093. {
  4094. name = "getNodeSkin",
  4095. summary = "Get the index of the skin used by a node.",
  4096. description = "Returns the index of the skin used by a node. Skins are collections of joints used for skeletal animation. A model can have multiple skins, and each node can use at most one skin to drive the animation of its meshes.",
  4097. key = "ModelData:getNodeSkin",
  4098. module = "lovr.data",
  4099. related = {
  4100. "ModelData:getSkinCount"
  4101. },
  4102. variants = {
  4103. {
  4104. arguments = {
  4105. {
  4106. name = "index",
  4107. type = "number",
  4108. description = "The index of the node."
  4109. }
  4110. },
  4111. returns = {
  4112. {
  4113. name = "skin",
  4114. type = "number",
  4115. description = "The index of the node's skin, or nil if the node isn't skeletally animated."
  4116. }
  4117. }
  4118. },
  4119. {
  4120. arguments = {
  4121. {
  4122. name = "name",
  4123. type = "string",
  4124. description = "The name of the node."
  4125. }
  4126. },
  4127. returns = {
  4128. {
  4129. name = "skin",
  4130. type = "number",
  4131. description = "The index of the node's skin, or nil if the node isn't skeletally animated."
  4132. }
  4133. }
  4134. }
  4135. }
  4136. },
  4137. {
  4138. name = "getNodeTransform",
  4139. summary = "Get the local transform of a node.",
  4140. description = "Returns local transform (position, orientation, and scale) of a node, relative to its parent.",
  4141. key = "ModelData:getNodeTransform",
  4142. module = "lovr.data",
  4143. related = {
  4144. "ModelData:getNodePosition",
  4145. "ModelData:getNodeOrientation",
  4146. "ModelData:getNodeScale",
  4147. "ModelData:getNodePose"
  4148. },
  4149. variants = {
  4150. {
  4151. arguments = {
  4152. {
  4153. name = "index",
  4154. type = "number",
  4155. description = "The index of the node."
  4156. }
  4157. },
  4158. returns = {
  4159. {
  4160. name = "x",
  4161. type = "number",
  4162. description = "The x coordinate."
  4163. },
  4164. {
  4165. name = "y",
  4166. type = "number",
  4167. description = "The y coordinate."
  4168. },
  4169. {
  4170. name = "z",
  4171. type = "number",
  4172. description = "The z coordinate."
  4173. },
  4174. {
  4175. name = "sx",
  4176. type = "number",
  4177. description = "The x scale."
  4178. },
  4179. {
  4180. name = "sy",
  4181. type = "number",
  4182. description = "The y scale."
  4183. },
  4184. {
  4185. name = "sz",
  4186. type = "number",
  4187. description = "The z scale."
  4188. },
  4189. {
  4190. name = "angle",
  4191. type = "number",
  4192. description = "The number of radians the node is rotated around its axis of rotation."
  4193. },
  4194. {
  4195. name = "ax",
  4196. type = "number",
  4197. description = "The x component of the axis of rotation."
  4198. },
  4199. {
  4200. name = "ay",
  4201. type = "number",
  4202. description = "The y component of the axis of rotation."
  4203. },
  4204. {
  4205. name = "az",
  4206. type = "number",
  4207. description = "The z component of the axis of rotation."
  4208. }
  4209. }
  4210. },
  4211. {
  4212. arguments = {
  4213. {
  4214. name = "name",
  4215. type = "string",
  4216. description = "The name of the node."
  4217. }
  4218. },
  4219. returns = {
  4220. {
  4221. name = "x",
  4222. type = "number",
  4223. description = "The x coordinate."
  4224. },
  4225. {
  4226. name = "y",
  4227. type = "number",
  4228. description = "The y coordinate."
  4229. },
  4230. {
  4231. name = "z",
  4232. type = "number",
  4233. description = "The z coordinate."
  4234. },
  4235. {
  4236. name = "sx",
  4237. type = "number",
  4238. description = "The x scale."
  4239. },
  4240. {
  4241. name = "sy",
  4242. type = "number",
  4243. description = "The y scale."
  4244. },
  4245. {
  4246. name = "sz",
  4247. type = "number",
  4248. description = "The z scale."
  4249. },
  4250. {
  4251. name = "angle",
  4252. type = "number",
  4253. description = "The number of radians the node is rotated around its axis of rotation."
  4254. },
  4255. {
  4256. name = "ax",
  4257. type = "number",
  4258. description = "The x component of the axis of rotation."
  4259. },
  4260. {
  4261. name = "ay",
  4262. type = "number",
  4263. description = "The y component of the axis of rotation."
  4264. },
  4265. {
  4266. name = "az",
  4267. type = "number",
  4268. description = "The z component of the axis of rotation."
  4269. }
  4270. }
  4271. }
  4272. }
  4273. },
  4274. {
  4275. name = "getRootNode",
  4276. summary = "Get the index of the root node.",
  4277. description = "Returns the index of the model's root node.",
  4278. key = "ModelData:getRootNode",
  4279. module = "lovr.data",
  4280. related = {
  4281. "ModelData:getNodeCount",
  4282. "ModelData:getNodeParent",
  4283. "Model:getRootNode"
  4284. },
  4285. variants = {
  4286. {
  4287. arguments = {},
  4288. returns = {
  4289. {
  4290. name = "root",
  4291. type = "number",
  4292. description = "The index of the root node."
  4293. }
  4294. }
  4295. }
  4296. }
  4297. },
  4298. {
  4299. name = "getSkinCount",
  4300. summary = "Get the number of skins in the model.",
  4301. description = "Returns the number of skins in the model. A skin is a collection of joints targeted by an animation.",
  4302. key = "ModelData:getSkinCount",
  4303. module = "lovr.data",
  4304. notes = "There is currently a maximum of 256 skins.",
  4305. variants = {
  4306. {
  4307. arguments = {},
  4308. returns = {
  4309. {
  4310. name = "count",
  4311. type = "number",
  4312. description = "The number of skins in the model."
  4313. }
  4314. }
  4315. }
  4316. },
  4317. related = {
  4318. "Model:hasJoints"
  4319. }
  4320. },
  4321. {
  4322. name = "getSkinInverseBindMatrix",
  4323. summary = "Get the inverse bind matrix for a joint in the skin.",
  4324. description = "Returns the inverse bind matrix for a joint in the skin.",
  4325. key = "ModelData:getSkinInverseBindMatrix",
  4326. module = "lovr.data",
  4327. variants = {
  4328. {
  4329. arguments = {
  4330. {
  4331. name = "skin",
  4332. type = "number",
  4333. description = "The index of a skin."
  4334. },
  4335. {
  4336. name = "joint",
  4337. type = "number",
  4338. description = "The index of a joint in the skin."
  4339. }
  4340. },
  4341. returns = {
  4342. {
  4343. name = "...",
  4344. type = "number",
  4345. description = "The 16 components of the 4x4 inverse bind matrix, in column-major order."
  4346. }
  4347. }
  4348. }
  4349. }
  4350. },
  4351. {
  4352. name = "getSkinJoints",
  4353. summary = "Get the joints in a skin.",
  4354. description = "Returns a table with the node indices of the joints in a skin.",
  4355. key = "ModelData:getSkinJoints",
  4356. module = "lovr.data",
  4357. variants = {
  4358. {
  4359. arguments = {
  4360. {
  4361. name = "skin",
  4362. type = "number",
  4363. description = "The index of a skin."
  4364. }
  4365. },
  4366. returns = {
  4367. {
  4368. name = "joints",
  4369. type = "table",
  4370. description = "The joints in the skin."
  4371. }
  4372. }
  4373. }
  4374. }
  4375. },
  4376. {
  4377. name = "getTriangleCount",
  4378. summary = "Get the total number of triangles in the model.",
  4379. description = "Returns the total number of triangles in the model. This count includes meshes that are attached to multiple nodes, and the count corresponds to the triangles returned by `ModelData:getTriangles`.",
  4380. key = "ModelData:getTriangleCount",
  4381. module = "lovr.data",
  4382. related = {
  4383. "ModelData:getTriangles",
  4384. "ModelData:getVertexCount",
  4385. "Model:getTriangleCount"
  4386. },
  4387. variants = {
  4388. {
  4389. arguments = {},
  4390. returns = {
  4391. {
  4392. name = "count",
  4393. type = "number",
  4394. description = "The total number of triangles in the model."
  4395. }
  4396. }
  4397. }
  4398. }
  4399. },
  4400. {
  4401. name = "getTriangles",
  4402. summary = "Get all the triangles in the model.",
  4403. description = "Returns the data for all triangles in the model. There are a few differences between this and the mesh-specific functions like `ModelData:getMeshVertex` and `ModelData:getMeshIndex`:\n\n- Only vertex positions are returned, not other vertex attributes.\n- Positions are relative to the origin of the whole model, instead of local to a node.\n- If a mesh is attached to more than one node, its vertices will be in the table multiple times.\n- Vertex indices will be relative to the whole triangle list instead of a mesh.",
  4404. key = "ModelData:getTriangles",
  4405. module = "lovr.data",
  4406. notes = "After this function is called on a ModelData once, the result is cached.",
  4407. variants = {
  4408. {
  4409. arguments = {},
  4410. returns = {
  4411. {
  4412. name = "vertices",
  4413. type = "table",
  4414. description = "The triangle vertex positions, returned as a flat (non-nested) table of numbers. The position of each vertex is given as an x, y, and z coordinate."
  4415. },
  4416. {
  4417. name = "indices",
  4418. type = "table",
  4419. description = "The vertex indices. Every 3 indices describes a triangle."
  4420. }
  4421. }
  4422. }
  4423. },
  4424. related = {
  4425. "ModelData:getTriangleCount",
  4426. "ModelData:getVertexCount",
  4427. "Model:getTriangles"
  4428. }
  4429. },
  4430. {
  4431. name = "getVertexCount",
  4432. summary = "Get the total vertex count of the model.",
  4433. description = "Returns the total vertex count of a model. This count includes meshes that are attached to multiple nodes, and the count corresponds to the vertices returned by `ModelData:getTriangles`.",
  4434. key = "ModelData:getVertexCount",
  4435. module = "lovr.data",
  4436. related = {
  4437. "ModelData:getTriangles",
  4438. "ModelData:getTriangleCount",
  4439. "Model:getVertexCount"
  4440. },
  4441. variants = {
  4442. {
  4443. arguments = {},
  4444. returns = {
  4445. {
  4446. name = "count",
  4447. type = "number",
  4448. description = "The total number of vertices in the model."
  4449. }
  4450. }
  4451. }
  4452. }
  4453. },
  4454. {
  4455. name = "getWidth",
  4456. summary = "Get the width of the model.",
  4457. description = "Returns the width of the model, computed from its axis-aligned bounding box.",
  4458. key = "ModelData:getWidth",
  4459. module = "lovr.data",
  4460. related = {
  4461. "ModelData:getHeight",
  4462. "ModelData:getDepth",
  4463. "ModelData:getDimensions",
  4464. "ModelData:getCenter",
  4465. "ModelData:getBoundingBox",
  4466. "Model:getWidth"
  4467. },
  4468. variants = {
  4469. {
  4470. arguments = {},
  4471. returns = {
  4472. {
  4473. name = "width",
  4474. type = "number",
  4475. description = "The width of the model."
  4476. }
  4477. }
  4478. }
  4479. }
  4480. }
  4481. }
  4482. },
  4483. {
  4484. name = "Rasterizer",
  4485. summary = "An object that rasterizes glyphs from font files.",
  4486. description = "A Rasterizer is an object that parses a TTF file, decoding and rendering glyphs from it.\n\nUsually you can just use `Font` objects.",
  4487. key = "Rasterizer",
  4488. module = "lovr.data",
  4489. constructors = {
  4490. "lovr.data.newRasterizer"
  4491. },
  4492. methods = {
  4493. {
  4494. name = "getAdvance",
  4495. summary = "Get the advance of the font.",
  4496. description = "Returns the advance metric of the font, in pixels. The advance is how many pixels the font advances horizontally after each glyph is rendered. This does not include kerning.",
  4497. key = "Rasterizer:getAdvance",
  4498. module = "lovr.data",
  4499. variants = {
  4500. {
  4501. arguments = {},
  4502. returns = {
  4503. {
  4504. name = "advance",
  4505. type = "number",
  4506. description = "The advance of the font, in pixels."
  4507. }
  4508. }
  4509. }
  4510. }
  4511. },
  4512. {
  4513. name = "getAscent",
  4514. summary = "Get the ascent of the font.",
  4515. description = "Returns the ascent metric of the font, in pixels. The ascent represents how far any glyph of the font ascends above the baseline.",
  4516. key = "Rasterizer:getAscent",
  4517. module = "lovr.data",
  4518. related = {
  4519. "Rasterizer:getDescent",
  4520. "Font:getAscent"
  4521. },
  4522. variants = {
  4523. {
  4524. arguments = {},
  4525. returns = {
  4526. {
  4527. name = "ascent",
  4528. type = "number",
  4529. description = "The ascent of the font, in pixels."
  4530. }
  4531. }
  4532. }
  4533. }
  4534. },
  4535. {
  4536. name = "getDescent",
  4537. summary = "Get the descent of the font.",
  4538. description = "Returns the descent metric of the font, in pixels. The descent represents how far any glyph of the font descends below the baseline.",
  4539. key = "Rasterizer:getDescent",
  4540. module = "lovr.data",
  4541. related = {
  4542. "Rasterzer:getAscent",
  4543. "Font:getDescent"
  4544. },
  4545. variants = {
  4546. {
  4547. arguments = {},
  4548. returns = {
  4549. {
  4550. name = "descent",
  4551. type = "number",
  4552. description = "The descent of the font, in pixels."
  4553. }
  4554. }
  4555. }
  4556. }
  4557. },
  4558. {
  4559. name = "getGlyphCount",
  4560. summary = "Get the number of glyphs stored in the font file.",
  4561. description = "Returns the number of glyphs stored in the font file.",
  4562. key = "Rasterizer:getGlyphCount",
  4563. module = "lovr.data",
  4564. related = {
  4565. "Rasterizer:hasGlyphs"
  4566. },
  4567. variants = {
  4568. {
  4569. arguments = {},
  4570. returns = {
  4571. {
  4572. name = "count",
  4573. type = "number",
  4574. description = "The number of glyphs stored in the font file."
  4575. }
  4576. }
  4577. }
  4578. }
  4579. },
  4580. {
  4581. name = "getHeight",
  4582. summary = "Get the height of the font.",
  4583. description = "Returns the height metric of the font, in pixels.",
  4584. key = "Rasterizer:getHeight",
  4585. module = "lovr.data",
  4586. related = {
  4587. "Font:getHeight"
  4588. },
  4589. variants = {
  4590. {
  4591. arguments = {},
  4592. returns = {
  4593. {
  4594. name = "height",
  4595. type = "number",
  4596. description = "The height of the font, in pixels."
  4597. }
  4598. }
  4599. }
  4600. }
  4601. },
  4602. {
  4603. name = "getLineHeight",
  4604. summary = "Get the line height of the font.",
  4605. description = "Returns the line height metric of the font, in pixels. This is how far apart lines are.",
  4606. key = "Rasterizer:getLineHeight",
  4607. module = "lovr.data",
  4608. related = {
  4609. "Rasterizer:getHeight",
  4610. "Font:getLineHeight",
  4611. "Font:setLineHeight"
  4612. },
  4613. variants = {
  4614. {
  4615. arguments = {},
  4616. returns = {
  4617. {
  4618. name = "height",
  4619. type = "number",
  4620. description = "The line height of the font, in pixels."
  4621. }
  4622. }
  4623. }
  4624. }
  4625. },
  4626. {
  4627. name = "hasGlyphs",
  4628. summary = "Get whether the Rasterizer can rasterize a set of glyphs.",
  4629. description = "Check if the Rasterizer can rasterize a set of glyphs.",
  4630. key = "Rasterizer:hasGlyphs",
  4631. module = "lovr.data",
  4632. related = {
  4633. "Rasterizer:getGlyphCount"
  4634. },
  4635. variants = {
  4636. {
  4637. arguments = {
  4638. {
  4639. name = "...",
  4640. type = "*",
  4641. description = "Strings (sets of characters) or numbers (character codes) to check for."
  4642. }
  4643. },
  4644. returns = {
  4645. {
  4646. name = "hasGlyphs",
  4647. type = "boolean",
  4648. description = "true if the Rasterizer can rasterize all of the supplied characters, false otherwise."
  4649. }
  4650. }
  4651. }
  4652. }
  4653. }
  4654. }
  4655. },
  4656. {
  4657. name = "Sound",
  4658. summary = "An object that holds raw audio samples.",
  4659. description = "A Sound stores the data for a sound. The supported sound formats are OGG, WAV, and MP3. Sounds cannot be played directly. Instead, there are `Source` objects in `lovr.audio` that are used for audio playback. All Source objects are backed by one of these Sounds, and multiple Sources can share a single Sound to reduce memory usage.\n\nMetadata\n---\n\nSounds hold a fixed number of frames. Each frame contains one audio sample for each channel. The `SampleFormat` of the Sound is the data type used for each sample (floating point, integer, etc.). The Sound has a `ChannelLayout`, representing the number of audio channels and how they map to speakers (mono, stereo, etc.). The sample rate of the Sound indicates how many frames should be played per second. The duration of the sound (in seconds) is the number of frames divided by the sample rate.\n\nCompression\n---\n\nSounds can be compressed. Compressed sounds are stored compressed in memory and are decoded as they are played. This uses a lot less memory but increases CPU usage during playback. OGG and MP3 are compressed audio formats. When creating a sound from a compressed format, there is an option to immediately decode it, storing it uncompressed in memory. It can be a good idea to decode short sound effects, since they won't use very much memory even when uncompressed and it will improve CPU usage. Compressed sounds can not be written to using `Sound:setFrames`.\n\nStreams\n---\n\nSounds can be created as a stream by passing `'stream'` as their contents when creating them. Audio frames can be written to the end of the stream, and read from the beginning. This works well for situations where data is being generated in real time or streamed in from some other data source.\n\nSources can be backed by a stream and they'll just play whatever audio is pushed to the stream. The audio module also lets you use a stream as a \"sink\" for an audio device. For playback devices, this works like loopback, so the mixed audio from all playing Sources will get written to the stream. For capture devices, all the microphone input will get written to the stream. Conversion between sample formats, channel layouts, and sample rates will happen automatically.\n\nKeep in mind that streams can still only hold a fixed number of frames. If too much data is written before it is read, older frames will start to get overwritten. Similary, it's possible to read too much data without writing fast enough.\n\nAmbisonics\n---\n\nAmbisonic sounds can be imported from WAVs, but can not yet be played. Sounds with a `ChannelLayout` of `ambisonic` are stored as first-order full-sphere ambisonics using the AmbiX format (ACN channel ordering and SN3D channel normalization). The AMB format is supported for import and will automatically get converted to AmbiX. See `lovr.data.newSound` for more info.",
  4660. key = "Sound",
  4661. module = "lovr.data",
  4662. constructors = {
  4663. "lovr.data.newSound"
  4664. },
  4665. methods = {
  4666. {
  4667. name = "getBlob",
  4668. summary = "Get the bytes backing this Sound as a Blob.",
  4669. description = "Returns a Blob containing the raw bytes of the Sound.",
  4670. key = "Sound:getBlob",
  4671. module = "lovr.data",
  4672. notes = "Samples for each channel are stored interleaved. The data type of each sample is given by `Sound:getFormat`.",
  4673. variants = {
  4674. {
  4675. arguments = {},
  4676. returns = {
  4677. {
  4678. name = "blob",
  4679. type = "Blob",
  4680. description = "The Blob instance containing the bytes for the `Sound`."
  4681. }
  4682. }
  4683. }
  4684. },
  4685. related = {
  4686. "Blob:getPointer",
  4687. "Image:getBlob"
  4688. }
  4689. },
  4690. {
  4691. name = "getCapacity",
  4692. summary = "Get the number of frames that can be written to the Sound.",
  4693. description = "Returns the number of frames that can be written to the Sound. For stream sounds, this is the number of frames that can be written without overwriting existing data. For normal sounds, this returns the same value as `Sound:getFrameCount`.",
  4694. key = "Sound:getCapacity",
  4695. module = "lovr.data",
  4696. related = {
  4697. "Sound:getFrameCount",
  4698. "Sound:getSampleCount",
  4699. "Source:getDuration"
  4700. },
  4701. variants = {
  4702. {
  4703. arguments = {},
  4704. returns = {
  4705. {
  4706. name = "capacity",
  4707. type = "number",
  4708. description = "The number of frames that can be written to the Sound."
  4709. }
  4710. }
  4711. }
  4712. }
  4713. },
  4714. {
  4715. name = "getChannelCount",
  4716. summary = "Get the number of channels in the Sound.",
  4717. description = "Returns the number of channels in the Sound. Mono sounds have 1 channel, stereo sounds have 2 channels, and ambisonic sounds have 4 channels.",
  4718. key = "Sound:getChannelCount",
  4719. module = "lovr.data",
  4720. related = {
  4721. "Sound:getChannelLayout"
  4722. },
  4723. variants = {
  4724. {
  4725. arguments = {},
  4726. returns = {
  4727. {
  4728. name = "channels",
  4729. type = "number",
  4730. description = "The number of channels in the sound."
  4731. }
  4732. }
  4733. }
  4734. }
  4735. },
  4736. {
  4737. name = "getChannelLayout",
  4738. summary = "Get the channel layout of the Sound.",
  4739. description = "Returns the channel layout of the Sound.",
  4740. key = "Sound:getChannelLayout",
  4741. module = "lovr.data",
  4742. related = {
  4743. "Sound:getChannelCount"
  4744. },
  4745. variants = {
  4746. {
  4747. arguments = {},
  4748. returns = {
  4749. {
  4750. name = "channels",
  4751. type = "ChannelLayout",
  4752. description = "The channel layout."
  4753. }
  4754. }
  4755. }
  4756. }
  4757. },
  4758. {
  4759. name = "getDuration",
  4760. summary = "Get the duration of the Sound.",
  4761. description = "Returns the duration of the Sound, in seconds.",
  4762. key = "Sound:getDuration",
  4763. module = "lovr.data",
  4764. notes = "This can be computed as `(frameCount / sampleRate)`.",
  4765. variants = {
  4766. {
  4767. arguments = {},
  4768. returns = {
  4769. {
  4770. name = "duration",
  4771. type = "number",
  4772. description = "The duration of the Sound, in seconds."
  4773. }
  4774. }
  4775. }
  4776. },
  4777. related = {
  4778. "Sound:getFrameCount",
  4779. "Sound:getSampleCount",
  4780. "Sound:getSampleRate",
  4781. "Source:getDuration"
  4782. }
  4783. },
  4784. {
  4785. name = "getFormat",
  4786. summary = "Get the sample format of the Sound.",
  4787. description = "Returns the sample format of the Sound.",
  4788. key = "Sound:getFormat",
  4789. module = "lovr.data",
  4790. related = {
  4791. "Sound:getChannelLayout",
  4792. "Sound:getSampleRate"
  4793. },
  4794. variants = {
  4795. {
  4796. arguments = {},
  4797. returns = {
  4798. {
  4799. name = "format",
  4800. type = "SampleFormat",
  4801. description = "The data type of each sample."
  4802. }
  4803. }
  4804. }
  4805. }
  4806. },
  4807. {
  4808. name = "getFrameCount",
  4809. summary = "Get the number of frames in the Sound.",
  4810. description = "Returns the number of frames in the Sound. A frame stores one sample for each channel.",
  4811. key = "Sound:getFrameCount",
  4812. module = "lovr.data",
  4813. notes = "For streams, this returns the number of frames in the stream's buffer.",
  4814. variants = {
  4815. {
  4816. arguments = {},
  4817. returns = {
  4818. {
  4819. name = "frames",
  4820. type = "number",
  4821. description = "The number of frames in the Sound."
  4822. }
  4823. }
  4824. }
  4825. },
  4826. related = {
  4827. "Sound:getDuration",
  4828. "Sound:getSampleCount",
  4829. "Sound:getChannelCount"
  4830. }
  4831. },
  4832. {
  4833. name = "getFrames",
  4834. summary = "Read frames from the Sound.",
  4835. description = "Reads frames from the Sound into a table, Blob, or another Sound.",
  4836. key = "Sound:getFrames",
  4837. module = "lovr.data",
  4838. variants = {
  4839. {
  4840. arguments = {
  4841. {
  4842. name = "count",
  4843. type = "number",
  4844. description = "The number of frames to read. If nil, reads as many frames as possible.\n\nCompressed sounds will automatically be decoded.\n\nReading from a stream will ignore the source offset and read the oldest frames.",
  4845. default = "nil"
  4846. },
  4847. {
  4848. name = "srcOffset",
  4849. type = "number",
  4850. description = "A frame offset to apply to the sound when reading frames.",
  4851. default = "0"
  4852. }
  4853. },
  4854. returns = {
  4855. {
  4856. name = "t",
  4857. type = "table",
  4858. description = "A table containing audio frames."
  4859. },
  4860. {
  4861. name = "count",
  4862. type = "number",
  4863. description = "The number of frames read."
  4864. }
  4865. }
  4866. },
  4867. {
  4868. arguments = {
  4869. {
  4870. name = "t",
  4871. type = "table",
  4872. description = "An existing table to read frames into."
  4873. },
  4874. {
  4875. name = "count",
  4876. type = "number",
  4877. description = "The number of frames to read. If nil, reads as many frames as possible.\n\nCompressed sounds will automatically be decoded.\n\nReading from a stream will ignore the source offset and read the oldest frames.",
  4878. default = "nil"
  4879. },
  4880. {
  4881. name = "srcOffset",
  4882. type = "number",
  4883. description = "A frame offset to apply to the sound when reading frames.",
  4884. default = "0"
  4885. },
  4886. {
  4887. name = "dstOffset",
  4888. type = "number",
  4889. description = "An offset to apply to the destination when writing frames (indices for tables, bytes for Blobs, frames for Sounds).",
  4890. default = "0"
  4891. }
  4892. },
  4893. returns = {
  4894. {
  4895. name = "t",
  4896. type = "table",
  4897. description = "A table containing audio frames."
  4898. },
  4899. {
  4900. name = "count",
  4901. type = "number",
  4902. description = "The number of frames read."
  4903. }
  4904. }
  4905. },
  4906. {
  4907. arguments = {
  4908. {
  4909. name = "blob",
  4910. type = "Blob",
  4911. description = "A Blob to read frames into."
  4912. },
  4913. {
  4914. name = "count",
  4915. type = "number",
  4916. description = "The number of frames to read. If nil, reads as many frames as possible.\n\nCompressed sounds will automatically be decoded.\n\nReading from a stream will ignore the source offset and read the oldest frames.",
  4917. default = "nil"
  4918. },
  4919. {
  4920. name = "srcOffset",
  4921. type = "number",
  4922. description = "A frame offset to apply to the sound when reading frames.",
  4923. default = "0"
  4924. },
  4925. {
  4926. name = "dstOffset",
  4927. type = "number",
  4928. description = "An offset to apply to the destination when writing frames (indices for tables, bytes for Blobs, frames for Sounds).",
  4929. default = "0"
  4930. }
  4931. },
  4932. returns = {
  4933. {
  4934. name = "count",
  4935. type = "number",
  4936. description = "The number of frames read."
  4937. }
  4938. }
  4939. },
  4940. {
  4941. arguments = {
  4942. {
  4943. name = "sound",
  4944. type = "Sound",
  4945. description = "Another Sound to copy frames into."
  4946. },
  4947. {
  4948. name = "count",
  4949. type = "number",
  4950. description = "The number of frames to read. If nil, reads as many frames as possible.\n\nCompressed sounds will automatically be decoded.\n\nReading from a stream will ignore the source offset and read the oldest frames.",
  4951. default = "nil"
  4952. },
  4953. {
  4954. name = "srcOffset",
  4955. type = "number",
  4956. description = "A frame offset to apply to the sound when reading frames.",
  4957. default = "0"
  4958. },
  4959. {
  4960. name = "dstOffset",
  4961. type = "number",
  4962. description = "An offset to apply to the destination when writing frames (indices for tables, bytes for Blobs, frames for Sounds).",
  4963. default = "0"
  4964. }
  4965. },
  4966. returns = {
  4967. {
  4968. name = "count",
  4969. type = "number",
  4970. description = "The number of frames read."
  4971. }
  4972. }
  4973. }
  4974. }
  4975. },
  4976. {
  4977. name = "getSampleCount",
  4978. summary = "Get the number of samples in the Sound.",
  4979. description = "Returns the total number of samples in the Sound.",
  4980. key = "Sound:getSampleCount",
  4981. module = "lovr.data",
  4982. notes = "For streams, this returns the number of samples in the stream's buffer.",
  4983. variants = {
  4984. {
  4985. arguments = {},
  4986. returns = {
  4987. {
  4988. name = "samples",
  4989. type = "number",
  4990. description = "The total number of samples in the Sound."
  4991. }
  4992. }
  4993. }
  4994. },
  4995. related = {
  4996. "Sound:getDuration",
  4997. "Sound:getFrameCount",
  4998. "Sound:getChannelCount"
  4999. }
  5000. },
  5001. {
  5002. name = "getSampleRate",
  5003. summary = "Get the sample rate of the Sound.",
  5004. description = "Returns the sample rate of the Sound, in Hz. This is the number of frames that are played every second. It's usually a high number like 48000.",
  5005. key = "Sound:getSampleRate",
  5006. module = "lovr.data",
  5007. variants = {
  5008. {
  5009. arguments = {},
  5010. returns = {
  5011. {
  5012. name = "frequency",
  5013. type = "number",
  5014. description = "The number of frames per second in the Sound."
  5015. }
  5016. }
  5017. }
  5018. }
  5019. },
  5020. {
  5021. name = "isCompressed",
  5022. summary = "Check if the Sound is compressed.",
  5023. description = "Returns whether the Sound is compressed. Compressed sounds are loaded from compressed audio formats like MP3 and OGG. They use a lot less memory but require some extra CPU work during playback. Compressed sounds can not be modified using `Sound:setFrames`.",
  5024. key = "Sound:isCompressed",
  5025. module = "lovr.data",
  5026. related = {
  5027. "Sound:isStream",
  5028. "lovr.data.newSound"
  5029. },
  5030. variants = {
  5031. {
  5032. arguments = {},
  5033. returns = {
  5034. {
  5035. name = "compressed",
  5036. type = "boolean",
  5037. description = "Whether the Sound is compressed."
  5038. }
  5039. }
  5040. }
  5041. }
  5042. },
  5043. {
  5044. name = "isStream",
  5045. summary = "Check if the Sound is a stream.",
  5046. description = "Returns whether the Sound is a stream.",
  5047. key = "Sound:isStream",
  5048. module = "lovr.data",
  5049. related = {
  5050. "Sound:isCompressed",
  5051. "lovr.data.newSound"
  5052. },
  5053. variants = {
  5054. {
  5055. arguments = {},
  5056. returns = {
  5057. {
  5058. name = "stream",
  5059. type = "boolean",
  5060. description = "Whether the Sound is a stream."
  5061. }
  5062. }
  5063. }
  5064. }
  5065. },
  5066. {
  5067. name = "setFrames",
  5068. summary = "Write frames to the Sound.",
  5069. description = "Writes frames to the Sound.",
  5070. key = "Sound:setFrames",
  5071. module = "lovr.data",
  5072. variants = {
  5073. {
  5074. arguments = {
  5075. {
  5076. name = "t",
  5077. type = "table",
  5078. description = "A table containing frames to write."
  5079. },
  5080. {
  5081. name = "count",
  5082. type = "number",
  5083. description = "How many frames to write. If nil, writes as many as possible.",
  5084. default = "nil"
  5085. },
  5086. {
  5087. name = "dstOffset",
  5088. type = "number",
  5089. description = "A frame offset to apply when writing the frames.",
  5090. default = "0"
  5091. },
  5092. {
  5093. name = "srcOffset",
  5094. type = "number",
  5095. description = "A frame, byte, or index offset to apply when reading frames from the source.",
  5096. default = "0"
  5097. }
  5098. },
  5099. returns = {
  5100. {
  5101. name = "count",
  5102. type = "number",
  5103. description = "The number of frames written."
  5104. }
  5105. }
  5106. },
  5107. {
  5108. arguments = {
  5109. {
  5110. name = "blob",
  5111. type = "Blob",
  5112. description = "A Blob containing frames to write."
  5113. },
  5114. {
  5115. name = "count",
  5116. type = "number",
  5117. description = "How many frames to write. If nil, writes as many as possible.",
  5118. default = "nil"
  5119. },
  5120. {
  5121. name = "dstOffset",
  5122. type = "number",
  5123. description = "A frame offset to apply when writing the frames.",
  5124. default = "0"
  5125. },
  5126. {
  5127. name = "srcOffset",
  5128. type = "number",
  5129. description = "A frame, byte, or index offset to apply when reading frames from the source.",
  5130. default = "0"
  5131. }
  5132. },
  5133. returns = {
  5134. {
  5135. name = "count",
  5136. type = "number",
  5137. description = "The number of frames written."
  5138. }
  5139. }
  5140. },
  5141. {
  5142. arguments = {
  5143. {
  5144. name = "sound",
  5145. type = "Sound",
  5146. description = "Another Sound to copy frames from."
  5147. },
  5148. {
  5149. name = "count",
  5150. type = "number",
  5151. description = "How many frames to write. If nil, writes as many as possible.",
  5152. default = "nil"
  5153. },
  5154. {
  5155. name = "dstOffset",
  5156. type = "number",
  5157. description = "A frame offset to apply when writing the frames.",
  5158. default = "0"
  5159. },
  5160. {
  5161. name = "srcOffset",
  5162. type = "number",
  5163. description = "A frame, byte, or index offset to apply when reading frames from the source.",
  5164. default = "0"
  5165. }
  5166. },
  5167. returns = {
  5168. {
  5169. name = "count",
  5170. type = "number",
  5171. description = "The number of frames written."
  5172. }
  5173. }
  5174. }
  5175. },
  5176. examples = {
  5177. {
  5178. description = "Generate a sine wave.",
  5179. code = "function lovr.load()\n local length = 1\n local rate = 48000\n local frames = length * rate\n local frequency = 440\n local volume = 1.0\n\n sound = lovr.data.newSound(frames, 'f32', 'stereo', rate)\n\n local data = {}\n for i = 1, frames do\n local amplitude = math.sin((i - 1) * frequency / rate * (2 * math.pi)) * volume\n data[2 * i - 1] = amplitude\n data[2 * i - 0] = amplitude\n end\n\n sound:setFrames(data)\n\n source = lovr.audio.newSource(sound)\n source:setLooping(true)\n source:play()\nend"
  5180. }
  5181. }
  5182. }
  5183. }
  5184. }
  5185. },
  5186. functions = {
  5187. {
  5188. name = "newBlob",
  5189. summary = "Create a new Blob.",
  5190. description = "Creates a new Blob.",
  5191. key = "lovr.data.newBlob",
  5192. module = "lovr.data",
  5193. related = {
  5194. "lovr.filesystem.newBlob"
  5195. },
  5196. variants = {
  5197. {
  5198. arguments = {
  5199. {
  5200. name = "size",
  5201. type = "number",
  5202. description = "The amount of data to allocate for the Blob, in bytes. All of the bytes will be filled with zeroes."
  5203. },
  5204. {
  5205. name = "name",
  5206. type = "string",
  5207. description = "A name for the Blob (used in error messages)",
  5208. default = "''"
  5209. }
  5210. },
  5211. returns = {
  5212. {
  5213. name = "blob",
  5214. type = "Blob",
  5215. description = "The new Blob."
  5216. }
  5217. }
  5218. },
  5219. {
  5220. arguments = {
  5221. {
  5222. name = "contents",
  5223. type = "string",
  5224. description = "A string to use for the Blob's contents."
  5225. },
  5226. {
  5227. name = "name",
  5228. type = "string",
  5229. description = "A name for the Blob (used in error messages)",
  5230. default = "''"
  5231. }
  5232. },
  5233. returns = {
  5234. {
  5235. name = "blob",
  5236. type = "Blob",
  5237. description = "The new Blob."
  5238. }
  5239. }
  5240. },
  5241. {
  5242. arguments = {
  5243. {
  5244. name = "source",
  5245. type = "Blob",
  5246. description = "A Blob to copy the contents from."
  5247. },
  5248. {
  5249. name = "name",
  5250. type = "string",
  5251. description = "A name for the Blob (used in error messages)",
  5252. default = "''"
  5253. }
  5254. },
  5255. returns = {
  5256. {
  5257. name = "blob",
  5258. type = "Blob",
  5259. description = "The new Blob."
  5260. }
  5261. }
  5262. }
  5263. }
  5264. },
  5265. {
  5266. name = "newImage",
  5267. summary = "Create a new Image.",
  5268. description = "Creates a new Image. Image data can be loaded and decoded from an image file, or a raw block of pixels with a specified width, height, and format can be created.",
  5269. key = "lovr.data.newImage",
  5270. module = "lovr.data",
  5271. notes = "The supported image file formats are png, jpg, hdr, dds (DXT1, DXT3, DXT5), ktx, and astc.\n\nOnly 2D textures are supported for DXT/ASTC.\n\nCurrently textures loaded as KTX need to be in DXT/ASTC formats.",
  5272. variants = {
  5273. {
  5274. description = "Load image data from a file.",
  5275. arguments = {
  5276. {
  5277. name = "filename",
  5278. type = "string",
  5279. description = "The filename of the image to load."
  5280. },
  5281. {
  5282. name = "flip",
  5283. type = "boolean",
  5284. description = "Whether to vertically flip the image on load. This should be true for normal textures, and false for textures that are going to be used in a cubemap.",
  5285. default = "true"
  5286. }
  5287. },
  5288. returns = {
  5289. {
  5290. name = "image",
  5291. type = "Image",
  5292. description = "The new Image."
  5293. }
  5294. }
  5295. },
  5296. {
  5297. description = "Create an Image with a given size and pixel format.",
  5298. arguments = {
  5299. {
  5300. name = "width",
  5301. type = "number",
  5302. description = "The width of the texture."
  5303. },
  5304. {
  5305. name = "height",
  5306. type = "number",
  5307. description = "The height of the texture."
  5308. },
  5309. {
  5310. name = "format",
  5311. type = "TextureFormat",
  5312. description = "The format of the texture's pixels.",
  5313. default = "rgba"
  5314. },
  5315. {
  5316. name = "data",
  5317. type = "Blob",
  5318. description = "Raw pixel values to use as the contents. If `nil`, the data will all be zero.",
  5319. default = "nil"
  5320. }
  5321. },
  5322. returns = {
  5323. {
  5324. name = "image",
  5325. type = "Image",
  5326. description = "The new Image."
  5327. }
  5328. }
  5329. },
  5330. {
  5331. description = "Clone an existing Image.",
  5332. arguments = {
  5333. {
  5334. name = "source",
  5335. type = "Image",
  5336. description = "The Image to clone."
  5337. }
  5338. },
  5339. returns = {
  5340. {
  5341. name = "image",
  5342. type = "Image",
  5343. description = "The new Image."
  5344. }
  5345. }
  5346. },
  5347. {
  5348. description = "Decode image data from a Blob.",
  5349. arguments = {
  5350. {
  5351. name = "blob",
  5352. type = "Blob",
  5353. description = "The Blob containing image data to decode."
  5354. },
  5355. {
  5356. name = "flip",
  5357. type = "boolean",
  5358. description = "Whether to vertically flip the image on load. This should be true for normal textures, and false for textures that are going to be used in a cubemap.",
  5359. default = "true"
  5360. }
  5361. },
  5362. returns = {
  5363. {
  5364. name = "image",
  5365. type = "Image",
  5366. description = "The new Image."
  5367. }
  5368. }
  5369. }
  5370. }
  5371. },
  5372. {
  5373. name = "newModelData",
  5374. summary = "Create a new ModelData.",
  5375. description = "Loads a 3D model from a file. The supported 3D file formats are OBJ and glTF.",
  5376. key = "lovr.data.newModelData",
  5377. module = "lovr.data",
  5378. variants = {
  5379. {
  5380. arguments = {
  5381. {
  5382. name = "filename",
  5383. type = "string",
  5384. description = "The filename of the model to load."
  5385. }
  5386. },
  5387. returns = {
  5388. {
  5389. name = "modelData",
  5390. type = "ModelData",
  5391. description = "The new ModelData."
  5392. }
  5393. }
  5394. },
  5395. {
  5396. arguments = {
  5397. {
  5398. name = "blob",
  5399. type = "Blob",
  5400. description = "The Blob containing data for a model to decode."
  5401. }
  5402. },
  5403. returns = {
  5404. {
  5405. name = "modelData",
  5406. type = "ModelData",
  5407. description = "The new ModelData."
  5408. }
  5409. }
  5410. }
  5411. }
  5412. },
  5413. {
  5414. name = "newRasterizer",
  5415. summary = "Create a new Rasterizer.",
  5416. description = "Creates a new Rasterizer from a TTF file.",
  5417. key = "lovr.data.newRasterizer",
  5418. module = "lovr.data",
  5419. variants = {
  5420. {
  5421. description = "Create a Rasterizer for the default font included with LÖVR (Varela Round).",
  5422. arguments = {
  5423. {
  5424. name = "size",
  5425. type = "number",
  5426. description = "The resolution to render the fonts at, in pixels. Higher resolutions use more memory and processing power but may provide better quality results for some fonts/situations.",
  5427. default = "32"
  5428. }
  5429. },
  5430. returns = {
  5431. {
  5432. name = "rasterizer",
  5433. type = "Rasterizer",
  5434. description = "The new Rasterizer."
  5435. }
  5436. }
  5437. },
  5438. {
  5439. arguments = {
  5440. {
  5441. name = "filename",
  5442. type = "string",
  5443. description = "The filename of the font file to load."
  5444. },
  5445. {
  5446. name = "size",
  5447. type = "number",
  5448. description = "The resolution to render the fonts at, in pixels. Higher resolutions use more memory and processing power but may provide better quality results for some fonts/situations.",
  5449. default = "32"
  5450. }
  5451. },
  5452. returns = {
  5453. {
  5454. name = "rasterizer",
  5455. type = "Rasterizer",
  5456. description = "The new Rasterizer."
  5457. }
  5458. }
  5459. },
  5460. {
  5461. arguments = {
  5462. {
  5463. name = "blob",
  5464. type = "Blob",
  5465. description = "The Blob containing font data."
  5466. },
  5467. {
  5468. name = "size",
  5469. type = "number",
  5470. description = "The resolution to render the fonts at, in pixels. Higher resolutions use more memory and processing power but may provide better quality results for some fonts/situations.",
  5471. default = "32"
  5472. }
  5473. },
  5474. returns = {
  5475. {
  5476. name = "rasterizer",
  5477. type = "Rasterizer",
  5478. description = "The new Rasterizer."
  5479. }
  5480. }
  5481. }
  5482. }
  5483. },
  5484. {
  5485. name = "newSound",
  5486. summary = "Create a new Sound.",
  5487. description = "Creates a new Sound. A sound can be loaded from an audio file, or it can be created empty with capacity for a certain number of audio frames.\n\nWhen loading audio from a file, use the `decode` option to control whether compressed audio should remain compressed or immediately get decoded to raw samples.\n\nWhen creating an empty sound, the `contents` parameter can be set to `'stream'` to create an audio stream. On streams, `Sound:setFrames` will always write to the end of the stream, and `Sound:getFrames` will always read the oldest samples from the beginning. The number of frames in the sound is the total capacity of the stream's buffer.",
  5488. key = "lovr.data.newSound",
  5489. module = "lovr.data",
  5490. notes = "It is highly recommended to use an audio format that matches the format of the audio module: `f32` sample formats at a sample rate of 48000, with 1 channel for spatialized sources or 2 channels for unspatialized sources. This will avoid the need to convert audio during playback, which boosts performance of the audio thread.\n\nThe WAV importer supports 16, 24, and 32 bit integer data and 32 bit floating point data. The data must be mono, stereo, or 4-channel full-sphere ambisonic. The `WAVE_FORMAT_EXTENSIBLE` extension is supported.\n\nAmbisonic channel layouts are supported for import (but not yet for playback). Ambisonic data can be loaded from WAV files. It must be first-order full-sphere ambisonic data with 4 channels. If the WAV has a `WAVE_FORMAT_EXTENSIBLE` chunk with an `AMBISONIC_B_FORMAT` format GUID, then the data is understood as using the AMB format with Furse-Malham channel ordering and normalization. *All other* 4-channel files are assumed to be using the AmbiX format with ACN channel ordering and SN3D normalization. AMB files will get automatically converted to AmbiX on import, so ambisonic Sounds will always be in a consistent format.\n\nOGG and MP3 files will always have the `f32` format when loaded.",
  5491. variants = {
  5492. {
  5493. description = "Create a raw or stream Sound from a frame count and format info:",
  5494. arguments = {
  5495. {
  5496. name = "frames",
  5497. type = "number",
  5498. description = "The number of frames the Sound can hold."
  5499. },
  5500. {
  5501. name = "format",
  5502. type = "SampleFormat",
  5503. description = "The sample data type.",
  5504. default = "'f32'"
  5505. },
  5506. {
  5507. name = "channels",
  5508. type = "ChannelLayout",
  5509. description = "The channel layout.",
  5510. default = "'stereo'"
  5511. },
  5512. {
  5513. name = "sampleRate",
  5514. type = "number",
  5515. description = "The sample rate, in Hz.",
  5516. default = "48000"
  5517. },
  5518. {
  5519. name = "contents",
  5520. type = "*",
  5521. description = "A Blob containing raw audio samples to use as the initial contents, 'stream' to create an audio stream, or `nil` to leave the data initialized to zero.",
  5522. default = "nil"
  5523. }
  5524. },
  5525. returns = {
  5526. {
  5527. name = "sound",
  5528. type = "Sound",
  5529. description = "Sounds good."
  5530. }
  5531. }
  5532. },
  5533. {
  5534. description = "Load a sound from a file. Compressed audio formats (OGG, MP3) can optionally be decoded into raw sounds.",
  5535. arguments = {
  5536. {
  5537. name = "filename",
  5538. type = "string",
  5539. description = "The filename of a sound to load."
  5540. },
  5541. {
  5542. name = "decode",
  5543. type = "boolean",
  5544. description = "Whether compressed audio files should be immediately decoded."
  5545. }
  5546. },
  5547. returns = {
  5548. {
  5549. name = "sound",
  5550. type = "Sound",
  5551. description = "Sounds good."
  5552. }
  5553. }
  5554. },
  5555. {
  5556. description = "Load a sound from a Blob containing the data of an audio file. Compressed audio formats (OGG, MP3) can optionally be decoded into raw sounds.\n\nIf the Blob contains raw audio samples, use the first variant instead of this one.",
  5557. arguments = {
  5558. {
  5559. name = "blob",
  5560. type = "Blob",
  5561. description = "The Blob containing audio file data to load."
  5562. },
  5563. {
  5564. name = "decode",
  5565. type = "boolean",
  5566. description = "Whether compressed audio files should be immediately decoded."
  5567. }
  5568. },
  5569. returns = {
  5570. {
  5571. name = "sound",
  5572. type = "Sound",
  5573. description = "Sounds good."
  5574. }
  5575. }
  5576. }
  5577. }
  5578. }
  5579. },
  5580. enums = {
  5581. {
  5582. name = "AnimationProperty",
  5583. summary = "Different animated properties.",
  5584. description = "This indicates the different transform properties that can be animated.",
  5585. key = "AnimationProperty",
  5586. module = "lovr.data",
  5587. values = {
  5588. {
  5589. name = "translation",
  5590. description = "Node translation."
  5591. },
  5592. {
  5593. name = "rotation",
  5594. description = "Node rotation."
  5595. },
  5596. {
  5597. name = "scale",
  5598. description = "Node scale."
  5599. }
  5600. }
  5601. },
  5602. {
  5603. name = "AttributeType",
  5604. summary = "Data types for vertex attributes in meshes.",
  5605. description = "These are the data types that can be used by vertex data in meshes.",
  5606. key = "AttributeType",
  5607. module = "lovr.data",
  5608. values = {
  5609. {
  5610. name = "i8",
  5611. description = "Signed 8 bit integers (-128 to 127)."
  5612. },
  5613. {
  5614. name = "u8",
  5615. description = "Unsigned 8 bit integers (0 to 255)."
  5616. },
  5617. {
  5618. name = "i16",
  5619. description = "Signed 16 bit integers (-32768 to 32767)."
  5620. },
  5621. {
  5622. name = "u16",
  5623. description = "Unsigned 16 bit integers (0 to 65535)."
  5624. },
  5625. {
  5626. name = "i32",
  5627. description = "Signed 32 bit integers (-2147483648 to 2147483647)."
  5628. },
  5629. {
  5630. name = "u32",
  5631. description = "Unsigned 32 bit integers (0 to 429467295)."
  5632. },
  5633. {
  5634. name = "f32",
  5635. description = "Floating point numbers."
  5636. }
  5637. }
  5638. },
  5639. {
  5640. name = "ChannelLayout",
  5641. summary = "Different channel layouts for Sounds.",
  5642. description = "Sounds can have different numbers of channels, and those channels can map to various speaker layouts.",
  5643. key = "ChannelLayout",
  5644. module = "lovr.data",
  5645. related = {
  5646. "lovr.data.newSound",
  5647. "Sound:getFormat"
  5648. },
  5649. values = {
  5650. {
  5651. name = "mono",
  5652. description = "1 channel."
  5653. },
  5654. {
  5655. name = "stereo",
  5656. description = "2 channels. The first channel is for the left speaker and the second is for the right."
  5657. },
  5658. {
  5659. name = "ambisonic",
  5660. description = "4 channels. Ambisonic channels don't map directly to speakers but instead represent directions in 3D space, sort of like the images of a skybox. Currently, ambisonic sounds can only be loaded, not played."
  5661. }
  5662. }
  5663. },
  5664. {
  5665. name = "DefaultAttribute",
  5666. summary = "Attributes that can be loaded from a model.",
  5667. description = "These are the different types of attributes that may be present in meshes loaded from models.",
  5668. key = "DefaultAttribute",
  5669. module = "lovr.data",
  5670. values = {
  5671. {
  5672. name = "position",
  5673. description = "Vertex positions."
  5674. },
  5675. {
  5676. name = "normal",
  5677. description = "Vertex normal vectors."
  5678. },
  5679. {
  5680. name = "uv",
  5681. description = "Vertex texture coordinates."
  5682. },
  5683. {
  5684. name = "color",
  5685. description = "Vertex colors."
  5686. },
  5687. {
  5688. name = "tangent",
  5689. description = "Vertex tangent vectors."
  5690. },
  5691. {
  5692. name = "joints",
  5693. description = "Vertex joint indices."
  5694. },
  5695. {
  5696. name = "weights",
  5697. description = "Vertex joint weights."
  5698. }
  5699. }
  5700. },
  5701. {
  5702. name = "DrawMode",
  5703. summary = "Different draw modes for meshes in ModelDatas.",
  5704. description = "The DrawMode of a mesh determines how its vertices are connected together.",
  5705. key = "DrawMode",
  5706. module = "lovr.data",
  5707. related = {
  5708. "ModelData:getMeshDrawMode"
  5709. },
  5710. values = {
  5711. {
  5712. name = "points",
  5713. description = "Each vertex is draw as a single point."
  5714. },
  5715. {
  5716. name = "lines",
  5717. description = "Every pair of vertices is drawn as a line."
  5718. },
  5719. {
  5720. name = "linestrip",
  5721. description = "Draws a single line through all of the vertices."
  5722. },
  5723. {
  5724. name = "lineloop",
  5725. description = "Draws a single line through all of the vertices, then connects back to the first vertex."
  5726. },
  5727. {
  5728. name = "strip",
  5729. description = "Vertices are rendered as triangles. After the first 3 vertices, each subsequent vertex connects to the previous two."
  5730. },
  5731. {
  5732. name = "triangles",
  5733. description = "Every 3 vertices forms a triangle."
  5734. },
  5735. {
  5736. name = "fan",
  5737. description = "Vertices are rendered as triangles. After the first 3 vertices, each subsequent vertex is connected to the previous vertex and the first vertex."
  5738. }
  5739. }
  5740. },
  5741. {
  5742. name = "SampleFormat",
  5743. summary = "Different data types for samples in a Sound.",
  5744. description = "Sounds can store audio samples as 16 bit integers or 32 bit floats.",
  5745. key = "SampleFormat",
  5746. module = "lovr.data",
  5747. related = {
  5748. "lovr.data.newSound",
  5749. "Sound:getFormat"
  5750. },
  5751. values = {
  5752. {
  5753. name = "f32",
  5754. description = "32 bit floating point samples (between -1.0 and 1.0)."
  5755. },
  5756. {
  5757. name = "i16",
  5758. description = "16 bit integer samples (between -32768 and 32767)."
  5759. }
  5760. }
  5761. },
  5762. {
  5763. name = "SmoothMode",
  5764. summary = "Different ways to interpolate between animation keyframes.",
  5765. description = "Different ways to interpolate between animation keyframes.",
  5766. key = "SmoothMode",
  5767. module = "lovr.data",
  5768. values = {
  5769. {
  5770. name = "step",
  5771. description = "The animated property will snap to the nearest keyframe."
  5772. },
  5773. {
  5774. name = "linear",
  5775. description = "The animated property will linearly interpolate between keyframes."
  5776. },
  5777. {
  5778. name = "cubic",
  5779. description = "The animated property will follow a smooth curve between nearby keyframes."
  5780. }
  5781. }
  5782. },
  5783. {
  5784. name = "TextureFormat",
  5785. description = "Different data layouts for pixels in `Image` and `Texture` objects.\n\nFormats starting with `d` are depth formats, used for depth/stencil render targets.\n\nFormats starting with `bc` and `astc` are compressed formats. Compressed formats have better performance since they stay compressed on the CPU and GPU, reducing the amount of memory bandwidth required to look up all the pixels needed for shading.\n\nFormats without the `f` suffix are unsigned normalized formats, which store values in the range `[0,1]`. The `f` suffix indicates a floating point format which can store values outside this range, and is used for HDR rendering or storing data in a texture.",
  5786. key = "TextureFormat",
  5787. module = "lovr.data",
  5788. values = {
  5789. {
  5790. name = "r8",
  5791. description = "One 8-bit channel. 1 byte per pixel."
  5792. },
  5793. {
  5794. name = "rg8",
  5795. description = "Two 8-bit channels. 2 bytes per pixel."
  5796. },
  5797. {
  5798. name = "rgba8",
  5799. description = "Four 8-bit channels. 4 bytes per pixel."
  5800. },
  5801. {
  5802. name = "r16",
  5803. description = "One 16-bit channel. 2 bytes per pixel."
  5804. },
  5805. {
  5806. name = "rg16",
  5807. description = "Two 16-bit channels. 4 bytes per pixel."
  5808. },
  5809. {
  5810. name = "rgba16",
  5811. description = "Four 16-bit channels. 8 bytes per pixel."
  5812. },
  5813. {
  5814. name = "r16f",
  5815. description = "One 16-bit floating point channel. 2 bytes per pixel."
  5816. },
  5817. {
  5818. name = "rg16f",
  5819. description = "Two 16-bit floating point channels. 4 bytes per pixel."
  5820. },
  5821. {
  5822. name = "rgba16f",
  5823. description = "Four 16-bit floating point channels. 8 bytes per pixel."
  5824. },
  5825. {
  5826. name = "r32f",
  5827. description = "One 32-bit floating point channel. 4 bytes per pixel."
  5828. },
  5829. {
  5830. name = "rg32f",
  5831. description = "Two 32-bit floating point channels. 8 bytes per pixel."
  5832. },
  5833. {
  5834. name = "rgba32f",
  5835. description = "Four 32-bit floating point channels. 16 bytes per pixel."
  5836. },
  5837. {
  5838. name = "rgb565",
  5839. description = "Packs three channels into 16 bits. 2 bytes per pixel."
  5840. },
  5841. {
  5842. name = "rgb5a1",
  5843. description = "Packs four channels into 16 bits, with \"cutout\" alpha. 2 bytes per pixel."
  5844. },
  5845. {
  5846. name = "rgb10a2",
  5847. description = "Packs four channels into 32 bits. 4 bytes per pixel."
  5848. },
  5849. {
  5850. name = "rg11b10f",
  5851. description = "Packs three unsigned floating point channels into 32 bits. 4 bytes per pixel."
  5852. },
  5853. {
  5854. name = "d16",
  5855. description = "One 16-bit depth channel. 2 bytes per pixel."
  5856. },
  5857. {
  5858. name = "d24s8",
  5859. description = "One 24-bit depth channel and one 8-bit stencil channel. 4 bytes per pixel."
  5860. },
  5861. {
  5862. name = "d32f",
  5863. description = "One 32-bit floating point depth channel. 4 bytes per pixel."
  5864. },
  5865. {
  5866. name = "bc1",
  5867. description = "3 channels. 8 bytes per 4x4 block, or 0.5 bytes per pixel. Good for opaque images."
  5868. },
  5869. {
  5870. name = "bc2",
  5871. description = "Four channels. 16 bytes per 4x4 block or 1 byte per pixel. Not good for anything, because it only has 16 distinct levels of alpha."
  5872. },
  5873. {
  5874. name = "bc3",
  5875. description = "Four channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for color images with transparency."
  5876. },
  5877. {
  5878. name = "bc4u",
  5879. description = "One unsigned normalized channel. 8 bytes per 4x4 block or 0.5 bytes per pixel. Good for grayscale images, like heightmaps."
  5880. },
  5881. {
  5882. name = "bc4s",
  5883. description = "One signed normalized channel. 8 bytes per 4x4 block or 0.5 bytes per pixel. Similar to bc4u but has a range of -1 to 1."
  5884. },
  5885. {
  5886. name = "bc5u",
  5887. description = "Two unsigned normalized channels. 16 bytes per 4x4 block, or 1 byte per pixel. Good for normal maps."
  5888. },
  5889. {
  5890. name = "bc5s",
  5891. description = "Two signed normalized channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for normal maps."
  5892. },
  5893. {
  5894. name = "bc6uf",
  5895. description = "Three unsigned floating point channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for HDR images."
  5896. },
  5897. {
  5898. name = "bc6sf",
  5899. description = "Three floating point channels. 16 bytes per 4x4 block or 1 byte per pixel. Good for HDR images."
  5900. },
  5901. {
  5902. name = "bc7",
  5903. description = "Four channels. 16 bytes per 4x4 block or 1 byte per pixel. High quality. Good for most color images, including transparency."
  5904. },
  5905. {
  5906. name = "astc4x4",
  5907. description = "Four channels, 16 bytes per 4x4 block or 1 byte per pixel."
  5908. },
  5909. {
  5910. name = "astc5x4",
  5911. description = "Four channels, 16 bytes per 5x4 block or 0.80 bytes per pixel."
  5912. },
  5913. {
  5914. name = "astc5x5",
  5915. description = "Four channels, 16 bytes per 5x5 block or 0.64 bytes per pixel."
  5916. },
  5917. {
  5918. name = "astc6x5",
  5919. description = "Four channels, 16 bytes per 6x5 block or 0.53 bytes per pixel."
  5920. },
  5921. {
  5922. name = "astc6x6",
  5923. description = "Four channels, 16 bytes per 6x6 block or 0.44 bytes per pixel."
  5924. },
  5925. {
  5926. name = "astc8x5",
  5927. description = "Four channels, 16 bytes per 8x5 block or 0.40 bytes per pixel."
  5928. },
  5929. {
  5930. name = "astc8x6",
  5931. description = "Four channels, 16 bytes per 8x6 block or 0.33 bytes per pixel."
  5932. },
  5933. {
  5934. name = "astc8x8",
  5935. description = "Four channels, 16 bytes per 8x8 block or 0.25 bytes per pixel."
  5936. },
  5937. {
  5938. name = "astc10x5",
  5939. description = "Four channels, 16 bytes per 10x5 block or 0.32 bytes per pixel."
  5940. },
  5941. {
  5942. name = "astc10x6",
  5943. description = "Four channels, 16 bytes per 10x6 block or 0.27 bytes per pixel."
  5944. },
  5945. {
  5946. name = "astc10x8",
  5947. description = "Four channels, 16 bytes per 10x8 block or 0.20 bytes per pixel."
  5948. },
  5949. {
  5950. name = "astc10x10",
  5951. description = "Four channels, 16 bytes per 10x10 block or 0.16 bytes per pixel."
  5952. },
  5953. {
  5954. name = "astc12x10",
  5955. description = "Four channels, 16 bytes per 12x10 block or 0.13 bytes per pixel."
  5956. },
  5957. {
  5958. name = "astc12x12",
  5959. description = "Four channels, 16 bytes per 12x12 block or 0.11 bytes per pixel."
  5960. }
  5961. }
  5962. }
  5963. }
  5964. },
  5965. {
  5966. name = "event",
  5967. tag = "modules",
  5968. summary = "Handles events from the operating system.",
  5969. description = "The `lovr.event` module handles events from the operating system.\n\nDue to its low-level nature, it's rare to use `lovr.event` in simple projects.",
  5970. key = "lovr.event",
  5971. enums = {
  5972. {
  5973. name = "KeyCode",
  5974. summary = "Keys that can be pressed.",
  5975. description = "Keys that can be pressed on a keyboard. Notably, numpad keys are missing right now.",
  5976. key = "KeyCode",
  5977. module = "lovr.event",
  5978. related = {
  5979. "lovr.keypressed",
  5980. "lovr.keyreleased"
  5981. },
  5982. values = {
  5983. {
  5984. name = "a",
  5985. description = "The A key."
  5986. },
  5987. {
  5988. name = "b",
  5989. description = "The B key."
  5990. },
  5991. {
  5992. name = "c",
  5993. description = "The C key."
  5994. },
  5995. {
  5996. name = "d",
  5997. description = "The D key."
  5998. },
  5999. {
  6000. name = "e",
  6001. description = "The E key."
  6002. },
  6003. {
  6004. name = "f",
  6005. description = "The F key."
  6006. },
  6007. {
  6008. name = "g",
  6009. description = "The G key."
  6010. },
  6011. {
  6012. name = "h",
  6013. description = "The H key."
  6014. },
  6015. {
  6016. name = "i",
  6017. description = "The I key."
  6018. },
  6019. {
  6020. name = "j",
  6021. description = "The J key."
  6022. },
  6023. {
  6024. name = "k",
  6025. description = "The K key."
  6026. },
  6027. {
  6028. name = "l",
  6029. description = "The L key."
  6030. },
  6031. {
  6032. name = "m",
  6033. description = "The M key."
  6034. },
  6035. {
  6036. name = "n",
  6037. description = "The N key."
  6038. },
  6039. {
  6040. name = "o",
  6041. description = "The O key."
  6042. },
  6043. {
  6044. name = "p",
  6045. description = "The P key."
  6046. },
  6047. {
  6048. name = "q",
  6049. description = "The Q key."
  6050. },
  6051. {
  6052. name = "r",
  6053. description = "The R key."
  6054. },
  6055. {
  6056. name = "s",
  6057. description = "The S key."
  6058. },
  6059. {
  6060. name = "t",
  6061. description = "The T key."
  6062. },
  6063. {
  6064. name = "u",
  6065. description = "The U key."
  6066. },
  6067. {
  6068. name = "v",
  6069. description = "The V key."
  6070. },
  6071. {
  6072. name = "w",
  6073. description = "The W key."
  6074. },
  6075. {
  6076. name = "x",
  6077. description = "The X key."
  6078. },
  6079. {
  6080. name = "y",
  6081. description = "The Y key."
  6082. },
  6083. {
  6084. name = "z",
  6085. description = "The Z key."
  6086. },
  6087. {
  6088. name = "0",
  6089. description = "The 0 key."
  6090. },
  6091. {
  6092. name = "1",
  6093. description = "The 1 key."
  6094. },
  6095. {
  6096. name = "2",
  6097. description = "The 2 key."
  6098. },
  6099. {
  6100. name = "3",
  6101. description = "The 3 key."
  6102. },
  6103. {
  6104. name = "4",
  6105. description = "The 4 key."
  6106. },
  6107. {
  6108. name = "5",
  6109. description = "The 5 key."
  6110. },
  6111. {
  6112. name = "6",
  6113. description = "The 6 key."
  6114. },
  6115. {
  6116. name = "7",
  6117. description = "The 7 key."
  6118. },
  6119. {
  6120. name = "8",
  6121. description = "The 8 key."
  6122. },
  6123. {
  6124. name = "9",
  6125. description = "The 9 key."
  6126. },
  6127. {
  6128. name = "space",
  6129. description = "The space bar."
  6130. },
  6131. {
  6132. name = "return",
  6133. description = "The enter key."
  6134. },
  6135. {
  6136. name = "tab",
  6137. description = "The tab key."
  6138. },
  6139. {
  6140. name = "escape",
  6141. description = "The escape key."
  6142. },
  6143. {
  6144. name = "backspace",
  6145. description = "The backspace key."
  6146. },
  6147. {
  6148. name = "up",
  6149. description = "The up arrow key."
  6150. },
  6151. {
  6152. name = "down",
  6153. description = "The down arrow key."
  6154. },
  6155. {
  6156. name = "left",
  6157. description = "The left arrow key."
  6158. },
  6159. {
  6160. name = "right",
  6161. description = "The right arrow key."
  6162. },
  6163. {
  6164. name = "home",
  6165. description = "The home key."
  6166. },
  6167. {
  6168. name = "end",
  6169. description = "The end key."
  6170. },
  6171. {
  6172. name = "pageup",
  6173. description = "The page up key."
  6174. },
  6175. {
  6176. name = "pagedown",
  6177. description = "The page down key."
  6178. },
  6179. {
  6180. name = "insert",
  6181. description = "The insert key."
  6182. },
  6183. {
  6184. name = "delete",
  6185. description = "The delete key."
  6186. },
  6187. {
  6188. name = "f1",
  6189. description = "The F1 key."
  6190. },
  6191. {
  6192. name = "f2",
  6193. description = "The F2 key."
  6194. },
  6195. {
  6196. name = "f3",
  6197. description = "The F3 key."
  6198. },
  6199. {
  6200. name = "f4",
  6201. description = "The F4 key."
  6202. },
  6203. {
  6204. name = "f5",
  6205. description = "The F5 key."
  6206. },
  6207. {
  6208. name = "f6",
  6209. description = "The F6 key."
  6210. },
  6211. {
  6212. name = "f7",
  6213. description = "The F7 key."
  6214. },
  6215. {
  6216. name = "f8",
  6217. description = "The F8 key."
  6218. },
  6219. {
  6220. name = "f9",
  6221. description = "The F9 key."
  6222. },
  6223. {
  6224. name = "f10",
  6225. description = "The F10 key."
  6226. },
  6227. {
  6228. name = "f11",
  6229. description = "The F11 key."
  6230. },
  6231. {
  6232. name = "f12",
  6233. description = "The F12 key."
  6234. },
  6235. {
  6236. name = "`",
  6237. description = "The backtick/backquote/grave accent key."
  6238. },
  6239. {
  6240. name = "-",
  6241. description = "The dash/hyphen/minus key."
  6242. },
  6243. {
  6244. name = "=",
  6245. description = "The equal sign key."
  6246. },
  6247. {
  6248. name = "[",
  6249. description = "The left bracket key."
  6250. },
  6251. {
  6252. name = "]",
  6253. description = "The right bracket key."
  6254. },
  6255. {
  6256. name = "\\",
  6257. description = "The backslash key."
  6258. },
  6259. {
  6260. name = ";",
  6261. description = "The semicolon key."
  6262. },
  6263. {
  6264. name = "'",
  6265. description = "The single quote key."
  6266. },
  6267. {
  6268. name = ",",
  6269. description = "The comma key."
  6270. },
  6271. {
  6272. name = ".",
  6273. description = "The period key."
  6274. },
  6275. {
  6276. name = "/",
  6277. description = "The slash key."
  6278. },
  6279. {
  6280. name = "lctrl",
  6281. description = "The left control key."
  6282. },
  6283. {
  6284. name = "lshift",
  6285. description = "The left shift key."
  6286. },
  6287. {
  6288. name = "lalt",
  6289. description = "The left alt key."
  6290. },
  6291. {
  6292. name = "lgui",
  6293. description = "The left OS key (windows, command, super)."
  6294. },
  6295. {
  6296. name = "rctrl",
  6297. description = "The right control key."
  6298. },
  6299. {
  6300. name = "rshift",
  6301. description = "The right shift key."
  6302. },
  6303. {
  6304. name = "ralt",
  6305. description = "The right alt key."
  6306. },
  6307. {
  6308. name = "rgui",
  6309. description = "The right OS key (windows, command, super)."
  6310. },
  6311. {
  6312. name = "capslock",
  6313. description = "The caps lock key."
  6314. },
  6315. {
  6316. name = "scrolllock",
  6317. description = "The scroll lock key."
  6318. },
  6319. {
  6320. name = "numlock",
  6321. description = "The numlock key."
  6322. }
  6323. }
  6324. }
  6325. },
  6326. examples = {
  6327. {
  6328. description = "Adding a custom event.",
  6329. code = "function lovr.load()\n lovr.handlers['customevent'] = function(a, b, c)\n print('custom event handled with args:', a, b, c)\n end\n\n lovr.event.push('customevent', 1, 2, 3)\nend"
  6330. }
  6331. },
  6332. functions = {
  6333. {
  6334. name = "clear",
  6335. summary = "Clear the event queue.",
  6336. description = "Clears the event queue, removing any unprocessed events.",
  6337. key = "lovr.event.clear",
  6338. module = "lovr.event",
  6339. variants = {
  6340. {
  6341. arguments = {},
  6342. returns = {}
  6343. }
  6344. }
  6345. },
  6346. {
  6347. name = "poll",
  6348. summary = "Iterate over unprocessed events in the queue.",
  6349. description = "This function returns a Lua iterator for all of the unprocessed items in the event queue. Each event consists of a name as a string, followed by event-specific arguments. This function is called in the default implementation of `lovr.run`, so it is normally not necessary to poll for events yourself.",
  6350. key = "lovr.event.poll",
  6351. module = "lovr.event",
  6352. variants = {
  6353. {
  6354. arguments = {},
  6355. returns = {
  6356. {
  6357. name = "iterator",
  6358. type = "function",
  6359. description = "The iterator function, usable in a for loop.",
  6360. arguments = {},
  6361. returns = {}
  6362. }
  6363. }
  6364. }
  6365. }
  6366. },
  6367. {
  6368. name = "pump",
  6369. summary = "Pump new events into the queue for processing.",
  6370. description = "Fills the event queue with unprocessed events from the operating system. This function should be called often, otherwise the operating system will consider the application unresponsive. This function is called in the default implementation of `lovr.run`.",
  6371. key = "lovr.event.pump",
  6372. module = "lovr.event",
  6373. related = {
  6374. "lovr.event.poll"
  6375. },
  6376. variants = {
  6377. {
  6378. arguments = {},
  6379. returns = {}
  6380. }
  6381. }
  6382. },
  6383. {
  6384. name = "push",
  6385. summary = "Manually push an event onto the queue.",
  6386. description = "Pushes an event onto the event queue. It will be processed the next time `lovr.event.poll` is called. For an event to be processed properly, there needs to be a function in the `lovr.handlers` table with a key that's the same as the event name.",
  6387. key = "lovr.event.push",
  6388. module = "lovr.event",
  6389. notes = "Only nil, booleans, numbers, strings, and LÖVR objects are supported types for event data.",
  6390. variants = {
  6391. {
  6392. arguments = {
  6393. {
  6394. name = "name",
  6395. type = "string",
  6396. description = "The name of the event."
  6397. }
  6398. },
  6399. returns = {}
  6400. }
  6401. },
  6402. related = {
  6403. "lovr.event.poll",
  6404. "lovr.event.quit"
  6405. }
  6406. },
  6407. {
  6408. name = "quit",
  6409. summary = "Quit the application.",
  6410. description = "Pushes an event to quit. An optional number can be passed to set the exit code for the application. An exit code of zero indicates normal termination, whereas a nonzero exit code indicates that an error occurred.",
  6411. key = "lovr.event.quit",
  6412. module = "lovr.event",
  6413. notes = "This function is equivalent to calling `lovr.event.push('quit', <args>)`.\n\nThe event won't be processed until the next time `lovr.event.poll` is called.\n\nThe `lovr.quit` callback will be called when the event is processed, which can be used to do any cleanup work. The callback can also return `false` to abort the quitting process.",
  6414. variants = {
  6415. {
  6416. arguments = {
  6417. {
  6418. name = "code",
  6419. type = "number",
  6420. description = "The exit code of the program.",
  6421. default = "0"
  6422. }
  6423. },
  6424. returns = {}
  6425. }
  6426. },
  6427. related = {
  6428. "lovr.quit",
  6429. "lovr.event.poll",
  6430. "lovr.event.restart"
  6431. }
  6432. },
  6433. {
  6434. name = "restart",
  6435. summary = "Restart the application.",
  6436. description = "Pushes an event to restart the framework.",
  6437. key = "lovr.event.restart",
  6438. module = "lovr.event",
  6439. notes = "The event won't be processed until the next time `lovr.event.poll` is called.\n\nThe `lovr.restart` callback can be used to persist a value between restarts.",
  6440. variants = {
  6441. {
  6442. arguments = {},
  6443. returns = {}
  6444. }
  6445. },
  6446. related = {
  6447. "lovr.restart",
  6448. "lovr.event.poll",
  6449. "lovr.event.quit"
  6450. }
  6451. }
  6452. },
  6453. objects = {},
  6454. notes = "You can define your own custom events by adding a function to the `lovr.handlers` table with a key of the name of the event you want to add. Then, push the event using `lovr.event.push`."
  6455. },
  6456. {
  6457. name = "filesystem",
  6458. tag = "modules",
  6459. summary = "Provides access to the filesystem.",
  6460. description = "The `lovr.filesystem` module provides access to the filesystem.",
  6461. key = "lovr.filesystem",
  6462. enums = {},
  6463. objects = {},
  6464. functions = {
  6465. {
  6466. name = "append",
  6467. summary = "Append content to the end of a file.",
  6468. description = "Appends content to the end of a file.",
  6469. key = "lovr.filesystem.append",
  6470. module = "lovr.filesystem",
  6471. notes = "If the file does not exist, it is created.",
  6472. variants = {
  6473. {
  6474. arguments = {
  6475. {
  6476. name = "filename",
  6477. type = "string",
  6478. description = "The file to append to."
  6479. },
  6480. {
  6481. name = "content",
  6482. type = "string",
  6483. description = "A string to write to the end of the file."
  6484. }
  6485. },
  6486. returns = {
  6487. {
  6488. name = "bytes",
  6489. type = "number",
  6490. description = "The number of bytes actually appended to the file."
  6491. }
  6492. }
  6493. },
  6494. {
  6495. arguments = {
  6496. {
  6497. name = "filename",
  6498. type = "string",
  6499. description = "The file to append to."
  6500. },
  6501. {
  6502. name = "blob",
  6503. type = "Blob",
  6504. description = "A Blob containing data to append to the file."
  6505. }
  6506. },
  6507. returns = {
  6508. {
  6509. name = "bytes",
  6510. type = "number",
  6511. description = "The number of bytes actually appended to the file."
  6512. }
  6513. }
  6514. }
  6515. }
  6516. },
  6517. {
  6518. name = "createDirectory",
  6519. summary = "Create a directory.",
  6520. description = "Creates a directory in the save directory. Any parent directories that don't exist will also be created.",
  6521. key = "lovr.filesystem.createDirectory",
  6522. module = "lovr.filesystem",
  6523. variants = {
  6524. {
  6525. arguments = {
  6526. {
  6527. name = "path",
  6528. type = "string",
  6529. description = "The directory to create, recursively."
  6530. }
  6531. },
  6532. returns = {
  6533. {
  6534. name = "success",
  6535. type = "boolean",
  6536. description = "Whether the directory was created."
  6537. }
  6538. }
  6539. }
  6540. }
  6541. },
  6542. {
  6543. name = "getAppdataDirectory",
  6544. summary = "Get the application data directory.",
  6545. description = "Returns the application data directory. This will be something like:\n\n- `C:\\Users\\user\\AppData\\Roaming` on Windows.\n- `/home/user/.config` on Linux.\n- `/Users/user/Library/Application Support` on macOS.",
  6546. key = "lovr.filesystem.getAppdataDirectory",
  6547. module = "lovr.filesystem",
  6548. variants = {
  6549. {
  6550. arguments = {},
  6551. returns = {
  6552. {
  6553. name = "path",
  6554. type = "string",
  6555. description = "The absolute path to the appdata directory."
  6556. }
  6557. }
  6558. }
  6559. }
  6560. },
  6561. {
  6562. name = "getDirectoryItems",
  6563. summary = "Get a list of files in a directory.",
  6564. description = "Returns a sorted table containing all files and folders in a single directory.",
  6565. key = "lovr.filesystem.getDirectoryItems",
  6566. module = "lovr.filesystem",
  6567. notes = "This function calls `table.sort` to sort the results, so if `table.sort` is not available in the global scope the results are not guaranteed to be sorted.",
  6568. variants = {
  6569. {
  6570. arguments = {
  6571. {
  6572. name = "path",
  6573. type = "string",
  6574. description = "The directory."
  6575. }
  6576. },
  6577. returns = {
  6578. {
  6579. name = "table",
  6580. type = "items",
  6581. description = "A table with a string for each file and subfolder in the directory."
  6582. }
  6583. }
  6584. }
  6585. }
  6586. },
  6587. {
  6588. name = "getExecutablePath",
  6589. summary = "Get the path of the LÖVR executable.",
  6590. description = "Returns the absolute path of the LÖVR executable.",
  6591. key = "lovr.filesystem.getExecutablePath",
  6592. module = "lovr.filesystem",
  6593. variants = {
  6594. {
  6595. arguments = {},
  6596. returns = {
  6597. {
  6598. name = "path",
  6599. type = "string",
  6600. description = "The absolute path of the LÖVR executable, or `nil` if it is unknown."
  6601. }
  6602. }
  6603. }
  6604. }
  6605. },
  6606. {
  6607. name = "getIdentity",
  6608. summary = "Get the name of the save directory.",
  6609. description = "Returns the identity of the game, which is used as the name of the save directory. The default is `default`. It can be changed using `t.identity` in `lovr.conf`.",
  6610. key = "lovr.filesystem.getIdentity",
  6611. module = "lovr.filesystem",
  6612. notes = "On Android, this is always the package id (like `org.lovr.app`).",
  6613. variants = {
  6614. {
  6615. arguments = {},
  6616. returns = {
  6617. {
  6618. name = "identity",
  6619. type = "string",
  6620. description = "The name of the save directory, or `nil` if it isn't set."
  6621. }
  6622. }
  6623. }
  6624. }
  6625. },
  6626. {
  6627. name = "getLastModified",
  6628. summary = "Get the modification time of a file.",
  6629. description = "Returns when a file was last modified, since some arbitrary time in the past.",
  6630. key = "lovr.filesystem.getLastModified",
  6631. module = "lovr.filesystem",
  6632. variants = {
  6633. {
  6634. arguments = {
  6635. {
  6636. name = "path",
  6637. type = "string",
  6638. description = "The file to check."
  6639. }
  6640. },
  6641. returns = {
  6642. {
  6643. name = "time",
  6644. type = "number",
  6645. description = "The modification time of the file, in seconds, or `nil` if it's unknown."
  6646. }
  6647. }
  6648. }
  6649. }
  6650. },
  6651. {
  6652. name = "getRealDirectory",
  6653. summary = "Get the absolute path to a file.",
  6654. description = "Get the absolute path of the mounted archive containing a path in the virtual filesystem. This can be used to determine if a file is in the game's source directory or the save directory.",
  6655. key = "lovr.filesystem.getRealDirectory",
  6656. module = "lovr.filesystem",
  6657. variants = {
  6658. {
  6659. arguments = {
  6660. {
  6661. name = "path",
  6662. type = "string",
  6663. description = "The path to check."
  6664. }
  6665. },
  6666. returns = {
  6667. {
  6668. name = "realpath",
  6669. type = "string",
  6670. description = "The absolute path of the mounted archive containing `path`."
  6671. }
  6672. }
  6673. }
  6674. }
  6675. },
  6676. {
  6677. name = "getRequirePath",
  6678. summary = "Get the require path.",
  6679. description = "Returns the require path. The require path is a semicolon-separated list of patterns that LÖVR will use to search for files when they are `require`d. Any question marks in the pattern will be replaced with the module that is being required. It is similar to Lua\\'s `package.path` variable, but the main difference is that the patterns are relative to the virtual filesystem.",
  6680. key = "lovr.filesystem.getRequirePath",
  6681. module = "lovr.filesystem",
  6682. notes = "The default reqiure path is '?.lua;?/init.lua'.",
  6683. variants = {
  6684. {
  6685. arguments = {},
  6686. returns = {
  6687. {
  6688. name = "path",
  6689. type = "string",
  6690. description = "The semicolon separated list of search patterns."
  6691. }
  6692. }
  6693. }
  6694. }
  6695. },
  6696. {
  6697. name = "getSaveDirectory",
  6698. summary = "Get the location of the save directory.",
  6699. description = "Returns the absolute path to the save directory.",
  6700. key = "lovr.filesystem.getSaveDirectory",
  6701. module = "lovr.filesystem",
  6702. notes = "The save directory takes the following form:\n\n``` <appdata>/LOVR/<identity> ```\n\nWhere `<appdata>` is `lovr.filesystem.getAppdataDirectory` and `<identity>` is `lovr.filesystem.getIdentity` and can be customized using `lovr.conf`.",
  6703. variants = {
  6704. {
  6705. arguments = {},
  6706. returns = {
  6707. {
  6708. name = "path",
  6709. type = "string",
  6710. description = "The absolute path to the save directory."
  6711. }
  6712. }
  6713. }
  6714. },
  6715. related = {
  6716. "lovr.filesystem.getIdentity",
  6717. "lovr.filesystem.getAppdataDirectory"
  6718. }
  6719. },
  6720. {
  6721. name = "getSize",
  6722. summary = "Get the size of a file.",
  6723. description = "Returns the size of a file, in bytes.",
  6724. key = "lovr.filesystem.getSize",
  6725. module = "lovr.filesystem",
  6726. notes = "If the file does not exist, an error is thrown.",
  6727. variants = {
  6728. {
  6729. arguments = {
  6730. {
  6731. name = "file",
  6732. type = "string",
  6733. description = "The file."
  6734. }
  6735. },
  6736. returns = {
  6737. {
  6738. name = "size",
  6739. type = "number",
  6740. description = "The size of the file, in bytes."
  6741. }
  6742. }
  6743. }
  6744. }
  6745. },
  6746. {
  6747. name = "getSource",
  6748. summary = "Get the location of the project source.",
  6749. description = "Get the absolute path of the project's source directory or archive.",
  6750. key = "lovr.filesystem.getSource",
  6751. module = "lovr.filesystem",
  6752. variants = {
  6753. {
  6754. arguments = {},
  6755. returns = {
  6756. {
  6757. name = "path",
  6758. type = "string",
  6759. description = "The absolute path of the project's source, or `nil` if it's unknown."
  6760. }
  6761. }
  6762. }
  6763. }
  6764. },
  6765. {
  6766. name = "getUserDirectory",
  6767. summary = "Get the location of the user's home directory.",
  6768. description = "Returns the absolute path of the user's home directory.",
  6769. key = "lovr.filesystem.getUserDirectory",
  6770. module = "lovr.filesystem",
  6771. variants = {
  6772. {
  6773. arguments = {},
  6774. returns = {
  6775. {
  6776. name = "path",
  6777. type = "string",
  6778. description = "The absolute path of the user's home directory."
  6779. }
  6780. }
  6781. }
  6782. }
  6783. },
  6784. {
  6785. name = "getWorkingDirectory",
  6786. summary = "Get the current working directory.",
  6787. description = "Returns the absolute path of the working directory. Usually this is where the executable was started from.",
  6788. key = "lovr.filesystem.getWorkingDirectory",
  6789. module = "lovr.filesystem",
  6790. variants = {
  6791. {
  6792. arguments = {},
  6793. returns = {
  6794. {
  6795. name = "path",
  6796. type = "string",
  6797. description = "The current working directory, or `nil` if it's unknown."
  6798. }
  6799. }
  6800. }
  6801. }
  6802. },
  6803. {
  6804. name = "isDirectory",
  6805. summary = "Check whether a path is a directory.",
  6806. description = "Check if a path exists and is a directory.",
  6807. key = "lovr.filesystem.isDirectory",
  6808. module = "lovr.filesystem",
  6809. related = {
  6810. "lovr.filesystem.isFile"
  6811. },
  6812. variants = {
  6813. {
  6814. arguments = {
  6815. {
  6816. name = "path",
  6817. type = "string",
  6818. description = "The path to check."
  6819. }
  6820. },
  6821. returns = {
  6822. {
  6823. name = "isDirectory",
  6824. type = "boolean",
  6825. description = "Whether or not the path is a directory."
  6826. }
  6827. }
  6828. }
  6829. }
  6830. },
  6831. {
  6832. name = "isFile",
  6833. summary = "Check whether a path is a file.",
  6834. description = "Check if a path exists and is a file.",
  6835. key = "lovr.filesystem.isFile",
  6836. module = "lovr.filesystem",
  6837. related = {
  6838. "lovr.filesystem.isDirectory"
  6839. },
  6840. variants = {
  6841. {
  6842. arguments = {
  6843. {
  6844. name = "path",
  6845. type = "string",
  6846. description = "The path to check."
  6847. }
  6848. },
  6849. returns = {
  6850. {
  6851. name = "isFile",
  6852. type = "boolean",
  6853. description = "Whether or not the path is a file."
  6854. }
  6855. }
  6856. }
  6857. }
  6858. },
  6859. {
  6860. name = "isFused",
  6861. summary = "Check if the project is fused.",
  6862. description = "Returns whether the current project source is fused to the executable.",
  6863. key = "lovr.filesystem.isFused",
  6864. module = "lovr.filesystem",
  6865. variants = {
  6866. {
  6867. arguments = {},
  6868. returns = {
  6869. {
  6870. name = "fused",
  6871. type = "boolean",
  6872. description = "Whether or not the project is fused."
  6873. }
  6874. }
  6875. }
  6876. }
  6877. },
  6878. {
  6879. name = "load",
  6880. summary = "Load a file as Lua code.",
  6881. description = "Load a file containing Lua code, returning a Lua chunk that can be run.",
  6882. key = "lovr.filesystem.load",
  6883. module = "lovr.filesystem",
  6884. variants = {
  6885. {
  6886. arguments = {
  6887. {
  6888. name = "filename",
  6889. type = "string",
  6890. description = "The file to load."
  6891. }
  6892. },
  6893. returns = {
  6894. {
  6895. name = "chunk",
  6896. type = "function",
  6897. description = "The runnable chunk.",
  6898. arguments = {
  6899. {
  6900. name = "...",
  6901. type = "*"
  6902. }
  6903. },
  6904. returns = {
  6905. {
  6906. name = "...",
  6907. type = "*"
  6908. }
  6909. }
  6910. }
  6911. }
  6912. }
  6913. },
  6914. notes = "An error is thrown if the file contains syntax errors.",
  6915. examples = {
  6916. {
  6917. description = "Safely loading code:",
  6918. code = "local success, chunk = pcall(lovr.filesystem.load, filename)\nif not success then\n print('Oh no! There was an error: ' .. tostring(chunk))\nelse\n local success, result = pcall(chunk)\n print(success, result)\nend"
  6919. }
  6920. }
  6921. },
  6922. {
  6923. name = "mount",
  6924. summary = "Mount a directory or archive.",
  6925. description = "Mounts a directory or `.zip` archive, adding it to the virtual filesystem. This allows you to read files from it.",
  6926. key = "lovr.filesystem.mount",
  6927. module = "lovr.filesystem",
  6928. variants = {
  6929. {
  6930. arguments = {
  6931. {
  6932. name = "path",
  6933. type = "string",
  6934. description = "The path to mount."
  6935. },
  6936. {
  6937. name = "mountpoint",
  6938. type = "string",
  6939. description = "The path in the virtual filesystem to mount to.",
  6940. default = "'/'"
  6941. },
  6942. {
  6943. name = "append",
  6944. type = "boolean",
  6945. description = "Whether the archive will be added to the end or the beginning of the search path.",
  6946. default = "false"
  6947. },
  6948. {
  6949. name = "root",
  6950. type = "string",
  6951. description = "A subdirectory inside the archive to use as the root. If `nil`, the actual root of the archive is used.",
  6952. default = "nil"
  6953. }
  6954. },
  6955. returns = {
  6956. {
  6957. name = "success",
  6958. type = "boolean",
  6959. description = "Whether the archive was successfully mounted."
  6960. }
  6961. }
  6962. }
  6963. },
  6964. notes = "The `append` option lets you control the priority of the archive's files in the event of naming collisions.\n\nThis function is not thread safe. Mounting or unmounting an archive while other threads call lovr.filesystem functions is not supported.",
  6965. related = {
  6966. "lovr.filesystem.unmount"
  6967. },
  6968. examples = {
  6969. {
  6970. description = "Mount `data.zip` with a file `images/background.png`:",
  6971. code = "lovr.filesystem.mount('data.zip', 'assets')\nprint(lovr.filesystem.isFile('assets/images/background.png')) -- true"
  6972. }
  6973. }
  6974. },
  6975. {
  6976. name = "newBlob",
  6977. summary = "Create a new Blob from a file.",
  6978. description = "Creates a new Blob that contains the contents of a file.",
  6979. key = "lovr.filesystem.newBlob",
  6980. module = "lovr.filesystem",
  6981. related = {
  6982. "lovr.data.newBlob",
  6983. "Blob"
  6984. },
  6985. variants = {
  6986. {
  6987. arguments = {
  6988. {
  6989. name = "filename",
  6990. type = "string",
  6991. description = "The file to load."
  6992. }
  6993. },
  6994. returns = {
  6995. {
  6996. name = "blob",
  6997. type = "Blob",
  6998. description = "The new Blob."
  6999. }
  7000. }
  7001. }
  7002. }
  7003. },
  7004. {
  7005. name = "read",
  7006. summary = "Read a file.",
  7007. description = "Read the contents of a file.",
  7008. key = "lovr.filesystem.read",
  7009. module = "lovr.filesystem",
  7010. notes = "If the file does not exist or cannot be read, nil is returned.",
  7011. variants = {
  7012. {
  7013. arguments = {
  7014. {
  7015. name = "filename",
  7016. type = "string",
  7017. description = "The name of the file to read."
  7018. },
  7019. {
  7020. name = "bytes",
  7021. type = "number",
  7022. description = "The number of bytes to read (if -1, all bytes will be read).",
  7023. default = "-1"
  7024. }
  7025. },
  7026. returns = {
  7027. {
  7028. name = "contents",
  7029. type = "string",
  7030. description = "The contents of the file."
  7031. },
  7032. {
  7033. name = "bytes",
  7034. type = "number",
  7035. description = "The number of bytes read from the file."
  7036. }
  7037. }
  7038. }
  7039. }
  7040. },
  7041. {
  7042. name = "remove",
  7043. summary = "Remove a file or directory.",
  7044. description = "Remove a file or directory in the save directory.",
  7045. key = "lovr.filesystem.remove",
  7046. module = "lovr.filesystem",
  7047. notes = "A directory can only be removed if it is empty.\n\nTo recursively remove a folder, use this function with `lovr.filesystem.getDirectoryItems`.",
  7048. variants = {
  7049. {
  7050. arguments = {
  7051. {
  7052. name = "path",
  7053. type = "string",
  7054. description = "The file or directory to remove."
  7055. }
  7056. },
  7057. returns = {
  7058. {
  7059. name = "success",
  7060. type = "boolean",
  7061. description = "Whether the path was removed."
  7062. }
  7063. }
  7064. }
  7065. }
  7066. },
  7067. {
  7068. name = "setIdentity",
  7069. summary = "Set the name of the save directory.",
  7070. description = "Set the name of the save directory.",
  7071. key = "lovr.filesystem.setIdentity",
  7072. module = "lovr.filesystem",
  7073. variants = {
  7074. {
  7075. arguments = {
  7076. {
  7077. name = "identity",
  7078. type = "string",
  7079. description = "The new name of the save directory."
  7080. }
  7081. },
  7082. returns = {}
  7083. }
  7084. }
  7085. },
  7086. {
  7087. name = "setRequirePath",
  7088. summary = "Set the require path.",
  7089. description = "Sets the require path. The require path is a semicolon-separated list of patterns that LÖVR will use to search for files when they are `require`d. Any question marks in the pattern will be replaced with the module that is being required. It is similar to Lua\\'s `package.path` variable, but the main difference is that the patterns are relative to the save directory and the project directory.",
  7090. key = "lovr.filesystem.setRequirePath",
  7091. module = "lovr.filesystem",
  7092. notes = "The default reqiure path is '?.lua;?/init.lua'.",
  7093. variants = {
  7094. {
  7095. arguments = {
  7096. {
  7097. name = "path",
  7098. type = "string",
  7099. description = "An optional semicolon separated list of search patterns.",
  7100. default = "nil"
  7101. }
  7102. },
  7103. returns = {}
  7104. }
  7105. }
  7106. },
  7107. {
  7108. name = "setSource",
  7109. summary = "Set the project source.",
  7110. description = "Sets the location of the project's source. This can only be done once, and is usually done internally.",
  7111. key = "lovr.filesystem.setSource",
  7112. module = "lovr.filesystem",
  7113. variants = {
  7114. {
  7115. arguments = {
  7116. {
  7117. name = "identity",
  7118. type = "string",
  7119. description = "The path containing the project's source."
  7120. }
  7121. },
  7122. returns = {}
  7123. }
  7124. }
  7125. },
  7126. {
  7127. name = "unmount",
  7128. summary = "Unmount a mounted archive.",
  7129. description = "Unmounts a directory or archive previously mounted with `lovr.filesystem.mount`.",
  7130. key = "lovr.filesystem.unmount",
  7131. module = "lovr.filesystem",
  7132. notes = "This function is not thread safe. Mounting or unmounting an archive while other threads call lovr.filesystem functions is not supported.",
  7133. variants = {
  7134. {
  7135. arguments = {
  7136. {
  7137. name = "path",
  7138. type = "string",
  7139. description = "The path to unmount."
  7140. }
  7141. },
  7142. returns = {
  7143. {
  7144. name = "success",
  7145. type = "boolean",
  7146. description = "Whether the archive was unmounted."
  7147. }
  7148. }
  7149. }
  7150. },
  7151. related = {
  7152. "lovr.filesystem.mount"
  7153. }
  7154. },
  7155. {
  7156. name = "write",
  7157. summary = "Write to a file.",
  7158. description = "Write to a file.",
  7159. key = "lovr.filesystem.write",
  7160. module = "lovr.filesystem",
  7161. notes = "If the file does not exist, it is created.\n\nIf the file already has data in it, it will be replaced with the new content.",
  7162. variants = {
  7163. {
  7164. arguments = {
  7165. {
  7166. name = "filename",
  7167. type = "string",
  7168. description = "The file to write to."
  7169. },
  7170. {
  7171. name = "content",
  7172. type = "string",
  7173. description = "A string to write to the file."
  7174. }
  7175. },
  7176. returns = {
  7177. {
  7178. name = "bytes",
  7179. type = "number",
  7180. description = "The number of bytes written."
  7181. }
  7182. }
  7183. },
  7184. {
  7185. arguments = {
  7186. {
  7187. name = "filename",
  7188. type = "string",
  7189. description = "The file to write to."
  7190. },
  7191. {
  7192. name = "blob",
  7193. type = "Blob",
  7194. description = "A Blob containing data to write to the file."
  7195. }
  7196. },
  7197. returns = {
  7198. {
  7199. name = "bytes",
  7200. type = "number",
  7201. description = "The number of bytes written."
  7202. }
  7203. }
  7204. }
  7205. },
  7206. related = {
  7207. "lovr.filesystem.append",
  7208. "lovr.filesystem.read"
  7209. }
  7210. }
  7211. },
  7212. notes = "LÖVR programs can only write to a single directory, called the save directory. The location of the save directory is platform-specific:\n\n<table>\n <tr>\n <td>Windows</td>\n <td><code>C:\\Users\\&lt;user&gt;\\AppData\\Roaming\\LOVR\\&lt;identity&gt;</code></td>\n </tr>\n <tr>\n <td>macOS</td>\n <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>\n </tr> </table>\n\n`<identity>` should be a unique identifier for your app. It can be set either in `lovr.conf` or by using `lovr.filesystem.setIdentity`.\n\nAll filenames are relative to either the save directory or the directory containing the project source. Files in the save directory take precedence over files in the project."
  7213. },
  7214. {
  7215. name = "graphics",
  7216. tag = "modules",
  7217. summary = "Renders graphics using the GPU.",
  7218. description = "The graphics module renders graphics and performs computation using the GPU.\n\nMost of the graphics functions are on the `Pass` object.",
  7219. key = "lovr.graphics",
  7220. objects = {
  7221. {
  7222. name = "Buffer",
  7223. summary = "A block of memory on the GPU.",
  7224. description = "A Buffer is a block of GPU memory. Buffers are similar to Lua tables or arrays: they have a length and store a list of values. The length of a Buffer and its format (the type of each value) are declared upfront and can't be changed. Each value of a Buffer consists of one or more fields, and each field has a type. For example, if a Buffer is used to store vertices, each value might store 3 fields for the position, normal vector, and UV coordinates of a vertex.\n\nBuffers are commonly used for:\n\n- Mesh data: Buffers hold the data that define the vertices in a mesh. Buffers also store the\n vertex indices of a mesh, which define the order the vertices are connected together into\n triangles. These are often called vertex buffers and index buffers.\n- Shader data: Buffers can be bound to a Shader, letting the Shader read arbitrary data. For\n example, Lua code could create a Buffer with the positions and colors of all the lights in a\n scene, which a Shader can use to do lighting calculations.\n- Compute: Compute shaders can write data to Buffers. This GPU-generated data can be used in\n later rendering work or sent back to Lua.\n- Indirect: Indirect rendering is an advanced technique where instructions for rendering work\n are recorded to a Buffer (potentially by a compute shader) and later drawn.\n\nThere are two types of Buffers:\n\n- **Temporary** buffers are very inexpensive to create, and writing to them from Lua is fast.\n However, they become invalid at the end of `lovr.draw` (i.e. when `lovr.graphics.submit` is\n called). The GPU is slightly slower at accessing data from temporary buffers, and compute\n shaders can not write to them. They are designed for storing data that changes every frame.\n- **Permanent** buffers are more expensive to create, and updating their contents requires a\n transfer from CPU memory to VRAM. They act like normal LÖVR objects and don't need to be\n recreated every frame. They often have faster performance when used by the GPU, and compute\n shaders can write to them. They are great for large pieces of data that are initialized once\n at load time, or data that is updated infrequently.",
  7225. key = "Buffer",
  7226. module = "lovr.graphics",
  7227. constructors = {
  7228. "lovr.graphics.getBuffer",
  7229. "lovr.graphics.newBuffer"
  7230. },
  7231. methods = {
  7232. {
  7233. name = "clear",
  7234. summary = "Clear the data in the Buffer.",
  7235. description = "Clears some or all of the data in the Buffer to zero. This is supported for both temporary and permanent Buffers. Permanent Buffers can also be cleared in a transfer pass using `Pass:clear`.",
  7236. key = "Buffer:clear",
  7237. module = "lovr.graphics",
  7238. notes = "Clearing a permanent buffer requires the byte offset and byte count of the cleared range to be a multiple of 4. This will usually be true for most field types.",
  7239. variants = {
  7240. {
  7241. arguments = {
  7242. {
  7243. name = "index",
  7244. type = "number",
  7245. description = "The index of the first item to clear.",
  7246. default = "1"
  7247. },
  7248. {
  7249. name = "count",
  7250. type = "number",
  7251. description = "The number of items to clear. If `nil`, clears as many items as possible.",
  7252. default = "nil"
  7253. }
  7254. },
  7255. returns = {}
  7256. }
  7257. },
  7258. related = {
  7259. "Pass:clear"
  7260. }
  7261. },
  7262. {
  7263. name = "getFormat",
  7264. summary = "Get the format of the Buffer.",
  7265. description = "Returns the format of the Buffer. This is the list of fields that comprise each item in the buffer. Each field has a type, byte offset, and vertex attribute location.",
  7266. key = "Buffer:getFormat",
  7267. module = "lovr.graphics",
  7268. variants = {
  7269. {
  7270. arguments = {},
  7271. returns = {
  7272. {
  7273. name = "format",
  7274. type = "table",
  7275. description = "The format of the Buffer."
  7276. }
  7277. }
  7278. }
  7279. },
  7280. related = {
  7281. "Buffer:getSize",
  7282. "Buffer:getLength",
  7283. "Buffer:getStride"
  7284. },
  7285. examples = {
  7286. {
  7287. code = "function lovr.load()\n buffer = lovr.graphics.newBuffer(1, { 'vec3', 'vec3', 'vec2' })\n\n for i, field in ipairs(buffer:getFormat()) do\n local type, offset, location = field.type, field.offset, field.location\n local template = 'Field: %d: Type = %s, Offset = %d, Location = %d'\n print(template:format(i, type, offset, location))\n end\n\n -- prints the following:\n -- Field 1: Type = f32x3, Offset = 0, Location = 0\n -- Field 2: Type = f32x3, Offset = 12, Location = 1\n -- Field 3: Type = f32x2, Offset = 24, Location = 2\nend"
  7288. }
  7289. }
  7290. },
  7291. {
  7292. name = "getLength",
  7293. summary = "Get the length of the Buffer.",
  7294. description = "Returns the length of the Buffer.",
  7295. key = "Buffer:getLength",
  7296. module = "lovr.graphics",
  7297. related = {
  7298. "Buffer:getSize",
  7299. "Buffer:getStride"
  7300. },
  7301. variants = {
  7302. {
  7303. arguments = {},
  7304. returns = {
  7305. {
  7306. name = "length",
  7307. type = "number",
  7308. description = "The length of the Buffer."
  7309. }
  7310. }
  7311. }
  7312. }
  7313. },
  7314. {
  7315. name = "getPointer",
  7316. summary = "Get a raw pointer to the Buffer's memory.",
  7317. description = "Returns a raw pointer to the Buffer's memory as a lightuserdata, intended for use with the LuaJIT ffi or for passing to C libraries. This is only available for temporary buffers, and as such the pointer is only valid until `lovr.graphics.submit` is called.",
  7318. key = "Buffer:getPointer",
  7319. module = "lovr.graphics",
  7320. related = {
  7321. "Blob:getPointer"
  7322. },
  7323. variants = {
  7324. {
  7325. arguments = {},
  7326. returns = {
  7327. {
  7328. name = "pointer",
  7329. type = "lightuserdata",
  7330. description = "A pointer to the Buffer's memory."
  7331. }
  7332. }
  7333. }
  7334. }
  7335. },
  7336. {
  7337. name = "getSize",
  7338. summary = "Get the size of the Buffer, in bytes.",
  7339. description = "Returns the size of the Buffer, in bytes. This is the same as `length * stride`.",
  7340. key = "Buffer:getSize",
  7341. module = "lovr.graphics",
  7342. related = {
  7343. "Buffer:getLength",
  7344. "Buffer:getStride"
  7345. },
  7346. variants = {
  7347. {
  7348. arguments = {},
  7349. returns = {
  7350. {
  7351. name = "size",
  7352. type = "number",
  7353. description = "The size of the Buffer, in bytes."
  7354. }
  7355. }
  7356. }
  7357. }
  7358. },
  7359. {
  7360. name = "getStride",
  7361. summary = "Get the distance between each item in the Buffer, in bytes.",
  7362. description = "Returns the distance between each item in the Buffer, in bytes.",
  7363. key = "Buffer:getStride",
  7364. module = "lovr.graphics",
  7365. notes = "When a Buffer is created, the stride can be set explicitly, otherwise it will be automatically computed based on the fields in the Buffer.\n\nStrides can not be zero, and can not be smaller than the size of a single item. To work around this, bind the Buffer as a storage buffer and fetch data from the buffer manually.",
  7366. variants = {
  7367. {
  7368. arguments = {},
  7369. returns = {
  7370. {
  7371. name = "stride",
  7372. type = "number",
  7373. description = "The stride of the Buffer, in bytes."
  7374. }
  7375. }
  7376. }
  7377. },
  7378. related = {
  7379. "Buffer:getSize",
  7380. "Buffer:getLength"
  7381. }
  7382. },
  7383. {
  7384. name = "isTemporary",
  7385. summary = "Check if the Buffer is temporary.",
  7386. description = "Returns whether the Buffer is temporary.",
  7387. key = "Buffer:isTemporary",
  7388. module = "lovr.graphics",
  7389. related = {
  7390. "lovr.graphics.getBuffer"
  7391. },
  7392. variants = {
  7393. {
  7394. arguments = {},
  7395. returns = {
  7396. {
  7397. name = "temporary",
  7398. type = "boolean",
  7399. description = "Whether the Buffer is temporary."
  7400. }
  7401. }
  7402. }
  7403. }
  7404. },
  7405. {
  7406. name = "setData",
  7407. summary = "Change the data in the Buffer.",
  7408. description = "Changes data in the Buffer using a table or a Blob. This is supported for both temporary and permanent buffers. All passes submitted to the GPU will use the new data.\n\nIt is also possible to change the data in permanent buffers inside of a transfer pass using `Pass:copy`. Using a transfer pass allows the copy to happen after other passes in the frame.",
  7409. key = "Buffer:setData",
  7410. module = "lovr.graphics",
  7411. variants = {
  7412. {
  7413. arguments = {
  7414. {
  7415. name = "data",
  7416. type = "table",
  7417. description = "A flat or nested table of items to copy to the Buffer (see notes for format)."
  7418. },
  7419. {
  7420. name = "sourceIndex",
  7421. type = "number",
  7422. description = "The index in the table to copy from.",
  7423. default = "1"
  7424. },
  7425. {
  7426. name = "destinationIndex",
  7427. type = "number",
  7428. description = "The index of the first value in the Buffer to update.",
  7429. default = "1"
  7430. },
  7431. {
  7432. name = "count",
  7433. type = "number",
  7434. description = "The number of values to update. `nil` will copy as many items as possible, based on the lengths of the source and destination.",
  7435. default = "nil"
  7436. }
  7437. },
  7438. returns = {}
  7439. },
  7440. {
  7441. arguments = {
  7442. {
  7443. name = "blob",
  7444. type = "Blob",
  7445. description = "The Blob to copy data from."
  7446. },
  7447. {
  7448. name = "sourceOffset",
  7449. type = "number",
  7450. description = "A byte offset into the Blob to copy from.",
  7451. default = "0"
  7452. },
  7453. {
  7454. name = "destinationOffset",
  7455. type = "number",
  7456. description = "A byte offset in the Buffer to copy to.",
  7457. default = "0"
  7458. },
  7459. {
  7460. name = "size",
  7461. type = "number",
  7462. description = "The number of bytes to copy. If nil, copies as many bytes as possible.",
  7463. default = "nil"
  7464. }
  7465. },
  7466. returns = {}
  7467. }
  7468. },
  7469. notes = "When using a table, the table can contain a nested table for each value in the Buffer, or it can be a flat list of field component values. It is not possible to mix both nested tables and flat values.\n\nFor each item updated, components of each field in the item (according to the Buffer's format) are read from either the nested subtable or the table itself. A single number can be used to update a field with a scalar type. Multiple numbers or a `lovr.math` vector can be used to update a field with a vector or mat4 type. Multiple numbers can be used to update mat2 and mat3 fields. When updating normalized field types, components read from the table will be clamped to the normalized range ([0,1] or [-1,1]). In the Buffer, each field is written at its byte offset according to the Buffer's format, and subsequent items are separated by the byte stride of the Buffer. Any missing components for an updated field will be set to zero.",
  7470. related = {
  7471. "Pass:copy"
  7472. },
  7473. examples = {
  7474. {
  7475. code = "function lovr.load()\n buffer = lovr.graphics.newBuffer(3, 'floats')\n buffer:setData({ { 1.0 }, { 2.0 }, { 3.0 } })\n buffer:setData({ 1.0, 2.0, 3.0 })\n\n buffer = lovr.graphics.newBuffer(5, { 'vec3', 'vec3', 'vec2' })\n buffer:setData({ vec3(1, 2, 3), vec3(4, 5, 6), vec2(7, 8) })\n buffer:setData({ { 1, 2, 3, 4, 5, 6, 7, 8 } })\n buffer:setData({ 1, 2, 3, 4, 5, 6, 7, 8 })\n buffer:setData({\n { x1, y1, z1, nx1, ny1, nz1, u1, v1 },\n { x2, y2, z2, vec3(nx, ny, nz) }\n }, 1, 3, 2)\nend"
  7476. }
  7477. }
  7478. }
  7479. }
  7480. },
  7481. {
  7482. name = "Font",
  7483. summary = "TODO",
  7484. description = "TODO",
  7485. key = "Font",
  7486. module = "lovr.graphics",
  7487. constructors = {
  7488. "lovr.graphics.newFont",
  7489. "lovr.graphics.getDefaultFont"
  7490. },
  7491. methods = {
  7492. {
  7493. name = "getAscent",
  7494. summary = "Get the ascent of the Font.",
  7495. description = "TODO",
  7496. key = "Font:getAscent",
  7497. module = "lovr.graphics",
  7498. related = {
  7499. "Font:getDescent",
  7500. "Font:getHeight",
  7501. "Font:getKerning",
  7502. "Font:getWidth"
  7503. },
  7504. variants = {
  7505. {
  7506. arguments = {},
  7507. returns = {
  7508. {
  7509. name = "ascent",
  7510. type = "number",
  7511. description = "TODO"
  7512. }
  7513. }
  7514. }
  7515. }
  7516. },
  7517. {
  7518. name = "getDescent",
  7519. summary = "Get the descent of the Font.",
  7520. description = "TODO",
  7521. key = "Font:getDescent",
  7522. module = "lovr.graphics",
  7523. related = {
  7524. "Font:getAscent",
  7525. "Font:getHeight",
  7526. "Font:getKerning",
  7527. "Font:getWidth"
  7528. },
  7529. variants = {
  7530. {
  7531. arguments = {},
  7532. returns = {
  7533. {
  7534. name = "descent",
  7535. type = "number",
  7536. description = "TODO"
  7537. }
  7538. }
  7539. }
  7540. }
  7541. },
  7542. {
  7543. name = "getHeight",
  7544. summary = "Get the height of the Font.",
  7545. description = "TODO",
  7546. key = "Font:getHeight",
  7547. module = "lovr.graphics",
  7548. related = {
  7549. "Font:getAscent",
  7550. "Font:getDescent",
  7551. "Font:getKerning",
  7552. "Font:getWidth",
  7553. "Font:getLines"
  7554. },
  7555. variants = {
  7556. {
  7557. arguments = {},
  7558. returns = {
  7559. {
  7560. name = "height",
  7561. type = "number",
  7562. description = "TODO"
  7563. }
  7564. }
  7565. }
  7566. }
  7567. },
  7568. {
  7569. name = "getKerning",
  7570. summary = "Get the kerning of the Font.",
  7571. description = "TODO",
  7572. key = "Font:getKerning",
  7573. module = "lovr.graphics",
  7574. related = {
  7575. "Font:getAscent",
  7576. "Font:getDescent",
  7577. "Font:getHeight",
  7578. "Font:getWidth"
  7579. },
  7580. variants = {
  7581. {
  7582. arguments = {
  7583. {
  7584. name = "first",
  7585. type = "Codepoint",
  7586. description = "TODO"
  7587. },
  7588. {
  7589. name = "second",
  7590. type = "Codepoint",
  7591. description = "TODO"
  7592. }
  7593. },
  7594. returns = {
  7595. {
  7596. name = "kerning",
  7597. type = "number",
  7598. description = "TODO"
  7599. }
  7600. }
  7601. }
  7602. }
  7603. },
  7604. {
  7605. name = "getLineSpacing",
  7606. summary = "Set the pixel density of the Font.",
  7607. description = "TODO",
  7608. key = "Font:getLineSpacing",
  7609. module = "lovr.graphics",
  7610. variants = {
  7611. {
  7612. arguments = {},
  7613. returns = {
  7614. {
  7615. name = "spacing",
  7616. type = "number",
  7617. description = "TODO"
  7618. }
  7619. }
  7620. }
  7621. }
  7622. },
  7623. {
  7624. name = "getLines",
  7625. summary = "Turn a long string into a sequence of wrapped lines.",
  7626. description = "TODO",
  7627. key = "Font:getLines",
  7628. module = "lovr.graphics",
  7629. related = {
  7630. "Font:getWidth",
  7631. "Font:getHeight",
  7632. "Pass:text"
  7633. },
  7634. variants = {
  7635. {
  7636. arguments = {
  7637. {
  7638. name = "text",
  7639. type = "Text",
  7640. description = "TODO"
  7641. },
  7642. {
  7643. name = "wrap",
  7644. type = "number",
  7645. description = "TODO"
  7646. }
  7647. },
  7648. returns = {
  7649. {
  7650. name = "lines",
  7651. type = "table",
  7652. description = "TODO"
  7653. }
  7654. }
  7655. }
  7656. }
  7657. },
  7658. {
  7659. name = "getPixelDensity",
  7660. summary = "Get the pixel density of the Font.",
  7661. description = "TODO",
  7662. key = "Font:getPixelDensity",
  7663. module = "lovr.graphics",
  7664. variants = {
  7665. {
  7666. arguments = {},
  7667. returns = {
  7668. {
  7669. name = "density",
  7670. type = "number",
  7671. description = "TODO"
  7672. }
  7673. }
  7674. }
  7675. }
  7676. },
  7677. {
  7678. name = "getRasterizer",
  7679. summary = "Get the Font's Rasterizer.",
  7680. description = "TODO",
  7681. key = "Font:getRasterizer",
  7682. module = "lovr.graphics",
  7683. related = {
  7684. "lovr.graphics.newFont",
  7685. "lovr.data.newRasterizer"
  7686. },
  7687. variants = {
  7688. {
  7689. arguments = {},
  7690. returns = {
  7691. {
  7692. name = "rasterizer",
  7693. type = "Rasterizer",
  7694. description = "The Rasterizer."
  7695. }
  7696. }
  7697. }
  7698. }
  7699. },
  7700. {
  7701. name = "getVertices",
  7702. summary = "Get the vertices for a piece of text.",
  7703. description = "Returns a table of vertices for a piece of text, along with a Material to use when rendering it. The Material may change over time if the Font's texture atlas needs to be resized to make room for more glyphs.",
  7704. key = "Font:getVertices",
  7705. module = "lovr.graphics",
  7706. notes = "Each vertex is a table of 4 floating point numbers with the following data:\n\n { x, y, u, v }\n\nThese could be placed in a vertex buffer using the following buffer format:\n\n { 'vec2:VertexPosition', 'vec2:VertexUV' }",
  7707. variants = {
  7708. {
  7709. arguments = {
  7710. {
  7711. name = "text",
  7712. type = "Text",
  7713. description = "TODO"
  7714. },
  7715. {
  7716. name = "wrap",
  7717. type = "number",
  7718. description = "TODO"
  7719. },
  7720. {
  7721. name = "halign",
  7722. type = "HorizontalAlign",
  7723. description = "TODO"
  7724. },
  7725. {
  7726. name = "valign",
  7727. type = "VerticalAlign",
  7728. description = "TODO"
  7729. }
  7730. },
  7731. returns = {
  7732. {
  7733. name = "vertices",
  7734. type = "table",
  7735. description = "The table of vertices. See below for the format of each vertex."
  7736. },
  7737. {
  7738. name = "material",
  7739. type = "Material",
  7740. description = "A Material to use when rendering the vertices."
  7741. }
  7742. }
  7743. }
  7744. }
  7745. },
  7746. {
  7747. name = "getWidth",
  7748. summary = "Get the width of rendered text.",
  7749. description = "TODO",
  7750. key = "Font:getWidth",
  7751. module = "lovr.graphics",
  7752. related = {
  7753. "Font:getAscent",
  7754. "Font:getDescent",
  7755. "Font:getHeight",
  7756. "Font:getKerning",
  7757. "Font:getLines"
  7758. },
  7759. variants = {
  7760. {
  7761. arguments = {
  7762. {
  7763. name = "text",
  7764. type = "Text",
  7765. description = "TODO"
  7766. }
  7767. },
  7768. returns = {
  7769. {
  7770. name = "width",
  7771. type = "number",
  7772. description = "TODO"
  7773. }
  7774. }
  7775. }
  7776. }
  7777. },
  7778. {
  7779. name = "setLineSpacing",
  7780. summary = "Set the line spacing of the Font.",
  7781. description = "TODO",
  7782. key = "Font:setLineSpacing",
  7783. module = "lovr.graphics",
  7784. variants = {
  7785. {
  7786. arguments = {
  7787. {
  7788. name = "spacing",
  7789. type = "number",
  7790. description = "TODO"
  7791. }
  7792. },
  7793. returns = {}
  7794. }
  7795. }
  7796. },
  7797. {
  7798. name = "setPixelDensity",
  7799. summary = "Set the pixel density of the Font.",
  7800. description = "TODO",
  7801. key = "Font:setPixelDensity",
  7802. module = "lovr.graphics",
  7803. variants = {
  7804. {
  7805. arguments = {
  7806. {
  7807. name = "density",
  7808. type = "number",
  7809. description = "TODO"
  7810. }
  7811. },
  7812. returns = {}
  7813. }
  7814. }
  7815. }
  7816. }
  7817. },
  7818. {
  7819. name = "Material",
  7820. summary = "TODO",
  7821. description = "TODO",
  7822. key = "Material",
  7823. module = "lovr.graphics",
  7824. constructors = {
  7825. "lovr.graphics.newMaterial"
  7826. },
  7827. methods = {
  7828. {
  7829. name = "getProperties",
  7830. summary = "Get the properties of the Material.",
  7831. description = "Returns the properties of the Material in a table.",
  7832. key = "Material:getProperties",
  7833. module = "lovr.graphics",
  7834. variants = {
  7835. {
  7836. arguments = {},
  7837. returns = {
  7838. {
  7839. name = "properties",
  7840. type = "table",
  7841. description = "The Material properties."
  7842. }
  7843. }
  7844. }
  7845. }
  7846. },
  7847. {
  7848. name = "setTexture",
  7849. summary = "Set a texture for the Material.",
  7850. description = "Sets a texture for a Material. Several predefined `MaterialTexture`s are supported. Any texture that is `nil` will use a single white pixel as a fallback.",
  7851. key = "Material:setTexture",
  7852. module = "lovr.graphics",
  7853. notes = "Textures must have a `TextureType` of `2d` to be used with Materials.",
  7854. variants = {
  7855. {
  7856. arguments = {
  7857. {
  7858. name = "textureType",
  7859. type = "MaterialTexture",
  7860. description = "The type of texture to set.",
  7861. default = "'diffuse'"
  7862. },
  7863. {
  7864. name = "texture",
  7865. type = "Texture",
  7866. description = "The texture to apply, or `nil` to use the default."
  7867. }
  7868. },
  7869. returns = {}
  7870. },
  7871. {
  7872. arguments = {
  7873. {
  7874. name = "texture",
  7875. type = "Texture",
  7876. description = "The texture to apply, or `nil` to use the default."
  7877. }
  7878. },
  7879. returns = {}
  7880. }
  7881. },
  7882. related = {
  7883. "MaterialTexture",
  7884. "lovr.graphics.newTexture"
  7885. }
  7886. }
  7887. }
  7888. },
  7889. {
  7890. name = "Model",
  7891. summary = "TODO",
  7892. description = "TODO",
  7893. key = "Model",
  7894. module = "lovr.graphics",
  7895. constructors = {
  7896. "lovr.graphics.newModel",
  7897. "lovr.headset.newModel"
  7898. },
  7899. methods = {
  7900. {
  7901. name = "animate",
  7902. summary = "Apply an animation to the nodes of the Model.",
  7903. description = "TODO",
  7904. key = "Model:animate",
  7905. module = "lovr.graphics",
  7906. notes = "TODO What happens if the timestamp is before the first keyframe? TODO Does it loop?",
  7907. variants = {
  7908. {
  7909. arguments = {
  7910. {
  7911. name = "name",
  7912. type = "string",
  7913. description = "The name of an animation in the model file."
  7914. },
  7915. {
  7916. name = "time",
  7917. type = "number",
  7918. description = "The timestamp to evaluate the keyframes at, in seconds."
  7919. },
  7920. {
  7921. name = "blend",
  7922. type = "number",
  7923. description = "How much of the animation's pose to blend into the nodes, from 0 to 1.",
  7924. default = "1.0"
  7925. }
  7926. },
  7927. returns = {}
  7928. },
  7929. {
  7930. arguments = {
  7931. {
  7932. name = "index",
  7933. type = "number",
  7934. description = "The index of an animation in the model file."
  7935. },
  7936. {
  7937. name = "time",
  7938. type = "number",
  7939. description = "The timestamp to evaluate the keyframes at, in seconds."
  7940. },
  7941. {
  7942. name = "blend",
  7943. type = "number",
  7944. description = "How much of the animation's pose to blend into the nodes, from 0 to 1.",
  7945. default = "1.0"
  7946. }
  7947. },
  7948. returns = {}
  7949. }
  7950. },
  7951. related = {
  7952. "Model:getAnimationCount",
  7953. "Model:getAnimationName",
  7954. "Model:getAnimationDuration",
  7955. "Model:getNodePosition",
  7956. "Model:setNodePosition",
  7957. "Model:getNodeOrientation",
  7958. "Model:setNodeOrientation",
  7959. "Model:getNodeScale",
  7960. "Model:setNodeScale",
  7961. "Model:getNodeTransform",
  7962. "Model:setNodeTransform"
  7963. }
  7964. },
  7965. {
  7966. name = "getAnimationCount",
  7967. summary = "Get the number of animations in the Model.",
  7968. description = "Returns the number of animations in the Model.",
  7969. key = "Model:getAnimationCount",
  7970. module = "lovr.graphics",
  7971. related = {
  7972. "Model:getAnimationName",
  7973. "Model:getAnimationDuration",
  7974. "Model:animate"
  7975. },
  7976. variants = {
  7977. {
  7978. arguments = {},
  7979. returns = {
  7980. {
  7981. name = "count",
  7982. type = "number",
  7983. description = "The number of animations in the Model."
  7984. }
  7985. }
  7986. }
  7987. }
  7988. },
  7989. {
  7990. name = "getAnimationDuration",
  7991. summary = "Get the duration of an animation in the Model.",
  7992. description = "TODO",
  7993. key = "Model:getAnimationDuration",
  7994. module = "lovr.graphics",
  7995. notes = "TODO how is duration calculated?",
  7996. variants = {
  7997. {
  7998. arguments = {
  7999. {
  8000. name = "index",
  8001. type = "number",
  8002. description = "The animation index."
  8003. }
  8004. },
  8005. returns = {
  8006. {
  8007. name = "duration",
  8008. type = "number",
  8009. description = "TODO"
  8010. }
  8011. }
  8012. },
  8013. {
  8014. arguments = {
  8015. {
  8016. name = "name",
  8017. type = "string",
  8018. description = "The name of the animation."
  8019. }
  8020. },
  8021. returns = {
  8022. {
  8023. name = "duration",
  8024. type = "number",
  8025. description = "TODO"
  8026. }
  8027. }
  8028. }
  8029. },
  8030. related = {
  8031. "Model:getAnimationCount",
  8032. "Model:getAnimationName",
  8033. "Model:animate"
  8034. }
  8035. },
  8036. {
  8037. name = "getAnimationName",
  8038. summary = "Get the name of an animation in the Model.",
  8039. description = "TODO",
  8040. key = "Model:getAnimationName",
  8041. module = "lovr.graphics",
  8042. related = {
  8043. "Model:getAnimationCount",
  8044. "Model:getAnimationDuration"
  8045. },
  8046. variants = {
  8047. {
  8048. arguments = {
  8049. {
  8050. name = "index",
  8051. type = "number",
  8052. description = "TODO"
  8053. }
  8054. },
  8055. returns = {
  8056. {
  8057. name = "name",
  8058. type = "string",
  8059. description = "The name of the animation."
  8060. }
  8061. }
  8062. }
  8063. }
  8064. },
  8065. {
  8066. name = "getBoundingBox",
  8067. summary = "Get the bounding box of the Model.",
  8068. description = "Returns the 6 values of the Model's axis-aligned bounding box.",
  8069. key = "Model:getBoundingBox",
  8070. module = "lovr.graphics",
  8071. related = {
  8072. "Model:getWidth",
  8073. "Model:getHeight",
  8074. "Model:getDepth",
  8075. "Model:getDimensions",
  8076. "Model:getCenter",
  8077. "Model:getBoundingSphere",
  8078. "ModelData:getBoundingBox",
  8079. "Collider:getAABB"
  8080. },
  8081. variants = {
  8082. {
  8083. arguments = {},
  8084. returns = {
  8085. {
  8086. name = "minx",
  8087. type = "number",
  8088. description = "The minimum x coordinate of the vertices in the Model."
  8089. },
  8090. {
  8091. name = "maxx",
  8092. type = "number",
  8093. description = "The maximum x coordinate of the vertices in the Model."
  8094. },
  8095. {
  8096. name = "miny",
  8097. type = "number",
  8098. description = "The minimum y coordinate of the vertices in the Model."
  8099. },
  8100. {
  8101. name = "maxy",
  8102. type = "number",
  8103. description = "The maximum y coordinate of the vertices in the Model."
  8104. },
  8105. {
  8106. name = "minz",
  8107. type = "number",
  8108. description = "The minimum z coordinate of the vertices in the Model."
  8109. },
  8110. {
  8111. name = "maxz",
  8112. type = "number",
  8113. description = "The maximum z coordinate of the vertices in the Model."
  8114. }
  8115. }
  8116. }
  8117. }
  8118. },
  8119. {
  8120. name = "getBoundingSphere",
  8121. summary = "Get the bounding sphere of the Model.",
  8122. description = "Returns a sphere approximately enclosing the vertices in the Model.",
  8123. key = "Model:getBoundingSphere",
  8124. module = "lovr.graphics",
  8125. related = {
  8126. "Model:getWidth",
  8127. "Model:getHeight",
  8128. "Model:getDepth",
  8129. "Model:getDimensions",
  8130. "Model:getCenter",
  8131. "Model:getBoundingBox",
  8132. "ModelData:getBoundingSphere"
  8133. },
  8134. variants = {
  8135. {
  8136. arguments = {},
  8137. returns = {
  8138. {
  8139. name = "x",
  8140. type = "number",
  8141. description = "The x coordinate of the position of the sphere."
  8142. },
  8143. {
  8144. name = "y",
  8145. type = "number",
  8146. description = "The y coordinate of the position of the sphere."
  8147. },
  8148. {
  8149. name = "z",
  8150. type = "number",
  8151. description = "The z coordinate of the position of the sphere."
  8152. },
  8153. {
  8154. name = "radius",
  8155. type = "number",
  8156. description = "The radius of the bounding sphere."
  8157. }
  8158. }
  8159. }
  8160. }
  8161. },
  8162. {
  8163. name = "getCenter",
  8164. summary = "Get the center of the Model's bounding box.",
  8165. description = "Returns the center of the Model's axis-aligned bounding box, relative to the Model's origin.",
  8166. key = "Model:getCenter",
  8167. module = "lovr.graphics",
  8168. related = {
  8169. "Model:getWidth",
  8170. "Model:getHeight",
  8171. "Model:getDepth",
  8172. "Model:getDimensions",
  8173. "Model:getBoundingBox",
  8174. "ModelData:getCenter"
  8175. },
  8176. variants = {
  8177. {
  8178. arguments = {},
  8179. returns = {
  8180. {
  8181. name = "x",
  8182. type = "number",
  8183. description = "The x offset of the center of the bounding box."
  8184. },
  8185. {
  8186. name = "y",
  8187. type = "number",
  8188. description = "The y offset of the center of the bounding box."
  8189. },
  8190. {
  8191. name = "z",
  8192. type = "number",
  8193. description = "The z offset of the center of the bounding box."
  8194. }
  8195. }
  8196. }
  8197. }
  8198. },
  8199. {
  8200. name = "getData",
  8201. summary = "Get the ModelData backing the Model.",
  8202. description = "Returns the ModelData this Model was created from.",
  8203. key = "Model:getData",
  8204. module = "lovr.graphics",
  8205. related = {
  8206. "lovr.data.newModelData"
  8207. },
  8208. variants = {
  8209. {
  8210. arguments = {},
  8211. returns = {
  8212. {
  8213. name = "data",
  8214. type = "ModelData",
  8215. description = "The ModelData."
  8216. }
  8217. }
  8218. }
  8219. }
  8220. },
  8221. {
  8222. name = "getDepth",
  8223. summary = "Get the depth of the Model.",
  8224. description = "Returns the depth of the Model, computed from its axis-aligned bounding box.",
  8225. key = "Model:getDepth",
  8226. module = "lovr.graphics",
  8227. related = {
  8228. "Model:getWidth",
  8229. "Model:getHeight",
  8230. "Model:getDimensions",
  8231. "Model:getCenter",
  8232. "Model:getBoundingBox",
  8233. "ModelData:getDepth"
  8234. },
  8235. variants = {
  8236. {
  8237. arguments = {},
  8238. returns = {
  8239. {
  8240. name = "depth",
  8241. type = "number",
  8242. description = "The depth of the Model."
  8243. }
  8244. }
  8245. }
  8246. }
  8247. },
  8248. {
  8249. name = "getDimensions",
  8250. summary = "Get the dimensions of the Model.",
  8251. description = "Returns the width, height, and depth of the Model, computed from its axis-aligned bounding box.",
  8252. key = "Model:getDimensions",
  8253. module = "lovr.graphics",
  8254. related = {
  8255. "Model:getWidth",
  8256. "Model:getHeight",
  8257. "Model:getDepth",
  8258. "Model:getCenter",
  8259. "Model:getBoundingBox",
  8260. "ModelData:getDimensions"
  8261. },
  8262. variants = {
  8263. {
  8264. arguments = {},
  8265. returns = {
  8266. {
  8267. name = "width",
  8268. type = "number",
  8269. description = "The width of the Model."
  8270. },
  8271. {
  8272. name = "height",
  8273. type = "number",
  8274. description = "The height of the Model."
  8275. },
  8276. {
  8277. name = "depth",
  8278. type = "number",
  8279. description = "The depth of the Model."
  8280. }
  8281. }
  8282. }
  8283. }
  8284. },
  8285. {
  8286. name = "getHeight",
  8287. summary = "Get the height of the Model.",
  8288. description = "Returns the height of the Model, computed from its axis-aligned bounding box.",
  8289. key = "Model:getHeight",
  8290. module = "lovr.graphics",
  8291. related = {
  8292. "Model:getWidth",
  8293. "Model:getDepth",
  8294. "Model:getDimensions",
  8295. "Model:getCenter",
  8296. "Model:getBoundingBox",
  8297. "ModelData:getHeight"
  8298. },
  8299. variants = {
  8300. {
  8301. arguments = {},
  8302. returns = {
  8303. {
  8304. name = "height",
  8305. type = "number",
  8306. description = "The height of the Model."
  8307. }
  8308. }
  8309. }
  8310. }
  8311. },
  8312. {
  8313. name = "getIndexBuffer",
  8314. summary = "Get a Buffer containing the triangle indices in the Model.",
  8315. description = "TODO",
  8316. key = "Model:getIndexBuffer",
  8317. module = "lovr.graphics",
  8318. related = {
  8319. "Model:getVertexBuffer"
  8320. },
  8321. variants = {
  8322. {
  8323. arguments = {},
  8324. returns = {
  8325. {
  8326. name = "buffer",
  8327. type = "Buffer",
  8328. description = "TODO"
  8329. }
  8330. }
  8331. }
  8332. }
  8333. },
  8334. {
  8335. name = "getMaterial",
  8336. summary = "Get a Material from the Model.",
  8337. description = "TODO",
  8338. key = "Model:getMaterial",
  8339. module = "lovr.graphics",
  8340. related = {
  8341. "Model:getMaterialCount",
  8342. "Model:getMaterialName"
  8343. },
  8344. variants = {
  8345. {
  8346. arguments = {
  8347. {
  8348. name = "name",
  8349. type = "string",
  8350. description = "The name of the Material to return."
  8351. }
  8352. },
  8353. returns = {
  8354. {
  8355. name = "material",
  8356. type = "Material",
  8357. description = "The material."
  8358. }
  8359. }
  8360. },
  8361. {
  8362. arguments = {
  8363. {
  8364. name = "index",
  8365. type = "number",
  8366. description = "The index of the Material to return."
  8367. }
  8368. },
  8369. returns = {
  8370. {
  8371. name = "material",
  8372. type = "Material",
  8373. description = "The material."
  8374. }
  8375. }
  8376. }
  8377. }
  8378. },
  8379. {
  8380. name = "getMaterialCount",
  8381. summary = "Get the number of materials in the Model.",
  8382. description = "Returns the number of materials in the Model.",
  8383. key = "Model:getMaterialCount",
  8384. module = "lovr.graphics",
  8385. related = {
  8386. "Model:getMaterialName",
  8387. "Model:getMaterial"
  8388. },
  8389. variants = {
  8390. {
  8391. arguments = {},
  8392. returns = {
  8393. {
  8394. name = "count",
  8395. type = "number",
  8396. description = "The number of materials in the Model."
  8397. }
  8398. }
  8399. }
  8400. }
  8401. },
  8402. {
  8403. name = "getMaterialName",
  8404. summary = "Get the name of a material in the Model.",
  8405. description = "TODO",
  8406. key = "Model:getMaterialName",
  8407. module = "lovr.graphics",
  8408. related = {
  8409. "Model:getMaterialCount",
  8410. "Model:getMaterial"
  8411. },
  8412. variants = {
  8413. {
  8414. arguments = {
  8415. {
  8416. name = "index",
  8417. type = "number",
  8418. description = "TODO"
  8419. }
  8420. },
  8421. returns = {
  8422. {
  8423. name = "name",
  8424. type = "string",
  8425. description = "The name of the material."
  8426. }
  8427. }
  8428. }
  8429. }
  8430. },
  8431. {
  8432. name = "getMetadata",
  8433. summary = "Get extra information from the model file.",
  8434. description = "Returns extra information stored in the model file. Currently this is only implemented for glTF models and returns the JSON string from the glTF or glb file. The metadata can be used to get application-specific data or add support for glTF extensions not supported by LÖVR.",
  8435. key = "Model:getMetadata",
  8436. module = "lovr.graphics",
  8437. variants = {
  8438. {
  8439. arguments = {},
  8440. returns = {
  8441. {
  8442. name = "metadata",
  8443. type = "string",
  8444. description = "The metadata from the model file."
  8445. }
  8446. }
  8447. }
  8448. }
  8449. },
  8450. {
  8451. name = "getNodeChildren",
  8452. summary = "Get the children of a node.",
  8453. description = "Given a parent node, this function returns a table with the indices of its children.",
  8454. key = "Model:getNodeChildren",
  8455. module = "lovr.graphics",
  8456. notes = "If the node does not have any children, this function returns an empty table.",
  8457. variants = {
  8458. {
  8459. arguments = {
  8460. {
  8461. name = "index",
  8462. type = "number",
  8463. description = "The index of the parent node."
  8464. }
  8465. },
  8466. returns = {
  8467. {
  8468. name = "children",
  8469. type = "table",
  8470. description = "A table containing a node index for each child of the node."
  8471. }
  8472. }
  8473. },
  8474. {
  8475. arguments = {
  8476. {
  8477. name = "name",
  8478. type = "string",
  8479. description = "The name of the parent node."
  8480. }
  8481. },
  8482. returns = {
  8483. {
  8484. name = "children",
  8485. type = "table",
  8486. description = "A table containing a node index for each child of the node."
  8487. }
  8488. }
  8489. }
  8490. },
  8491. related = {
  8492. "Model:getNodeParent",
  8493. "Model:getRootNode"
  8494. }
  8495. },
  8496. {
  8497. name = "getNodeCount",
  8498. summary = "Get the number of nodes in the model.",
  8499. description = "Returns the number of nodes in the model.",
  8500. key = "Model:getNodeCount",
  8501. module = "lovr.graphics",
  8502. variants = {
  8503. {
  8504. arguments = {},
  8505. returns = {
  8506. {
  8507. name = "count",
  8508. type = "number",
  8509. description = "The number of nodes in the model."
  8510. }
  8511. }
  8512. }
  8513. }
  8514. },
  8515. {
  8516. name = "getNodeDraw",
  8517. summary = "TODO",
  8518. description = "TODO",
  8519. key = "Model:getNodeDraw",
  8520. module = "lovr.graphics",
  8521. related = {
  8522. "Pass:setMeshMode",
  8523. "Pass:setMaterial",
  8524. "Pass:mesh",
  8525. "Model:getVertexBuffer",
  8526. "Model:getIndexBuffer"
  8527. },
  8528. variants = {
  8529. {
  8530. arguments = {
  8531. {
  8532. name = "node",
  8533. type = "number",
  8534. description = "The index of the node."
  8535. },
  8536. {
  8537. name = "index",
  8538. type = "number",
  8539. description = "The index of the draw."
  8540. }
  8541. },
  8542. returns = {
  8543. {
  8544. name = "mode",
  8545. type = "MeshMode",
  8546. description = "Whether the vertices are points, lines, or triangles."
  8547. },
  8548. {
  8549. name = "material",
  8550. type = "Material",
  8551. description = "The Material used by the draw."
  8552. },
  8553. {
  8554. name = "start",
  8555. type = "number",
  8556. description = "The offset of the first vertex in the draw."
  8557. },
  8558. {
  8559. name = "count",
  8560. type = "number",
  8561. description = "The number of vertices in the draw."
  8562. },
  8563. {
  8564. name = "base",
  8565. type = "number",
  8566. description = "The base vertex of the draw (added to each instance value), or nil if the draw does not use an index buffer."
  8567. }
  8568. }
  8569. },
  8570. {
  8571. arguments = {
  8572. {
  8573. name = "name",
  8574. type = "string",
  8575. description = "The name of the node."
  8576. },
  8577. {
  8578. name = "index",
  8579. type = "number",
  8580. description = "The index of the draw."
  8581. }
  8582. },
  8583. returns = {
  8584. {
  8585. name = "mode",
  8586. type = "MeshMode",
  8587. description = "Whether the vertices are points, lines, or triangles."
  8588. },
  8589. {
  8590. name = "material",
  8591. type = "Material",
  8592. description = "The Material used by the draw."
  8593. },
  8594. {
  8595. name = "start",
  8596. type = "number",
  8597. description = "The offset of the first vertex in the draw."
  8598. },
  8599. {
  8600. name = "count",
  8601. type = "number",
  8602. description = "The number of vertices in the draw."
  8603. },
  8604. {
  8605. name = "base",
  8606. type = "number",
  8607. description = "The base vertex of the draw (added to each instance value), or nil if the draw does not use an index buffer."
  8608. }
  8609. }
  8610. }
  8611. }
  8612. },
  8613. {
  8614. name = "getNodeDrawCount",
  8615. summary = "TODO",
  8616. description = "TODO",
  8617. key = "Model:getNodeDrawCount",
  8618. module = "lovr.graphics",
  8619. related = {
  8620. "ModelData:getNodeMeshCount",
  8621. "Model:getNodeDraw"
  8622. },
  8623. variants = {
  8624. {
  8625. arguments = {
  8626. {
  8627. name = "index",
  8628. type = "number",
  8629. description = "The index of a node."
  8630. }
  8631. },
  8632. returns = {
  8633. {
  8634. name = "count",
  8635. type = "number",
  8636. description = "The number of draws in the node."
  8637. }
  8638. }
  8639. },
  8640. {
  8641. arguments = {
  8642. {
  8643. name = "name",
  8644. type = "string",
  8645. description = "The name of a node."
  8646. }
  8647. },
  8648. returns = {
  8649. {
  8650. name = "count",
  8651. type = "number",
  8652. description = "The number of draws in the node."
  8653. }
  8654. }
  8655. }
  8656. }
  8657. },
  8658. {
  8659. name = "getNodeName",
  8660. summary = "Get the name of a node in the Model.",
  8661. description = "TODO",
  8662. key = "Model:getNodeName",
  8663. module = "lovr.graphics",
  8664. related = {
  8665. "Model:getNodeCount",
  8666. "Model:getAnimationName",
  8667. "Model:getMaterialName"
  8668. },
  8669. variants = {
  8670. {
  8671. arguments = {
  8672. {
  8673. name = "index",
  8674. type = "number",
  8675. description = "TODO"
  8676. }
  8677. },
  8678. returns = {
  8679. {
  8680. name = "name",
  8681. type = "string",
  8682. description = "TODO"
  8683. }
  8684. }
  8685. }
  8686. }
  8687. },
  8688. {
  8689. name = "getNodeOrientation",
  8690. summary = "Get the orientation of a node.",
  8691. description = "TODO",
  8692. key = "Model:getNodeOrientation",
  8693. module = "lovr.graphics",
  8694. related = {
  8695. "Model:getNodePosition",
  8696. "Model:setNodePosition",
  8697. "Model:getNodeScale",
  8698. "Model:setNodeScale",
  8699. "Model:getNodePose",
  8700. "Model:setNodePose",
  8701. "Model:getNodeTransform",
  8702. "Model:setNodeTransform",
  8703. "Model:animate"
  8704. },
  8705. variants = {
  8706. {
  8707. arguments = {
  8708. {
  8709. name = "index",
  8710. type = "number",
  8711. description = "The index of the node."
  8712. },
  8713. {
  8714. name = "origin",
  8715. type = "OriginType",
  8716. description = "Whether the orientation should be returned relative to the root node or the node's parent.",
  8717. default = "'root'"
  8718. }
  8719. },
  8720. returns = {
  8721. {
  8722. name = "angle",
  8723. type = "number",
  8724. description = "The number of radians the node is rotated around its axis of rotation."
  8725. },
  8726. {
  8727. name = "ax",
  8728. type = "number",
  8729. description = "The x component of the axis of rotation."
  8730. },
  8731. {
  8732. name = "ay",
  8733. type = "number",
  8734. description = "The y component of the axis of rotation."
  8735. },
  8736. {
  8737. name = "az",
  8738. type = "number",
  8739. description = "The z component of the axis of rotation."
  8740. }
  8741. }
  8742. },
  8743. {
  8744. arguments = {
  8745. {
  8746. name = "name",
  8747. type = "string",
  8748. description = "The name of the node."
  8749. },
  8750. {
  8751. name = "origin",
  8752. type = "OriginType",
  8753. description = "Whether the orientation should be returned relative to the root node or the node's parent.",
  8754. default = "'root'"
  8755. }
  8756. },
  8757. returns = {
  8758. {
  8759. name = "angle",
  8760. type = "number",
  8761. description = "The number of radians the node is rotated around its axis of rotation."
  8762. },
  8763. {
  8764. name = "ax",
  8765. type = "number",
  8766. description = "The x component of the axis of rotation."
  8767. },
  8768. {
  8769. name = "ay",
  8770. type = "number",
  8771. description = "The y component of the axis of rotation."
  8772. },
  8773. {
  8774. name = "az",
  8775. type = "number",
  8776. description = "The z component of the axis of rotation."
  8777. }
  8778. }
  8779. }
  8780. }
  8781. },
  8782. {
  8783. name = "getNodeParent",
  8784. summary = "Get the parent of a node.",
  8785. description = "Given a child node, this function returns the index of its parent.",
  8786. key = "Model:getNodeParent",
  8787. module = "lovr.graphics",
  8788. related = {
  8789. "Model:getNodeChildren",
  8790. "Model:getRootNode"
  8791. },
  8792. variants = {
  8793. {
  8794. arguments = {
  8795. {
  8796. name = "index",
  8797. type = "number",
  8798. description = "The index of the child node."
  8799. }
  8800. },
  8801. returns = {
  8802. {
  8803. name = "parent",
  8804. type = "number",
  8805. description = "The index of the parent."
  8806. }
  8807. }
  8808. },
  8809. {
  8810. arguments = {
  8811. {
  8812. name = "name",
  8813. type = "string",
  8814. description = "The name of the child node."
  8815. }
  8816. },
  8817. returns = {
  8818. {
  8819. name = "parent",
  8820. type = "number",
  8821. description = "The index of the parent."
  8822. }
  8823. }
  8824. }
  8825. }
  8826. },
  8827. {
  8828. name = "getNodePose",
  8829. summary = "Get the pose of a node.",
  8830. description = "TODO",
  8831. key = "Model:getNodePose",
  8832. module = "lovr.graphics",
  8833. related = {
  8834. "Model:getNodePosition",
  8835. "Model:setNodePosition",
  8836. "Model:getNodeOrientation",
  8837. "Model:setNodeOrientation",
  8838. "Model:getNodeScale",
  8839. "Model:setNodeScale",
  8840. "Model:getNodeTransform",
  8841. "Model:setNodeTransform",
  8842. "Model:animate"
  8843. },
  8844. variants = {
  8845. {
  8846. arguments = {
  8847. {
  8848. name = "index",
  8849. type = "number",
  8850. description = "The index of a node."
  8851. },
  8852. {
  8853. name = "origin",
  8854. type = "OriginType",
  8855. description = "Whether the pose should be returned relative to the root node or the node's parent.",
  8856. default = "'root'"
  8857. }
  8858. },
  8859. returns = {
  8860. {
  8861. name = "x",
  8862. type = "number",
  8863. description = "The x position of the node."
  8864. },
  8865. {
  8866. name = "y",
  8867. type = "number",
  8868. description = "The y position of the node."
  8869. },
  8870. {
  8871. name = "z",
  8872. type = "number",
  8873. description = "The z position of the node."
  8874. },
  8875. {
  8876. name = "angle",
  8877. type = "number",
  8878. description = "The number of radians the node is rotated around its axis of rotation."
  8879. },
  8880. {
  8881. name = "ax",
  8882. type = "number",
  8883. description = "The x component of the axis of rotation."
  8884. },
  8885. {
  8886. name = "ay",
  8887. type = "number",
  8888. description = "The y component of the axis of rotation."
  8889. },
  8890. {
  8891. name = "az",
  8892. type = "number",
  8893. description = "The z component of the axis of rotation."
  8894. }
  8895. }
  8896. },
  8897. {
  8898. arguments = {
  8899. {
  8900. name = "name",
  8901. type = "string",
  8902. description = "The name of a node."
  8903. },
  8904. {
  8905. name = "origin",
  8906. type = "OriginType",
  8907. description = "Whether the pose should be returned relative to the root node or the node's parent.",
  8908. default = "'root'"
  8909. }
  8910. },
  8911. returns = {
  8912. {
  8913. name = "x",
  8914. type = "number",
  8915. description = "The x position of the node."
  8916. },
  8917. {
  8918. name = "y",
  8919. type = "number",
  8920. description = "The y position of the node."
  8921. },
  8922. {
  8923. name = "z",
  8924. type = "number",
  8925. description = "The z position of the node."
  8926. },
  8927. {
  8928. name = "angle",
  8929. type = "number",
  8930. description = "The number of radians the node is rotated around its axis of rotation."
  8931. },
  8932. {
  8933. name = "ax",
  8934. type = "number",
  8935. description = "The x component of the axis of rotation."
  8936. },
  8937. {
  8938. name = "ay",
  8939. type = "number",
  8940. description = "The y component of the axis of rotation."
  8941. },
  8942. {
  8943. name = "az",
  8944. type = "number",
  8945. description = "The z component of the axis of rotation."
  8946. }
  8947. }
  8948. }
  8949. }
  8950. },
  8951. {
  8952. name = "getNodePosition",
  8953. summary = "Get the position of a node.",
  8954. description = "TODO",
  8955. key = "Model:getNodePosition",
  8956. module = "lovr.graphics",
  8957. related = {
  8958. "Model:getNodeOrientation",
  8959. "Model:setNodeOrientation",
  8960. "Model:getNodeScale",
  8961. "Model:setNodeScale",
  8962. "Model:getNodePose",
  8963. "Model:setNodePose",
  8964. "Model:getNodeTransform",
  8965. "Model:setNodeTransform",
  8966. "Model:animate"
  8967. },
  8968. variants = {
  8969. {
  8970. arguments = {
  8971. {
  8972. name = "index",
  8973. type = "number",
  8974. description = "The index of the node."
  8975. },
  8976. {
  8977. name = "space",
  8978. type = "OriginType",
  8979. description = "Whether the position should be returned relative to the root node or the node's parent.",
  8980. default = "'root'"
  8981. }
  8982. },
  8983. returns = {
  8984. {
  8985. name = "x",
  8986. type = "number",
  8987. description = "The x coordinate."
  8988. },
  8989. {
  8990. name = "y",
  8991. type = "number",
  8992. description = "The y coordinate."
  8993. },
  8994. {
  8995. name = "z",
  8996. type = "number",
  8997. description = "The z coordinate."
  8998. }
  8999. }
  9000. },
  9001. {
  9002. arguments = {
  9003. {
  9004. name = "name",
  9005. type = "string",
  9006. description = "The name of the node."
  9007. },
  9008. {
  9009. name = "space",
  9010. type = "OriginType",
  9011. description = "Whether the position should be returned relative to the root node or the node's parent.",
  9012. default = "'root'"
  9013. }
  9014. },
  9015. returns = {
  9016. {
  9017. name = "x",
  9018. type = "number",
  9019. description = "The x coordinate."
  9020. },
  9021. {
  9022. name = "y",
  9023. type = "number",
  9024. description = "The y coordinate."
  9025. },
  9026. {
  9027. name = "z",
  9028. type = "number",
  9029. description = "The z coordinate."
  9030. }
  9031. }
  9032. }
  9033. }
  9034. },
  9035. {
  9036. name = "getNodeScale",
  9037. summary = "Get the scale of a node.",
  9038. description = "TODO",
  9039. key = "Model:getNodeScale",
  9040. module = "lovr.graphics",
  9041. related = {
  9042. "Model:getNodePosition",
  9043. "Model:setNodePosition",
  9044. "Model:getNodeOrientation",
  9045. "Model:setNodeOrientation",
  9046. "Model:getNodePose",
  9047. "Model:setNodePose",
  9048. "Model:getNodeTransform",
  9049. "Model:setNodeTransform",
  9050. "Model:animate"
  9051. },
  9052. variants = {
  9053. {
  9054. arguments = {
  9055. {
  9056. name = "index",
  9057. type = "number",
  9058. description = "The index of the node."
  9059. },
  9060. {
  9061. name = "origin",
  9062. type = "OriginType",
  9063. description = "Whether the scale should be returned relative to the root node or the node's parent.",
  9064. default = "'root'"
  9065. }
  9066. },
  9067. returns = {
  9068. {
  9069. name = "x",
  9070. type = "number",
  9071. description = "The x scale."
  9072. },
  9073. {
  9074. name = "y",
  9075. type = "number",
  9076. description = "The y scale."
  9077. },
  9078. {
  9079. name = "z",
  9080. type = "number",
  9081. description = "The z scale."
  9082. }
  9083. }
  9084. },
  9085. {
  9086. arguments = {
  9087. {
  9088. name = "name",
  9089. type = "string",
  9090. description = "The name of the node."
  9091. },
  9092. {
  9093. name = "origin",
  9094. type = "OriginType",
  9095. description = "Whether the scale should be returned relative to the root node or the node's parent.",
  9096. default = "'root'"
  9097. }
  9098. },
  9099. returns = {
  9100. {
  9101. name = "x",
  9102. type = "number",
  9103. description = "The x scale."
  9104. },
  9105. {
  9106. name = "y",
  9107. type = "number",
  9108. description = "The y scale."
  9109. },
  9110. {
  9111. name = "z",
  9112. type = "number",
  9113. description = "The z scale."
  9114. }
  9115. }
  9116. }
  9117. }
  9118. },
  9119. {
  9120. name = "getNodeTransform",
  9121. summary = "Get the transform of a node.",
  9122. description = "TODO",
  9123. key = "Model:getNodeTransform",
  9124. module = "lovr.graphics",
  9125. related = {
  9126. "Model:getNodePosition",
  9127. "Model:setNodePosition",
  9128. "Model:getNodeOrientation",
  9129. "Model:setNodeOrientation",
  9130. "Model:getNodeScale",
  9131. "Model:setNodeScale",
  9132. "Model:getNodePose",
  9133. "Model:setNodePose",
  9134. "Model:animate"
  9135. },
  9136. variants = {
  9137. {
  9138. arguments = {
  9139. {
  9140. name = "index",
  9141. type = "number",
  9142. description = "The index of a node."
  9143. },
  9144. {
  9145. name = "origin",
  9146. type = "OriginType",
  9147. description = "Whether the transform should be returned relative to the root node or the node's parent.",
  9148. default = "'root'"
  9149. }
  9150. },
  9151. returns = {
  9152. {
  9153. name = "x",
  9154. type = "number",
  9155. description = "The x position of the node."
  9156. },
  9157. {
  9158. name = "y",
  9159. type = "number",
  9160. description = "The y position of the node."
  9161. },
  9162. {
  9163. name = "z",
  9164. type = "number",
  9165. description = "The z position of the node."
  9166. },
  9167. {
  9168. name = "sx",
  9169. type = "number",
  9170. description = "The x scale of the node."
  9171. },
  9172. {
  9173. name = "sy",
  9174. type = "number",
  9175. description = "The y scale of the node."
  9176. },
  9177. {
  9178. name = "sz",
  9179. type = "number",
  9180. description = "The z scale of the node."
  9181. },
  9182. {
  9183. name = "angle",
  9184. type = "number",
  9185. description = "The number of radians the node is rotated around its axis of rotation."
  9186. },
  9187. {
  9188. name = "ax",
  9189. type = "number",
  9190. description = "The x component of the axis of rotation."
  9191. },
  9192. {
  9193. name = "ay",
  9194. type = "number",
  9195. description = "The y component of the axis of rotation."
  9196. },
  9197. {
  9198. name = "az",
  9199. type = "number",
  9200. description = "The z component of the axis of rotation."
  9201. }
  9202. }
  9203. },
  9204. {
  9205. arguments = {
  9206. {
  9207. name = "name",
  9208. type = "string",
  9209. description = "The name of a node."
  9210. },
  9211. {
  9212. name = "origin",
  9213. type = "OriginType",
  9214. description = "Whether the transform should be returned relative to the root node or the node's parent.",
  9215. default = "'root'"
  9216. }
  9217. },
  9218. returns = {
  9219. {
  9220. name = "x",
  9221. type = "number",
  9222. description = "The x position of the node."
  9223. },
  9224. {
  9225. name = "y",
  9226. type = "number",
  9227. description = "The y position of the node."
  9228. },
  9229. {
  9230. name = "z",
  9231. type = "number",
  9232. description = "The z position of the node."
  9233. },
  9234. {
  9235. name = "sx",
  9236. type = "number",
  9237. description = "The x scale of the node."
  9238. },
  9239. {
  9240. name = "sy",
  9241. type = "number",
  9242. description = "The y scale of the node."
  9243. },
  9244. {
  9245. name = "sz",
  9246. type = "number",
  9247. description = "The z scale of the node."
  9248. },
  9249. {
  9250. name = "angle",
  9251. type = "number",
  9252. description = "The number of radians the node is rotated around its axis of rotation."
  9253. },
  9254. {
  9255. name = "ax",
  9256. type = "number",
  9257. description = "The x component of the axis of rotation."
  9258. },
  9259. {
  9260. name = "ay",
  9261. type = "number",
  9262. description = "The y component of the axis of rotation."
  9263. },
  9264. {
  9265. name = "az",
  9266. type = "number",
  9267. description = "The z component of the axis of rotation."
  9268. }
  9269. }
  9270. }
  9271. }
  9272. },
  9273. {
  9274. name = "getRootNode",
  9275. summary = "Get the index of the root node.",
  9276. description = "Returns the index of the model's root node.",
  9277. key = "Model:getRootNode",
  9278. module = "lovr.graphics",
  9279. related = {
  9280. "Model:getNodeCount",
  9281. "Model:getNodeParent"
  9282. },
  9283. variants = {
  9284. {
  9285. arguments = {},
  9286. returns = {
  9287. {
  9288. name = "root",
  9289. type = "number",
  9290. description = "The index of the root node."
  9291. }
  9292. }
  9293. }
  9294. }
  9295. },
  9296. {
  9297. name = "getTexture",
  9298. summary = "Get one of the textures in the Model.",
  9299. description = "TODO",
  9300. key = "Model:getTexture",
  9301. module = "lovr.graphics",
  9302. related = {
  9303. "Model:getTextureCount",
  9304. "Model:getMaterial"
  9305. },
  9306. variants = {
  9307. {
  9308. arguments = {},
  9309. returns = {
  9310. {
  9311. name = "texture",
  9312. type = "Texture",
  9313. description = "TODO"
  9314. }
  9315. }
  9316. }
  9317. }
  9318. },
  9319. {
  9320. name = "getTextureCount",
  9321. summary = "Get the number of textures in the Model.",
  9322. description = "Returns the number of textures in the Model.",
  9323. key = "Model:getTextureCount",
  9324. module = "lovr.graphics",
  9325. related = {
  9326. "Model:getTexture"
  9327. },
  9328. variants = {
  9329. {
  9330. arguments = {},
  9331. returns = {
  9332. {
  9333. name = "count",
  9334. type = "number",
  9335. description = "The number of textures in the Model."
  9336. }
  9337. }
  9338. }
  9339. }
  9340. },
  9341. {
  9342. name = "getTriangleCount",
  9343. summary = "Get the total number of triangles in the Model.",
  9344. description = "Returns the total number of triangles in the Model.",
  9345. key = "Model:getTriangleCount",
  9346. module = "lovr.graphics",
  9347. notes = "This isn't always related to the length of the vertex buffer, since a mesh in the Model could be drawn by multiple nodes.",
  9348. variants = {
  9349. {
  9350. arguments = {},
  9351. returns = {
  9352. {
  9353. name = "count",
  9354. type = "number",
  9355. description = "The total number of triangles in the Model."
  9356. }
  9357. }
  9358. }
  9359. },
  9360. related = {
  9361. "Model:getTriangles",
  9362. "Model:getVertexCount",
  9363. "ModelData:getTriangleCount"
  9364. }
  9365. },
  9366. {
  9367. name = "getTriangles",
  9368. summary = "Get all the triangles in the Model.",
  9369. description = "Returns 2 tables containing mesh data for the Model.\n\nThe first table is a list of vertex positions and contains 3 numbers for the x, y, and z coordinate of each vertex. The second table is a list of triangles and contains 1-based indices into the first table representing the first, second, and third vertices that make up each triangle.\n\nThe vertex positions will be affected by node transforms.",
  9370. key = "Model:getTriangles",
  9371. module = "lovr.graphics",
  9372. notes = "After this function is called on a Model once, the result is cached (in its ModelData).",
  9373. variants = {
  9374. {
  9375. arguments = {},
  9376. returns = {
  9377. {
  9378. name = "vertices",
  9379. type = "table",
  9380. description = "The triangle vertex positions, returned as a flat (non-nested) table of numbers. The position of each vertex is given as an x, y, and z coordinate."
  9381. },
  9382. {
  9383. name = "indices",
  9384. type = "table",
  9385. description = "The vertex indices. Every 3 indices describes a triangle."
  9386. }
  9387. }
  9388. }
  9389. },
  9390. related = {
  9391. "Model:getTriangleCount",
  9392. "Model:getVertexCount",
  9393. "ModelData:getTriangles"
  9394. }
  9395. },
  9396. {
  9397. name = "getVertexBuffer",
  9398. summary = "Get a Buffer containing the vertices in the Model.",
  9399. description = "TODO",
  9400. key = "Model:getVertexBuffer",
  9401. module = "lovr.graphics",
  9402. related = {
  9403. "Model:getIndexBuffer"
  9404. },
  9405. variants = {
  9406. {
  9407. arguments = {},
  9408. returns = {
  9409. {
  9410. name = "buffer",
  9411. type = "Buffer",
  9412. description = "TODO"
  9413. }
  9414. }
  9415. }
  9416. }
  9417. },
  9418. {
  9419. name = "getVertexCount",
  9420. summary = "Get the total vertex count of the Model.",
  9421. description = "Returns the total vertex count of the Model.",
  9422. key = "Model:getVertexCount",
  9423. module = "lovr.graphics",
  9424. notes = "This isn't always the same as the length of the vertex buffer, since a mesh in the Model could be drawn by multiple nodes.",
  9425. variants = {
  9426. {
  9427. arguments = {},
  9428. returns = {
  9429. {
  9430. name = "count",
  9431. type = "number",
  9432. description = "The total number of vertices."
  9433. }
  9434. }
  9435. }
  9436. },
  9437. related = {
  9438. "Model:getTriangles",
  9439. "Model:getTriangleCount",
  9440. "ModelData:getVertexCount"
  9441. }
  9442. },
  9443. {
  9444. name = "getWidth",
  9445. summary = "Get the width of the Model.",
  9446. description = "Returns the width of the Model, computed from its axis-aligned bounding box.",
  9447. key = "Model:getWidth",
  9448. module = "lovr.graphics",
  9449. related = {
  9450. "Model:getHeight",
  9451. "Model:getDepth",
  9452. "Model:getDimensions",
  9453. "Model:getCenter",
  9454. "Model:getBoundingBox",
  9455. "ModelData:getWidth"
  9456. },
  9457. variants = {
  9458. {
  9459. arguments = {},
  9460. returns = {
  9461. {
  9462. name = "width",
  9463. type = "number",
  9464. description = "The width of the Model."
  9465. }
  9466. }
  9467. }
  9468. }
  9469. },
  9470. {
  9471. name = "hasJoints",
  9472. summary = "Check if the Model uses joints for skeletal animation.",
  9473. description = "TODO",
  9474. key = "Model:hasJoints",
  9475. module = "lovr.graphics",
  9476. notes = "TODO it's computed as skinCount TODO it's different from animationCount",
  9477. variants = {
  9478. {
  9479. arguments = {},
  9480. returns = {
  9481. {
  9482. name = "jointed",
  9483. type = "boolean",
  9484. description = "Whether the animation uses joints for skeletal animation."
  9485. }
  9486. }
  9487. }
  9488. }
  9489. },
  9490. {
  9491. name = "setNodeOrientation",
  9492. summary = "Set or blend the orientation of a node.",
  9493. description = "TODO",
  9494. key = "Model:setNodeOrientation",
  9495. module = "lovr.graphics",
  9496. related = {
  9497. "Model:getNodePosition",
  9498. "Model:setNodePosition",
  9499. "Model:getNodeScale",
  9500. "Model:setNodeScale",
  9501. "Model:getNodePose",
  9502. "Model:setNodePose",
  9503. "Model:getNodeTransform",
  9504. "Model:setNodeTransform",
  9505. "Model:animate"
  9506. },
  9507. variants = {
  9508. {
  9509. arguments = {
  9510. {
  9511. name = "index",
  9512. type = "number",
  9513. description = "The index of the node."
  9514. },
  9515. {
  9516. name = "orientation",
  9517. type = "rotation",
  9518. description = "The target orientation."
  9519. },
  9520. {
  9521. name = "blend",
  9522. type = "number",
  9523. description = "A number from 0 to 1 indicating how much of the target orientation to blend in. A value of 0 will not change the node's orientation at all, whereas 1 will fully blend to the target orientation.",
  9524. default = "1.0"
  9525. }
  9526. },
  9527. returns = {}
  9528. },
  9529. {
  9530. arguments = {
  9531. {
  9532. name = "name",
  9533. type = "string",
  9534. description = "The name of the node."
  9535. },
  9536. {
  9537. name = "orientation",
  9538. type = "rotation",
  9539. description = "The target orientation."
  9540. },
  9541. {
  9542. name = "blend",
  9543. type = "number",
  9544. description = "A number from 0 to 1 indicating how much of the target orientation to blend in. A value of 0 will not change the node's orientation at all, whereas 1 will fully blend to the target orientation.",
  9545. default = "1.0"
  9546. }
  9547. },
  9548. returns = {}
  9549. }
  9550. }
  9551. },
  9552. {
  9553. name = "setNodePose",
  9554. summary = "Set or blend the pose of a node.",
  9555. description = "TODO",
  9556. key = "Model:setNodePose",
  9557. module = "lovr.graphics",
  9558. related = {
  9559. "Model:getNodePosition",
  9560. "Model:setNodePosition",
  9561. "Model:getNodeOrientation",
  9562. "Model:setNodeOrientation",
  9563. "Model:getNodeScale",
  9564. "Model:setNodeScale",
  9565. "Model:getNodeTransform",
  9566. "Model:setNodeTransform",
  9567. "Model:animate"
  9568. },
  9569. variants = {
  9570. {
  9571. arguments = {
  9572. {
  9573. name = "index",
  9574. type = "number",
  9575. description = "The index of the node."
  9576. },
  9577. {
  9578. name = "position",
  9579. type = "vector3",
  9580. description = "The target position."
  9581. },
  9582. {
  9583. name = "orientation",
  9584. type = "rotation",
  9585. description = "The target orientation."
  9586. },
  9587. {
  9588. name = "blend",
  9589. type = "number",
  9590. description = "A number from 0 to 1 indicating how much of the target pose to blend in. A value of 0 will not change the node's pose at all, whereas 1 will fully blend to the target pose.",
  9591. default = "1.0"
  9592. }
  9593. },
  9594. returns = {}
  9595. },
  9596. {
  9597. arguments = {
  9598. {
  9599. name = "name",
  9600. type = "string",
  9601. description = "The name of the node."
  9602. },
  9603. {
  9604. name = "position",
  9605. type = "vector3",
  9606. description = "The target position."
  9607. },
  9608. {
  9609. name = "orientation",
  9610. type = "rotation",
  9611. description = "The target orientation."
  9612. },
  9613. {
  9614. name = "blend",
  9615. type = "number",
  9616. description = "A number from 0 to 1 indicating how much of the target pose to blend in. A value of 0 will not change the node's pose at all, whereas 1 will fully blend to the target pose.",
  9617. default = "1.0"
  9618. }
  9619. },
  9620. returns = {}
  9621. }
  9622. }
  9623. },
  9624. {
  9625. name = "setNodePosition",
  9626. summary = "Set or blend the position of a node.",
  9627. description = "TODO",
  9628. key = "Model:setNodePosition",
  9629. module = "lovr.graphics",
  9630. related = {
  9631. "Model:getNodeOrientation",
  9632. "Model:setNodeOrientation",
  9633. "Model:getNodeScale",
  9634. "Model:setNodeScale",
  9635. "Model:getNodePose",
  9636. "Model:setNodePose",
  9637. "Model:getNodeTransform",
  9638. "Model:setNodeTransform",
  9639. "Model:animate"
  9640. },
  9641. variants = {
  9642. {
  9643. arguments = {
  9644. {
  9645. name = "index",
  9646. type = "number",
  9647. description = "The index of the node."
  9648. },
  9649. {
  9650. name = "position",
  9651. type = "vector3",
  9652. description = "The target position."
  9653. },
  9654. {
  9655. name = "blend",
  9656. type = "number",
  9657. description = "A number from 0 to 1 indicating how much of the target position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position.",
  9658. default = "1.0"
  9659. }
  9660. },
  9661. returns = {}
  9662. },
  9663. {
  9664. arguments = {
  9665. {
  9666. name = "name",
  9667. type = "string",
  9668. description = "The name of the node."
  9669. },
  9670. {
  9671. name = "position",
  9672. type = "vector3",
  9673. description = "The target position."
  9674. },
  9675. {
  9676. name = "blend",
  9677. type = "number",
  9678. description = "A number from 0 to 1 indicating how much of the target position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position.",
  9679. default = "1.0"
  9680. }
  9681. },
  9682. returns = {}
  9683. }
  9684. }
  9685. },
  9686. {
  9687. name = "setNodeScale",
  9688. summary = "Set or blend the scale of a node.",
  9689. description = "TODO",
  9690. key = "Model:setNodeScale",
  9691. module = "lovr.graphics",
  9692. related = {
  9693. "Model:getNodePosition",
  9694. "Model:setNodePosition",
  9695. "Model:getNodeOrientation",
  9696. "Model:setNodeOrientation",
  9697. "Model:getNodePose",
  9698. "Model:setNodePose",
  9699. "Model:getNodeTransform",
  9700. "Model:setNodeTransform",
  9701. "Model:animate"
  9702. },
  9703. variants = {
  9704. {
  9705. arguments = {
  9706. {
  9707. name = "index",
  9708. type = "number",
  9709. description = "The index of the node."
  9710. },
  9711. {
  9712. name = "scale",
  9713. type = "vector3",
  9714. description = "The target scale."
  9715. },
  9716. {
  9717. name = "blend",
  9718. type = "number",
  9719. description = "A number from 0 to 1 indicating how much of the target scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale.",
  9720. default = "1.0"
  9721. }
  9722. },
  9723. returns = {}
  9724. },
  9725. {
  9726. arguments = {
  9727. {
  9728. name = "name",
  9729. type = "string",
  9730. description = "The name of the node."
  9731. },
  9732. {
  9733. name = "scale",
  9734. type = "vector3",
  9735. description = "The target scale."
  9736. },
  9737. {
  9738. name = "blend",
  9739. type = "number",
  9740. description = "A number from 0 to 1 indicating how much of the target scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale.",
  9741. default = "1.0"
  9742. }
  9743. },
  9744. returns = {}
  9745. }
  9746. }
  9747. },
  9748. {
  9749. name = "setNodeTransform",
  9750. summary = "Set or blend the transform of a node.",
  9751. description = "TODO",
  9752. key = "Model:setNodeTransform",
  9753. module = "lovr.graphics",
  9754. related = {
  9755. "Model:getNodePosition",
  9756. "Model:setNodePosition",
  9757. "Model:getNodeOrientation",
  9758. "Model:setNodeOrientation",
  9759. "Model:getNodeScale",
  9760. "Model:setNodeScale",
  9761. "Model:getNodePose",
  9762. "Model:setNodePose",
  9763. "Model:animate"
  9764. },
  9765. variants = {
  9766. {
  9767. arguments = {
  9768. {
  9769. name = "index",
  9770. type = "number",
  9771. description = "The index of the node."
  9772. },
  9773. {
  9774. name = "transform",
  9775. type = "transform",
  9776. description = "The target transform."
  9777. },
  9778. {
  9779. name = "blend",
  9780. type = "number",
  9781. description = "A number from 0 to 1 indicating how much of the target transform to blend in. A value of 0 will not change the node's transform at all, whereas 1 will fully blend to the target transform.",
  9782. default = "1.0"
  9783. }
  9784. },
  9785. returns = {}
  9786. },
  9787. {
  9788. arguments = {
  9789. {
  9790. name = "name",
  9791. type = "string",
  9792. description = "The name of the node."
  9793. },
  9794. {
  9795. name = "transform",
  9796. type = "transform",
  9797. description = "The target transform."
  9798. },
  9799. {
  9800. name = "blend",
  9801. type = "number",
  9802. description = "A number from 0 to 1 indicating how much of the target transform to blend in. A value of 0 will not change the node's transform at all, whereas 1 will fully blend to the target transform.",
  9803. default = "1.0"
  9804. }
  9805. },
  9806. returns = {}
  9807. }
  9808. }
  9809. }
  9810. }
  9811. },
  9812. {
  9813. name = "Pass",
  9814. summary = "A stream of graphics commands.",
  9815. description = "TODO",
  9816. key = "Pass",
  9817. module = "lovr.graphics",
  9818. sections = {
  9819. {
  9820. name = "Drawing",
  9821. tag = "drawing",
  9822. description = "TODO"
  9823. },
  9824. {
  9825. name = "Coordinate System",
  9826. tag = "transform",
  9827. description = "TODO"
  9828. },
  9829. {
  9830. name = "Render States",
  9831. tag = "pipeline",
  9832. description = "TODO"
  9833. },
  9834. {
  9835. name = "Shader Inputs",
  9836. tag = "shader-inputs",
  9837. description = "TODO"
  9838. },
  9839. {
  9840. name = "Camera",
  9841. tag = "camera",
  9842. description = "TODO"
  9843. },
  9844. {
  9845. name = "Compute",
  9846. tag = "compute",
  9847. description = "TODO"
  9848. }
  9849. },
  9850. methods = {
  9851. {
  9852. name = "blit",
  9853. tag = "transfer",
  9854. summary = "Copy data between textures with scaling.",
  9855. description = "TODO",
  9856. key = "Pass:blit",
  9857. module = "lovr.graphics",
  9858. variants = {
  9859. {
  9860. arguments = {
  9861. {
  9862. name = "src",
  9863. type = "Texture",
  9864. description = "TODO"
  9865. },
  9866. {
  9867. name = "dst",
  9868. type = "Texture",
  9869. description = "TODO"
  9870. },
  9871. {
  9872. name = "srcx",
  9873. type = "number",
  9874. description = "TODO",
  9875. default = "0"
  9876. },
  9877. {
  9878. name = "srcy",
  9879. type = "number",
  9880. description = "TODO",
  9881. default = "0"
  9882. },
  9883. {
  9884. name = "srcz",
  9885. type = "number",
  9886. description = "TODO",
  9887. default = "0"
  9888. },
  9889. {
  9890. name = "dstx",
  9891. type = "number",
  9892. description = "TODO",
  9893. default = "0"
  9894. },
  9895. {
  9896. name = "dsty",
  9897. type = "number",
  9898. description = "TODO",
  9899. default = "0"
  9900. },
  9901. {
  9902. name = "dstz",
  9903. type = "number",
  9904. description = "TODO",
  9905. default = "0"
  9906. },
  9907. {
  9908. name = "srcw",
  9909. type = "number",
  9910. description = "TODO",
  9911. default = "nil"
  9912. },
  9913. {
  9914. name = "srch",
  9915. type = "number",
  9916. description = "TODO",
  9917. default = "nil"
  9918. },
  9919. {
  9920. name = "srcd",
  9921. type = "number",
  9922. description = "TODO",
  9923. default = "nil"
  9924. },
  9925. {
  9926. name = "dstw",
  9927. type = "number",
  9928. description = "TODO",
  9929. default = "nil"
  9930. },
  9931. {
  9932. name = "dsth",
  9933. type = "number",
  9934. description = "TODO",
  9935. default = "nil"
  9936. },
  9937. {
  9938. name = "dstd",
  9939. type = "number",
  9940. description = "TODO",
  9941. default = "nil"
  9942. },
  9943. {
  9944. name = "srclevel",
  9945. type = "number",
  9946. description = "TODO",
  9947. default = "1"
  9948. },
  9949. {
  9950. name = "dstlevel",
  9951. type = "number",
  9952. description = "TODO",
  9953. default = "1"
  9954. }
  9955. },
  9956. returns = {}
  9957. }
  9958. }
  9959. },
  9960. {
  9961. name = "box",
  9962. tag = "drawing",
  9963. summary = "Draw a box.",
  9964. description = "TODO",
  9965. key = "Pass:box",
  9966. module = "lovr.graphics",
  9967. notes = "TODO",
  9968. variants = {
  9969. {
  9970. arguments = {
  9971. {
  9972. name = "transform",
  9973. type = "Transform3",
  9974. description = "The transform to apply to the box."
  9975. },
  9976. {
  9977. name = "style",
  9978. type = "DrawStyle",
  9979. description = "Whether the box should be drawn filled or outlined.",
  9980. default = "'fill'"
  9981. }
  9982. },
  9983. returns = {}
  9984. }
  9985. }
  9986. },
  9987. {
  9988. name = "capsule",
  9989. tag = "drawing",
  9990. summary = "Draw a capsule.",
  9991. description = "TODO",
  9992. key = "Pass:capsule",
  9993. module = "lovr.graphics",
  9994. notes = "TODO",
  9995. variants = {
  9996. {
  9997. arguments = {
  9998. {
  9999. name = "transform",
  10000. type = "TransformXY2",
  10001. description = "The transform to apply to the capsule. The x and y scale is the radius, the z scale is the length."
  10002. },
  10003. {
  10004. name = "segments",
  10005. type = "number",
  10006. description = "The number of circular segments to render.",
  10007. default = "32"
  10008. }
  10009. },
  10010. returns = {}
  10011. },
  10012. {
  10013. arguments = {
  10014. {
  10015. name = "p1",
  10016. type = "Point3",
  10017. description = "The starting point of the capsule."
  10018. },
  10019. {
  10020. name = "p2",
  10021. type = "Point3",
  10022. description = "The ending point of the capsule."
  10023. },
  10024. {
  10025. name = "segments",
  10026. type = "number",
  10027. description = "The number of circular segments to render.",
  10028. default = "32"
  10029. }
  10030. },
  10031. returns = {}
  10032. }
  10033. }
  10034. },
  10035. {
  10036. name = "circle",
  10037. tag = "drawing",
  10038. summary = "Draw a circle.",
  10039. description = "TODO",
  10040. key = "Pass:circle",
  10041. module = "lovr.graphics",
  10042. notes = "TODO",
  10043. variants = {
  10044. {
  10045. arguments = {
  10046. {
  10047. name = "transform",
  10048. type = "Transform",
  10049. description = "The transform to apply to the circle."
  10050. },
  10051. {
  10052. name = "style",
  10053. type = "DrawStyle",
  10054. description = "Whether the circle should be filled or outlined.",
  10055. default = "'fill'"
  10056. },
  10057. {
  10058. name = "angle1",
  10059. type = "number",
  10060. description = "The angle of the beginning of the arc.",
  10061. default = "0"
  10062. },
  10063. {
  10064. name = "angle2",
  10065. type = "number",
  10066. description = "angle of the end of the arc.",
  10067. default = "2 * math.pi"
  10068. },
  10069. {
  10070. name = "segments",
  10071. type = "number",
  10072. description = "The number of segments to render.",
  10073. default = "64"
  10074. }
  10075. },
  10076. returns = {}
  10077. }
  10078. }
  10079. },
  10080. {
  10081. name = "clear",
  10082. tag = "transfer",
  10083. summary = "Clear a Buffer or Texture.",
  10084. description = "TODO",
  10085. key = "Pass:clear",
  10086. module = "lovr.graphics",
  10087. notes = "TODO",
  10088. variants = {
  10089. {
  10090. arguments = {
  10091. {
  10092. name = "buffer",
  10093. type = "Buffer",
  10094. description = "The Buffer to clear."
  10095. },
  10096. {
  10097. name = "offset",
  10098. type = "number",
  10099. description = "TODO"
  10100. },
  10101. {
  10102. name = "extent",
  10103. type = "number",
  10104. description = "TODO"
  10105. }
  10106. },
  10107. returns = {}
  10108. },
  10109. {
  10110. arguments = {
  10111. {
  10112. name = "texture",
  10113. type = "Texture",
  10114. description = "The Texture to clear."
  10115. },
  10116. {
  10117. name = "color",
  10118. type = "Color",
  10119. description = "The color to clear to."
  10120. },
  10121. {
  10122. name = "layer",
  10123. type = "number",
  10124. description = "The index of the first layer to clear.",
  10125. default = "1"
  10126. },
  10127. {
  10128. name = "layers",
  10129. type = "number",
  10130. description = "The number of layers to clear.",
  10131. default = "nil"
  10132. },
  10133. {
  10134. name = "level",
  10135. type = "number",
  10136. description = "The index of the first mipmap level to clear.",
  10137. default = "1"
  10138. },
  10139. {
  10140. name = "levels",
  10141. type = "number",
  10142. description = "The number of mipmap level to clear.",
  10143. default = "nil"
  10144. }
  10145. },
  10146. returns = {}
  10147. }
  10148. }
  10149. },
  10150. {
  10151. name = "compute",
  10152. tag = "compute",
  10153. summary = "Dispatch a compute shader.",
  10154. description = "TODO",
  10155. key = "Pass:compute",
  10156. module = "lovr.graphics",
  10157. notes = "TODO",
  10158. variants = {
  10159. {
  10160. arguments = {
  10161. {
  10162. name = "x",
  10163. type = "number",
  10164. description = "How many workgroups to dispatch in the x dimension.",
  10165. default = "1"
  10166. },
  10167. {
  10168. name = "y",
  10169. type = "number",
  10170. description = "How many workgroups to dispatch in the y dimension.",
  10171. default = "1"
  10172. },
  10173. {
  10174. name = "z",
  10175. type = "number",
  10176. description = "How many workgroups to dispatch in the z dimension.",
  10177. default = "1"
  10178. }
  10179. },
  10180. returns = {}
  10181. },
  10182. {
  10183. description = "Perform an \"indirect\" dispatch, sourcing workgroup counts from a Buffer.",
  10184. arguments = {
  10185. {
  10186. name = "buffer",
  10187. type = "Buffer",
  10188. description = "A Buffer object containing the x, y, and z workgroup counts, stored as 4 byte unsigned integers."
  10189. },
  10190. {
  10191. name = "offset",
  10192. type = "number",
  10193. description = "The byte offset to read the workgroup counts from in the Buffer.",
  10194. default = "0"
  10195. }
  10196. },
  10197. returns = {}
  10198. }
  10199. }
  10200. },
  10201. {
  10202. name = "cone",
  10203. tag = "drawing",
  10204. summary = "Draw a cone.",
  10205. description = "TODO",
  10206. key = "Pass:cone",
  10207. module = "lovr.graphics",
  10208. notes = "TODO",
  10209. variants = {
  10210. {
  10211. arguments = {
  10212. {
  10213. name = "transform",
  10214. type = "TransformXY2",
  10215. description = "The transform to apply to the cone. The x and y scale is the radius, the z scale is the length."
  10216. },
  10217. {
  10218. name = "segments",
  10219. type = "number",
  10220. description = "The number of circular segments to render.",
  10221. default = "64"
  10222. }
  10223. },
  10224. returns = {}
  10225. }
  10226. }
  10227. },
  10228. {
  10229. name = "copy",
  10230. tag = "transfer",
  10231. summary = "Copy data to or between GPU resources.",
  10232. description = "TODO",
  10233. key = "Pass:copy",
  10234. module = "lovr.graphics",
  10235. variants = {
  10236. {
  10237. description = "Copy table data to a Buffer.",
  10238. arguments = {
  10239. {
  10240. name = "table",
  10241. type = "table",
  10242. description = "TODO"
  10243. },
  10244. {
  10245. name = "bufferdst",
  10246. type = "Buffer",
  10247. description = "TODO"
  10248. },
  10249. {
  10250. name = "srcindex",
  10251. type = "number",
  10252. description = "TODO",
  10253. default = "1"
  10254. },
  10255. {
  10256. name = "dstindex",
  10257. type = "number",
  10258. description = "TODO",
  10259. default = "1"
  10260. },
  10261. {
  10262. name = "count",
  10263. type = "number",
  10264. description = "TODO",
  10265. default = "nil"
  10266. }
  10267. },
  10268. returns = {}
  10269. },
  10270. {
  10271. description = "Copy binary data to a Buffer.",
  10272. arguments = {
  10273. {
  10274. name = "blob",
  10275. type = "Blob",
  10276. description = "TODO"
  10277. },
  10278. {
  10279. name = "bufferdst",
  10280. type = "Buffer",
  10281. description = "TODO"
  10282. },
  10283. {
  10284. name = "srcoffset",
  10285. type = "number",
  10286. description = "TODO",
  10287. default = "0"
  10288. },
  10289. {
  10290. name = "dstoffset",
  10291. type = "number",
  10292. description = "TODO",
  10293. default = "0"
  10294. },
  10295. {
  10296. name = "size",
  10297. type = "number",
  10298. description = "TODO",
  10299. default = "nil"
  10300. }
  10301. },
  10302. returns = {}
  10303. },
  10304. {
  10305. description = "Copy data between Buffers.",
  10306. arguments = {
  10307. {
  10308. name = "buffersrc",
  10309. type = "Buffer",
  10310. description = "TODO"
  10311. },
  10312. {
  10313. name = "bufferdst",
  10314. type = "Buffer",
  10315. description = "TODO"
  10316. },
  10317. {
  10318. name = "srcoffset",
  10319. type = "number",
  10320. description = "TODO",
  10321. default = "0"
  10322. },
  10323. {
  10324. name = "dstoffset",
  10325. type = "number",
  10326. description = "TODO",
  10327. default = "0"
  10328. },
  10329. {
  10330. name = "size",
  10331. type = "number",
  10332. description = "TODO",
  10333. default = "nil"
  10334. }
  10335. },
  10336. returns = {}
  10337. },
  10338. {
  10339. description = "Copy Image data to a Texture.",
  10340. arguments = {
  10341. {
  10342. name = "image",
  10343. type = "Image",
  10344. description = "TODO"
  10345. },
  10346. {
  10347. name = "texturedst",
  10348. type = "Texture",
  10349. description = "TODO"
  10350. },
  10351. {
  10352. name = "srcx",
  10353. type = "number",
  10354. description = "TODO",
  10355. default = "0"
  10356. },
  10357. {
  10358. name = "srcy",
  10359. type = "number",
  10360. description = "TODO",
  10361. default = "0"
  10362. },
  10363. {
  10364. name = "dstx",
  10365. type = "number",
  10366. description = "TODO",
  10367. default = "0"
  10368. },
  10369. {
  10370. name = "dsty",
  10371. type = "number",
  10372. description = "TODO",
  10373. default = "0"
  10374. },
  10375. {
  10376. name = "width",
  10377. type = "number",
  10378. description = "TODO",
  10379. default = "nil"
  10380. },
  10381. {
  10382. name = "height",
  10383. type = "number",
  10384. description = "TODO",
  10385. default = "nil"
  10386. },
  10387. {
  10388. name = "srclayer",
  10389. type = "number",
  10390. description = "TODO",
  10391. default = "1"
  10392. },
  10393. {
  10394. name = "dstlayer",
  10395. type = "number",
  10396. description = "TODO",
  10397. default = "1"
  10398. },
  10399. {
  10400. name = "layers",
  10401. type = "number",
  10402. description = "TODO",
  10403. default = "nil"
  10404. },
  10405. {
  10406. name = "srclevel",
  10407. type = "number",
  10408. description = "TODO",
  10409. default = "1"
  10410. },
  10411. {
  10412. name = "dstlevel",
  10413. type = "number",
  10414. description = "TODO",
  10415. default = "1"
  10416. }
  10417. },
  10418. returns = {}
  10419. },
  10420. {
  10421. description = "Copy data between Textures.",
  10422. arguments = {
  10423. {
  10424. name = "texturesrc",
  10425. type = "Texture",
  10426. description = "TODO"
  10427. },
  10428. {
  10429. name = "texturedst",
  10430. type = "Texture",
  10431. description = "TODO"
  10432. },
  10433. {
  10434. name = "srcx",
  10435. type = "number",
  10436. description = "TODO",
  10437. default = "0"
  10438. },
  10439. {
  10440. name = "srcy",
  10441. type = "number",
  10442. description = "TODO",
  10443. default = "0"
  10444. },
  10445. {
  10446. name = "dstx",
  10447. type = "number",
  10448. description = "TODO",
  10449. default = "0"
  10450. },
  10451. {
  10452. name = "dsty",
  10453. type = "number",
  10454. description = "TODO",
  10455. default = "0"
  10456. },
  10457. {
  10458. name = "width",
  10459. type = "number",
  10460. description = "TODO",
  10461. default = "nil"
  10462. },
  10463. {
  10464. name = "height",
  10465. type = "number",
  10466. description = "TODO",
  10467. default = "nil"
  10468. },
  10469. {
  10470. name = "srclayer",
  10471. type = "number",
  10472. description = "TODO",
  10473. default = "1"
  10474. },
  10475. {
  10476. name = "dstlayer",
  10477. type = "number",
  10478. description = "TODO",
  10479. default = "1"
  10480. },
  10481. {
  10482. name = "layers",
  10483. type = "number",
  10484. description = "TODO",
  10485. default = "nil"
  10486. },
  10487. {
  10488. name = "srclevel",
  10489. type = "number",
  10490. description = "TODO",
  10491. default = "1"
  10492. },
  10493. {
  10494. name = "dstlevel",
  10495. type = "number",
  10496. description = "TODO",
  10497. default = "1"
  10498. }
  10499. },
  10500. returns = {}
  10501. },
  10502. {
  10503. description = "Copy tally data to a Buffer.",
  10504. arguments = {
  10505. {
  10506. name = "tally",
  10507. type = "Tally",
  10508. description = "TODO"
  10509. },
  10510. {
  10511. name = "srcindex",
  10512. type = "number",
  10513. description = "TODO",
  10514. default = "1"
  10515. },
  10516. {
  10517. name = "dstoffset",
  10518. type = "number",
  10519. description = "TODO",
  10520. default = "0"
  10521. },
  10522. {
  10523. name = "count",
  10524. type = "number",
  10525. description = "TODO",
  10526. default = "nil"
  10527. }
  10528. },
  10529. returns = {}
  10530. }
  10531. }
  10532. },
  10533. {
  10534. name = "cube",
  10535. tag = "drawing",
  10536. summary = "Draw a cube.",
  10537. description = "TODO",
  10538. key = "Pass:cube",
  10539. module = "lovr.graphics",
  10540. notes = "TODO",
  10541. variants = {
  10542. {
  10543. arguments = {
  10544. {
  10545. name = "transform",
  10546. type = "Transform",
  10547. description = "The transform to apply to the cube."
  10548. },
  10549. {
  10550. name = "style",
  10551. type = "DrawStyle",
  10552. description = "Whether the cube should be drawn filled or outlined.",
  10553. default = "'fill'"
  10554. }
  10555. },
  10556. returns = {}
  10557. }
  10558. }
  10559. },
  10560. {
  10561. name = "cylinder",
  10562. tag = "drawing",
  10563. summary = "Draw a cylinder.",
  10564. description = "TODO",
  10565. key = "Pass:cylinder",
  10566. module = "lovr.graphics",
  10567. notes = "TODO",
  10568. variants = {
  10569. {
  10570. arguments = {
  10571. {
  10572. name = "transform",
  10573. type = "TransformXY2",
  10574. description = "The transform to apply to the cylinder. The x and y scale is the radius, the z scale is the length."
  10575. },
  10576. {
  10577. name = "capped",
  10578. type = "boolean",
  10579. description = "Whether the tops and bottoms of the cylinder should be rendered.",
  10580. default = "true"
  10581. },
  10582. {
  10583. name = "angle1",
  10584. type = "number",
  10585. description = "The angle of the beginning of the arc.",
  10586. default = "0"
  10587. },
  10588. {
  10589. name = "angle2",
  10590. type = "number",
  10591. description = "angle of the end of the arc.",
  10592. default = "2 * math.pi"
  10593. },
  10594. {
  10595. name = "segments",
  10596. type = "number",
  10597. description = "The number of circular segments to render.",
  10598. default = "64"
  10599. }
  10600. },
  10601. returns = {}
  10602. },
  10603. {
  10604. arguments = {
  10605. {
  10606. name = "p1",
  10607. type = "Point3",
  10608. description = "The starting point of the cylinder."
  10609. },
  10610. {
  10611. name = "p2",
  10612. type = "Point3",
  10613. description = "The ending point of the cylinder."
  10614. },
  10615. {
  10616. name = "capped",
  10617. type = "boolean",
  10618. description = "Whether the tops and bottoms of the cylinder should be rendered.",
  10619. default = "true"
  10620. },
  10621. {
  10622. name = "angle1",
  10623. type = "number",
  10624. description = "The angle of the beginning of the arc.",
  10625. default = "0"
  10626. },
  10627. {
  10628. name = "angle2",
  10629. type = "number",
  10630. description = "angle of the end of the arc.",
  10631. default = "2 * math.pi"
  10632. },
  10633. {
  10634. name = "segments",
  10635. type = "number",
  10636. description = "The number of circular segments to render.",
  10637. default = "64"
  10638. }
  10639. },
  10640. returns = {}
  10641. }
  10642. }
  10643. },
  10644. {
  10645. name = "draw",
  10646. tag = "drawing",
  10647. summary = "Draw a drawable object.",
  10648. description = "TODO",
  10649. key = "Pass:draw",
  10650. module = "lovr.graphics",
  10651. variants = {
  10652. {
  10653. arguments = {
  10654. {
  10655. name = "model",
  10656. type = "Model",
  10657. description = "The model to draw."
  10658. },
  10659. {
  10660. name = "transform",
  10661. type = "Transform",
  10662. description = "The transform of the object."
  10663. },
  10664. {
  10665. name = "nodeindex",
  10666. type = "number",
  10667. description = "TODO"
  10668. },
  10669. {
  10670. name = "children",
  10671. type = "boolean",
  10672. description = "TODO"
  10673. },
  10674. {
  10675. name = "instances",
  10676. type = "number",
  10677. description = "TODO"
  10678. }
  10679. },
  10680. returns = {}
  10681. },
  10682. {
  10683. arguments = {
  10684. {
  10685. name = "model",
  10686. type = "Model",
  10687. description = "The model to draw."
  10688. },
  10689. {
  10690. name = "transform",
  10691. type = "Transform",
  10692. description = "The transform of the object."
  10693. },
  10694. {
  10695. name = "nodename",
  10696. type = "string",
  10697. description = "TODO"
  10698. },
  10699. {
  10700. name = "children",
  10701. type = "boolean",
  10702. description = "TODO"
  10703. },
  10704. {
  10705. name = "instances",
  10706. type = "number",
  10707. description = "TODO"
  10708. }
  10709. },
  10710. returns = {}
  10711. }
  10712. }
  10713. },
  10714. {
  10715. name = "fill",
  10716. tag = "drawing",
  10717. summary = "Draw a fullscreen quad.",
  10718. description = "TODO",
  10719. key = "Pass:fill",
  10720. module = "lovr.graphics",
  10721. variants = {
  10722. {
  10723. arguments = {
  10724. {
  10725. name = "texture",
  10726. type = "Texture",
  10727. description = "The texture to fill."
  10728. }
  10729. },
  10730. returns = {}
  10731. },
  10732. {
  10733. arguments = {},
  10734. returns = {}
  10735. }
  10736. }
  10737. },
  10738. {
  10739. name = "getClear",
  10740. summary = "TODO",
  10741. description = "TODO",
  10742. key = "Pass:getClear",
  10743. module = "lovr.graphics",
  10744. notes = "TODO",
  10745. variants = {
  10746. {
  10747. arguments = {},
  10748. returns = {
  10749. {
  10750. name = "clears",
  10751. type = "table",
  10752. description = "TODO"
  10753. }
  10754. }
  10755. }
  10756. }
  10757. },
  10758. {
  10759. name = "getDimensions",
  10760. summary = "TODO",
  10761. description = "TODO",
  10762. key = "Pass:getDimensions",
  10763. module = "lovr.graphics",
  10764. variants = {
  10765. {
  10766. arguments = {},
  10767. returns = {
  10768. {
  10769. name = "width",
  10770. type = "number",
  10771. description = "TODO"
  10772. },
  10773. {
  10774. name = "height",
  10775. type = "number",
  10776. description = "TODO"
  10777. }
  10778. }
  10779. }
  10780. }
  10781. },
  10782. {
  10783. name = "getHeight",
  10784. summary = "TODO",
  10785. description = "TODO",
  10786. key = "Pass:getHeight",
  10787. module = "lovr.graphics",
  10788. variants = {
  10789. {
  10790. arguments = {},
  10791. returns = {
  10792. {
  10793. name = "height",
  10794. type = "number",
  10795. description = "TODO"
  10796. }
  10797. }
  10798. }
  10799. }
  10800. },
  10801. {
  10802. name = "getProjection",
  10803. tag = "camera",
  10804. summary = "Get the field of view.",
  10805. description = "Returns the projection for a single view.",
  10806. key = "Pass:getProjection",
  10807. module = "lovr.graphics",
  10808. related = {
  10809. "lovr.headset.getViewAngles",
  10810. "lovr.headset.getViewCount",
  10811. "lovr.graphics.getViewPose",
  10812. "lovr.graphics.setViewPose"
  10813. },
  10814. variants = {
  10815. {
  10816. arguments = {
  10817. {
  10818. name = "view",
  10819. type = "number",
  10820. description = "The view index."
  10821. }
  10822. },
  10823. returns = {
  10824. {
  10825. name = "left",
  10826. type = "number",
  10827. description = "The left field of view angle, in radians."
  10828. },
  10829. {
  10830. name = "right",
  10831. type = "number",
  10832. description = "The right field of view angle, in radians."
  10833. },
  10834. {
  10835. name = "up",
  10836. type = "number",
  10837. description = "The top field of view angle, in radians."
  10838. },
  10839. {
  10840. name = "down",
  10841. type = "number",
  10842. description = "The bottom field of view angle, in radians."
  10843. }
  10844. }
  10845. },
  10846. {
  10847. arguments = {
  10848. {
  10849. name = "view",
  10850. type = "number",
  10851. description = "The view index."
  10852. },
  10853. {
  10854. name = "matrix",
  10855. type = "Mat4",
  10856. description = "The matrix to fill with the projection."
  10857. }
  10858. },
  10859. returns = {
  10860. {
  10861. name = "matrix",
  10862. type = "Mat4",
  10863. description = "The matrix containing the projection."
  10864. }
  10865. }
  10866. }
  10867. }
  10868. },
  10869. {
  10870. name = "getSampleCount",
  10871. summary = "TODO",
  10872. description = "TODO",
  10873. key = "Pass:getSampleCount",
  10874. module = "lovr.graphics",
  10875. variants = {
  10876. {
  10877. arguments = {},
  10878. returns = {
  10879. {
  10880. name = "samples",
  10881. type = "number",
  10882. description = "TODO"
  10883. }
  10884. }
  10885. }
  10886. }
  10887. },
  10888. {
  10889. name = "getTarget",
  10890. summary = "TODO",
  10891. description = "TODO",
  10892. key = "Pass:getTarget",
  10893. module = "lovr.graphics",
  10894. variants = {
  10895. {
  10896. arguments = {},
  10897. returns = {
  10898. {
  10899. name = "target",
  10900. type = "table",
  10901. description = "TODO"
  10902. }
  10903. }
  10904. }
  10905. }
  10906. },
  10907. {
  10908. name = "getType",
  10909. summary = "Get the type of the Pass.",
  10910. description = "TODO",
  10911. key = "Pass:getType",
  10912. module = "lovr.graphics",
  10913. variants = {
  10914. {
  10915. arguments = {},
  10916. returns = {
  10917. {
  10918. name = " type",
  10919. type = "PassType",
  10920. description = "The type of the Pass."
  10921. }
  10922. }
  10923. }
  10924. }
  10925. },
  10926. {
  10927. name = "getViewCount",
  10928. summary = "TODO",
  10929. description = "TODO",
  10930. key = "Pass:getViewCount",
  10931. module = "lovr.graphics",
  10932. variants = {
  10933. {
  10934. arguments = {},
  10935. returns = {
  10936. {
  10937. name = "views",
  10938. type = "number",
  10939. description = "TODO"
  10940. }
  10941. }
  10942. }
  10943. }
  10944. },
  10945. {
  10946. name = "getViewPose",
  10947. tag = "camera",
  10948. summary = "Get the camera pose.",
  10949. description = "Get the pose of a single view.",
  10950. key = "Pass:getViewPose",
  10951. module = "lovr.graphics",
  10952. related = {
  10953. "lovr.headset.getViewPose",
  10954. "lovr.headset.getViewCount",
  10955. "lovr.graphics.getProjection",
  10956. "lovr.graphics.setProjection"
  10957. },
  10958. variants = {
  10959. {
  10960. arguments = {
  10961. {
  10962. name = "view",
  10963. type = "number",
  10964. description = "The view index."
  10965. }
  10966. },
  10967. returns = {
  10968. {
  10969. name = "x",
  10970. type = "number",
  10971. description = "The x position of the viewer, in meters."
  10972. },
  10973. {
  10974. name = "y",
  10975. type = "number",
  10976. description = "The y position of the viewer, in meters."
  10977. },
  10978. {
  10979. name = "z",
  10980. type = "number",
  10981. description = "The z position of the viewer, in meters."
  10982. },
  10983. {
  10984. name = "angle",
  10985. type = "number",
  10986. description = "The number of radians the viewer is rotated around its axis of rotation."
  10987. },
  10988. {
  10989. name = "ax",
  10990. type = "number",
  10991. description = "The x component of the axis of rotation."
  10992. },
  10993. {
  10994. name = "ay",
  10995. type = "number",
  10996. description = "The y component of the axis of rotation."
  10997. },
  10998. {
  10999. name = "az",
  11000. type = "number",
  11001. description = "The z component of the axis of rotation."
  11002. }
  11003. }
  11004. },
  11005. {
  11006. arguments = {
  11007. {
  11008. name = "view",
  11009. type = "number",
  11010. description = "The view index."
  11011. },
  11012. {
  11013. name = "matrix",
  11014. type = "Mat4",
  11015. description = "The matrix to fill with the view pose."
  11016. },
  11017. {
  11018. name = "invert",
  11019. type = "boolean",
  11020. description = "Whether the matrix should be inverted."
  11021. }
  11022. },
  11023. returns = {
  11024. {
  11025. name = "matrix",
  11026. type = "Mat4",
  11027. description = "The matrix containing the view pose."
  11028. }
  11029. }
  11030. }
  11031. }
  11032. },
  11033. {
  11034. name = "getWidth",
  11035. summary = "TODO",
  11036. description = "TODO",
  11037. key = "Pass:getWidth",
  11038. module = "lovr.graphics",
  11039. variants = {
  11040. {
  11041. arguments = {},
  11042. returns = {
  11043. {
  11044. name = "width",
  11045. type = "number",
  11046. description = "TODO"
  11047. }
  11048. }
  11049. }
  11050. }
  11051. },
  11052. {
  11053. name = "line",
  11054. tag = "drawing",
  11055. summary = "Draw a line.",
  11056. description = "TODO",
  11057. key = "Pass:line",
  11058. module = "lovr.graphics",
  11059. notes = "TODO",
  11060. variants = {
  11061. {
  11062. arguments = {
  11063. {
  11064. name = "x1",
  11065. type = "number",
  11066. description = "The x coordinate of the first point."
  11067. },
  11068. {
  11069. name = "y1",
  11070. type = "number",
  11071. description = "The y coordinate of the first point."
  11072. },
  11073. {
  11074. name = "z1",
  11075. type = "number",
  11076. description = "The z coordinate of the first point."
  11077. },
  11078. {
  11079. name = "x2",
  11080. type = "number",
  11081. description = "The x coordinate of the next point."
  11082. },
  11083. {
  11084. name = "y2",
  11085. type = "number",
  11086. description = "The y coordinate of the next point."
  11087. },
  11088. {
  11089. name = "z2",
  11090. type = "number",
  11091. description = "The z coordinate of the next point."
  11092. },
  11093. {
  11094. name = "...",
  11095. type = "*",
  11096. description = "More points to add to the line."
  11097. }
  11098. },
  11099. returns = {}
  11100. },
  11101. {
  11102. arguments = {
  11103. {
  11104. name = "t",
  11105. type = "table",
  11106. description = "A table of numbers or Vec3 objects (not both) representing points of the line."
  11107. }
  11108. },
  11109. returns = {}
  11110. },
  11111. {
  11112. arguments = {
  11113. {
  11114. name = "v1",
  11115. type = "Vec3",
  11116. description = "A vector containing the position of the first point of the line."
  11117. },
  11118. {
  11119. name = "v2",
  11120. type = "Vec3",
  11121. description = "A vector containing the position of the next point on the line."
  11122. },
  11123. {
  11124. name = "...",
  11125. type = "*",
  11126. description = "More points to add to the line."
  11127. }
  11128. },
  11129. returns = {}
  11130. }
  11131. }
  11132. },
  11133. {
  11134. name = "mesh",
  11135. tag = "drawing",
  11136. summary = "Draw a mesh.",
  11137. description = "TODO",
  11138. key = "Pass:mesh",
  11139. module = "lovr.graphics",
  11140. notes = "TODO",
  11141. variants = {
  11142. {
  11143. arguments = {
  11144. {
  11145. name = "vertices",
  11146. type = "Buffer",
  11147. description = "TODO",
  11148. default = "nil"
  11149. },
  11150. {
  11151. name = "transform",
  11152. type = "transform",
  11153. description = "The transform to apply to the mesh."
  11154. },
  11155. {
  11156. name = "start",
  11157. type = "number",
  11158. description = "The 1-based index of the first vertex to render from the vertex buffer (or the first index, when using an index buffer).",
  11159. default = "1"
  11160. },
  11161. {
  11162. name = "count",
  11163. type = "number",
  11164. description = "The number of vertices to render (or the number of indices, when using an index buffer). When `nil`, as many vertices or indices as possible will be drawn (based on the length of the Buffers and `start`).",
  11165. default = "nil"
  11166. },
  11167. {
  11168. name = "instances",
  11169. type = "number",
  11170. description = "The number of copies of the mesh to render.",
  11171. default = "1"
  11172. }
  11173. },
  11174. returns = {}
  11175. },
  11176. {
  11177. arguments = {
  11178. {
  11179. name = "vertices",
  11180. type = "Buffer",
  11181. description = "TODO",
  11182. default = "nil"
  11183. },
  11184. {
  11185. name = "indices",
  11186. type = "Buffer",
  11187. description = "TODO"
  11188. },
  11189. {
  11190. name = "transform",
  11191. type = "transform",
  11192. description = "The transform to apply to the mesh."
  11193. },
  11194. {
  11195. name = "start",
  11196. type = "number",
  11197. description = "The 1-based index of the first vertex to render from the vertex buffer (or the first index, when using an index buffer).",
  11198. default = "1"
  11199. },
  11200. {
  11201. name = "count",
  11202. type = "number",
  11203. description = "The number of vertices to render (or the number of indices, when using an index buffer). When `nil`, as many vertices or indices as possible will be drawn (based on the length of the Buffers and `start`).",
  11204. default = "nil"
  11205. },
  11206. {
  11207. name = "instances",
  11208. type = "number",
  11209. description = "The number of copies of the mesh to render.",
  11210. default = "1"
  11211. }
  11212. },
  11213. returns = {}
  11214. },
  11215. {
  11216. arguments = {
  11217. {
  11218. name = "vertices",
  11219. type = "Buffer",
  11220. description = "TODO",
  11221. default = "nil"
  11222. },
  11223. {
  11224. name = "indices",
  11225. type = "Buffer",
  11226. description = "TODO"
  11227. },
  11228. {
  11229. name = "draws",
  11230. type = "Buffer",
  11231. description = "TODO"
  11232. },
  11233. {
  11234. name = "drawcount",
  11235. type = "number",
  11236. description = "TODO"
  11237. },
  11238. {
  11239. name = "offset",
  11240. type = "number",
  11241. description = "TODO"
  11242. },
  11243. {
  11244. name = "stride",
  11245. type = "number",
  11246. description = "TODO"
  11247. }
  11248. },
  11249. returns = {}
  11250. }
  11251. }
  11252. },
  11253. {
  11254. name = "mipmap",
  11255. tag = "transfer",
  11256. summary = "Generate mipmaps for a texture.",
  11257. description = "TODO",
  11258. key = "Pass:mipmap",
  11259. module = "lovr.graphics",
  11260. variants = {
  11261. {
  11262. arguments = {
  11263. {
  11264. name = "texture",
  11265. type = "Texture",
  11266. description = "TODO"
  11267. },
  11268. {
  11269. name = "base",
  11270. type = "number",
  11271. description = "TODO",
  11272. default = "0"
  11273. },
  11274. {
  11275. name = "count",
  11276. type = "number",
  11277. description = "TODO",
  11278. default = "nil"
  11279. }
  11280. },
  11281. returns = {}
  11282. }
  11283. }
  11284. },
  11285. {
  11286. name = "origin",
  11287. tag = "transform",
  11288. summary = "Reset the transform to the origin.",
  11289. description = "TODO",
  11290. key = "Pass:origin",
  11291. module = "lovr.graphics",
  11292. related = {
  11293. "lovr.graphics.translate",
  11294. "lovr.graphics.rotate",
  11295. "lovr.graphics.scale",
  11296. "lovr.graphics.transform"
  11297. },
  11298. variants = {
  11299. {
  11300. arguments = {},
  11301. returns = {}
  11302. }
  11303. }
  11304. },
  11305. {
  11306. name = "plane",
  11307. tag = "drawing",
  11308. summary = "Draw a flat plane.",
  11309. description = "TODO",
  11310. key = "Pass:plane",
  11311. module = "lovr.graphics",
  11312. notes = "TODO",
  11313. variants = {
  11314. {
  11315. arguments = {
  11316. {
  11317. name = "transform",
  11318. type = "Transform2",
  11319. description = "The transform to apply to the plane."
  11320. },
  11321. {
  11322. name = "style",
  11323. type = "DrawStyle",
  11324. description = "Whether the plane should be drawn filled or outlined.",
  11325. default = "'fill'"
  11326. },
  11327. {
  11328. name = "columns",
  11329. type = "number",
  11330. description = "The number of horizontal segments in the plane.",
  11331. default = "1"
  11332. },
  11333. {
  11334. name = "rows",
  11335. type = "number",
  11336. description = "The number of vertical segments in the plane.",
  11337. default = "cols"
  11338. }
  11339. },
  11340. returns = {}
  11341. }
  11342. }
  11343. },
  11344. {
  11345. name = "points",
  11346. tag = "drawing",
  11347. summary = "Draw points.",
  11348. description = "TODO",
  11349. key = "Pass:points",
  11350. module = "lovr.graphics",
  11351. notes = "TODO",
  11352. variants = {
  11353. {
  11354. arguments = {
  11355. {
  11356. name = "x",
  11357. type = "number",
  11358. description = "The x coordinate of the first point."
  11359. },
  11360. {
  11361. name = "y",
  11362. type = "number",
  11363. description = "The y coordinate of the first point."
  11364. },
  11365. {
  11366. name = "z",
  11367. type = "number",
  11368. description = "The z coordinate of the first point."
  11369. },
  11370. {
  11371. name = "...",
  11372. type = "*",
  11373. description = "More points."
  11374. }
  11375. },
  11376. returns = {}
  11377. },
  11378. {
  11379. arguments = {
  11380. {
  11381. name = "t",
  11382. type = "table",
  11383. description = "A table of numbers or Vec3 objects (not both) representing point positions."
  11384. }
  11385. },
  11386. returns = {}
  11387. },
  11388. {
  11389. arguments = {
  11390. {
  11391. name = "v",
  11392. type = "Vec3",
  11393. description = "A vector containing the position of the first point to draw."
  11394. },
  11395. {
  11396. name = "...",
  11397. type = "*",
  11398. description = "More points."
  11399. }
  11400. },
  11401. returns = {}
  11402. }
  11403. }
  11404. },
  11405. {
  11406. name = "pop",
  11407. tag = "transform",
  11408. summary = "Restore original state from a stack.",
  11409. description = "TODO",
  11410. key = "Pass:pop",
  11411. module = "lovr.graphics",
  11412. notes = "TODO stack balancing/error",
  11413. related = {
  11414. "lovr.graphics.push",
  11415. "StackType"
  11416. },
  11417. variants = {
  11418. {
  11419. arguments = {
  11420. {
  11421. name = "stack",
  11422. type = "StackType",
  11423. description = "The type of stack to pop.",
  11424. default = "'transform'"
  11425. }
  11426. },
  11427. returns = {}
  11428. }
  11429. }
  11430. },
  11431. {
  11432. name = "push",
  11433. tag = "transform",
  11434. summary = "Push state onto a stack.",
  11435. description = "TODO",
  11436. key = "Pass:push",
  11437. module = "lovr.graphics",
  11438. notes = "TODO stack balancing/error",
  11439. related = {
  11440. "lovr.graphics.pop",
  11441. "StackType"
  11442. },
  11443. variants = {
  11444. {
  11445. arguments = {
  11446. {
  11447. name = "stack",
  11448. type = "StackType",
  11449. description = "The type of stack to push.",
  11450. default = "'transform'"
  11451. }
  11452. },
  11453. returns = {}
  11454. }
  11455. }
  11456. },
  11457. {
  11458. name = "read",
  11459. tag = "transfer",
  11460. summary = "Download data from a GPU resource.",
  11461. description = "TODO",
  11462. key = "Pass:read",
  11463. module = "lovr.graphics",
  11464. variants = {
  11465. {
  11466. arguments = {
  11467. {
  11468. name = "buffer",
  11469. type = "Buffer",
  11470. description = "TODO"
  11471. },
  11472. {
  11473. name = "index",
  11474. type = "number",
  11475. description = "TODO"
  11476. },
  11477. {
  11478. name = "count",
  11479. type = "number",
  11480. description = "TODO"
  11481. }
  11482. },
  11483. returns = {
  11484. {
  11485. name = "readback",
  11486. type = "Readback",
  11487. description = "TODO"
  11488. }
  11489. }
  11490. },
  11491. {
  11492. arguments = {
  11493. {
  11494. name = "texture",
  11495. type = "Texture",
  11496. description = "TODO"
  11497. },
  11498. {
  11499. name = "x",
  11500. type = "number",
  11501. description = "TODO",
  11502. default = "0"
  11503. },
  11504. {
  11505. name = "y",
  11506. type = "number",
  11507. description = "TODO",
  11508. default = "0"
  11509. },
  11510. {
  11511. name = "layer",
  11512. type = "number",
  11513. description = "TODO",
  11514. default = "1"
  11515. },
  11516. {
  11517. name = "level",
  11518. type = "number",
  11519. description = "TODO",
  11520. default = "1"
  11521. },
  11522. {
  11523. name = "width",
  11524. type = "number",
  11525. description = "TODO",
  11526. default = "nil"
  11527. },
  11528. {
  11529. name = "height",
  11530. type = "number",
  11531. description = "TODO",
  11532. default = "nil"
  11533. }
  11534. },
  11535. returns = {
  11536. {
  11537. name = "readback",
  11538. type = "Readback",
  11539. description = "TODO"
  11540. }
  11541. }
  11542. },
  11543. {
  11544. arguments = {
  11545. {
  11546. name = "tally",
  11547. type = "Tally",
  11548. description = "TODO"
  11549. },
  11550. {
  11551. name = "index",
  11552. type = "number",
  11553. description = "TODO"
  11554. },
  11555. {
  11556. name = "count",
  11557. type = "number",
  11558. description = "TODO"
  11559. }
  11560. },
  11561. returns = {
  11562. {
  11563. name = "readback",
  11564. type = "Readback",
  11565. description = "TODO"
  11566. }
  11567. }
  11568. }
  11569. }
  11570. },
  11571. {
  11572. name = "rotate",
  11573. tag = "transform",
  11574. summary = "Rotate the coordinate system.",
  11575. description = "TODO",
  11576. key = "Pass:rotate",
  11577. module = "lovr.graphics",
  11578. notes = "TODO axis does not need to be normalized TODO order matters",
  11579. related = {
  11580. "lovr.graphics.translate",
  11581. "lovr.graphics.scale",
  11582. "lovr.graphics.transform"
  11583. },
  11584. variants = {
  11585. {
  11586. arguments = {
  11587. {
  11588. name = "angle",
  11589. type = "number",
  11590. description = "The number of radians to rotate around the axis of rotation.",
  11591. default = "0"
  11592. },
  11593. {
  11594. name = "ax",
  11595. type = "number",
  11596. description = "The x component of the axis of rotation.",
  11597. default = "0"
  11598. },
  11599. {
  11600. name = "ay",
  11601. type = "number",
  11602. description = "The y component of the axis of rotation.",
  11603. default = "1"
  11604. },
  11605. {
  11606. name = "az",
  11607. type = "number",
  11608. description = "The z component of the axis of rotation.",
  11609. default = "0"
  11610. }
  11611. },
  11612. returns = {}
  11613. },
  11614. {
  11615. arguments = {
  11616. {
  11617. name = "q",
  11618. type = "Quat",
  11619. description = "A quaternion containing the rotation to apply."
  11620. }
  11621. },
  11622. returns = {}
  11623. }
  11624. }
  11625. },
  11626. {
  11627. name = "scale",
  11628. tag = "transform",
  11629. summary = "Scale the coordinate system.",
  11630. description = "TODO",
  11631. key = "Pass:scale",
  11632. module = "lovr.graphics",
  11633. related = {
  11634. "lovr.graphics.translate",
  11635. "lovr.graphics.rotate",
  11636. "lovr.graphics.transform"
  11637. },
  11638. variants = {
  11639. {
  11640. arguments = {
  11641. {
  11642. name = "x",
  11643. type = "number",
  11644. description = "The amount to scale the x axis.",
  11645. default = "1"
  11646. },
  11647. {
  11648. name = "y",
  11649. type = "number",
  11650. description = "The amount to scale the y axis.",
  11651. default = "1"
  11652. },
  11653. {
  11654. name = "z",
  11655. type = "number",
  11656. description = "The amount to scale the z axis.",
  11657. default = "1"
  11658. }
  11659. },
  11660. returns = {}
  11661. },
  11662. {
  11663. arguments = {
  11664. {
  11665. name = "v",
  11666. type = "Vec3",
  11667. description = "A vector to translate by."
  11668. }
  11669. },
  11670. returns = {}
  11671. }
  11672. }
  11673. },
  11674. {
  11675. name = "send",
  11676. summary = "Set the value of a shader variable.",
  11677. description = "TODO",
  11678. key = "Pass:send",
  11679. module = "lovr.graphics",
  11680. notes = "TODO",
  11681. variants = {
  11682. {
  11683. arguments = {
  11684. {
  11685. name = "name",
  11686. type = "string",
  11687. description = "The name of the Shader variable."
  11688. },
  11689. {
  11690. name = "buffer",
  11691. type = "Buffer",
  11692. description = "The Buffer to assign."
  11693. }
  11694. },
  11695. returns = {}
  11696. },
  11697. {
  11698. arguments = {
  11699. {
  11700. name = "name",
  11701. type = "string",
  11702. description = "The name of the Shader variable."
  11703. },
  11704. {
  11705. name = "texture",
  11706. type = "Texture",
  11707. description = "The Texture to assign."
  11708. }
  11709. },
  11710. returns = {}
  11711. },
  11712. {
  11713. arguments = {
  11714. {
  11715. name = "name",
  11716. type = "string",
  11717. description = "The name of the Shader variable."
  11718. },
  11719. {
  11720. name = "sampler",
  11721. type = "Sampler",
  11722. description = "The Sampler to assign."
  11723. }
  11724. },
  11725. returns = {}
  11726. },
  11727. {
  11728. arguments = {
  11729. {
  11730. name = "name",
  11731. type = "string",
  11732. description = "The name of the Shader variable."
  11733. },
  11734. {
  11735. name = "constant",
  11736. type = "*",
  11737. description = "Numbers or vectors to assign to the push constant."
  11738. }
  11739. },
  11740. returns = {}
  11741. },
  11742. {
  11743. arguments = {
  11744. {
  11745. name = "binding",
  11746. type = "number",
  11747. description = "The binding number of the Shader variable."
  11748. },
  11749. {
  11750. name = "buffer",
  11751. type = "Buffer",
  11752. description = "The Buffer to assign."
  11753. }
  11754. },
  11755. returns = {}
  11756. },
  11757. {
  11758. arguments = {
  11759. {
  11760. name = "binding",
  11761. type = "number",
  11762. description = "The binding number of the Shader variable."
  11763. },
  11764. {
  11765. name = "texture",
  11766. type = "Texture",
  11767. description = "The Texture to assign."
  11768. }
  11769. },
  11770. returns = {}
  11771. },
  11772. {
  11773. arguments = {
  11774. {
  11775. name = "binding",
  11776. type = "number",
  11777. description = "The binding number of the Shader variable."
  11778. },
  11779. {
  11780. name = "sampler",
  11781. type = "Sampler",
  11782. description = "The Sampler to assign."
  11783. }
  11784. },
  11785. returns = {}
  11786. }
  11787. }
  11788. },
  11789. {
  11790. name = "setAlphaToCoverage",
  11791. tag = "pipeline",
  11792. summary = "Enable or disable alpha to coverage.",
  11793. description = "TODO",
  11794. key = "Pass:setAlphaToCoverage",
  11795. module = "lovr.graphics",
  11796. variants = {
  11797. {
  11798. arguments = {
  11799. {
  11800. name = "enable",
  11801. type = "boolean",
  11802. description = "Whether alpha to coverage should be enabled."
  11803. }
  11804. },
  11805. returns = {}
  11806. }
  11807. }
  11808. },
  11809. {
  11810. name = "setBlendMode",
  11811. tag = "pipeline",
  11812. summary = "Set the blend mode.",
  11813. description = "TODO",
  11814. key = "Pass:setBlendMode",
  11815. module = "lovr.graphics",
  11816. notes = "TODO",
  11817. variants = {
  11818. {
  11819. arguments = {
  11820. {
  11821. name = "blend",
  11822. type = "BlendMode",
  11823. description = "The blend mode."
  11824. },
  11825. {
  11826. name = "alphaBlend",
  11827. type = "BlendAlphaMode",
  11828. description = "The alpha blend mode."
  11829. }
  11830. },
  11831. returns = {}
  11832. }
  11833. }
  11834. },
  11835. {
  11836. name = "setColor",
  11837. tag = "pipeline",
  11838. summary = "Set the color.",
  11839. description = "TODO",
  11840. key = "Pass:setColor",
  11841. module = "lovr.graphics",
  11842. variants = {
  11843. {
  11844. arguments = {
  11845. {
  11846. name = "color",
  11847. type = "Color",
  11848. description = "The new color."
  11849. }
  11850. },
  11851. returns = {}
  11852. }
  11853. }
  11854. },
  11855. {
  11856. name = "setColorWrite",
  11857. tag = "pipeline",
  11858. summary = "Change the color components affected by drawing.",
  11859. description = "TODO",
  11860. key = "Pass:setColorWrite",
  11861. module = "lovr.graphics",
  11862. notes = "TODO",
  11863. variants = {
  11864. {
  11865. arguments = {
  11866. {
  11867. name = "r",
  11868. type = "boolean",
  11869. description = "Whether the red component should be affected by drawing."
  11870. },
  11871. {
  11872. name = "g",
  11873. type = "boolean",
  11874. description = "Whether the green component should be affected by drawing."
  11875. },
  11876. {
  11877. name = "b",
  11878. type = "boolean",
  11879. description = "Whether the blue component should be affected by drawing."
  11880. },
  11881. {
  11882. name = "a",
  11883. type = "boolean",
  11884. description = "Whether the alpha component should be affected by drawing."
  11885. }
  11886. },
  11887. returns = {}
  11888. }
  11889. }
  11890. },
  11891. {
  11892. name = "setCullMode",
  11893. tag = "pipeline",
  11894. summary = "Control triangle face culling.",
  11895. description = "TODO",
  11896. key = "Pass:setCullMode",
  11897. module = "lovr.graphics",
  11898. notes = "TODO",
  11899. related = {
  11900. "lovr.graphics.setWinding"
  11901. },
  11902. variants = {
  11903. {
  11904. arguments = {
  11905. {
  11906. name = "mode",
  11907. type = "CullMode",
  11908. description = "Whether `front` faces, `back` faces, or `none` of the faces should be culled.",
  11909. default = "'none'"
  11910. }
  11911. },
  11912. returns = {}
  11913. }
  11914. }
  11915. },
  11916. {
  11917. name = "setDepthClamp",
  11918. tag = "pipeline",
  11919. summary = "Enable or disable depth clamp.",
  11920. description = "TODO",
  11921. key = "Pass:setDepthClamp",
  11922. module = "lovr.graphics",
  11923. notes = "TODO depthClamp feature!",
  11924. related = {
  11925. "lovr.graphics.setDepthTest",
  11926. "lovr.graphics.setDepthWrite",
  11927. "lovr.graphics.setDepthOffset"
  11928. },
  11929. variants = {
  11930. {
  11931. arguments = {
  11932. {
  11933. name = "enable",
  11934. type = "boolean",
  11935. description = "Whether depth clamp should be enabled."
  11936. }
  11937. },
  11938. returns = {}
  11939. }
  11940. }
  11941. },
  11942. {
  11943. name = "setDepthOffset",
  11944. tag = "pipeline",
  11945. summary = "Configure the depth offset.",
  11946. description = "TODO",
  11947. key = "Pass:setDepthOffset",
  11948. module = "lovr.graphics",
  11949. notes = "TODO",
  11950. related = {
  11951. "lovr.graphics.setDepthTest",
  11952. "lovr.graphics.setDepthWrite"
  11953. },
  11954. variants = {
  11955. {
  11956. arguments = {
  11957. {
  11958. name = "offset",
  11959. type = "number",
  11960. description = "The depth offset.",
  11961. default = "0.0"
  11962. },
  11963. {
  11964. name = "sloped",
  11965. type = "number",
  11966. description = "The sloped depth offset.",
  11967. default = "0.0"
  11968. }
  11969. },
  11970. returns = {}
  11971. }
  11972. }
  11973. },
  11974. {
  11975. name = "setDepthTest",
  11976. tag = "pipeline",
  11977. summary = "Configure the depth test.",
  11978. description = "TODO",
  11979. key = "Pass:setDepthTest",
  11980. module = "lovr.graphics",
  11981. notes = "TODO",
  11982. related = {
  11983. "lovr.graphics.setDepthWrite",
  11984. "lovr.graphics.setDepthOffset",
  11985. "lovr.graphics.setDepthClamp",
  11986. "lovr.graphics.setStencilTest"
  11987. },
  11988. variants = {
  11989. {
  11990. arguments = {
  11991. {
  11992. name = "test",
  11993. type = "CompareMode",
  11994. description = "The new depth test to use."
  11995. }
  11996. },
  11997. returns = {}
  11998. },
  11999. {
  12000. description = "Disable the depth test.",
  12001. arguments = {},
  12002. returns = {}
  12003. }
  12004. }
  12005. },
  12006. {
  12007. name = "setDepthWrite",
  12008. tag = "pipeline",
  12009. summary = "Set whether draws write to the depth buffer.",
  12010. description = "TODO",
  12011. key = "Pass:setDepthWrite",
  12012. module = "lovr.graphics",
  12013. notes = "TODO",
  12014. related = {
  12015. "lovr.graphics.setDepthTest",
  12016. "lovr.graphics.setStencilWrite",
  12017. "lovr.graphics.setColorWrite"
  12018. },
  12019. variants = {
  12020. {
  12021. arguments = {
  12022. {
  12023. name = "write",
  12024. type = "boolean",
  12025. description = "The new depth write setting."
  12026. }
  12027. },
  12028. returns = {}
  12029. }
  12030. }
  12031. },
  12032. {
  12033. name = "setFont",
  12034. tag = "pipeline",
  12035. summary = "Enable or disable depth clamp.",
  12036. description = "TODO",
  12037. key = "Pass:setFont",
  12038. module = "lovr.graphics",
  12039. related = {
  12040. "Pass:text"
  12041. },
  12042. variants = {
  12043. {
  12044. arguments = {
  12045. {
  12046. name = "font",
  12047. type = "Font",
  12048. description = "The Font to use when rendering text."
  12049. }
  12050. },
  12051. returns = {}
  12052. }
  12053. }
  12054. },
  12055. {
  12056. name = "setMaterial",
  12057. tag = "pipeline",
  12058. summary = "Set the material.",
  12059. description = "TODO",
  12060. key = "Pass:setMaterial",
  12061. module = "lovr.graphics",
  12062. variants = {
  12063. {
  12064. arguments = {
  12065. {
  12066. name = "material",
  12067. type = "Material",
  12068. description = "TODO"
  12069. }
  12070. },
  12071. returns = {}
  12072. }
  12073. }
  12074. },
  12075. {
  12076. name = "setMeshMode",
  12077. tag = "pipeline",
  12078. summary = "Change whether mesh vertices are drawn as points, lines, or triangles.",
  12079. description = "TODO",
  12080. key = "Pass:setMeshMode",
  12081. module = "lovr.graphics",
  12082. variants = {
  12083. {
  12084. arguments = {
  12085. {
  12086. name = "mode",
  12087. type = "MeshMode",
  12088. description = "TODO"
  12089. }
  12090. },
  12091. returns = {}
  12092. }
  12093. }
  12094. },
  12095. {
  12096. name = "setProjection",
  12097. tag = "camera",
  12098. summary = "Set the field of view.",
  12099. description = "Sets the projection for a single view. 4 field of view angles can be used, similar to the field of view returned by `lovr.headset.getViewAngles`. Alternatively, a projection matrix can be used for other types of projections like orthographic, oblique, etc. There is also a shorthand string \"orthographic\" that can be used to configure an orthographic projection.\n\nUp to 6 views are supported. When rendering to the headset, both projections are changed to match the ones used by the headset. This is also available by calling `lovr.headset.getViewAngles`.",
  12100. key = "Pass:setProjection",
  12101. module = "lovr.graphics",
  12102. notes = "A far clipping plane of 0.0 can be used for an infinite far plane with reversed Z range. This is the default.",
  12103. related = {
  12104. "lovr.headset.getViewAngles",
  12105. "lovr.headset.getViewCount",
  12106. "lovr.graphics.getViewPose",
  12107. "lovr.graphics.setViewPose"
  12108. },
  12109. variants = {
  12110. {
  12111. arguments = {
  12112. {
  12113. name = "view",
  12114. type = "number",
  12115. description = "The index of the view to update."
  12116. },
  12117. {
  12118. name = "left",
  12119. type = "number",
  12120. description = "The left field of view angle, in radians."
  12121. },
  12122. {
  12123. name = "right",
  12124. type = "number",
  12125. description = "The right field of view angle, in radians."
  12126. },
  12127. {
  12128. name = "up",
  12129. type = "number",
  12130. description = "The top field of view angle, in radians."
  12131. },
  12132. {
  12133. name = "down",
  12134. type = "number",
  12135. description = "The bottom field of view angle, in radians."
  12136. },
  12137. {
  12138. name = "near",
  12139. type = "number",
  12140. description = "The near clipping plane distance, in meters.",
  12141. default = ".01"
  12142. },
  12143. {
  12144. name = "far",
  12145. type = "number",
  12146. description = "The far clipping plane distance, in meters.",
  12147. default = "100.0"
  12148. }
  12149. },
  12150. returns = {}
  12151. },
  12152. {
  12153. arguments = {
  12154. {
  12155. name = "view",
  12156. type = "number",
  12157. description = "The index of the view to update."
  12158. },
  12159. {
  12160. name = "matrix",
  12161. type = "Mat4",
  12162. description = "The projection matrix for the view."
  12163. }
  12164. },
  12165. returns = {}
  12166. }
  12167. }
  12168. },
  12169. {
  12170. name = "setSampler",
  12171. tag = "pipeline",
  12172. summary = "Set the sampler.",
  12173. description = "TODO",
  12174. key = "Pass:setSampler",
  12175. module = "lovr.graphics",
  12176. variants = {
  12177. {
  12178. arguments = {
  12179. {
  12180. name = "sampler",
  12181. type = "Sampler",
  12182. description = "TODO"
  12183. }
  12184. },
  12185. returns = {}
  12186. }
  12187. }
  12188. },
  12189. {
  12190. name = "setScissor",
  12191. tag = "pipeline",
  12192. summary = "Set the scissor.",
  12193. description = "TODO",
  12194. key = "Pass:setScissor",
  12195. module = "lovr.graphics",
  12196. notes = "TODO not floating point, negative, limits, not pipeline, initial pass state",
  12197. related = {
  12198. "lovr.graphics.setViewport"
  12199. },
  12200. variants = {
  12201. {
  12202. arguments = {
  12203. {
  12204. name = "x",
  12205. type = "number",
  12206. description = "The x coordinate of the upper-left corner of the scissor rectangle."
  12207. },
  12208. {
  12209. name = "y",
  12210. type = "number",
  12211. description = "The y coordinate of the upper-left corner of the scissor rectangle."
  12212. },
  12213. {
  12214. name = "w",
  12215. type = "number",
  12216. description = "The width of the scissor rectangle."
  12217. },
  12218. {
  12219. name = "h",
  12220. type = "number",
  12221. description = "The height of the scissor rectangle."
  12222. }
  12223. },
  12224. returns = {}
  12225. }
  12226. }
  12227. },
  12228. {
  12229. name = "setShader",
  12230. tag = "pipeline",
  12231. summary = "Set the active Shader.",
  12232. description = "TODO",
  12233. key = "Pass:setShader",
  12234. module = "lovr.graphics",
  12235. variants = {
  12236. {
  12237. arguments = {
  12238. {
  12239. name = "shader",
  12240. type = "Shader",
  12241. description = "A custom Shader object to use for rendering."
  12242. }
  12243. },
  12244. returns = {}
  12245. },
  12246. {
  12247. description = "Use one of the default shaders for drawing.",
  12248. arguments = {
  12249. {
  12250. name = "default",
  12251. type = "DefaultShader",
  12252. description = "One of the default shaders to use."
  12253. }
  12254. },
  12255. returns = {}
  12256. },
  12257. {
  12258. description = "Switch back to using an automatic shader for drawing.",
  12259. arguments = {},
  12260. returns = {}
  12261. }
  12262. }
  12263. },
  12264. {
  12265. name = "setStencilTest",
  12266. tag = "pipeline",
  12267. summary = "Configure the stencil test.",
  12268. description = "TODO",
  12269. key = "Pass:setStencilTest",
  12270. module = "lovr.graphics",
  12271. notes = "TODO",
  12272. related = {
  12273. "lovr.graphics.setStencilWrite",
  12274. "lovr.graphics.setDepthTest"
  12275. },
  12276. variants = {
  12277. {
  12278. arguments = {
  12279. {
  12280. name = "test",
  12281. type = "CompareMode",
  12282. description = "The new stencil test to use."
  12283. },
  12284. {
  12285. name = "value",
  12286. type = "number",
  12287. description = "The stencil value to compare against."
  12288. },
  12289. {
  12290. name = "mask",
  12291. type = "number",
  12292. description = "An optional mask to apply to stencil values before the comparison.",
  12293. default = "0xff"
  12294. }
  12295. },
  12296. returns = {}
  12297. },
  12298. {
  12299. description = "Disable the stencil test.",
  12300. arguments = {},
  12301. returns = {}
  12302. }
  12303. }
  12304. },
  12305. {
  12306. name = "setStencilWrite",
  12307. tag = "pipeline",
  12308. summary = "Set whether draws write to the stencil buffer.",
  12309. description = "TODO",
  12310. key = "Pass:setStencilWrite",
  12311. module = "lovr.graphics",
  12312. notes = "TODO",
  12313. related = {
  12314. "lovr.graphics.setStencilTest",
  12315. "lovr.graphics.setDepthTest"
  12316. },
  12317. variants = {
  12318. {
  12319. arguments = {
  12320. {
  12321. name = "action",
  12322. type = "StencilAction",
  12323. description = "How pixels drawn will update the stencil buffer."
  12324. },
  12325. {
  12326. name = "value",
  12327. type = "number",
  12328. description = "When using the 'replace' action, this is the value to replace with.",
  12329. default = "1"
  12330. },
  12331. {
  12332. name = "mask",
  12333. type = "number",
  12334. description = "An optional mask to apply to stencil values before writing.",
  12335. default = "0xff"
  12336. }
  12337. },
  12338. returns = {}
  12339. },
  12340. {
  12341. arguments = {
  12342. {
  12343. name = "actions",
  12344. type = "table",
  12345. description = "A list of 3 stencil actions, used when a pixel fails the stencil test, fails the depth test, or passes the stencil test, respectively."
  12346. },
  12347. {
  12348. name = "value",
  12349. type = "number",
  12350. description = "When using the 'replace' action, this is the value to replace with.",
  12351. default = "1"
  12352. },
  12353. {
  12354. name = "mask",
  12355. type = "number",
  12356. description = "An optional mask to apply to stencil values before writing.",
  12357. default = "0xff"
  12358. }
  12359. },
  12360. returns = {}
  12361. },
  12362. {
  12363. description = "Disables stencil writing.",
  12364. arguments = {},
  12365. returns = {}
  12366. }
  12367. }
  12368. },
  12369. {
  12370. name = "setViewPose",
  12371. tag = "camera",
  12372. summary = "Set the camera pose.",
  12373. description = "Sets the pose for a single view. Objects rendered in this view will appear as though the camera is positioned using the given pose.\n\nUp to 6 views are supported. When rendering to the headset, views are changed to match the eye positions. These view poses are also available using `lovr.headset.getViewPose`.",
  12374. key = "Pass:setViewPose",
  12375. module = "lovr.graphics",
  12376. related = {
  12377. "lovr.headset.getViewPose",
  12378. "lovr.headset.getViewCount",
  12379. "lovr.graphics.getProjection",
  12380. "lovr.graphics.setProjection"
  12381. },
  12382. variants = {
  12383. {
  12384. arguments = {
  12385. {
  12386. name = "view",
  12387. type = "number",
  12388. description = "The index of the view to update."
  12389. },
  12390. {
  12391. name = "x",
  12392. type = "number",
  12393. description = "The x position of the viewer, in meters."
  12394. },
  12395. {
  12396. name = "y",
  12397. type = "number",
  12398. description = "The y position of the viewer, in meters."
  12399. },
  12400. {
  12401. name = "z",
  12402. type = "number",
  12403. description = "The z position of the viewer, in meters."
  12404. },
  12405. {
  12406. name = "angle",
  12407. type = "number",
  12408. description = "The number of radians the viewer is rotated around its axis of rotation."
  12409. },
  12410. {
  12411. name = "ax",
  12412. type = "number",
  12413. description = "The x component of the axis of rotation."
  12414. },
  12415. {
  12416. name = "ay",
  12417. type = "number",
  12418. description = "The y component of the axis of rotation."
  12419. },
  12420. {
  12421. name = "az",
  12422. type = "number",
  12423. description = "The z component of the axis of rotation."
  12424. }
  12425. },
  12426. returns = {}
  12427. },
  12428. {
  12429. arguments = {
  12430. {
  12431. name = "view",
  12432. type = "number",
  12433. description = "The index of the view to update."
  12434. },
  12435. {
  12436. name = "matrix",
  12437. type = "Mat4",
  12438. description = "A matrix containing the viewer pose."
  12439. },
  12440. {
  12441. name = "inverted",
  12442. type = "boolean",
  12443. description = "Whether the matrix is an inverted pose (a view matrix)."
  12444. }
  12445. },
  12446. returns = {}
  12447. }
  12448. }
  12449. },
  12450. {
  12451. name = "setViewport",
  12452. tag = "pipeline",
  12453. summary = "Set the viewport.",
  12454. description = "TODO",
  12455. key = "Pass:setViewport",
  12456. module = "lovr.graphics",
  12457. notes = "TODO floating point, negative, flipped depth range, limits, not pipeline, initial pass state, what the hell is depth range",
  12458. related = {
  12459. "lovr.graphics.setScissor"
  12460. },
  12461. variants = {
  12462. {
  12463. arguments = {
  12464. {
  12465. name = "x",
  12466. type = "number",
  12467. description = "The x coordinate of the upper-left corner of the viewport."
  12468. },
  12469. {
  12470. name = "y",
  12471. type = "number",
  12472. description = "The y coordinate of the upper-left corner of the viewport."
  12473. },
  12474. {
  12475. name = "w",
  12476. type = "number",
  12477. description = "The width of the viewport."
  12478. },
  12479. {
  12480. name = "h",
  12481. type = "number",
  12482. description = "The height of the viewport."
  12483. },
  12484. {
  12485. name = "minDepth",
  12486. type = "number",
  12487. description = "The min component of the depth range.",
  12488. default = "0.0"
  12489. },
  12490. {
  12491. name = "maxDepth",
  12492. type = "number",
  12493. description = "The max component of the depth range.",
  12494. default = "1.0"
  12495. }
  12496. },
  12497. returns = {}
  12498. }
  12499. }
  12500. },
  12501. {
  12502. name = "setWinding",
  12503. tag = "pipeline",
  12504. summary = "Set the winding direction of triangle vertices.",
  12505. description = "TODO",
  12506. key = "Pass:setWinding",
  12507. module = "lovr.graphics",
  12508. notes = "TODO",
  12509. related = {
  12510. "lovr.graphics.setCullMode"
  12511. },
  12512. variants = {
  12513. {
  12514. arguments = {
  12515. {
  12516. name = "winding",
  12517. type = "Winding",
  12518. description = "Whether triangle vertices are ordered `clockwise` or `counterclockwise`."
  12519. }
  12520. },
  12521. returns = {}
  12522. }
  12523. }
  12524. },
  12525. {
  12526. name = "setWireframe",
  12527. tag = "pipeline",
  12528. summary = "Enable or disable wireframe rendering.",
  12529. description = "TODO",
  12530. key = "Pass:setWireframe",
  12531. module = "lovr.graphics",
  12532. notes = "TODO",
  12533. variants = {
  12534. {
  12535. arguments = {
  12536. {
  12537. name = "enable",
  12538. type = "boolean",
  12539. description = "Whether wireframe rendering should be enabled."
  12540. }
  12541. },
  12542. returns = {}
  12543. }
  12544. }
  12545. },
  12546. {
  12547. name = "skybox",
  12548. tag = "drawing",
  12549. summary = "Draw a skybox.",
  12550. description = "TODO",
  12551. key = "Pass:skybox",
  12552. module = "lovr.graphics",
  12553. notes = "TODO",
  12554. variants = {
  12555. {
  12556. arguments = {
  12557. {
  12558. name = "skybox",
  12559. type = "Texture",
  12560. description = "The skybox to render. Its `TextureType` can be `cube` to render as a cubemap, or `2d` to render as an equirectangular (spherical) 2D image."
  12561. }
  12562. },
  12563. returns = {}
  12564. },
  12565. {
  12566. arguments = {},
  12567. returns = {}
  12568. }
  12569. }
  12570. },
  12571. {
  12572. name = "sphere",
  12573. tag = "drawing",
  12574. summary = "Draw a sphere.",
  12575. description = "TODO",
  12576. key = "Pass:sphere",
  12577. module = "lovr.graphics",
  12578. notes = "TODO",
  12579. variants = {
  12580. {
  12581. arguments = {
  12582. {
  12583. name = "transform",
  12584. type = "transform",
  12585. description = "The transform to apply to the sphere."
  12586. },
  12587. {
  12588. name = "longitudes",
  12589. type = "number",
  12590. description = "The number of \"horizontal\" segments.",
  12591. default = "48"
  12592. },
  12593. {
  12594. name = "latitudes",
  12595. type = "number",
  12596. description = "The number of \"vertical\" segments.",
  12597. default = "longitudes / 2"
  12598. }
  12599. },
  12600. returns = {}
  12601. }
  12602. }
  12603. },
  12604. {
  12605. name = "text",
  12606. tag = "drawing",
  12607. summary = "Draw text.",
  12608. description = "TODO",
  12609. key = "Pass:text",
  12610. module = "lovr.graphics",
  12611. notes = "TODO",
  12612. related = {
  12613. "Pass:setFont"
  12614. },
  12615. variants = {
  12616. {
  12617. arguments = {
  12618. {
  12619. name = "text",
  12620. type = "string",
  12621. description = "The text to render."
  12622. },
  12623. {
  12624. name = "transform",
  12625. type = "transform",
  12626. description = "The transform of the text."
  12627. },
  12628. {
  12629. name = "wrap",
  12630. type = "number",
  12631. description = "The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.",
  12632. default = "0"
  12633. },
  12634. {
  12635. name = "halign",
  12636. type = "HorizontalAlign",
  12637. description = "The horizontal alignment.",
  12638. default = "'center'"
  12639. },
  12640. {
  12641. name = "valign",
  12642. type = "VerticalAlign",
  12643. description = "The vertical alignment.",
  12644. default = "'middle'"
  12645. }
  12646. },
  12647. returns = {}
  12648. },
  12649. {
  12650. arguments = {
  12651. {
  12652. name = "colortext",
  12653. type = "table",
  12654. description = "A table of strings with colors to render, in the form `{ color1, string1, color2, string2\n }`, where color is a `Color`."
  12655. },
  12656. {
  12657. name = "transform",
  12658. type = "transform",
  12659. description = "The transform of the text."
  12660. },
  12661. {
  12662. name = "wrap",
  12663. type = "number",
  12664. description = "The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.",
  12665. default = "0"
  12666. },
  12667. {
  12668. name = "halign",
  12669. type = "HorizontalAlign",
  12670. description = "The horizontal alignment.",
  12671. default = "'center'"
  12672. },
  12673. {
  12674. name = "valign",
  12675. type = "VerticalAlign",
  12676. description = "The vertical alignment.",
  12677. default = "'middle'"
  12678. }
  12679. },
  12680. returns = {}
  12681. }
  12682. }
  12683. },
  12684. {
  12685. name = "tick",
  12686. tag = "transfer",
  12687. summary = "Begin measuring GPU counters.",
  12688. description = "TODO",
  12689. key = "Pass:tick",
  12690. module = "lovr.graphics",
  12691. variants = {
  12692. {
  12693. arguments = {
  12694. {
  12695. name = "tally",
  12696. type = "Tally",
  12697. description = "TODO"
  12698. },
  12699. {
  12700. name = "index",
  12701. type = "number",
  12702. description = "TODO"
  12703. }
  12704. },
  12705. returns = {}
  12706. }
  12707. }
  12708. },
  12709. {
  12710. name = "tock",
  12711. tag = "transfer",
  12712. summary = "Stop measuring GPU counters.",
  12713. description = "TODO",
  12714. key = "Pass:tock",
  12715. module = "lovr.graphics",
  12716. variants = {
  12717. {
  12718. arguments = {
  12719. {
  12720. name = "tally",
  12721. type = "Tally",
  12722. description = "TODO"
  12723. },
  12724. {
  12725. name = "index",
  12726. type = "number",
  12727. description = "TODO"
  12728. }
  12729. },
  12730. returns = {}
  12731. }
  12732. }
  12733. },
  12734. {
  12735. name = "torus",
  12736. tag = "drawing",
  12737. summary = "Draw a donut.",
  12738. description = "TODO",
  12739. key = "Pass:torus",
  12740. module = "lovr.graphics",
  12741. notes = "TODO",
  12742. variants = {
  12743. {
  12744. arguments = {
  12745. {
  12746. name = "transform",
  12747. type = "TransformXY2",
  12748. description = "The transform to apply to the torus. The x scale is the radius, the z scale is the thickness."
  12749. },
  12750. {
  12751. name = "tsegments",
  12752. type = "number",
  12753. description = "The number of toroidal (circular) segments to render.",
  12754. default = "64"
  12755. },
  12756. {
  12757. name = "psegments",
  12758. type = "number",
  12759. description = "The number of poloidal (tubular) segments to render.",
  12760. default = "32"
  12761. }
  12762. },
  12763. returns = {}
  12764. }
  12765. }
  12766. },
  12767. {
  12768. name = "transform",
  12769. tag = "transform",
  12770. summary = "Apply a general transform to the coordinate system.",
  12771. description = "TODO",
  12772. key = "Pass:transform",
  12773. module = "lovr.graphics",
  12774. notes = "TODO you can use combos of numbers/vectors/quats too (or use meta Transform type to explain)",
  12775. related = {
  12776. "lovr.graphics.translate",
  12777. "lovr.graphics.rotate",
  12778. "lovr.graphics.scale"
  12779. },
  12780. variants = {
  12781. {
  12782. arguments = {
  12783. {
  12784. name = "x",
  12785. type = "number",
  12786. description = "The x component of the translation.",
  12787. default = "0"
  12788. },
  12789. {
  12790. name = "y",
  12791. type = "number",
  12792. description = "The y component of the translation.",
  12793. default = "0"
  12794. },
  12795. {
  12796. name = "z",
  12797. type = "number",
  12798. description = "The z component of the translation.",
  12799. default = "0"
  12800. },
  12801. {
  12802. name = "sx",
  12803. type = "number",
  12804. description = "The x scale factor.",
  12805. default = "1"
  12806. },
  12807. {
  12808. name = "sy",
  12809. type = "number",
  12810. description = "The y scale factor.",
  12811. default = "1"
  12812. },
  12813. {
  12814. name = "sz",
  12815. type = "number",
  12816. description = "The z scale factor.",
  12817. default = "1"
  12818. },
  12819. {
  12820. name = "angle",
  12821. type = "number",
  12822. description = "The number of radians to rotate around the axis of rotation.",
  12823. default = "0"
  12824. },
  12825. {
  12826. name = "ax",
  12827. type = "number",
  12828. description = "The x component of the axis of rotation.",
  12829. default = "0"
  12830. },
  12831. {
  12832. name = "ay",
  12833. type = "number",
  12834. description = "The y component of the axis of rotation.",
  12835. default = "1"
  12836. },
  12837. {
  12838. name = "az",
  12839. type = "number",
  12840. description = "The z component of the axis of rotation.",
  12841. default = "0"
  12842. }
  12843. },
  12844. returns = {}
  12845. },
  12846. {
  12847. arguments = {
  12848. {
  12849. name = "transform",
  12850. type = "Mat4",
  12851. description = "The matrix holding the transform to apply."
  12852. }
  12853. },
  12854. returns = {}
  12855. }
  12856. }
  12857. },
  12858. {
  12859. name = "translate",
  12860. tag = "transform",
  12861. summary = "Translate the coordinate system.",
  12862. description = "TODO",
  12863. key = "Pass:translate",
  12864. module = "lovr.graphics",
  12865. notes = "Order matters when scaling, translating, and rotating the coordinate system.",
  12866. related = {
  12867. "lovr.graphics.rotate",
  12868. "lovr.graphics.scale",
  12869. "lovr.graphics.transform"
  12870. },
  12871. variants = {
  12872. {
  12873. arguments = {
  12874. {
  12875. name = "x",
  12876. type = "number",
  12877. description = "The amount to translate on the x axis.",
  12878. default = "0"
  12879. },
  12880. {
  12881. name = "y",
  12882. type = "number",
  12883. description = "The amount to translate on the y axis.",
  12884. default = "0"
  12885. },
  12886. {
  12887. name = "z",
  12888. type = "number",
  12889. description = "The amount to translate on the z axis.",
  12890. default = "0"
  12891. }
  12892. },
  12893. returns = {}
  12894. },
  12895. {
  12896. arguments = {
  12897. {
  12898. name = "v",
  12899. type = "Vec3",
  12900. description = "A vector to translate by."
  12901. }
  12902. },
  12903. returns = {}
  12904. }
  12905. }
  12906. }
  12907. }
  12908. },
  12909. {
  12910. name = "Readback",
  12911. summary = "TODO",
  12912. description = "TODO",
  12913. key = "Readback",
  12914. module = "lovr.graphics",
  12915. constructors = {
  12916. "Pass:read"
  12917. },
  12918. methods = {
  12919. {
  12920. name = "getBlob",
  12921. summary = "Get Readback's data as a Blob.",
  12922. description = "Returns the Readback's data as a Blob.",
  12923. key = "Readback:getBlob",
  12924. module = "lovr.graphics",
  12925. notes = "TODO what if it's an image?!",
  12926. variants = {
  12927. {
  12928. arguments = {},
  12929. returns = {
  12930. {
  12931. name = "blob",
  12932. type = "Blob",
  12933. description = "The Blob."
  12934. }
  12935. }
  12936. }
  12937. },
  12938. related = {
  12939. "Readback:getData",
  12940. "Readback:getImage"
  12941. }
  12942. },
  12943. {
  12944. name = "getData",
  12945. summary = "Get Readback's data as a table.",
  12946. description = "Returns the data from the Readback, as a table.",
  12947. key = "Readback:getData",
  12948. module = "lovr.graphics",
  12949. notes = "TODO what if the readback is a buffer/texture?!",
  12950. variants = {
  12951. {
  12952. arguments = {},
  12953. returns = {
  12954. {
  12955. name = "data",
  12956. type = "table",
  12957. description = "A table containing the values that were read back."
  12958. }
  12959. }
  12960. }
  12961. },
  12962. related = {
  12963. "Readback:getBlob",
  12964. "Readback:getImage"
  12965. }
  12966. },
  12967. {
  12968. name = "getImage",
  12969. summary = "Get Readback's data as an Image.",
  12970. description = "Returns the Readback's data as an Image.",
  12971. key = "Readback:getImage",
  12972. module = "lovr.graphics",
  12973. notes = "TODO what if it's a buffer or tally?!",
  12974. variants = {
  12975. {
  12976. arguments = {},
  12977. returns = {
  12978. {
  12979. name = "image",
  12980. type = "Image",
  12981. description = "The Image."
  12982. }
  12983. }
  12984. }
  12985. },
  12986. related = {
  12987. "Readback:getData",
  12988. "Readback:getBlob"
  12989. }
  12990. },
  12991. {
  12992. name = "isComplete",
  12993. summary = "Check if a Readback is complete.",
  12994. description = "Returns whether the Readback has completed on the GPU and its data is available.",
  12995. key = "Readback:isComplete",
  12996. module = "lovr.graphics",
  12997. variants = {
  12998. {
  12999. arguments = {},
  13000. returns = {
  13001. {
  13002. name = "complete",
  13003. type = "boolean",
  13004. description = "Whether the readback is complete."
  13005. }
  13006. }
  13007. }
  13008. }
  13009. },
  13010. {
  13011. name = "wait",
  13012. summary = "Wait for the Readback to finish.",
  13013. description = "Blocks the CPU until the Readback is finished on the GPU.",
  13014. key = "Readback:wait",
  13015. module = "lovr.graphics",
  13016. notes = "TODO what if the readback will never complete?!",
  13017. variants = {
  13018. {
  13019. arguments = {},
  13020. returns = {
  13021. {
  13022. name = "waited",
  13023. type = "boolean",
  13024. description = "Whether the CPU had to be blocked for waiting."
  13025. }
  13026. }
  13027. }
  13028. }
  13029. }
  13030. }
  13031. },
  13032. {
  13033. name = "Sampler",
  13034. summary = "TODO",
  13035. description = "TODO",
  13036. key = "Sampler",
  13037. module = "lovr.graphics",
  13038. constructors = {
  13039. "lovr.graphics.newSampler"
  13040. },
  13041. methods = {
  13042. {
  13043. name = "getAnisotropy",
  13044. summary = "Get the anisotropy of the Sampler.",
  13045. description = "TODO",
  13046. key = "Sampler:getAnisotropy",
  13047. module = "lovr.graphics",
  13048. related = {
  13049. "Sampler:getFilter",
  13050. "Sampler:getWrap",
  13051. "Sampler:getCompareMode",
  13052. "Sampler:getMipmapRange"
  13053. },
  13054. variants = {
  13055. {
  13056. arguments = {},
  13057. returns = {
  13058. {
  13059. name = "anisotropy",
  13060. type = "number",
  13061. description = "TODO"
  13062. }
  13063. }
  13064. }
  13065. }
  13066. },
  13067. {
  13068. name = "getCompareMode",
  13069. summary = "Get the compare mode of the Sampler.",
  13070. description = "TODO",
  13071. key = "Sampler:getCompareMode",
  13072. module = "lovr.graphics",
  13073. related = {
  13074. "Sampler:getFilter",
  13075. "Sampler:getWrap",
  13076. "Sampler:getAnisotropy",
  13077. "Sampler:getMipmapRange"
  13078. },
  13079. variants = {
  13080. {
  13081. arguments = {},
  13082. returns = {
  13083. {
  13084. name = "compare",
  13085. type = "CompareMode",
  13086. description = "TODO"
  13087. }
  13088. }
  13089. }
  13090. }
  13091. },
  13092. {
  13093. name = "getFilter",
  13094. summary = "Get the filter mode of the Sampler.",
  13095. description = "TODO",
  13096. key = "Sampler:getFilter",
  13097. module = "lovr.graphics",
  13098. related = {
  13099. "Sampler:getWrap",
  13100. "Sampler:getCompareMode",
  13101. "Sampler:getAnisotropy",
  13102. "Sampler:getMipmapRange"
  13103. },
  13104. variants = {
  13105. {
  13106. arguments = {},
  13107. returns = {
  13108. {
  13109. name = "min",
  13110. type = "FilterMode",
  13111. description = "TODO"
  13112. },
  13113. {
  13114. name = "mag",
  13115. type = "FilterMode",
  13116. description = "TODO"
  13117. },
  13118. {
  13119. name = "mip",
  13120. type = "FilterMode",
  13121. description = "TODO"
  13122. }
  13123. }
  13124. }
  13125. }
  13126. },
  13127. {
  13128. name = "getMipmapRange",
  13129. summary = "Get the mipmap range of the Sampler.",
  13130. description = "TODO",
  13131. key = "Sampler:getMipmapRange",
  13132. module = "lovr.graphics",
  13133. related = {
  13134. "Sampler:getFilter",
  13135. "Sampler:getWrap",
  13136. "Sampler:getCompareMode",
  13137. "Sampler:getAnisotropy"
  13138. },
  13139. variants = {
  13140. {
  13141. arguments = {},
  13142. returns = {
  13143. {
  13144. name = "min",
  13145. type = "number",
  13146. description = "TODO"
  13147. },
  13148. {
  13149. name = "max",
  13150. type = "number",
  13151. description = "TODO"
  13152. }
  13153. }
  13154. }
  13155. }
  13156. },
  13157. {
  13158. name = "getWrap",
  13159. summary = "Get the wrap mode of the Sampler.",
  13160. description = "TODO",
  13161. key = "Sampler:getWrap",
  13162. module = "lovr.graphics",
  13163. related = {
  13164. "Sampler:getFilter",
  13165. "Sampler:getCompareMode",
  13166. "Sampler:getAnisotropy",
  13167. "Sampler:getMipmapRange"
  13168. },
  13169. variants = {
  13170. {
  13171. arguments = {},
  13172. returns = {
  13173. {
  13174. name = "x",
  13175. type = "WrapMode",
  13176. description = "TODO"
  13177. },
  13178. {
  13179. name = "y",
  13180. type = "WrapMode",
  13181. description = "TODO"
  13182. },
  13183. {
  13184. name = "z",
  13185. type = "WrapMode",
  13186. description = "TODO"
  13187. }
  13188. }
  13189. }
  13190. }
  13191. }
  13192. }
  13193. },
  13194. {
  13195. name = "Shader",
  13196. summary = "TODO",
  13197. description = "TODO",
  13198. key = "Shader",
  13199. module = "lovr.graphics",
  13200. constructors = {
  13201. "lovr.graphics.newShader",
  13202. "Shader:clone"
  13203. },
  13204. methods = {
  13205. {
  13206. name = "clone",
  13207. summary = "Clone a Shader.",
  13208. description = "TODO",
  13209. key = "Shader:clone",
  13210. module = "lovr.graphics",
  13211. variants = {
  13212. {
  13213. arguments = {
  13214. {
  13215. name = "source",
  13216. type = "Shader",
  13217. description = "The Shader to clone."
  13218. },
  13219. {
  13220. name = "flags",
  13221. type = "table",
  13222. description = "TODO"
  13223. }
  13224. },
  13225. returns = {
  13226. {
  13227. name = "shader",
  13228. type = "Shader",
  13229. description = "The new Shader."
  13230. }
  13231. }
  13232. }
  13233. }
  13234. },
  13235. {
  13236. name = "getType",
  13237. summary = "Get the type of the Shader.",
  13238. description = "TODO",
  13239. key = "Shader:getType",
  13240. module = "lovr.graphics",
  13241. related = {
  13242. "Shader:hasStage"
  13243. },
  13244. variants = {
  13245. {
  13246. arguments = {},
  13247. returns = {
  13248. {
  13249. name = "type",
  13250. type = "ShaderType",
  13251. description = "The type of the Shader."
  13252. }
  13253. }
  13254. }
  13255. }
  13256. },
  13257. {
  13258. name = "getWorkgroupSize",
  13259. summary = "Get the workgroup size of a compute shader.",
  13260. description = "Returns the workgroup size of a compute shader. TODO what is it.",
  13261. key = "Shader:getWorkgroupSize",
  13262. module = "lovr.graphics",
  13263. variants = {
  13264. {
  13265. arguments = {},
  13266. returns = {
  13267. {
  13268. name = "x",
  13269. type = "number",
  13270. description = "The x size of a workgroup."
  13271. },
  13272. {
  13273. name = "y",
  13274. type = "number",
  13275. description = "The y size of a workgroup."
  13276. },
  13277. {
  13278. name = "z",
  13279. type = "number",
  13280. description = "The z size of a workgroup."
  13281. }
  13282. }
  13283. }
  13284. }
  13285. },
  13286. {
  13287. name = "hasAttribute",
  13288. summary = "Check if the Shader has a given vertex attribute.",
  13289. description = "TODO",
  13290. key = "Shader:hasAttribute",
  13291. module = "lovr.graphics",
  13292. variants = {
  13293. {
  13294. arguments = {
  13295. {
  13296. name = "name",
  13297. type = "string",
  13298. description = "The name of an attribute."
  13299. }
  13300. },
  13301. returns = {
  13302. {
  13303. name = "exists",
  13304. type = "boolean",
  13305. description = "Whether the Shader has the attribute."
  13306. }
  13307. }
  13308. },
  13309. {
  13310. arguments = {
  13311. {
  13312. name = "location",
  13313. type = "number",
  13314. description = "The location of an attribute."
  13315. }
  13316. },
  13317. returns = {
  13318. {
  13319. name = "exists",
  13320. type = "boolean",
  13321. description = "Whether the Shader has the attribute."
  13322. }
  13323. }
  13324. }
  13325. }
  13326. },
  13327. {
  13328. name = "hasStage",
  13329. summary = "Check if the Shader has a given stage.",
  13330. description = "TODO",
  13331. key = "Shader:hasStage",
  13332. module = "lovr.graphics",
  13333. related = {
  13334. "Shader:getType"
  13335. },
  13336. variants = {
  13337. {
  13338. arguments = {
  13339. {
  13340. name = "stage",
  13341. type = "ShaderStage",
  13342. description = "The stage."
  13343. }
  13344. },
  13345. returns = {
  13346. {
  13347. name = "exists",
  13348. type = "boolean",
  13349. description = "Whether the Shader has the stage."
  13350. }
  13351. }
  13352. }
  13353. }
  13354. }
  13355. }
  13356. },
  13357. {
  13358. name = "Tally",
  13359. summary = "TODO",
  13360. description = "TODO",
  13361. key = "Tally",
  13362. module = "lovr.graphics",
  13363. constructors = {
  13364. "lovr.graphics.newTally"
  13365. },
  13366. methods = {
  13367. {
  13368. name = "getCount",
  13369. summary = "Get the number of slots in the Tally.",
  13370. description = "Returns the number of slots in the Tally.",
  13371. key = "Tally:getCount",
  13372. module = "lovr.graphics",
  13373. variants = {
  13374. {
  13375. arguments = {},
  13376. returns = {
  13377. {
  13378. name = "count",
  13379. type = "number",
  13380. description = "The number of slots in the Tally."
  13381. }
  13382. }
  13383. }
  13384. }
  13385. },
  13386. {
  13387. name = "getType",
  13388. summary = "TODO",
  13389. description = "TODO",
  13390. key = "Tally:getType",
  13391. module = "lovr.graphics",
  13392. variants = {
  13393. {
  13394. arguments = {},
  13395. returns = {
  13396. {
  13397. name = "type",
  13398. type = "TallyType",
  13399. description = "TODO"
  13400. }
  13401. }
  13402. }
  13403. }
  13404. },
  13405. {
  13406. name = "getViewCount",
  13407. summary = "Get the number of render Pass views the Tally is configured for.",
  13408. description = "Tally objects with the `time` type can only be used in render passes with a certain number of views. This returns that number.",
  13409. key = "Tally:getViewCount",
  13410. module = "lovr.graphics",
  13411. variants = {
  13412. {
  13413. arguments = {},
  13414. returns = {
  13415. {
  13416. name = "views",
  13417. type = "number",
  13418. description = "The number of views the Tally is compatible with."
  13419. }
  13420. }
  13421. }
  13422. }
  13423. }
  13424. }
  13425. },
  13426. {
  13427. name = "Texture",
  13428. summary = "A multidimensional block of memory on the GPU.",
  13429. description = "Textures are multidimensional blocks of memory on the GPU, contrasted with `Buffer`s which are similar but one-dimensional. Textures can be used to provide material data to Shaders, and they are also used as the destination for rendering operations.\n\nTextures can be created from image filenames, `Image` objects, or they can be left blank and created with a width, height, and depth.\n\nEach Texture has a type (`TextureType`). 2D Textures are the most common and are often used to store color image data, but there are also cubemaps for skyboxes, 3D textures for volumetric info, and array textures which store a sequence of 2D images.\n\nThe format of a Texture (`TextureFormat`) defines the size and number of channels of each pixel.\n\nTextures can have mipmaps, which are a precomputed set of progressively smaller versions of the Texture. Mipmaps help make the Texture look smoother at smaller sizes, and also improve the performance of reading data from the Texture in a Shader.\n\nWhen used as a render target, the Texture can store multiple different color samples for each pixel, which can be averaged together after rendering to do antialiasing (this is called multisample antialiasing, or MSAA).\n\nIt is possible to create multiple views of a single Texture. A texture view references a subset of the array layers and mipmap levels of its parent texture, and can be bound to a Shader or used as a render target just like a normal texture.",
  13430. key = "Texture",
  13431. module = "lovr.graphics",
  13432. constructors = {
  13433. "lovr.graphics.newTexture",
  13434. "Texture:newView"
  13435. },
  13436. methods = {
  13437. {
  13438. name = "getDimensions",
  13439. summary = "Get the dimensions of the Texture.",
  13440. description = "Returns the width, height, and depth of the Texture.",
  13441. key = "Texture:getDimensions",
  13442. module = "lovr.graphics",
  13443. related = {
  13444. "Texture:getWidth",
  13445. "Texture:getHeight",
  13446. "Texture:getDepth"
  13447. },
  13448. variants = {
  13449. {
  13450. arguments = {},
  13451. returns = {
  13452. {
  13453. name = "width",
  13454. type = "number",
  13455. description = "The width of the Texture."
  13456. },
  13457. {
  13458. name = "height",
  13459. type = "number",
  13460. description = "The height of the Texture."
  13461. },
  13462. {
  13463. name = "depth",
  13464. type = "number",
  13465. description = "The depth of the Texture."
  13466. }
  13467. }
  13468. }
  13469. }
  13470. },
  13471. {
  13472. name = "getFormat",
  13473. summary = "Get the format of the Texture.",
  13474. description = "Returns the format of the texture. The default is `rgba8`.",
  13475. key = "Texture:getFormat",
  13476. module = "lovr.graphics",
  13477. variants = {
  13478. {
  13479. arguments = {},
  13480. returns = {
  13481. {
  13482. name = "format",
  13483. type = "TextureFormat",
  13484. description = "The format of the Texture."
  13485. }
  13486. }
  13487. }
  13488. }
  13489. },
  13490. {
  13491. name = "getHeight",
  13492. summary = "Get the height of the Texture, in pixels.",
  13493. description = "Returns the height of the Texture, in pixels.",
  13494. key = "Texture:getHeight",
  13495. module = "lovr.graphics",
  13496. related = {
  13497. "Texture:getWidth",
  13498. "Texture:getLayerCount",
  13499. "Texture:getDimensions"
  13500. },
  13501. variants = {
  13502. {
  13503. arguments = {},
  13504. returns = {
  13505. {
  13506. name = "height",
  13507. type = "number",
  13508. description = "The height of the Texture, in pixels."
  13509. }
  13510. }
  13511. }
  13512. }
  13513. },
  13514. {
  13515. name = "getLayerCount",
  13516. summary = "Get the layer count of the Texture.",
  13517. description = "Returns the layer count of the Texture. 2D textures always have 1 layer and cubemaps always have 6 layers. For 3D and array textures, this is the number of images stored in the texture. 3D textures represent a spatial 3D volume, whereas array textures are multiple layers of distinct 2D images.",
  13518. key = "Texture:getLayerCount",
  13519. module = "lovr.graphics",
  13520. related = {
  13521. "Texture:getWidth",
  13522. "Texture:getHeight",
  13523. "Texture:getDimensions"
  13524. },
  13525. variants = {
  13526. {
  13527. arguments = {},
  13528. returns = {
  13529. {
  13530. name = "layers",
  13531. type = "number",
  13532. description = "The layer count of the Texture."
  13533. }
  13534. }
  13535. }
  13536. }
  13537. },
  13538. {
  13539. name = "getMipmapCount",
  13540. summary = "Get the number of mipmap levels in the Texture.",
  13541. description = "Returns the number of mipmap levels in the Texture. This is set when the Texture is created. By default, textures are created with a full set of mipmap levels, and mipmaps are generated if the images used to create the texture do not include mipmaps.",
  13542. key = "Texture:getMipmapCount",
  13543. module = "lovr.graphics",
  13544. notes = "Each mipmap level will be half the size of the previous (larger) mipmap level, down to a single pixel. This means the maximum number of mipmap levels is given by `log2(max(width, height))` for non-3D textures and `log2(max(width, height, depth))` for 3D textures.",
  13545. variants = {
  13546. {
  13547. arguments = {},
  13548. returns = {
  13549. {
  13550. name = "mipmaps",
  13551. type = "number",
  13552. description = "The number of mipmap levels in the Texture."
  13553. }
  13554. }
  13555. }
  13556. },
  13557. related = {
  13558. "lovr.graphics.newTexture",
  13559. "Pass:mipmap"
  13560. }
  13561. },
  13562. {
  13563. name = "getParent",
  13564. summary = "Get the parent of a Texture view.",
  13565. description = "Returns the parent of a Texture view, which is the Texture that it references. Returns `nil` if the Texture is not a view.",
  13566. key = "Texture:getParent",
  13567. module = "lovr.graphics",
  13568. related = {
  13569. "Texture:isView",
  13570. "Texture:newView"
  13571. },
  13572. variants = {
  13573. {
  13574. arguments = {},
  13575. returns = {
  13576. {
  13577. name = "parent",
  13578. type = "Texture",
  13579. description = "The parent of the texture, or `nil` if the texture is not a view."
  13580. }
  13581. }
  13582. }
  13583. }
  13584. },
  13585. {
  13586. name = "getSampleCount",
  13587. summary = "Get the number of MSAA samples in the Texture.",
  13588. description = "Returns the number of multisample antialiasing (MSAA) samples in the Texture. Multisampling is used for antialiasing when rendering to the Texture. Using more samples will cause the Texture to use additional memory but reduce aliasing artifacts.",
  13589. key = "Texture:getSampleCount",
  13590. module = "lovr.graphics",
  13591. notes = "Currently, the sample count must be either 1 or 4.",
  13592. variants = {
  13593. {
  13594. arguments = {},
  13595. returns = {
  13596. {
  13597. name = "samples",
  13598. type = "number",
  13599. description = "The number of samples in the Texture."
  13600. }
  13601. }
  13602. }
  13603. },
  13604. related = {
  13605. "lovr.graphics.newTexture"
  13606. }
  13607. },
  13608. {
  13609. name = "getType",
  13610. summary = "Get the type of the Texture.",
  13611. description = "Returns the type of the texture.",
  13612. key = "Texture:getType",
  13613. module = "lovr.graphics",
  13614. variants = {
  13615. {
  13616. arguments = {},
  13617. returns = {
  13618. {
  13619. name = "type",
  13620. type = "TextureType",
  13621. description = "The type of the Texture."
  13622. }
  13623. }
  13624. }
  13625. }
  13626. },
  13627. {
  13628. name = "getWidth",
  13629. summary = "Get the width of the Texture, in pixels.",
  13630. description = "Returns the width of the Texture, in pixels.",
  13631. key = "Texture:getWidth",
  13632. module = "lovr.graphics",
  13633. related = {
  13634. "Texture:getHeight",
  13635. "Texture:getLayerCount",
  13636. "Texture:getDimensions"
  13637. },
  13638. variants = {
  13639. {
  13640. arguments = {},
  13641. returns = {
  13642. {
  13643. name = "width",
  13644. type = "number",
  13645. description = "The width of the Texture, in pixels."
  13646. }
  13647. }
  13648. }
  13649. }
  13650. },
  13651. {
  13652. name = "hasUsage",
  13653. summary = "Check if a Texture was created with a set of usage flags.",
  13654. description = "Returns whether a Texture was created with a set of `TextureUsage` flags. Usage flags are specified when the Texture is created, and restrict what you can do with a Texture object. By default, only the `sample` usage is enabled. Applying a smaller set of usage flags helps LÖVR optimize things better.",
  13655. key = "Texture:hasUsage",
  13656. module = "lovr.graphics",
  13657. related = {
  13658. "lovr.graphics.newTexture"
  13659. },
  13660. variants = {
  13661. {
  13662. arguments = {
  13663. {
  13664. name = "...",
  13665. type = "TextureUsage",
  13666. description = "One or more usage flags."
  13667. }
  13668. },
  13669. returns = {
  13670. {
  13671. name = "supported",
  13672. type = "boolean",
  13673. description = "Whether the Texture has all the provided usage flags."
  13674. }
  13675. }
  13676. }
  13677. }
  13678. },
  13679. {
  13680. name = "isView",
  13681. summary = "Check if a Texture is a texture view.",
  13682. description = "Returns whether a Texture is a texture view, created with `Texture:newView`.",
  13683. key = "Texture:isView",
  13684. module = "lovr.graphics",
  13685. related = {
  13686. "Texture:getParent",
  13687. "Texture:newView"
  13688. },
  13689. variants = {
  13690. {
  13691. arguments = {},
  13692. returns = {
  13693. {
  13694. name = "view",
  13695. type = "boolean",
  13696. description = "Whether the Texture is a texture view."
  13697. }
  13698. }
  13699. }
  13700. }
  13701. },
  13702. {
  13703. name = "newView",
  13704. summary = "Create a texture view referencing this Texture.",
  13705. description = "Creates a new Texture view. A texture view does not store any pixels on its own, but instead uses the pixel data of a \"parent\" Texture object. The width, height, format, sample count, and usage flags all match the parent. The view may have a different `TextureType` from the parent, and it may reference a subset of the parent texture's images and mipmap levels.\n\nTexture views can be used as render targets in a render pass and they can be bound to Shaders. They can not currently be used for transfer operations. They are used for:\n\n- Reinterpretation of texture contents. For example, a cubemap can be treated as\n an array texture.\n- Rendering to a particular image or mipmap level of a texture.\n- Binding a particular image or mipmap level to a shader.",
  13706. key = "Texture:newView",
  13707. module = "lovr.graphics",
  13708. related = {
  13709. "Texture:isView",
  13710. "Texture:getParent",
  13711. "lovr.graphics.newTexture"
  13712. },
  13713. variants = {
  13714. {
  13715. arguments = {
  13716. {
  13717. name = "parent",
  13718. type = "Texture",
  13719. description = "The parent Texture to create the view of."
  13720. },
  13721. {
  13722. name = "type",
  13723. type = "TextureType",
  13724. description = "The texture type of the view."
  13725. },
  13726. {
  13727. name = "layer",
  13728. type = "number",
  13729. description = "The index of the first layer in the view.",
  13730. default = "1"
  13731. },
  13732. {
  13733. name = "layerCount",
  13734. type = "number",
  13735. description = "The number of layers in the view, or `nil` to use all remaining layers.",
  13736. default = "nil"
  13737. },
  13738. {
  13739. name = "mipmap",
  13740. type = "number",
  13741. description = "The index of the first mipmap in the view.",
  13742. default = "1"
  13743. },
  13744. {
  13745. name = "mipmapCount",
  13746. type = "number",
  13747. description = "The number of mipmaps in the view, or `nil` to use all remaining mipmaps.",
  13748. default = "nil"
  13749. }
  13750. },
  13751. returns = {
  13752. {
  13753. name = "view",
  13754. type = "Texture",
  13755. description = "The new texture view."
  13756. }
  13757. }
  13758. }
  13759. }
  13760. }
  13761. }
  13762. }
  13763. },
  13764. functions = {
  13765. {
  13766. name = "compileShader",
  13767. tag = "graphics-objects",
  13768. summary = "Compile a Shader.",
  13769. description = "TODO",
  13770. key = "lovr.graphics.compileShader",
  13771. module = "lovr.graphics",
  13772. related = {
  13773. "lovr.graphics.newShader"
  13774. },
  13775. variants = {
  13776. {
  13777. arguments = {
  13778. {
  13779. name = "stage",
  13780. type = "ShaderStage",
  13781. description = "TODO"
  13782. },
  13783. {
  13784. name = "source",
  13785. type = "ShaderSource",
  13786. description = "TODO"
  13787. }
  13788. },
  13789. returns = {
  13790. {
  13791. name = "bytecode",
  13792. type = "Blob",
  13793. description = "TODO"
  13794. }
  13795. }
  13796. }
  13797. }
  13798. },
  13799. {
  13800. name = "getBackgroundColor",
  13801. tag = "graphics-global",
  13802. summary = "Get the background color.",
  13803. description = "TODO",
  13804. key = "lovr.graphics.getBackgroundColor",
  13805. module = "lovr.graphics",
  13806. notes = "TODO",
  13807. variants = {
  13808. {
  13809. arguments = {},
  13810. returns = {
  13811. {
  13812. name = "r",
  13813. type = "number",
  13814. description = "The red component of the background color."
  13815. },
  13816. {
  13817. name = "g",
  13818. type = "number",
  13819. description = "The green component of the background color."
  13820. },
  13821. {
  13822. name = "b",
  13823. type = "number",
  13824. description = "The blue component of the background color."
  13825. },
  13826. {
  13827. name = "a",
  13828. type = "number",
  13829. description = "The alpha component of the background color."
  13830. }
  13831. }
  13832. }
  13833. }
  13834. },
  13835. {
  13836. name = "getBuffer",
  13837. tag = "graphics-objects",
  13838. summary = "Get a temporary Buffer.",
  13839. description = "Creates a temporary Buffer.",
  13840. key = "lovr.graphics.getBuffer",
  13841. module = "lovr.graphics",
  13842. notes = "The format table can contain a list of `FieldType`s or a list of tables to provide extra information about each field. Each inner table has the following keys:\n\n- `type` is the `FieldType` of the field and is required.\n- `offset` is the byte offset of the field. Any fields with a `nil` offset will be placed next\n to each other sequentially in memory, subject to any padding required by the Buffer's layout.\n In practice this means that you probably want to provide an `offset` for either all of the\n fields or none of them.\n- `location` is the vertex attribute location of each field. This is used to match up each\n field with an attribute declared in a shader, and doesn't have any purpose when binding the\n buffer as a uniform or storage buffer. Any fields with a `nil` location will use an\n autoincrementing location starting at zero. Named locations are not currently supported, but\n may be added in the future.\n\nIf no table or Blob is used to define the initial Buffer contents, its data will be undefined.\n\nThere is currently a max of 16 fields.",
  13843. related = {
  13844. "lovr.graphics.newBuffer"
  13845. },
  13846. variants = {
  13847. {
  13848. arguments = {
  13849. {
  13850. name = "length",
  13851. type = "number",
  13852. description = "The length of the Buffer."
  13853. },
  13854. {
  13855. name = "type",
  13856. type = "FieldType",
  13857. description = "The type of each item in the Buffer."
  13858. }
  13859. },
  13860. returns = {
  13861. {
  13862. name = "buffer",
  13863. type = "Buffer",
  13864. description = "The new Buffer."
  13865. }
  13866. }
  13867. },
  13868. {
  13869. arguments = {
  13870. {
  13871. name = "data",
  13872. type = "table",
  13873. description = "The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data."
  13874. },
  13875. {
  13876. name = "type",
  13877. type = "FieldType",
  13878. description = "The type of each item in the Buffer."
  13879. }
  13880. },
  13881. returns = {
  13882. {
  13883. name = "buffer",
  13884. type = "Buffer",
  13885. description = "The new Buffer."
  13886. }
  13887. }
  13888. },
  13889. {
  13890. arguments = {
  13891. {
  13892. name = "length",
  13893. type = "number",
  13894. description = "The length of the Buffer."
  13895. },
  13896. {
  13897. name = "format",
  13898. type = "table",
  13899. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  13900. default = "nil",
  13901. table = {
  13902. {
  13903. name = "layout",
  13904. type = "BufferLayout",
  13905. description = "How to lay out the Buffer fields in memory.",
  13906. default = "packed"
  13907. },
  13908. {
  13909. name = "stride",
  13910. type = "number",
  13911. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  13912. }
  13913. }
  13914. }
  13915. },
  13916. returns = {
  13917. {
  13918. name = "buffer",
  13919. type = "Buffer",
  13920. description = "The new Buffer."
  13921. }
  13922. }
  13923. },
  13924. {
  13925. arguments = {
  13926. {
  13927. name = "data",
  13928. type = "table",
  13929. description = "The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data."
  13930. },
  13931. {
  13932. name = "format",
  13933. type = "table",
  13934. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  13935. default = "nil",
  13936. table = {
  13937. {
  13938. name = "layout",
  13939. type = "BufferLayout",
  13940. description = "How to lay out the Buffer fields in memory.",
  13941. default = "packed"
  13942. },
  13943. {
  13944. name = "stride",
  13945. type = "number",
  13946. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  13947. }
  13948. }
  13949. }
  13950. },
  13951. returns = {
  13952. {
  13953. name = "buffer",
  13954. type = "Buffer",
  13955. description = "The new Buffer."
  13956. }
  13957. }
  13958. },
  13959. {
  13960. arguments = {
  13961. {
  13962. name = "blob",
  13963. type = "Blob",
  13964. description = "A Blob with the initial contents of the Buffer. The size of the Blob will be used to determine the length of the Buffer."
  13965. },
  13966. {
  13967. name = "type",
  13968. type = "FieldType",
  13969. description = "The type of each item in the Buffer."
  13970. }
  13971. },
  13972. returns = {
  13973. {
  13974. name = "buffer",
  13975. type = "Buffer",
  13976. description = "The new Buffer."
  13977. }
  13978. }
  13979. },
  13980. {
  13981. arguments = {
  13982. {
  13983. name = "blob",
  13984. type = "Blob",
  13985. description = "A Blob with the initial contents of the Buffer. The size of the Blob will be used to determine the length of the Buffer."
  13986. },
  13987. {
  13988. name = "format",
  13989. type = "table",
  13990. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  13991. default = "nil",
  13992. table = {
  13993. {
  13994. name = "layout",
  13995. type = "BufferLayout",
  13996. description = "How to lay out the Buffer fields in memory.",
  13997. default = "packed"
  13998. },
  13999. {
  14000. name = "stride",
  14001. type = "number",
  14002. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  14003. }
  14004. }
  14005. }
  14006. },
  14007. returns = {
  14008. {
  14009. name = "buffer",
  14010. type = "Buffer",
  14011. description = "The new Buffer."
  14012. }
  14013. }
  14014. }
  14015. }
  14016. },
  14017. {
  14018. name = "getDefaultFont",
  14019. tag = "graphics-objects",
  14020. summary = "Get the default Font.",
  14021. description = "Returns the default Font. The default font is Varela Round, created at 32px with a spread value of `4.0`. It's used by `Pass:text` if no Font is provided.",
  14022. key = "lovr.graphics.getDefaultFont",
  14023. module = "lovr.graphics",
  14024. related = {
  14025. "Pass:text",
  14026. "lovr.graphics.newFont"
  14027. },
  14028. variants = {
  14029. {
  14030. arguments = {},
  14031. returns = {
  14032. {
  14033. name = "font",
  14034. type = "Font",
  14035. description = "The default Font object."
  14036. }
  14037. }
  14038. }
  14039. }
  14040. },
  14041. {
  14042. name = "getDevice",
  14043. tag = "graphics-misc",
  14044. summary = "Get information about the graphics device and driver.",
  14045. description = "Returns information about the graphics device and driver.",
  14046. key = "lovr.graphics.getDevice",
  14047. module = "lovr.graphics",
  14048. notes = "The device and vendor ID numbers will usually be PCI IDs, which are standardized numbers consisting of 4 hex digits. Various online databases and system utilities can be used to look up these numbers. Here are some example vendor IDs for a few popular GPU manufacturers:\n\n<table>\n <thead>\n <tr>\n <td>ID</td>\n <td>Vendor</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><code>0x1002</code></td>\n <td>Advanced Micro Devices, Inc.</td>\n </tr>\n <tr>\n <td><code>0x8086</code></td>\n <td>Intel Corporation</td>\n </tr>\n <tr>\n <td><code>0x10de</code></td>\n <td>NVIDIA Corporation</td>\n </tr>\n </tbody> </table>\n\nIt is not currently possible to get the version of the driver, although this could be added.\n\nRegarding multiple GPUs: If OpenXR is enabled, the OpenXR runtime has control over which GPU is used, which ensures best compatibility with the VR headset. Otherwise, the \"first\" GPU returned by the renderer will be used. There is currently no other way to pick a GPU to use.",
  14049. related = {
  14050. "lovr.graphics.getFeatures",
  14051. "lovr.graphics.getLimits",
  14052. "lovr.graphics.getStats"
  14053. },
  14054. variants = {
  14055. {
  14056. arguments = {},
  14057. returns = {
  14058. {
  14059. name = "device",
  14060. type = "table",
  14061. table = {
  14062. {
  14063. name = "id",
  14064. type = "number",
  14065. description = "The vendor-unique number for this GPU."
  14066. },
  14067. {
  14068. name = "vendor",
  14069. type = "number",
  14070. description = "The identifier of the GPU vendor."
  14071. },
  14072. {
  14073. name = "name",
  14074. type = "string",
  14075. description = "The name of the GPU."
  14076. },
  14077. {
  14078. name = "renderer",
  14079. type = "string",
  14080. description = "The renderer in use, currently either \"Vulkan\" or \"WebGPU\"."
  14081. },
  14082. {
  14083. name = "subgroupSize",
  14084. type = "number",
  14085. description = "The number of threads that run in a single GPU compute unit. This is usually 32 or 64, and is sometimes called the \"wave\" or \"warp\" size. This can be used to optimize compute shaders for the current hardware."
  14086. },
  14087. {
  14088. name = "discrete",
  14089. type = "boolean",
  14090. description = "Whether the GPU is a discrete graphics card."
  14091. }
  14092. }
  14093. }
  14094. }
  14095. }
  14096. }
  14097. },
  14098. {
  14099. name = "getFeatures",
  14100. tag = "graphics-misc",
  14101. summary = "Get the supported GPU features.",
  14102. description = "Returns a table indicating which features are supported by the GPU.",
  14103. key = "lovr.graphics.getFeatures",
  14104. module = "lovr.graphics",
  14105. related = {
  14106. "lovr.graphics.isFormatSupported",
  14107. "lovr.graphics.getDevice",
  14108. "lovr.graphics.getLimits",
  14109. "lovr.graphics.getStats"
  14110. },
  14111. variants = {
  14112. {
  14113. arguments = {},
  14114. returns = {
  14115. {
  14116. name = "features",
  14117. type = "table",
  14118. description = "",
  14119. table = {
  14120. {
  14121. name = "textureBC",
  14122. type = "boolean",
  14123. description = "Whether `TextureFormat`s starting with `bc` are supported. This will almost always be `true` on desktop GPUs and will almost always be `false` on mobile GPUs."
  14124. },
  14125. {
  14126. name = "textureASTC",
  14127. type = "boolean",
  14128. description = "Whether `TextureFormat`s beginning with `astc` are supported. This will almost always be `true` on mobile GPUs and will almost always be `false` on desktop GPUs."
  14129. },
  14130. {
  14131. name = "wireframe",
  14132. type = "boolean",
  14133. description = "When supported, `Pass:setWireframe` will work, otherwise it will do nothing. This will always be `true` when using Vulkan, and will always be `false` when using WebGPU."
  14134. },
  14135. {
  14136. name = "depthClamp",
  14137. type = "boolean",
  14138. description = "When supported, `Pass:setDepthClamp` will work, otherwise it will do nothing."
  14139. },
  14140. {
  14141. name = "indirectDrawFirstInstance",
  14142. type = "boolean",
  14143. description = "Whether indirect draws can set the firstInstance property of buffer memory to something other than zero."
  14144. },
  14145. {
  14146. name = "float64",
  14147. type = "boolean",
  14148. description = "Whether shader code can use doubles."
  14149. },
  14150. {
  14151. name = "int64",
  14152. type = "boolean",
  14153. description = "Whether shader code can use signed and unsigned 64-bit integers."
  14154. },
  14155. {
  14156. name = "int16",
  14157. type = "boolean",
  14158. description = "Whether shader code can use signed and unsigned 16-bit integers."
  14159. }
  14160. }
  14161. }
  14162. }
  14163. }
  14164. }
  14165. },
  14166. {
  14167. name = "getLimits",
  14168. tag = "graphics-misc",
  14169. summary = "Get the limits of the current GPU.",
  14170. description = "Returns limits of the current GPU.",
  14171. key = "lovr.graphics.getLimits",
  14172. module = "lovr.graphics",
  14173. notes = "The limit ranges are as follows:\n\n<table>\n <thead>\n <tr>\n <td>Limit</td>\n <td>Minimum</td>\n <td>Maximum</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><code>textureSize2D</code></td>\n <td>4096</td>\n <td></td>\n </tr>\n <tr>\n <td><code>textureSize3D</code></td>\n <td>256</td>\n <td></td>\n </tr>\n <tr>\n <td><code>textureSizeCube</code></td>\n <td>4096</td>\n <td></td>\n </tr>\n <tr>\n <td><code>textureLayers</code></td>\n <td>256</td>\n <td></td>\n </tr>\n <tr>\n <td><code>renderSize</code></td>\n <td>{ 4096, 4096, 6 }</td>\n <td></td>\n </tr>\n <tr>\n <td><code>uniformBuffersPerStage</code></td>\n <td>9</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>storageBuffersPerStage</code></td>\n <td>4</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>sampledTexturesPerStage</code></td>\n <td>32</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>storageTexturesPerStage</code></td>\n <td>4</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>samplersPerStage</code></td>\n <td>15</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>resourcesPerShader</code></td>\n <td>32</td>\n <td>32*</td>\n </tr>\n <tr>\n <td><code>uniformBufferRange</code></td>\n <td>65536</td>\n <td></td>\n </tr>\n <tr>\n <td><code>storageBufferRange</code></td>\n <td>134217728 (128MB)</td>\n <td>1073741824 (1GB)*</td>\n </tr>\n <tr>\n <td><code>uniformBufferAlign</code></td>\n <td></td>\n <td>256</td>\n </tr>\n <tr>\n <td><code>storageBufferAlign</code></td>\n <td></td>\n <td>64</td>\n </tr>\n <tr>\n <td><code>vertexAttributes</code></td>\n <td>16</td>\n <td>16*</td>\n </tr>\n <tr>\n <td><code>vertexBufferStride</code></td>\n <td>2048</td>\n <td>65535*</td>\n </tr>\n <tr>\n <td><code>vertexShaderOutputs</code></td>\n <td>64</td>\n <td></td>\n </tr>\n <tr>\n <td><code>clipDistances</code></td>\n <td>0</td>\n <td></td>\n </tr>\n <tr>\n <td><code>cullDistances</code></td>\n <td>0</td>\n <td></td>\n </tr>\n <tr>\n <td><code>clipAndCullDistances</code></td>\n <td>0</td>\n <td></td>\n </tr>\n <tr>\n <td><code>computeDispatchCount</code></td>\n <td>{ 65536, 65536, 65536 }</td>\n <td></td>\n </tr>\n <tr>\n <td><code>computeWorkgroupSize</code></td>\n <td>{ 128, 128, 64 }</td>\n <td></td>\n </tr>\n <tr>\n <td><code>computeWorkgroupVolume</code></td>\n <td>128</td>\n <td></td>\n </tr>\n <tr>\n <td><code>computeSharedMemory</code></td>\n <td>16384 (16KB)</td>\n <td></td>\n </tr>\n <tr>\n <td><code>pushConstantSize</code></td>\n <td>128</td>\n <td>256*</td>\n </tr>\n <tr>\n <td><code>indirectDrawCount</code></td>\n <td>1</td>\n <td></td>\n </tr>\n <tr>\n <td><code>instances</code></td>\n <td>134217727</td>\n <td></td>\n </tr>\n <tr>\n <td><code>anisotropy</code></td>\n <td>0.0</td>\n <td></td>\n </tr>\n <tr>\n <td><code>pointSize</code></td>\n <td>1.0</td>\n <td></td>\n </tr>\n </tbody> </table>\n\nNote: in the table above, `*` means that LÖVR itself is imposing a cap on the limit, instead of the GPU.",
  14174. related = {
  14175. "lovr.graphics.isFormatSupported",
  14176. "lovr.graphics.getDevice",
  14177. "lovr.graphics.getFeatures",
  14178. "lovr.graphics.getStats"
  14179. },
  14180. variants = {
  14181. {
  14182. arguments = {},
  14183. returns = {
  14184. {
  14185. name = "limits",
  14186. type = "table",
  14187. description = "",
  14188. table = {
  14189. {
  14190. name = "textureSize2D",
  14191. type = "number",
  14192. description = "The maximum width/height of `2d` and `array` textures."
  14193. },
  14194. {
  14195. name = "textureSize3D",
  14196. type = "number",
  14197. description = "The maximum width/height/depth of `3d` textures."
  14198. },
  14199. {
  14200. name = "textureSizeCube",
  14201. type = "number",
  14202. description = "The maximum width/height of `cube` textures."
  14203. },
  14204. {
  14205. name = "textureLayers",
  14206. type = "number",
  14207. description = "The maximum depth of `array` textures."
  14208. },
  14209. {
  14210. name = "renderSize",
  14211. type = "table",
  14212. description = "The maximum width, height, and layer count of a texture (or texture view) used as a render target."
  14213. },
  14214. {
  14215. name = "uniformBuffersPerStage",
  14216. type = "number",
  14217. description = "The maximum number of uniform buffers in a shader stage."
  14218. },
  14219. {
  14220. name = "storageBuffersPerStage",
  14221. type = "number",
  14222. description = "The maximum number of storage buffers in a shader stage."
  14223. },
  14224. {
  14225. name = "sampledTexturesPerStage",
  14226. type = "number",
  14227. description = "The maximum number of sampled textures in a shader stage."
  14228. },
  14229. {
  14230. name = "storageTexturesPerStage",
  14231. type = "number",
  14232. description = "The maximum number of storage textures in a shader stage."
  14233. },
  14234. {
  14235. name = "samplersPerStage",
  14236. type = "number",
  14237. description = "The maximum number of samplers in a shader stage."
  14238. },
  14239. {
  14240. name = "resourcesPerShader",
  14241. type = "number",
  14242. description = "The maximum combined number of buffers, textures, and sampler variables in a Shader."
  14243. },
  14244. {
  14245. name = "uniformBufferRange",
  14246. type = "number",
  14247. description = "The maximum range of bytes that can be bound to a uniform buffer in a shader."
  14248. },
  14249. {
  14250. name = "storageBufferRange",
  14251. type = "number",
  14252. description = "The maximum range of bytes that can be bound to a storage buffer in a shader."
  14253. },
  14254. {
  14255. name = "uniformBufferAlign",
  14256. type = "number",
  14257. description = "When binding a range of bytes to a uniform buffer binding in a shader, the byte offset of the range must be a multiple of this limit's value."
  14258. },
  14259. {
  14260. name = "storageBufferAlign",
  14261. type = "number",
  14262. description = "When binding a range of bytes to a storage buffer binding in a shader, the byte offset of the range must be a multiple of this limit's value."
  14263. },
  14264. {
  14265. name = "vertexAttributes",
  14266. type = "number",
  14267. description = "The maximum number of input attributes in a vertex shader."
  14268. },
  14269. {
  14270. name = "vertexBufferStride",
  14271. type = "number",
  14272. description = "The maximum stride of a buffer used as a vertex buffer, in bytes."
  14273. },
  14274. {
  14275. name = "vertexShaderOutputs",
  14276. type = "number",
  14277. description = "The maximum number of components output from a vertex shader."
  14278. },
  14279. {
  14280. name = "clipDistances",
  14281. type = "number",
  14282. description = "The maximum number of clipping planes declared by a shader."
  14283. },
  14284. {
  14285. name = "cullDistances",
  14286. type = "number",
  14287. description = "The maximum number of cull distances declared by a shader."
  14288. },
  14289. {
  14290. name = "clipAndCullDistances",
  14291. type = "number",
  14292. description = "The maximum number of clipping planes and cull distances declared by a shader."
  14293. },
  14294. {
  14295. name = "workgroupCount",
  14296. type = "table",
  14297. description = "The maximum values of `x`, `y`, and `z` in `Pass:compute`."
  14298. },
  14299. {
  14300. name = "workgroupSize",
  14301. type = "table",
  14302. description = "The maximum values of `local_size_x`, `local_size_y`, and `local_size_z` declared in a compute shader."
  14303. },
  14304. {
  14305. name = "totalWorkgroupSize",
  14306. type = "number",
  14307. description = "The maximum product of `local_size_x`, `local_size_y`, and `local_size_z` in a compute shader."
  14308. },
  14309. {
  14310. name = "computeSharedMemory",
  14311. type = "number",
  14312. description = "The maximum number of bytes used by `shared` variables in compute shaders."
  14313. },
  14314. {
  14315. name = "shaderConstantSize",
  14316. type = "number",
  14317. description = "The maximum number of bytes of push constants that can be in a Shader. Push constants are shared between stages, so the stage with the largest amount of push constant data will count towards this limit."
  14318. },
  14319. {
  14320. name = "indirectDrawCount",
  14321. type = "number",
  14322. description = "The maximum number of draws that can be issued by an indirect draw call."
  14323. },
  14324. {
  14325. name = "instances",
  14326. type = "number",
  14327. description = "The maximum number of instances that can be rendered in a draw call."
  14328. },
  14329. {
  14330. name = "anisotropy",
  14331. type = "number",
  14332. description = "The maximum value of the `anisotropy` parameter in `lovr.graphics.newSampler`."
  14333. },
  14334. {
  14335. name = "pointSize",
  14336. type = "number",
  14337. description = "The maximum point size."
  14338. }
  14339. }
  14340. }
  14341. }
  14342. }
  14343. }
  14344. },
  14345. {
  14346. name = "getPass",
  14347. tag = "graphics-objects",
  14348. summary = "Get a temporary Pass.",
  14349. description = "TODO",
  14350. key = "lovr.graphics.getPass",
  14351. module = "lovr.graphics",
  14352. related = {
  14353. "lovr.graphics.submit",
  14354. "lovr.graphics.getWindowPass",
  14355. "lovr.headset.getPass"
  14356. },
  14357. variants = {
  14358. {
  14359. arguments = {
  14360. {
  14361. name = "type",
  14362. type = "PassType",
  14363. description = "TODO"
  14364. }
  14365. },
  14366. returns = {
  14367. {
  14368. name = "pass",
  14369. type = "Pass",
  14370. description = "The new Pass."
  14371. }
  14372. }
  14373. },
  14374. {
  14375. arguments = {
  14376. {
  14377. name = "type",
  14378. type = "PassType",
  14379. description = "TODO"
  14380. },
  14381. {
  14382. name = "texture",
  14383. type = "Texture",
  14384. description = "TODO"
  14385. }
  14386. },
  14387. returns = {
  14388. {
  14389. name = "pass",
  14390. type = "Pass",
  14391. description = "The new Pass."
  14392. }
  14393. }
  14394. },
  14395. {
  14396. arguments = {
  14397. {
  14398. name = "type",
  14399. type = "PassType",
  14400. description = "TODO"
  14401. },
  14402. {
  14403. name = "canvas",
  14404. type = "table",
  14405. description = "TODO",
  14406. table = {
  14407. {
  14408. name = "depth",
  14409. type = "*",
  14410. description = "TODO"
  14411. },
  14412. {
  14413. name = "clear",
  14414. type = "*",
  14415. description = "TODO"
  14416. },
  14417. {
  14418. name = "samples",
  14419. type = "number",
  14420. description = "TODO"
  14421. },
  14422. {
  14423. name = "mipmap",
  14424. type = "boolean",
  14425. description = "TODO",
  14426. default = "'false'"
  14427. }
  14428. }
  14429. }
  14430. },
  14431. returns = {
  14432. {
  14433. name = "pass",
  14434. type = "Pass",
  14435. description = "The new Pass."
  14436. }
  14437. }
  14438. }
  14439. }
  14440. },
  14441. {
  14442. name = "getStats",
  14443. tag = "graphics-misc",
  14444. summary = "Get graphics-related statistics.",
  14445. description = "TODO",
  14446. key = "lovr.graphics.getStats",
  14447. module = "lovr.graphics",
  14448. related = {
  14449. "lovr.graphics.getDevice",
  14450. "lovr.graphics.getFeatures",
  14451. "lovr.graphics.getLimits"
  14452. },
  14453. variants = {
  14454. {
  14455. arguments = {},
  14456. returns = {
  14457. {
  14458. name = "stats",
  14459. type = "table",
  14460. description = "Graphics statistics.",
  14461. table = {
  14462. {
  14463. name = "memory",
  14464. type = "table",
  14465. description = "TODO",
  14466. table = {
  14467. {
  14468. name = "total",
  14469. type = "number",
  14470. description = "TODO"
  14471. },
  14472. {
  14473. name = "buffer",
  14474. type = "number",
  14475. description = "TODO"
  14476. },
  14477. {
  14478. name = "texture",
  14479. type = "number",
  14480. description = "TODO"
  14481. }
  14482. }
  14483. },
  14484. {
  14485. name = "objects",
  14486. type = "table",
  14487. description = "TODO",
  14488. table = {
  14489. {
  14490. name = "buffers",
  14491. type = "number",
  14492. description = "TODO"
  14493. },
  14494. {
  14495. name = "textures",
  14496. type = "number",
  14497. description = "TODO"
  14498. },
  14499. {
  14500. name = "samplers",
  14501. type = "number",
  14502. description = "TODO"
  14503. },
  14504. {
  14505. name = "shaders",
  14506. type = "number",
  14507. description = "TODO"
  14508. }
  14509. }
  14510. },
  14511. {
  14512. name = "frame",
  14513. type = "table",
  14514. description = "TODO",
  14515. table = {
  14516. {
  14517. name = "scratchMemory",
  14518. type = "number",
  14519. description = "TODO"
  14520. },
  14521. {
  14522. name = "renderPasses",
  14523. type = "number",
  14524. description = "TODO"
  14525. },
  14526. {
  14527. name = "computePasses",
  14528. type = "number",
  14529. description = "TODO"
  14530. },
  14531. {
  14532. name = "transferPasses",
  14533. type = "number",
  14534. description = "TODO"
  14535. },
  14536. {
  14537. name = "pipelineBinds",
  14538. type = "number",
  14539. description = "TODO"
  14540. },
  14541. {
  14542. name = "bundleBinds",
  14543. type = "number",
  14544. description = "TODO"
  14545. },
  14546. {
  14547. name = "drawCalls",
  14548. type = "number",
  14549. description = "TODO"
  14550. },
  14551. {
  14552. name = "dispatches",
  14553. type = "number",
  14554. description = "TODO"
  14555. },
  14556. {
  14557. name = "workgroups",
  14558. type = "number",
  14559. description = "TODO"
  14560. },
  14561. {
  14562. name = "copies",
  14563. type = "number",
  14564. description = "TODO"
  14565. }
  14566. }
  14567. },
  14568. {
  14569. name = "internal",
  14570. type = "table",
  14571. description = "TODO",
  14572. table = {
  14573. {
  14574. name = "blocks",
  14575. type = "number",
  14576. description = "TODO"
  14577. },
  14578. {
  14579. name = "canvases",
  14580. type = "number",
  14581. description = "TODO"
  14582. },
  14583. {
  14584. name = "pipelines",
  14585. type = "number",
  14586. description = "TODO"
  14587. },
  14588. {
  14589. name = "layouts",
  14590. type = "number",
  14591. description = "TODO"
  14592. },
  14593. {
  14594. name = "bunches",
  14595. type = "number",
  14596. description = "TODO"
  14597. }
  14598. }
  14599. }
  14600. }
  14601. }
  14602. }
  14603. }
  14604. }
  14605. },
  14606. {
  14607. name = "getWindowPass",
  14608. tag = "graphics-objects",
  14609. summary = "Get the window pass.",
  14610. description = "Returns the window pass. This is a builtin render `Pass` object that renders to the desktop window texture. If the desktop window was not open when the graphics module was initialized, this function will return `nil`.",
  14611. key = "lovr.graphics.getWindowPass",
  14612. module = "lovr.graphics",
  14613. notes = "- TODO is the same pass always returned\n- TODO does the texture change\n- TODO what settings does the Pass use (incl conf.lua)\n- TODO is it reset",
  14614. variants = {
  14615. {
  14616. arguments = {},
  14617. returns = {
  14618. {
  14619. name = "pass",
  14620. type = "Pass",
  14621. description = "The window pass, or `nil` if there is no window."
  14622. }
  14623. }
  14624. }
  14625. }
  14626. },
  14627. {
  14628. name = "isFormatSupported",
  14629. tag = "graphics-misc",
  14630. summary = "Check if a Texture format is supported.",
  14631. description = "TODO",
  14632. key = "lovr.graphics.isFormatSupported",
  14633. module = "lovr.graphics",
  14634. related = {
  14635. "lovr.graphics.getDevice",
  14636. "lovr.graphics.getFeatures",
  14637. "lovr.graphics.getLimits"
  14638. },
  14639. variants = {
  14640. {
  14641. arguments = {
  14642. {
  14643. name = "format",
  14644. type = "TextureFormat",
  14645. description = "TODO"
  14646. }
  14647. },
  14648. returns = {
  14649. {
  14650. name = "supported",
  14651. type = "boolean",
  14652. description = "TODO"
  14653. }
  14654. }
  14655. }
  14656. }
  14657. },
  14658. {
  14659. name = "newBuffer",
  14660. tag = "graphics-objects",
  14661. summary = "Create a new Buffer.",
  14662. description = "Creates a Buffer.",
  14663. key = "lovr.graphics.newBuffer",
  14664. module = "lovr.graphics",
  14665. notes = "The format table can contain a list of `FieldType`s or a list of tables to provide extra information about each field. Each inner table has the following keys:\n\n- `type` is the `FieldType` of the field and is required.\n- `offset` is the byte offset of the field. Any fields with a `nil` offset will be placed next\n to each other sequentially in memory, subject to any padding required by the Buffer's layout.\n In practice this means that you probably want to provide an `offset` for either all of the\n fields or none of them.\n- `location` is the vertex attribute location of each field. This is used to match up each\n field with an attribute declared in a shader, and doesn't have any purpose when binding the\n buffer as a uniform or storage buffer. Any fields with a `nil` location will use an\n autoincrementing location starting at zero. Named locations are not currently supported, but\n may be added in the future.\n\nIf no table or Blob is used to define the initial Buffer contents, its data will be undefined.\n\nThere is currently a max of 16 fields.",
  14666. related = {
  14667. "lovr.graphics.getBuffer"
  14668. },
  14669. variants = {
  14670. {
  14671. arguments = {
  14672. {
  14673. name = "length",
  14674. type = "number",
  14675. description = "The length of the Buffer."
  14676. },
  14677. {
  14678. name = "type",
  14679. type = "FieldType",
  14680. description = "The type of each item in the Buffer."
  14681. }
  14682. },
  14683. returns = {
  14684. {
  14685. name = "buffer",
  14686. type = "Buffer",
  14687. description = "The new Buffer."
  14688. }
  14689. }
  14690. },
  14691. {
  14692. arguments = {
  14693. {
  14694. name = "data",
  14695. type = "table",
  14696. description = "The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data."
  14697. },
  14698. {
  14699. name = "type",
  14700. type = "FieldType",
  14701. description = "The type of each item in the Buffer."
  14702. }
  14703. },
  14704. returns = {
  14705. {
  14706. name = "buffer",
  14707. type = "Buffer",
  14708. description = "The new Buffer."
  14709. }
  14710. }
  14711. },
  14712. {
  14713. arguments = {
  14714. {
  14715. name = "length",
  14716. type = "number",
  14717. description = "The length of the Buffer."
  14718. },
  14719. {
  14720. name = "format",
  14721. type = "table",
  14722. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  14723. default = "nil",
  14724. table = {
  14725. {
  14726. name = "layout",
  14727. type = "BufferLayout",
  14728. description = "How to lay out the Buffer fields in memory.",
  14729. default = "packed"
  14730. },
  14731. {
  14732. name = "stride",
  14733. type = "number",
  14734. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  14735. }
  14736. }
  14737. }
  14738. },
  14739. returns = {
  14740. {
  14741. name = "buffer",
  14742. type = "Buffer",
  14743. description = "The new Buffer."
  14744. }
  14745. }
  14746. },
  14747. {
  14748. arguments = {
  14749. {
  14750. name = "data",
  14751. type = "table",
  14752. description = "The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data."
  14753. },
  14754. {
  14755. name = "format",
  14756. type = "table",
  14757. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  14758. default = "nil",
  14759. table = {
  14760. {
  14761. name = "layout",
  14762. type = "BufferLayout",
  14763. description = "How to lay out the Buffer fields in memory.",
  14764. default = "packed"
  14765. },
  14766. {
  14767. name = "stride",
  14768. type = "number",
  14769. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  14770. }
  14771. }
  14772. }
  14773. },
  14774. returns = {
  14775. {
  14776. name = "buffer",
  14777. type = "Buffer",
  14778. description = "The new Buffer."
  14779. }
  14780. }
  14781. },
  14782. {
  14783. arguments = {
  14784. {
  14785. name = "blob",
  14786. type = "Blob",
  14787. description = "A Blob with the initial contents of the Buffer. The size of the Blob will be used to determine the length of the Buffer."
  14788. },
  14789. {
  14790. name = "type",
  14791. type = "FieldType",
  14792. description = "The type of each item in the Buffer."
  14793. }
  14794. },
  14795. returns = {
  14796. {
  14797. name = "buffer",
  14798. type = "Buffer",
  14799. description = "The new Buffer."
  14800. }
  14801. }
  14802. },
  14803. {
  14804. arguments = {
  14805. {
  14806. name = "blob",
  14807. type = "Blob",
  14808. description = "A Blob with the initial contents of the Buffer. The size of the Blob will be used to determine the length of the Buffer."
  14809. },
  14810. {
  14811. name = "format",
  14812. type = "table",
  14813. description = "A list of fields in the Buffer (see notes). `nil` is a valid format, but means only `Blob`s can be written to the Buffer from Lua.",
  14814. default = "nil",
  14815. table = {
  14816. {
  14817. name = "layout",
  14818. type = "BufferLayout",
  14819. description = "How to lay out the Buffer fields in memory.",
  14820. default = "packed"
  14821. },
  14822. {
  14823. name = "stride",
  14824. type = "number",
  14825. description = "The stride of the Buffer, in bytes. When `nil`, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride."
  14826. }
  14827. }
  14828. }
  14829. },
  14830. returns = {
  14831. {
  14832. name = "buffer",
  14833. type = "Buffer",
  14834. description = "The new Buffer."
  14835. }
  14836. }
  14837. }
  14838. }
  14839. },
  14840. {
  14841. name = "newFont",
  14842. tag = "graphics-objects",
  14843. summary = "Create a new Font.",
  14844. description = "TODO",
  14845. key = "lovr.graphics.newFont",
  14846. module = "lovr.graphics",
  14847. related = {
  14848. "lovr.graphics.getDefaultFont",
  14849. "lovr.data.newRasterizer",
  14850. "Pass:text"
  14851. },
  14852. variants = {
  14853. {
  14854. arguments = {
  14855. {
  14856. name = "filename",
  14857. type = "string",
  14858. description = "TODO"
  14859. },
  14860. {
  14861. name = "size",
  14862. type = "number",
  14863. description = "TODO",
  14864. default = "32"
  14865. },
  14866. {
  14867. name = "spread",
  14868. type = "number",
  14869. description = "TODO",
  14870. default = "4"
  14871. }
  14872. },
  14873. returns = {
  14874. {
  14875. name = "font",
  14876. type = "Font",
  14877. description = "The new Font."
  14878. }
  14879. }
  14880. },
  14881. {
  14882. arguments = {
  14883. {
  14884. name = "blob",
  14885. type = "Blob",
  14886. description = "TODO"
  14887. },
  14888. {
  14889. name = "size",
  14890. type = "number",
  14891. description = "TODO",
  14892. default = "32"
  14893. },
  14894. {
  14895. name = "spread",
  14896. type = "number",
  14897. description = "TODO",
  14898. default = "4"
  14899. }
  14900. },
  14901. returns = {
  14902. {
  14903. name = "font",
  14904. type = "Font",
  14905. description = "The new Font."
  14906. }
  14907. }
  14908. },
  14909. {
  14910. arguments = {
  14911. {
  14912. name = "size",
  14913. type = "number",
  14914. description = "TODO",
  14915. default = "32"
  14916. },
  14917. {
  14918. name = "spread",
  14919. type = "number",
  14920. description = "TODO",
  14921. default = "4"
  14922. }
  14923. },
  14924. returns = {
  14925. {
  14926. name = "font",
  14927. type = "Font",
  14928. description = "The new Font."
  14929. }
  14930. }
  14931. },
  14932. {
  14933. arguments = {
  14934. {
  14935. name = "rasterizer",
  14936. type = "Rasterizer",
  14937. description = "TODO"
  14938. },
  14939. {
  14940. name = "spread",
  14941. type = "number",
  14942. description = "TODO",
  14943. default = "4"
  14944. }
  14945. },
  14946. returns = {
  14947. {
  14948. name = "font",
  14949. type = "Font",
  14950. description = "The new Font."
  14951. }
  14952. }
  14953. }
  14954. }
  14955. },
  14956. {
  14957. name = "newMaterial",
  14958. tag = "graphics-objects",
  14959. summary = "Create a new Material.",
  14960. description = "TODO",
  14961. key = "lovr.graphics.newMaterial",
  14962. module = "lovr.graphics",
  14963. variants = {
  14964. {
  14965. arguments = {
  14966. {
  14967. name = "texture",
  14968. type = "Texture",
  14969. description = "TODO"
  14970. }
  14971. },
  14972. returns = {
  14973. {
  14974. name = "material",
  14975. type = "Material",
  14976. description = "TODO"
  14977. }
  14978. }
  14979. },
  14980. {
  14981. arguments = {
  14982. {
  14983. name = "options",
  14984. type = "table",
  14985. description = "Material properties.",
  14986. table = {
  14987. {
  14988. name = "color",
  14989. type = "Color",
  14990. description = "TODO"
  14991. },
  14992. {
  14993. name = "glow",
  14994. type = "Color",
  14995. description = "TODO"
  14996. },
  14997. {
  14998. name = "uvShift",
  14999. type = "Point2D",
  15000. description = "TODO"
  15001. },
  15002. {
  15003. name = "uvScale",
  15004. type = "Scale2D",
  15005. description = "TODO"
  15006. },
  15007. {
  15008. name = "metalness",
  15009. type = "number",
  15010. description = "TODO"
  15011. },
  15012. {
  15013. name = "roughness",
  15014. type = "number",
  15015. description = "TODO"
  15016. },
  15017. {
  15018. name = "clearcoat",
  15019. type = "number",
  15020. description = "TODO"
  15021. },
  15022. {
  15023. name = "clearcoatRoughness",
  15024. type = "number",
  15025. description = "TODO"
  15026. },
  15027. {
  15028. name = "occlusionStrength",
  15029. type = "number",
  15030. description = "TODO"
  15031. },
  15032. {
  15033. name = "glowStrength",
  15034. type = "number",
  15035. description = "TODO"
  15036. },
  15037. {
  15038. name = "normalScale",
  15039. type = "number",
  15040. description = "TODO"
  15041. },
  15042. {
  15043. name = "alphaCutoff",
  15044. type = "number",
  15045. description = "TODO"
  15046. },
  15047. {
  15048. name = "texture",
  15049. type = "Texture",
  15050. description = "TODO"
  15051. },
  15052. {
  15053. name = "glowTexture",
  15054. type = "Texture",
  15055. description = "TODO"
  15056. },
  15057. {
  15058. name = "occlusionTexture",
  15059. type = "Texture",
  15060. description = "TODO"
  15061. },
  15062. {
  15063. name = "metalnessTexture",
  15064. type = "Texture",
  15065. description = "TODO"
  15066. },
  15067. {
  15068. name = "roughnessTexture",
  15069. type = "Texture",
  15070. description = "TODO"
  15071. },
  15072. {
  15073. name = "clearcoatTexture",
  15074. type = "Texture",
  15075. description = "TODO"
  15076. },
  15077. {
  15078. name = "normalTexture",
  15079. type = "Texture",
  15080. description = "TODO"
  15081. }
  15082. }
  15083. }
  15084. },
  15085. returns = {
  15086. {
  15087. name = "material",
  15088. type = "Material",
  15089. description = "TODO"
  15090. }
  15091. }
  15092. }
  15093. }
  15094. },
  15095. {
  15096. name = "newModel",
  15097. tag = "graphics-objects",
  15098. summary = "Create a new Model.",
  15099. description = "TODO",
  15100. key = "lovr.graphics.newModel",
  15101. module = "lovr.graphics",
  15102. related = {
  15103. "lovr.data.newModelData",
  15104. "Pass:draw"
  15105. },
  15106. variants = {
  15107. {
  15108. arguments = {
  15109. {
  15110. name = "filename",
  15111. type = "string",
  15112. description = "TODO"
  15113. },
  15114. {
  15115. name = "options",
  15116. type = "table",
  15117. description = "Model options.",
  15118. table = {
  15119. {
  15120. name = "mipmaps",
  15121. type = "boolean",
  15122. description = "TODO"
  15123. }
  15124. }
  15125. }
  15126. },
  15127. returns = {
  15128. {
  15129. name = "model",
  15130. type = "Model",
  15131. description = "The new Model."
  15132. }
  15133. }
  15134. },
  15135. {
  15136. arguments = {
  15137. {
  15138. name = "blob",
  15139. type = "Blob",
  15140. description = "TODO"
  15141. },
  15142. {
  15143. name = "options",
  15144. type = "table",
  15145. description = "Model options.",
  15146. table = {
  15147. {
  15148. name = "mipmaps",
  15149. type = "boolean",
  15150. description = "TODO"
  15151. }
  15152. }
  15153. }
  15154. },
  15155. returns = {
  15156. {
  15157. name = "model",
  15158. type = "Model",
  15159. description = "The new Model."
  15160. }
  15161. }
  15162. },
  15163. {
  15164. arguments = {
  15165. {
  15166. name = "modelData",
  15167. type = "ModelData",
  15168. description = "TODO"
  15169. }
  15170. },
  15171. returns = {
  15172. {
  15173. name = "model",
  15174. type = "Model",
  15175. description = "The new Model."
  15176. }
  15177. }
  15178. }
  15179. }
  15180. },
  15181. {
  15182. name = "newSampler",
  15183. tag = "graphics-objects",
  15184. summary = "Create a new Sampler.",
  15185. description = "TODO",
  15186. key = "lovr.graphics.newSampler",
  15187. module = "lovr.graphics",
  15188. related = {
  15189. "Pass:setSampler"
  15190. },
  15191. variants = {
  15192. {
  15193. arguments = {
  15194. {
  15195. name = "options",
  15196. type = "table",
  15197. description = "TODO",
  15198. table = {
  15199. {
  15200. name = "filter",
  15201. type = "table",
  15202. description = "TODO"
  15203. },
  15204. {
  15205. name = "wrap",
  15206. type = "table",
  15207. description = "TODO"
  15208. },
  15209. {
  15210. name = "compare",
  15211. type = "CompareMode",
  15212. description = "TODO"
  15213. },
  15214. {
  15215. name = "anisotropy",
  15216. type = "number",
  15217. description = "TODO"
  15218. },
  15219. {
  15220. name = "mipmaprange",
  15221. type = "table",
  15222. description = "TODO"
  15223. }
  15224. }
  15225. }
  15226. },
  15227. returns = {
  15228. {
  15229. name = "sampler",
  15230. type = "Sampler",
  15231. description = "TODO"
  15232. }
  15233. }
  15234. }
  15235. }
  15236. },
  15237. {
  15238. name = "newShader",
  15239. tag = "graphics-objects",
  15240. summary = "Create a Shader.",
  15241. description = "TODO",
  15242. key = "lovr.graphics.newShader",
  15243. module = "lovr.graphics",
  15244. related = {
  15245. "lovr.graphics.compileShader"
  15246. },
  15247. variants = {
  15248. {
  15249. description = "Create a graphics shader.",
  15250. arguments = {
  15251. {
  15252. name = "vertex",
  15253. type = "ShaderSource",
  15254. description = "TODO"
  15255. },
  15256. {
  15257. name = "fragment",
  15258. type = "ShaderSource",
  15259. description = "TODO"
  15260. },
  15261. {
  15262. name = "options",
  15263. type = "table",
  15264. description = "Shader options.",
  15265. table = {
  15266. {
  15267. name = "flags",
  15268. type = "table",
  15269. description = "TODO"
  15270. },
  15271. {
  15272. name = "label",
  15273. type = "string",
  15274. description = "TODO"
  15275. }
  15276. }
  15277. }
  15278. },
  15279. returns = {
  15280. {
  15281. name = "shader",
  15282. type = "Shader",
  15283. description = "TODO"
  15284. }
  15285. }
  15286. },
  15287. {
  15288. description = "Create a compute shader.",
  15289. arguments = {
  15290. {
  15291. name = "compute",
  15292. type = "ShaderSource",
  15293. description = "TODO"
  15294. },
  15295. {
  15296. name = "options",
  15297. type = "table",
  15298. description = "Shader options.",
  15299. table = {
  15300. {
  15301. name = "flags",
  15302. type = "table",
  15303. description = "TODO"
  15304. },
  15305. {
  15306. name = "label",
  15307. type = "string",
  15308. description = "TODO"
  15309. }
  15310. }
  15311. }
  15312. },
  15313. returns = {
  15314. {
  15315. name = "shader",
  15316. type = "Shader",
  15317. description = "TODO"
  15318. }
  15319. }
  15320. }
  15321. }
  15322. },
  15323. {
  15324. name = "newTally",
  15325. tag = "graphics-objects",
  15326. summary = "Create a new Tally.",
  15327. description = "TODO",
  15328. key = "lovr.graphics.newTally",
  15329. module = "lovr.graphics",
  15330. related = {
  15331. "Pass:tick",
  15332. "Pass:tock"
  15333. },
  15334. variants = {
  15335. {
  15336. arguments = {
  15337. {
  15338. name = "type",
  15339. type = "TallyType",
  15340. description = "The type of the Tally, which controls what \"thing\" it measures."
  15341. },
  15342. {
  15343. name = "count",
  15344. type = "number",
  15345. description = "The number of slots in the Tally. Each slot performs one measurement."
  15346. },
  15347. {
  15348. name = "views",
  15349. type = "number",
  15350. description = "Tally objects with the `time` type can only be used in render passes with a certain number of views. This is ignored for other types of tallies.",
  15351. default = "2"
  15352. }
  15353. },
  15354. returns = {
  15355. {
  15356. name = "tally",
  15357. type = "Tally",
  15358. description = "The new Tally."
  15359. }
  15360. }
  15361. }
  15362. }
  15363. },
  15364. {
  15365. name = "newTexture",
  15366. tag = "graphics-objects",
  15367. summary = "Create a new Texture.",
  15368. description = "TODO",
  15369. key = "lovr.graphics.newTexture",
  15370. module = "lovr.graphics",
  15371. related = {
  15372. "Texture:newView"
  15373. },
  15374. variants = {
  15375. {
  15376. arguments = {
  15377. {
  15378. name = "filename",
  15379. type = "string",
  15380. description = "TODO"
  15381. },
  15382. {
  15383. name = "options",
  15384. type = "table",
  15385. description = "Texture options.",
  15386. table = {
  15387. {
  15388. name = "type",
  15389. type = "TextureType",
  15390. description = "TODO"
  15391. },
  15392. {
  15393. name = "format",
  15394. type = "TextureFormat",
  15395. description = "TODO"
  15396. },
  15397. {
  15398. name = "linear",
  15399. type = "boolean",
  15400. description = "TODO"
  15401. },
  15402. {
  15403. name = "samples",
  15404. type = "number",
  15405. description = "TODO"
  15406. },
  15407. {
  15408. name = "mipmaps",
  15409. type = "number",
  15410. description = "TODO"
  15411. },
  15412. {
  15413. name = "usage",
  15414. type = "table",
  15415. description = "TODO"
  15416. },
  15417. {
  15418. name = "label",
  15419. type = "string",
  15420. description = "TODO"
  15421. }
  15422. }
  15423. }
  15424. },
  15425. returns = {
  15426. {
  15427. name = "texture",
  15428. type = "Texture",
  15429. description = "TODO"
  15430. }
  15431. }
  15432. },
  15433. {
  15434. arguments = {
  15435. {
  15436. name = "width",
  15437. type = "number",
  15438. description = "TODO"
  15439. },
  15440. {
  15441. name = "height",
  15442. type = "number",
  15443. description = "TODO"
  15444. },
  15445. {
  15446. name = "options",
  15447. type = "table",
  15448. description = "Texture options.",
  15449. table = {
  15450. {
  15451. name = "type",
  15452. type = "TextureType",
  15453. description = "TODO"
  15454. },
  15455. {
  15456. name = "format",
  15457. type = "TextureFormat",
  15458. description = "TODO"
  15459. },
  15460. {
  15461. name = "linear",
  15462. type = "boolean",
  15463. description = "TODO"
  15464. },
  15465. {
  15466. name = "samples",
  15467. type = "number",
  15468. description = "TODO"
  15469. },
  15470. {
  15471. name = "mipmaps",
  15472. type = "number",
  15473. description = "TODO"
  15474. },
  15475. {
  15476. name = "usage",
  15477. type = "table",
  15478. description = "TODO"
  15479. },
  15480. {
  15481. name = "label",
  15482. type = "string",
  15483. description = "TODO"
  15484. }
  15485. }
  15486. }
  15487. },
  15488. returns = {
  15489. {
  15490. name = "texture",
  15491. type = "Texture",
  15492. description = "TODO"
  15493. }
  15494. }
  15495. },
  15496. {
  15497. arguments = {
  15498. {
  15499. name = "width",
  15500. type = "number",
  15501. description = "TODO"
  15502. },
  15503. {
  15504. name = "height",
  15505. type = "number",
  15506. description = "TODO"
  15507. },
  15508. {
  15509. name = "depth",
  15510. type = "number",
  15511. description = "TODO"
  15512. },
  15513. {
  15514. name = "options",
  15515. type = "table",
  15516. description = "Texture options.",
  15517. table = {
  15518. {
  15519. name = "type",
  15520. type = "TextureType",
  15521. description = "TODO"
  15522. },
  15523. {
  15524. name = "format",
  15525. type = "TextureFormat",
  15526. description = "TODO"
  15527. },
  15528. {
  15529. name = "linear",
  15530. type = "boolean",
  15531. description = "TODO"
  15532. },
  15533. {
  15534. name = "samples",
  15535. type = "number",
  15536. description = "TODO"
  15537. },
  15538. {
  15539. name = "mipmaps",
  15540. type = "number",
  15541. description = "TODO"
  15542. },
  15543. {
  15544. name = "usage",
  15545. type = "table",
  15546. description = "TODO"
  15547. },
  15548. {
  15549. name = "label",
  15550. type = "string",
  15551. description = "TODO"
  15552. }
  15553. }
  15554. }
  15555. },
  15556. returns = {
  15557. {
  15558. name = "texture",
  15559. type = "Texture",
  15560. description = "TODO"
  15561. }
  15562. }
  15563. },
  15564. {
  15565. arguments = {
  15566. {
  15567. name = "image",
  15568. type = "string",
  15569. description = "TODO"
  15570. },
  15571. {
  15572. name = "options",
  15573. type = "table",
  15574. description = "Texture options.",
  15575. table = {
  15576. {
  15577. name = "type",
  15578. type = "TextureType",
  15579. description = "TODO"
  15580. },
  15581. {
  15582. name = "format",
  15583. type = "TextureFormat",
  15584. description = "TODO"
  15585. },
  15586. {
  15587. name = "linear",
  15588. type = "boolean",
  15589. description = "TODO"
  15590. },
  15591. {
  15592. name = "samples",
  15593. type = "number",
  15594. description = "TODO"
  15595. },
  15596. {
  15597. name = "mipmaps",
  15598. type = "number",
  15599. description = "TODO"
  15600. },
  15601. {
  15602. name = "usage",
  15603. type = "table",
  15604. description = "TODO"
  15605. },
  15606. {
  15607. name = "label",
  15608. type = "string",
  15609. description = "TODO"
  15610. }
  15611. }
  15612. }
  15613. },
  15614. returns = {
  15615. {
  15616. name = "texture",
  15617. type = "Texture",
  15618. description = "TODO"
  15619. }
  15620. }
  15621. },
  15622. {
  15623. arguments = {
  15624. {
  15625. name = "images",
  15626. type = "table",
  15627. description = "TODO"
  15628. },
  15629. {
  15630. name = "options",
  15631. type = "table",
  15632. description = "Texture options.",
  15633. table = {
  15634. {
  15635. name = "type",
  15636. type = "TextureType",
  15637. description = "TODO"
  15638. },
  15639. {
  15640. name = "format",
  15641. type = "TextureFormat",
  15642. description = "TODO"
  15643. },
  15644. {
  15645. name = "linear",
  15646. type = "boolean",
  15647. description = "TODO"
  15648. },
  15649. {
  15650. name = "samples",
  15651. type = "number",
  15652. description = "TODO"
  15653. },
  15654. {
  15655. name = "mipmaps",
  15656. type = "number",
  15657. description = "TODO"
  15658. },
  15659. {
  15660. name = "usage",
  15661. type = "table",
  15662. description = "TODO"
  15663. },
  15664. {
  15665. name = "label",
  15666. type = "string",
  15667. description = "TODO"
  15668. }
  15669. }
  15670. }
  15671. },
  15672. returns = {
  15673. {
  15674. name = "texture",
  15675. type = "Texture",
  15676. description = "TODO"
  15677. }
  15678. }
  15679. }
  15680. }
  15681. },
  15682. {
  15683. name = "present",
  15684. tag = "work-submission",
  15685. summary = "Update the desktop window contents.",
  15686. description = "Presents the window texture to the desktop window. This function is called automatically by the default implementation of `lovr.run`, so it normally does not need to be called.",
  15687. key = "lovr.graphics.present",
  15688. module = "lovr.graphics",
  15689. notes = "This should be called after submitting the window pass (`lovr.graphics.getWindowPass`). If the window texture has not been rendered to since the last present, this function does nothing.",
  15690. related = {
  15691. "lovr.graphics.submit",
  15692. "lovr.graphics.getWindowPass"
  15693. },
  15694. variants = {
  15695. {
  15696. arguments = {},
  15697. returns = {}
  15698. }
  15699. }
  15700. },
  15701. {
  15702. name = "setBackgroundColor",
  15703. tag = "graphics-global",
  15704. summary = "Set the background color.",
  15705. description = "TODO",
  15706. key = "lovr.graphics.setBackgroundColor",
  15707. module = "lovr.graphics",
  15708. notes = "TODO",
  15709. variants = {
  15710. {
  15711. description = "TODO",
  15712. arguments = {
  15713. {
  15714. name = "r",
  15715. type = "number",
  15716. description = "The red component of the background color."
  15717. },
  15718. {
  15719. name = "g",
  15720. type = "number",
  15721. description = "The green component of the background color."
  15722. },
  15723. {
  15724. name = "b",
  15725. type = "number",
  15726. description = "The blue component of the background color."
  15727. },
  15728. {
  15729. name = "a",
  15730. type = "number",
  15731. description = "The alpha component of the background color.",
  15732. default = "1.0"
  15733. }
  15734. },
  15735. returns = {}
  15736. },
  15737. {
  15738. description = "TODO",
  15739. arguments = {
  15740. {
  15741. name = "hex",
  15742. type = "number",
  15743. description = "A hexcode (like `0xffffff`) to use for the background color (does not support alpha)."
  15744. },
  15745. {
  15746. name = "a",
  15747. type = "number",
  15748. description = "The alpha component of the background color.",
  15749. default = "1.0"
  15750. }
  15751. },
  15752. returns = {}
  15753. },
  15754. {
  15755. description = "TODO",
  15756. arguments = {
  15757. {
  15758. name = "color",
  15759. type = "table",
  15760. description = "A table containing 3 or 4 color components."
  15761. }
  15762. },
  15763. returns = {}
  15764. }
  15765. }
  15766. },
  15767. {
  15768. name = "submit",
  15769. tag = "work-submission",
  15770. summary = "Submit recorded graphics work to the GPU.",
  15771. description = "TODO",
  15772. key = "lovr.graphics.submit",
  15773. module = "lovr.graphics",
  15774. related = {
  15775. "lovr.graphics.wait"
  15776. },
  15777. variants = {
  15778. {
  15779. arguments = {
  15780. {
  15781. name = "...",
  15782. type = "Pass",
  15783. description = "The pass objects to submit. Falsy values will be skipped."
  15784. }
  15785. },
  15786. returns = {
  15787. {
  15788. name = "true",
  15789. type = "boolean",
  15790. description = "Always returns true, for convenience when returning from `lovr.draw`."
  15791. }
  15792. }
  15793. },
  15794. {
  15795. arguments = {
  15796. {
  15797. name = "t",
  15798. type = "table",
  15799. description = "A table of passes to submit. Falsy values will be skipped."
  15800. }
  15801. },
  15802. returns = {
  15803. {
  15804. name = "true",
  15805. type = "boolean",
  15806. description = "Always returns true, for convenience when returning from `lovr.draw`."
  15807. }
  15808. }
  15809. }
  15810. }
  15811. },
  15812. {
  15813. name = "wait",
  15814. tag = "work-submission",
  15815. summary = "Stalls the CPU until all submitted GPU work is finished.",
  15816. description = "TODO",
  15817. key = "lovr.graphics.wait",
  15818. module = "lovr.graphics",
  15819. related = {
  15820. "lovr.graphics.submit"
  15821. },
  15822. variants = {
  15823. {
  15824. arguments = {},
  15825. returns = {}
  15826. }
  15827. }
  15828. }
  15829. },
  15830. enums = {
  15831. {
  15832. name = "BufferLayout",
  15833. description = "The different ways to pack Buffer fields into memory.\n\nThe default is `packed`, which is suitable for vertex buffers and index buffers. It doesn't add any padding between elements, and so it doesn't waste any space. However, this layout won't necessarily work for uniform buffers and storage buffers.\n\nThe `std140` layout corresponds to the std140 layout used for uniform buffers in GLSL. It adds the most padding between fields, and requires the stride to be a multiple of 16. Example:\n\n``` layout(std140) uniform ObjectScales { float scales[64]; }; ```\n\nThe `std430` layout corresponds to the std430 layout used for storage buffers in GLSL. It adds some padding between certain types, and may round up the stride. Example:\n\n``` layout(std430) buffer TileSizes { vec2 sizes[]; } ```",
  15834. key = "BufferLayout",
  15835. module = "lovr.graphics",
  15836. related = {
  15837. "lovr.graphics.newBuffer",
  15838. "lovr.graphics.getBuffer",
  15839. "Buffer:getFormat",
  15840. "Buffer:getStride",
  15841. "FieldType"
  15842. },
  15843. values = {
  15844. {
  15845. name = "packed",
  15846. description = "The packed layout, without any padding."
  15847. },
  15848. {
  15849. name = "std140",
  15850. description = "The std140 layout."
  15851. },
  15852. {
  15853. name = "std430",
  15854. description = "The std430 layout."
  15855. }
  15856. }
  15857. },
  15858. {
  15859. name = "FieldType",
  15860. description = "Different types for `Buffer` fields. These are scalar, vector, or matrix types, usually packed into small amounts of space to reduce the amount of memory they occupy.\n\nThe names are encoded as follows:\n\n- The data type:\n - `i` for signed integer\n - `u` for unsigned integer\n - `sn` for signed normalized (-1 to 1)\n - `un` for unsigned normalized (0 to 1)\n - `f` for floating point\n- The bit depth of each component\n- The letter `x` followed by the component count (for vectors)",
  15861. key = "FieldType",
  15862. module = "lovr.graphics",
  15863. related = {
  15864. "lovr.graphics.newBuffer",
  15865. "lovr.graphics.getBuffer",
  15866. "Buffer:getFormat"
  15867. },
  15868. notes = "In addition to these values, the following aliases can be used:\n\n<table>\n <thead>\n <tr>\n <td>Alias</td>\n <td>Maps to</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><code>vec2</code></td>\n <td><code>f32x2</code></td>\n </tr>\n <tr>\n <td><code>vec3</code></td>\n <td><code>f32x3</code></td>\n </tr>\n <tr>\n <td><code>vec4</code></td>\n <td><code>f32x4</code></td>\n </tr>\n <tr>\n <td><code>int</code></td>\n <td><code>i32</code></td>\n </tr>\n <tr>\n <td><code>uint</code></td>\n <td><code>u32</code></td>\n </tr>\n <tr>\n <td><code>float</code></td>\n <td><code>f32</code></td>\n </tr>\n <tr>\n <td><code>color</code></td>\n <td><code>un8x4</code></td>\n </tr>\n </tbody> </table>\n\nAdditionally, the following convenience rules apply:\n\n- Field types can end in an `s`, which will be stripped off.\n- Field types can end in `x1`, which will be stripped off.\n\nSo you can write, e.g. `lovr.graphics.newBuffer(4, 'floats')`, which is cute!",
  15869. values = {
  15870. {
  15871. name = "i8x4",
  15872. description = "Four 8-bit signed integers."
  15873. },
  15874. {
  15875. name = "u8x4",
  15876. description = "Four 8-bit unsigned integers."
  15877. },
  15878. {
  15879. name = "sn8x4",
  15880. description = "Four 8-bit signed normalized values."
  15881. },
  15882. {
  15883. name = "un8x4",
  15884. description = "Four 8-bit unsigned normalized values (aka `color`)."
  15885. },
  15886. {
  15887. name = "un10x3",
  15888. description = "Three 10-bit unsigned normalized values, and 2 padding bits (aka `normal`)."
  15889. },
  15890. {
  15891. name = "i16",
  15892. description = "One 16-bit signed integer."
  15893. },
  15894. {
  15895. name = "i16x2",
  15896. description = "Two 16-bit signed integers."
  15897. },
  15898. {
  15899. name = "i16x4",
  15900. description = "Four 16-bit signed integers."
  15901. },
  15902. {
  15903. name = "u16",
  15904. description = "One 16-bit unsigned integer."
  15905. },
  15906. {
  15907. name = "u16x2",
  15908. description = "Two 16-bit unsigned integers."
  15909. },
  15910. {
  15911. name = "u16x4",
  15912. description = "Four 16-bit unsigned integers."
  15913. },
  15914. {
  15915. name = "sn16x2",
  15916. description = "Two 16-bit signed normalized values."
  15917. },
  15918. {
  15919. name = "sn16x4",
  15920. description = "Four 16-bit signed normalized values."
  15921. },
  15922. {
  15923. name = "un16x2",
  15924. description = "Two 16-bit unsigned normalized values."
  15925. },
  15926. {
  15927. name = "un16x4",
  15928. description = "Four 16-bit unsigned normalized values."
  15929. },
  15930. {
  15931. name = "i32",
  15932. description = "One 32-bit signed integer (aka `int`)."
  15933. },
  15934. {
  15935. name = "i32x2",
  15936. description = "Two 32-bit signed integers."
  15937. },
  15938. {
  15939. name = "i32x2",
  15940. description = "Two 32-bit signed integers."
  15941. },
  15942. {
  15943. name = "i32x3",
  15944. description = "Three 32-bit signed integers."
  15945. },
  15946. {
  15947. name = "i32x4",
  15948. description = "Four 32-bit signed integers."
  15949. },
  15950. {
  15951. name = "u32",
  15952. description = "One 32-bit unsigned integer (aka `uint`)."
  15953. },
  15954. {
  15955. name = "u32x2",
  15956. description = "Two 32-bit unsigned integers."
  15957. },
  15958. {
  15959. name = "u32x3",
  15960. description = "Three 32-bit unsigned integers."
  15961. },
  15962. {
  15963. name = "u32x4",
  15964. description = "Four 32-bit unsigned integers."
  15965. },
  15966. {
  15967. name = "f16x2",
  15968. description = "Two 16-bit floating point numbers."
  15969. },
  15970. {
  15971. name = "f16x4",
  15972. description = "Four 16-bit floating point numbers."
  15973. },
  15974. {
  15975. name = "f32",
  15976. description = "One 32-bit floating point number (aka `float`)."
  15977. },
  15978. {
  15979. name = "f32x2",
  15980. description = "Two 32-bit floating point numbers (aka `vec2`)."
  15981. },
  15982. {
  15983. name = "f32x3",
  15984. description = "Three 32-bit floating point numbers (aka `vec3`)."
  15985. },
  15986. {
  15987. name = "f32x4",
  15988. description = "Four 32-bit floating point numbers (aka `vec4`)."
  15989. },
  15990. {
  15991. name = "mat2",
  15992. description = "A 2x2 matrix containing four 32-bit floats."
  15993. },
  15994. {
  15995. name = "mat3",
  15996. description = "A 3x3 matrix containing nine 32-bit floats."
  15997. },
  15998. {
  15999. name = "mat4",
  16000. description = "A 4x4 matrix containing sixteen 32-bit floats."
  16001. }
  16002. }
  16003. },
  16004. {
  16005. name = "MeshMode",
  16006. summary = "Different ways to draw mesh vertices.",
  16007. description = "TODO",
  16008. key = "MeshMode",
  16009. module = "lovr.graphics",
  16010. values = {
  16011. {
  16012. name = "points",
  16013. description = "TODO"
  16014. },
  16015. {
  16016. name = "lines",
  16017. description = "TODO"
  16018. },
  16019. {
  16020. name = "triangles",
  16021. description = "TODO"
  16022. }
  16023. }
  16024. },
  16025. {
  16026. name = "PassType",
  16027. summary = "Different types of Passes.",
  16028. description = "TODO",
  16029. key = "PassType",
  16030. module = "lovr.graphics",
  16031. values = {
  16032. {
  16033. name = "render",
  16034. description = "TODO"
  16035. },
  16036. {
  16037. name = "compute",
  16038. description = "TODO"
  16039. },
  16040. {
  16041. name = "transfer",
  16042. description = "TODO"
  16043. }
  16044. }
  16045. },
  16046. {
  16047. name = "ShaderStage",
  16048. description = "TODO",
  16049. key = "ShaderStage",
  16050. module = "lovr.graphics",
  16051. values = {
  16052. {
  16053. name = "vertex",
  16054. description = "TODO"
  16055. },
  16056. {
  16057. name = "fragment",
  16058. description = "TODO"
  16059. },
  16060. {
  16061. name = "compute",
  16062. description = "TODO"
  16063. }
  16064. }
  16065. },
  16066. {
  16067. name = "ShaderType",
  16068. summary = "Different types of Shaders.",
  16069. description = "TODO",
  16070. key = "ShaderType",
  16071. module = "lovr.graphics",
  16072. values = {
  16073. {
  16074. name = "graphics",
  16075. description = "TODO"
  16076. },
  16077. {
  16078. name = "compute",
  16079. description = "TODO"
  16080. }
  16081. }
  16082. },
  16083. {
  16084. name = "StackType",
  16085. summary = "Types of stacks that can be pushed and popped.",
  16086. description = "TODO",
  16087. key = "StackType",
  16088. module = "lovr.graphics",
  16089. values = {
  16090. {
  16091. name = "transform",
  16092. description = "TODO"
  16093. },
  16094. {
  16095. name = "state",
  16096. descriptioin = "TODO"
  16097. }
  16098. }
  16099. },
  16100. {
  16101. name = "TallyType",
  16102. summary = "Different values a Tally can measure.",
  16103. description = "TODO",
  16104. key = "TallyType",
  16105. module = "lovr.graphics",
  16106. values = {
  16107. {
  16108. name = "time",
  16109. description = "Each slot measures elapsed time in nanoseconds."
  16110. },
  16111. {
  16112. name = "pixel",
  16113. description = "Each slot measures the approximate number of pixels affected by rendering."
  16114. },
  16115. {
  16116. name = "shader",
  16117. description = "Each slot measures the number of times different shader stages are invoked."
  16118. }
  16119. }
  16120. },
  16121. {
  16122. name = "TextureFeature",
  16123. summary = "Different ways Textures can be used.",
  16124. description = "These are the different ways `Texture` objects can be used. These are passed in to `lovr.graphics.isFormatSupported` to see which texture operations are supported by the GPU for a given format.",
  16125. key = "TextureFeature",
  16126. module = "lovr.graphics",
  16127. values = {
  16128. {
  16129. name = "sample",
  16130. description = "The Texture can be sampled (e.g. a `texture2D` or `sampler2D` variable in shaders)."
  16131. },
  16132. {
  16133. name = "filter",
  16134. description = "The Texture can be used with a `Sampler` using a `FilterMode` of `linear`."
  16135. },
  16136. {
  16137. name = "render",
  16138. description = "The Texture can be rendered to by using it as a target in a render `Pass`."
  16139. },
  16140. {
  16141. name = "blend",
  16142. description = "Blending can be enabled when rendering to this format in a render pass."
  16143. },
  16144. {
  16145. name = "storage",
  16146. description = "The Texture can be sent to an image variable in shaders (e.g. `image2D`)."
  16147. },
  16148. {
  16149. name = "atomic",
  16150. description = "Atomic operations can be used on storage textures with this format."
  16151. },
  16152. {
  16153. name = "blitsrc",
  16154. description = "Source textures in `Pass:blit` can use this format."
  16155. },
  16156. {
  16157. name = "blitdst",
  16158. description = "Destination textures in `Pass:blit` can use this format."
  16159. }
  16160. }
  16161. },
  16162. {
  16163. name = "TextureType",
  16164. description = "Different types of textures. Textures are multidimensional blocks of GPU memory, and the texture's type determines how many dimensions there are, and adds some semantics about what the 3rd dimension means.",
  16165. key = "TextureType",
  16166. module = "lovr.graphics",
  16167. values = {
  16168. {
  16169. name = "2d",
  16170. description = "A single 2D image, the most common type."
  16171. },
  16172. {
  16173. name = "3d",
  16174. description = "A 3D image, where a sequence of 2D images defines a 3D volume. Each mipmap level of a 3D texture gets smaller in the x, y, and z axes, unlike cubemap and array textures."
  16175. },
  16176. {
  16177. name = "cube",
  16178. description = "Six 2D images that define the faces of a cubemap, used for skyboxes or other \"directional\" images."
  16179. },
  16180. {
  16181. name = "array",
  16182. description = "Array textures are sequences of distinct 2D images."
  16183. }
  16184. }
  16185. },
  16186. {
  16187. name = "TextureUsage",
  16188. description = "These are the different things `Texture`s can be used for. When creating a Texture, a set of these flags can be provided, restricting what operations are allowed on the texture. Using a smaller set of flags may improve performance. If none are provided, the only usage flag applied is `sample`.",
  16189. key = "TextureUsage",
  16190. module = "lovr.graphics",
  16191. values = {
  16192. {
  16193. name = "sample",
  16194. description = "Whether the texture can be sampled from in Shaders (i.e. used in a material, or bound to a variable with a `texture` type, like `texture2D`)."
  16195. },
  16196. {
  16197. name = "render",
  16198. description = "Whether the texture can be rendered to (i.e. by using it as a render target in `lovr.graphics.pass`)."
  16199. },
  16200. {
  16201. name = "storage",
  16202. description = "Whether the texture can be used as a storage texture for compute operations (i.e. bound to a variable with an `image` type, like `image2D`)."
  16203. },
  16204. {
  16205. name = "transfer",
  16206. description = "Whether the texture can be used in a transfer pass."
  16207. }
  16208. }
  16209. }
  16210. },
  16211. sections = {
  16212. {
  16213. name = "Objects",
  16214. tag = "graphics-objects"
  16215. },
  16216. {
  16217. name = "Global State",
  16218. tag = "graphics-global"
  16219. },
  16220. {
  16221. name = "Work Submission",
  16222. tag = "work-submission",
  16223. description = "The only way to get the GPU to do anything is to submit `Pass` objects to it. LÖVR submits the default pass automatically at the end of `lovr.draw`, but work can also be submitted manually."
  16224. },
  16225. {
  16226. name = "System Info",
  16227. tag = "graphics-misc",
  16228. description = "Information about the GPU hardware and the features it supports."
  16229. }
  16230. }
  16231. },
  16232. {
  16233. name = "headset",
  16234. tag = "modules",
  16235. summary = "Connects to VR hardware.",
  16236. description = "The `lovr.headset` module is where all the magical VR functionality is. With it, you can access connected VR hardware and get information about the available space the player has. Note that all units are reported in meters. Position `(0, 0, 0)` is on the floor in the center of the play area.",
  16237. key = "lovr.headset",
  16238. objects = {},
  16239. functions = {
  16240. {
  16241. name = "animate",
  16242. tag = "input",
  16243. summary = "Animate a model to match its Device input state.",
  16244. description = "Animates a device model to match its current input state. The buttons and joysticks on a controller will move as they're pressed/moved and hand models will move to match skeletal input.\n\nThe model should have been created using `lovr.headset.newModel` with the `animated` flag set to `true`.",
  16245. key = "lovr.headset.animate",
  16246. module = "lovr.headset",
  16247. notes = "Currently this function is supported for OpenVR controller models and Oculus hand models.\n\nThis function may animate using node-based animation or skeletal animation. `Model:hasJoints` can be used on a Model so you know if a Shader with the `animated` ShaderFlag needs to be used to render the results properly.\n\nIt's possible to use models that weren't created with `lovr.headset.newModel` but they need to be set up carefully to have the same structure as the models provided by the headset SDK.",
  16248. related = {
  16249. "lovr.headset.newModel"
  16250. },
  16251. variants = {
  16252. {
  16253. arguments = {
  16254. {
  16255. name = "device",
  16256. type = "Device",
  16257. description = "The device to use for the animation data.",
  16258. default = "'head'"
  16259. },
  16260. {
  16261. name = "model",
  16262. type = "Model",
  16263. description = "The model to animate."
  16264. }
  16265. },
  16266. returns = {
  16267. {
  16268. name = "success",
  16269. type = "boolean",
  16270. description = "Whether the animation was applied successfully to the Model. If the Model was not compatible or animation data for the device was not available, this will be `false`."
  16271. }
  16272. }
  16273. }
  16274. }
  16275. },
  16276. {
  16277. name = "getAngularVelocity",
  16278. tag = "input",
  16279. summary = "Get the angular velocity of a device.",
  16280. description = "Returns the current angular velocity of a device.",
  16281. key = "lovr.headset.getAngularVelocity",
  16282. module = "lovr.headset",
  16283. related = {
  16284. "lovr.headset.getVelocity",
  16285. "lovr.headset.getPosition",
  16286. "lovr.headset.getOrientation"
  16287. },
  16288. variants = {
  16289. {
  16290. arguments = {
  16291. {
  16292. name = "device",
  16293. type = "Device",
  16294. description = "The device to get the velocity of.",
  16295. default = "'head'"
  16296. }
  16297. },
  16298. returns = {
  16299. {
  16300. name = "x",
  16301. type = "number",
  16302. description = "The x component of the angular velocity."
  16303. },
  16304. {
  16305. name = "y",
  16306. type = "number",
  16307. description = "The y component of the angular velocity."
  16308. },
  16309. {
  16310. name = "z",
  16311. type = "number",
  16312. description = "The z component of the angular velocity."
  16313. }
  16314. }
  16315. }
  16316. }
  16317. },
  16318. {
  16319. name = "getAxis",
  16320. tag = "input",
  16321. summary = "Get the state of an analog axis on a device.",
  16322. description = "Get the current state of an analog axis on a device. Some axes are multidimensional, for example a 2D touchpad or thumbstick with x/y axes. For multidimensional axes, this function will return multiple values, one number for each axis. In these cases, it can be useful to use the `select` function built in to Lua to select a particular axis component.",
  16323. key = "lovr.headset.getAxis",
  16324. module = "lovr.headset",
  16325. notes = "The axis values will be between 0 and 1 for 1D axes, and between -1 and 1 for each component of a multidimensional axis.\n\nWhen hand tracking is active, pinch strength will be mapped to the `trigger` axis.",
  16326. related = {
  16327. "DeviceAxis",
  16328. "lovr.headset.isDown"
  16329. },
  16330. variants = {
  16331. {
  16332. arguments = {
  16333. {
  16334. name = "device",
  16335. type = "Device",
  16336. description = "The device."
  16337. },
  16338. {
  16339. name = "axis",
  16340. type = "DeviceAxis",
  16341. description = "The axis."
  16342. }
  16343. },
  16344. returns = {}
  16345. }
  16346. }
  16347. },
  16348. {
  16349. name = "getBoundsDepth",
  16350. tag = "playArea",
  16351. summary = "Get the depth of the play area.",
  16352. description = "Returns the depth of the play area, in meters.",
  16353. key = "lovr.headset.getBoundsDepth",
  16354. module = "lovr.headset",
  16355. notes = "This currently returns 0 on the Quest.",
  16356. related = {
  16357. "lovr.headset.getBoundsWidth",
  16358. "lovr.headset.getBoundsDimensions"
  16359. },
  16360. variants = {
  16361. {
  16362. arguments = {},
  16363. returns = {
  16364. {
  16365. name = "depth",
  16366. type = "number",
  16367. description = "The depth of the play area, in meters."
  16368. }
  16369. }
  16370. }
  16371. }
  16372. },
  16373. {
  16374. name = "getBoundsDimensions",
  16375. tag = "playArea",
  16376. summary = "Get the size of the play area.",
  16377. description = "Returns the size of the play area, in meters.",
  16378. key = "lovr.headset.getBoundsDimensions",
  16379. module = "lovr.headset",
  16380. notes = "This currently returns 0 on the Quest.",
  16381. related = {
  16382. "lovr.headset.getBoundsWidth",
  16383. "lovr.headset.getBoundsDepth",
  16384. "lovr.headset.getBoundsGeometry"
  16385. },
  16386. variants = {
  16387. {
  16388. arguments = {},
  16389. returns = {
  16390. {
  16391. name = "width",
  16392. type = "number",
  16393. description = "The width of the play area, in meters."
  16394. },
  16395. {
  16396. name = "depth",
  16397. type = "number",
  16398. description = "The depth of the play area, in meters."
  16399. }
  16400. }
  16401. }
  16402. }
  16403. },
  16404. {
  16405. name = "getBoundsGeometry",
  16406. tag = "playArea",
  16407. summary = "Get a list of points that make up the play area boundary.",
  16408. description = "Returns a list of points representing the boundaries of the play area, or `nil` if the current headset driver does not expose this information.",
  16409. key = "lovr.headset.getBoundsGeometry",
  16410. module = "lovr.headset",
  16411. related = {
  16412. "lovr.headset.getBoundsDimensions"
  16413. },
  16414. variants = {
  16415. {
  16416. arguments = {
  16417. {
  16418. name = "t",
  16419. type = "table",
  16420. description = "A table to fill with the points. If `nil`, a new table will be created.",
  16421. default = "nil"
  16422. }
  16423. },
  16424. returns = {
  16425. {
  16426. name = "points",
  16427. type = "table",
  16428. description = "A flat table of 3D points representing the play area boundaries."
  16429. }
  16430. }
  16431. }
  16432. }
  16433. },
  16434. {
  16435. name = "getBoundsWidth",
  16436. tag = "playArea",
  16437. summary = "Get the width of the play area.",
  16438. description = "Returns the width of the play area, in meters.",
  16439. key = "lovr.headset.getBoundsWidth",
  16440. module = "lovr.headset",
  16441. notes = "This currently returns 0 on the Quest.",
  16442. related = {
  16443. "lovr.headset.getBoundsDepth",
  16444. "lovr.headset.getBoundsDimensions"
  16445. },
  16446. variants = {
  16447. {
  16448. arguments = {},
  16449. returns = {
  16450. {
  16451. name = "width",
  16452. type = "number",
  16453. description = "The width of the play area, in meters."
  16454. }
  16455. }
  16456. }
  16457. }
  16458. },
  16459. {
  16460. name = "getClipDistance",
  16461. tag = "headset",
  16462. summary = "Get the near and far clipping planes of the headset.",
  16463. description = "Returns the near and far clipping planes used to render to the headset. Objects closer than the near clipping plane or further than the far clipping plane will be clipped out of view.",
  16464. key = "lovr.headset.getClipDistance",
  16465. module = "lovr.headset",
  16466. notes = "The default near and far clipping planes are 0.1 meters and 100.0 meters.\n\nThis is not currently supported by the `vrapi` headset driver.",
  16467. variants = {
  16468. {
  16469. arguments = {},
  16470. returns = {
  16471. {
  16472. name = "near",
  16473. type = "number",
  16474. description = "The distance to the near clipping plane, in meters."
  16475. },
  16476. {
  16477. name = "far",
  16478. type = "number",
  16479. description = "The distance to the far clipping plane, in meters."
  16480. }
  16481. }
  16482. }
  16483. }
  16484. },
  16485. {
  16486. name = "getDisplayDimensions",
  16487. tag = "headset",
  16488. summary = "Get the dimensions of the headset display.",
  16489. description = "Returns the texture dimensions of the headset display (for one eye), in pixels.",
  16490. key = "lovr.headset.getDisplayDimensions",
  16491. module = "lovr.headset",
  16492. related = {
  16493. "lovr.headset.getDisplayWidth",
  16494. "lovr.headset.getDisplayHeight"
  16495. },
  16496. variants = {
  16497. {
  16498. arguments = {},
  16499. returns = {
  16500. {
  16501. name = "width",
  16502. type = "number",
  16503. description = "The width of the display."
  16504. },
  16505. {
  16506. name = "height",
  16507. type = "number",
  16508. description = "The height of the display."
  16509. }
  16510. }
  16511. }
  16512. }
  16513. },
  16514. {
  16515. name = "getDisplayFrequencies",
  16516. tag = "headset",
  16517. summary = "Get the list of refresh rates supported by the headset display.",
  16518. description = "Returns a table with all the refresh rates supported by the headset display, in Hz.",
  16519. key = "lovr.headset.getDisplayFrequencies",
  16520. module = "lovr.headset",
  16521. related = {
  16522. "lovr.headset.setDisplayFrequency"
  16523. },
  16524. variants = {
  16525. {
  16526. arguments = {},
  16527. returns = {
  16528. {
  16529. name = "frequencies",
  16530. type = "table",
  16531. description = "A flat table of the refresh rates supported by the headset display, nil if not supported."
  16532. }
  16533. }
  16534. }
  16535. }
  16536. },
  16537. {
  16538. name = "getDisplayFrequency",
  16539. tag = "headset",
  16540. summary = "Get the refresh rate of the headset display.",
  16541. description = "Returns the refresh rate of the headset display, in Hz.",
  16542. key = "lovr.headset.getDisplayFrequency",
  16543. module = "lovr.headset",
  16544. variants = {
  16545. {
  16546. arguments = {},
  16547. returns = {
  16548. {
  16549. name = "frequency",
  16550. type = "number",
  16551. description = "The frequency of the display, or `nil` if I have no idea what it is."
  16552. }
  16553. }
  16554. }
  16555. }
  16556. },
  16557. {
  16558. name = "getDisplayHeight",
  16559. tag = "headset",
  16560. summary = "Get the height of the headset display.",
  16561. description = "Returns the height of the headset display (for one eye), in pixels.",
  16562. key = "lovr.headset.getDisplayHeight",
  16563. module = "lovr.headset",
  16564. related = {
  16565. "lovr.headset.getDisplayWidth",
  16566. "lovr.headset.getDisplayDimensions"
  16567. },
  16568. variants = {
  16569. {
  16570. arguments = {},
  16571. returns = {
  16572. {
  16573. name = "height",
  16574. type = "number",
  16575. description = "The height of the display."
  16576. }
  16577. }
  16578. }
  16579. }
  16580. },
  16581. {
  16582. name = "getDisplayMask",
  16583. tag = "headset",
  16584. summary = "Get a mesh that masks out the visible display area.",
  16585. description = "Returns 2D triangle vertices that represent areas of the headset display that will never be seen by the user (due to the circular lenses). This area can be masked out by rendering it to the depth buffer or stencil buffer. Then, further drawing operations can skip rendering those pixels using the depth test (`lovr.graphics.setDepthTest`) or stencil test (`lovr.graphics.setStencilTest`), which improves performance.",
  16586. key = "lovr.headset.getDisplayMask",
  16587. module = "lovr.headset",
  16588. variants = {
  16589. {
  16590. arguments = {},
  16591. returns = {
  16592. {
  16593. name = "points",
  16594. type = "table",
  16595. description = "A table of points. Each point is a table with two numbers between 0 and 1."
  16596. }
  16597. }
  16598. }
  16599. },
  16600. examples = {
  16601. {
  16602. code = "function lovr.load()\n lovr.graphics.setBackgroundColor(1, 1, 1)\n\n shader = lovr.graphics.newShader([[\n vec4 position(mat4 projection, mat4 transform, vec4 vertex) {\n\n // Rescale mesh coordinates from (0,1) to (-1,1)\n vertex.xy *= 2.;\n vertex.xy -= 1.;\n\n // Flip the mesh if it's being drawn in the right eye\n if (lovrViewID == 1) {\n vertex.x = -vertex.x;\n }\n\n return vertex;\n }\n ]], [[\n // The fragment shader returns solid black for illustration purposes. It could be transparent.\n vec4 color(vec4 graphicsColor, sampler2D image, vec2 uv) {\n return vec4(0., 0., 0., 1.);\n }\n ]])\n\n mask = lovr.headset.getDisplayMask()\n\n if mask then\n mesh = lovr.graphics.newMesh({ { 'lovrPosition', 'float', 2 } }, mask, 'triangles')\n end\nend\n\nfunction lovr.draw()\n if mask then\n -- Mask out parts of the display that aren't visible to skip rendering those pixels later\n lovr.graphics.setShader(shader)\n mesh:draw()\n lovr.graphics.setShader()\n\n -- Draw a red cube\n lovr.graphics.setColor(0xff0000)\n lovr.graphics.cube('fill', 0, 1.7, -1, .5, lovr.timer.getTime())\n lovr.graphics.setColor(0xffffff)\n else\n lovr.graphics.setColor(0x000000)\n lovr.graphics.print('No mask found.', 0, 1.7, -3, .2)\n lovr.graphics.setColor(0xffffff)\n end\nend"
  16603. }
  16604. }
  16605. },
  16606. {
  16607. name = "getDisplayWidth",
  16608. tag = "headset",
  16609. summary = "Get the width of the headset display.",
  16610. description = "Returns the width of the headset display (for one eye), in pixels.",
  16611. key = "lovr.headset.getDisplayWidth",
  16612. module = "lovr.headset",
  16613. related = {
  16614. "lovr.headset.getDisplayHeight",
  16615. "lovr.headset.getDisplayDimensions"
  16616. },
  16617. variants = {
  16618. {
  16619. arguments = {},
  16620. returns = {
  16621. {
  16622. name = "width",
  16623. type = "number",
  16624. description = "The width of the display."
  16625. }
  16626. }
  16627. }
  16628. }
  16629. },
  16630. {
  16631. name = "getDriver",
  16632. tag = "headset",
  16633. summary = "Get the VR API currently in use for a device.",
  16634. description = "Returns the `HeadsetDriver` that is currently in use, optionally for a specific device. The order of headset drivers can be changed using `lovr.conf` to prefer or exclude specific VR APIs.",
  16635. key = "lovr.headset.getDriver",
  16636. module = "lovr.headset",
  16637. variants = {
  16638. {
  16639. description = "Get the current headset driver that LÖVR is submitting frames to.",
  16640. arguments = {},
  16641. returns = {
  16642. {
  16643. name = "driver",
  16644. type = "HeadsetDriver",
  16645. description = "The driver of the headset in use, e.g. \"OpenVR\"."
  16646. }
  16647. }
  16648. },
  16649. {
  16650. description = "Get the current input driver for a device.",
  16651. arguments = {
  16652. {
  16653. name = "device",
  16654. type = "Device",
  16655. description = "The device to get the active driver of. This will be the first driver that is currently returning a pose for the device."
  16656. }
  16657. },
  16658. returns = {
  16659. {
  16660. name = "driver",
  16661. type = "HeadsetDriver",
  16662. description = "The driver of the headset in use, e.g. \"OpenVR\"."
  16663. }
  16664. }
  16665. }
  16666. }
  16667. },
  16668. {
  16669. name = "getHands",
  16670. tag = "input",
  16671. summary = "Get a list of currently tracked hand devices.",
  16672. description = "Returns a table with all of the currently tracked hand devices.",
  16673. key = "lovr.headset.getHands",
  16674. module = "lovr.headset",
  16675. notes = "The hand paths will *always* be either `hand/left` or `hand/right`.",
  16676. examples = {
  16677. {
  16678. code = "function lovr.update(dt)\n for i, hand in ipairs(lovr.headset.getHands()) do\n print(hand, lovr.headset.getPose(hand))\n end\nend"
  16679. }
  16680. },
  16681. variants = {
  16682. {
  16683. arguments = {},
  16684. returns = {
  16685. {
  16686. name = "hands",
  16687. type = "table",
  16688. description = "The currently tracked hand devices.",
  16689. arguments = {},
  16690. returns = {}
  16691. }
  16692. }
  16693. }
  16694. }
  16695. },
  16696. {
  16697. name = "getMirrorTexture",
  16698. tag = "headset",
  16699. summary = "Get the Texture containing a view of what's in the headset.",
  16700. description = "Returns a Texture that contains whatever is currently rendered to the headset.\n\nSometimes this can be `nil` if the current headset driver doesn't have a mirror texture, which can happen if the driver renders directly to the display. Currently the `desktop`, `webxr`, and `vrapi` drivers do not have a mirror texture.\n\nIt also isn't guaranteed that the same Texture will be returned by subsequent calls to this function. Currently, the `oculus` driver exhibits this behavior.",
  16701. key = "lovr.headset.getMirrorTexture",
  16702. module = "lovr.headset",
  16703. related = {
  16704. "lovr.mirror"
  16705. },
  16706. variants = {
  16707. {
  16708. arguments = {},
  16709. returns = {
  16710. {
  16711. name = "mirror",
  16712. type = "Texture",
  16713. description = "The mirror texture."
  16714. }
  16715. }
  16716. }
  16717. }
  16718. },
  16719. {
  16720. name = "getName",
  16721. tag = "headset",
  16722. summary = "Get the name of the connected headset display.",
  16723. description = "Returns the name of the headset as a string. The exact string that is returned depends on the hardware and VR SDK that is currently in use.",
  16724. key = "lovr.headset.getName",
  16725. module = "lovr.headset",
  16726. notes = "<table>\n <thead>\n <tr>\n <td>driver</td>\n <td>name</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>desktop</td>\n <td><code>Simulator</code></td>\n </tr>\n <tr>\n <td>openvr</td>\n <td>varies</td>\n </tr>\n <tr>\n <td>openxr</td>\n <td>varies</td>\n </tr>\n <tr>\n <td>vrapi</td>\n <td><code>Oculus Quest</code> or <code>Oculus Quest 2</code></td>\n </tr>\n <tr>\n <td>webxr</td>\n <td>always nil</td>\n </tr>\n <tr>\n <td>oculus</td>\n <td>varies</td>\n </tr>\n <tr>\n <td>pico</td>\n <td><code>Pico</code></td>\n </tr>\n </tbody> </table>",
  16727. variants = {
  16728. {
  16729. arguments = {},
  16730. returns = {
  16731. {
  16732. name = "name",
  16733. type = "string",
  16734. description = "The name of the headset as a string."
  16735. }
  16736. }
  16737. }
  16738. }
  16739. },
  16740. {
  16741. name = "getOrientation",
  16742. tag = "input",
  16743. summary = "Get the orientation of a device.",
  16744. description = "Returns the current orientation of a device, in angle/axis form.",
  16745. key = "lovr.headset.getOrientation",
  16746. module = "lovr.headset",
  16747. notes = "If the device isn't tracked, all zeroes will be returned.",
  16748. related = {
  16749. "lovr.headset.getPose",
  16750. "lovr.headset.getPosition",
  16751. "lovr.headset.getVelocity",
  16752. "lovr.headset.getAngularVelocity",
  16753. "lovr.headset.isTracked",
  16754. "lovr.headset.getDriver"
  16755. },
  16756. variants = {
  16757. {
  16758. arguments = {
  16759. {
  16760. name = "device",
  16761. type = "Device",
  16762. description = "The device to get the orientation of.",
  16763. default = "'head'"
  16764. }
  16765. },
  16766. returns = {
  16767. {
  16768. name = "angle",
  16769. type = "number",
  16770. description = "The amount of rotation around the axis of rotation, in radians."
  16771. },
  16772. {
  16773. name = "ax",
  16774. type = "number",
  16775. description = "The x component of the axis of rotation."
  16776. },
  16777. {
  16778. name = "ay",
  16779. type = "number",
  16780. description = "The y component of the axis of rotation."
  16781. },
  16782. {
  16783. name = "az",
  16784. type = "number",
  16785. description = "The z component of the axis of rotation."
  16786. }
  16787. }
  16788. }
  16789. }
  16790. },
  16791. {
  16792. name = "getOriginType",
  16793. tag = "headset",
  16794. summary = "Get the type of tracking origin of the headset.",
  16795. description = "Returns the type of origin used for the tracking volume. The different types of origins are explained on the `HeadsetOrigin` page.",
  16796. key = "lovr.headset.getOriginType",
  16797. module = "lovr.headset",
  16798. related = {
  16799. "HeadsetOrigin"
  16800. },
  16801. variants = {
  16802. {
  16803. arguments = {},
  16804. returns = {
  16805. {
  16806. name = "origin",
  16807. type = "HeadsetOrigin",
  16808. description = "The type of origin."
  16809. }
  16810. }
  16811. }
  16812. }
  16813. },
  16814. {
  16815. name = "getPass",
  16816. summary = "Get a Pass that renders to the headset.",
  16817. description = "TODO",
  16818. key = "lovr.headset.getPass",
  16819. module = "lovr.headset",
  16820. related = {
  16821. "lovr.graphics.getPass",
  16822. "lovr.conf"
  16823. },
  16824. variants = {
  16825. {
  16826. arguments = {},
  16827. returns = {
  16828. {
  16829. name = "pass",
  16830. type = "Pass",
  16831. description = "The Pass."
  16832. }
  16833. }
  16834. }
  16835. }
  16836. },
  16837. {
  16838. name = "getPose",
  16839. tag = "input",
  16840. summary = "Get the pose of a device.",
  16841. description = "Returns the current position and orientation of a device.",
  16842. key = "lovr.headset.getPose",
  16843. module = "lovr.headset",
  16844. notes = "Units are in meters.\n\nIf the device isn't tracked, all zeroes will be returned.",
  16845. related = {
  16846. "lovr.headset.getPosition",
  16847. "lovr.headset.getOrientation",
  16848. "lovr.headset.getVelocity",
  16849. "lovr.headset.getAngularVelocity",
  16850. "lovr.headset.getSkeleton",
  16851. "lovr.headset.isTracked",
  16852. "lovr.headset.getDriver"
  16853. },
  16854. variants = {
  16855. {
  16856. arguments = {
  16857. {
  16858. name = "device",
  16859. type = "Device",
  16860. description = "The device to get the pose of.",
  16861. default = "'head'"
  16862. }
  16863. },
  16864. returns = {
  16865. {
  16866. name = "x",
  16867. type = "number",
  16868. description = "The x position."
  16869. },
  16870. {
  16871. name = "y",
  16872. type = "number",
  16873. description = "The y position."
  16874. },
  16875. {
  16876. name = "z",
  16877. type = "number",
  16878. description = "The z position."
  16879. },
  16880. {
  16881. name = "angle",
  16882. type = "number",
  16883. description = "The amount of rotation around the axis of rotation, in radians."
  16884. },
  16885. {
  16886. name = "ax",
  16887. type = "number",
  16888. description = "The x component of the axis of rotation."
  16889. },
  16890. {
  16891. name = "ay",
  16892. type = "number",
  16893. description = "The y component of the axis of rotation."
  16894. },
  16895. {
  16896. name = "az",
  16897. type = "number",
  16898. description = "The z component of the axis of rotation."
  16899. }
  16900. }
  16901. }
  16902. }
  16903. },
  16904. {
  16905. name = "getPosition",
  16906. tag = "input",
  16907. summary = "Get the position of a device.",
  16908. description = "Returns the current position of a device, in meters, relative to the play area.",
  16909. key = "lovr.headset.getPosition",
  16910. module = "lovr.headset",
  16911. notes = "If the device isn't tracked, all zeroes will be returned.",
  16912. related = {
  16913. "lovr.headset.getPose",
  16914. "lovr.headset.getOrientation",
  16915. "lovr.headset.getVelocity",
  16916. "lovr.headset.getAngularVelocity",
  16917. "lovr.headset.isTracked",
  16918. "lovr.headset.getDriver"
  16919. },
  16920. variants = {
  16921. {
  16922. arguments = {
  16923. {
  16924. name = "device",
  16925. type = "Device",
  16926. description = "The device to get the position of.",
  16927. default = "'head'"
  16928. }
  16929. },
  16930. returns = {
  16931. {
  16932. name = "x",
  16933. type = "number",
  16934. description = "The x position of the device."
  16935. },
  16936. {
  16937. name = "y",
  16938. type = "number",
  16939. description = "The y position of the device."
  16940. },
  16941. {
  16942. name = "z",
  16943. type = "number",
  16944. description = "The z position of the device."
  16945. }
  16946. }
  16947. }
  16948. }
  16949. },
  16950. {
  16951. name = "getSkeleton",
  16952. tag = "input",
  16953. summary = "Get skeletal joint poses tracked by a device.",
  16954. description = "Returns a list of joint poses tracked by a device. Currently, only hand devices are able to track joints.",
  16955. key = "lovr.headset.getSkeleton",
  16956. module = "lovr.headset",
  16957. related = {
  16958. "lovr.headset.getPose",
  16959. "lovr.headset.animate"
  16960. },
  16961. examples = {
  16962. {
  16963. code = "function lovr.draw()\n for _, hand in ipairs({ 'left', 'right' }) do\n for _, joint in ipairs(lovr.headset.getSkeleton(hand) or {}) do\n lovr.graphics.points(unpack(joint, 1, 3))\n end\n end\nend"
  16964. }
  16965. },
  16966. notes = "If the Device does not support tracking joints or the poses are unavailable, `nil` is returned.\n\nThe joint orientation is similar to the graphics coordinate system: -Z is the forwards direction, pointing towards the fingertips. The +Y direction is \"up\", pointing out of the back of the hand. The +X direction is to the right, perpendicular to X and Z.\n\nHand joints are returned in the following order:\n\n<table>\n <thead>\n <tr>\n <td colspan=\"2\">Joint</td>\n <td>Index</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td colspan=\"2\">Palm</td>\n <td>1</td>\n </tr>\n <tr>\n <td colspan=\"2\">Wrist</td>\n <td>2</td>\n </tr>\n <tr>\n <td rowspan=\"4\">Thumb</td>\n <td>Metacarpal</td>\n <td>3</td>\n </tr>\n <tr>\n <td>Proximal</td>\n <td>4</td>\n </tr>\n <tr>\n <td>Distal</td>\n <td>5</td>\n </tr>\n <tr>\n <td>Tip</td>\n <td>6</td>\n </tr>\n <tr>\n <td rowspan=\"5\">Index</td>\n <td>Metacarpal</td>\n <td>7</td>\n </tr>\n <tr>\n <td>Proximal</td>\n <td>8</td>\n </tr>\n <tr>\n <td>Intermediate</td>\n <td>9</td>\n </tr>\n <tr>\n <td>Distal</td>\n <td>10</td>\n </tr>\n <tr>\n <td>Tip</td>\n <td>11</td>\n </tr>\n <tr>\n <td rowspan=\"5\">Middle</td>\n <td>Metacarpal</td>\n <td>12</td>\n </tr>\n <tr>\n <td>Proximal</td>\n <td>13</td>\n </tr>\n <tr>\n <td>Intermediate</td>\n <td>14</td>\n </tr>\n <tr>\n <td>Distal</td>\n <td>15</td>\n </tr>\n <tr>\n <td>Tip</td>\n <td>16</td>\n </tr>\n <tr>\n <td rowspan=\"5\">Ring</td>\n <td>Metacarpal</td>\n <td>17</td>\n </tr>\n <tr>\n <td>Proximal</td>\n <td>18</td>\n </tr>\n <tr>\n <td>Intermediate</td>\n <td>19</td>\n </tr>\n <tr>\n <td>Distal</td>\n <td>20</td>\n </tr>\n <tr>\n <td>Tip</td>\n <td>21</td>\n </tr>\n <tr>\n <td rowspan=\"5\">Pinky</td>\n <td>Metacarpal</td>\n <td>22</td>\n </tr>\n <tr>\n <td>Proximal</td>\n <td>23</td>\n </tr>\n <tr>\n <td>Intermediate</td>\n <td>24</td>\n </tr>\n <tr>\n <td>Distal</td>\n <td>25</td>\n </tr>\n <tr>\n <td>Tip</td>\n <td>26</td>\n </tr>\n </tbody> </table>",
  16967. variants = {
  16968. {
  16969. arguments = {
  16970. {
  16971. name = "device",
  16972. type = "Device",
  16973. description = "The Device to query."
  16974. }
  16975. },
  16976. returns = {
  16977. {
  16978. name = "poses",
  16979. type = "table",
  16980. description = "A list of joint poses for the device. Each pose is a table with 3 numbers for the position of the joint followed by 4 numbers for the angle/axis orientation of the joint."
  16981. }
  16982. }
  16983. },
  16984. {
  16985. arguments = {
  16986. {
  16987. name = "device",
  16988. type = "Device",
  16989. description = "The Device to query."
  16990. },
  16991. {
  16992. name = "t",
  16993. type = "table",
  16994. description = "A table to fill with the joint poses, instead of allocating a new one."
  16995. }
  16996. },
  16997. returns = {
  16998. {
  16999. name = "poses",
  17000. type = "table",
  17001. description = "A list of joint poses for the device. Each pose is a table with 3 numbers for the position of the joint followed by 4 numbers for the angle/axis orientation of the joint."
  17002. }
  17003. }
  17004. }
  17005. }
  17006. },
  17007. {
  17008. name = "getTime",
  17009. summary = "Get the predicted display time.",
  17010. description = "Returns the estimated time in the future at which the light from the pixels of the current frame will hit the eyes of the user.\n\nThis can be used as a replacement for `lovr.timer.getTime` for timestamps that are used for rendering to get a smoother result that is synchronized with the display of the headset.",
  17011. key = "lovr.headset.getTime",
  17012. module = "lovr.headset",
  17013. notes = "This has a different epoch than `lovr.timer.getTime`, so it is not guaranteed to be close to that value.",
  17014. variants = {
  17015. {
  17016. arguments = {},
  17017. returns = {
  17018. {
  17019. name = "time",
  17020. type = "number",
  17021. description = "The predicted display time, in seconds."
  17022. }
  17023. }
  17024. }
  17025. },
  17026. related = {
  17027. "lovr.timer.getTime"
  17028. }
  17029. },
  17030. {
  17031. name = "getVelocity",
  17032. tag = "input",
  17033. summary = "Get the linear velocity of a device.",
  17034. description = "Returns the current linear velocity of a device, in meters per second.",
  17035. key = "lovr.headset.getVelocity",
  17036. module = "lovr.headset",
  17037. related = {
  17038. "lovr.headset.getAngularVelocity",
  17039. "lovr.headset.getPose",
  17040. "lovr.headset.getPosition",
  17041. "lovr.headset.getOrientation"
  17042. },
  17043. variants = {
  17044. {
  17045. arguments = {
  17046. {
  17047. name = "device",
  17048. type = "Device",
  17049. description = "The device to get the velocity of.",
  17050. default = "'head'"
  17051. }
  17052. },
  17053. returns = {
  17054. {
  17055. name = "vx",
  17056. type = "number",
  17057. description = "The x component of the linear velocity."
  17058. },
  17059. {
  17060. name = "vy",
  17061. type = "number",
  17062. description = "The y component of the linear velocity."
  17063. },
  17064. {
  17065. name = "vz",
  17066. type = "number",
  17067. description = "The z component of the linear velocity."
  17068. }
  17069. }
  17070. }
  17071. }
  17072. },
  17073. {
  17074. name = "getViewAngles",
  17075. tag = "headset",
  17076. summary = "Get the field of view angles of a view.",
  17077. description = "Returns the view angles of one of the headset views.\n\nThese can be used with `Mat4:fov` to create a projection matrix.\n\nIf tracking data is unavailable for the view or the index is invalid, `nil` is returned.",
  17078. key = "lovr.headset.getViewAngles",
  17079. module = "lovr.headset",
  17080. related = {
  17081. "lovr.headset.getViewCount",
  17082. "lovr.headset.getViewPose"
  17083. },
  17084. variants = {
  17085. {
  17086. arguments = {
  17087. {
  17088. name = "view",
  17089. type = "number",
  17090. description = "The view index."
  17091. }
  17092. },
  17093. returns = {
  17094. {
  17095. name = "left",
  17096. type = "number",
  17097. description = "The left view angle, in radians."
  17098. },
  17099. {
  17100. name = "right",
  17101. type = "number",
  17102. description = "The right view angle, in radians."
  17103. },
  17104. {
  17105. name = "top",
  17106. type = "number",
  17107. description = "The top view angle, in radians."
  17108. },
  17109. {
  17110. name = "bottom",
  17111. type = "number",
  17112. description = "The bottom view angle, in radians."
  17113. }
  17114. }
  17115. }
  17116. }
  17117. },
  17118. {
  17119. name = "getViewCount",
  17120. tag = "headset",
  17121. summary = "Get the number of views used for rendering.",
  17122. description = "Returns the number of views used for rendering. Each view consists of a pose in space and a set of angle values that determine the field of view.\n\nThis is usually 2 for stereo rendering configurations, but it can also be different. For example, one way of doing foveated rendering uses 2 views for each eye -- one low quality view with a wider field of view, and a high quality view with a narrower field of view.",
  17123. key = "lovr.headset.getViewCount",
  17124. module = "lovr.headset",
  17125. related = {
  17126. "lovr.headset.getViewPose",
  17127. "lovr.headset.getViewAngles"
  17128. },
  17129. variants = {
  17130. {
  17131. arguments = {},
  17132. returns = {
  17133. {
  17134. name = "count",
  17135. type = "number",
  17136. description = "The number of views."
  17137. }
  17138. }
  17139. }
  17140. }
  17141. },
  17142. {
  17143. name = "getViewPose",
  17144. tag = "headset",
  17145. summary = "Get the pose of one of the views.",
  17146. description = "Returns the pose of one of the headset views. This info can be used to create view matrices or do other eye-dependent calculations.\n\nIf tracking data is unavailable for the view or the index is invalid, `nil` is returned.",
  17147. key = "lovr.headset.getViewPose",
  17148. module = "lovr.headset",
  17149. related = {
  17150. "lovr.headset.getViewCount",
  17151. "lovr.headset.getViewAngles"
  17152. },
  17153. variants = {
  17154. {
  17155. arguments = {
  17156. {
  17157. name = "view",
  17158. type = "number",
  17159. description = "The view index."
  17160. }
  17161. },
  17162. returns = {
  17163. {
  17164. name = "x",
  17165. type = "number",
  17166. description = "The x coordinate of the view position, in meters."
  17167. },
  17168. {
  17169. name = "y",
  17170. type = "number",
  17171. description = "The y coordinate of the view position, in meters."
  17172. },
  17173. {
  17174. name = "z",
  17175. type = "number",
  17176. description = "The z coordinate of the view position, in meters."
  17177. },
  17178. {
  17179. name = "angle",
  17180. type = "number",
  17181. description = "The amount of rotation around the rotation axis, in radians."
  17182. },
  17183. {
  17184. name = "ax",
  17185. type = "number",
  17186. description = "The x component of the axis of rotation."
  17187. },
  17188. {
  17189. name = "ay",
  17190. type = "number",
  17191. description = "The y component of the axis of rotation."
  17192. },
  17193. {
  17194. name = "az",
  17195. type = "number",
  17196. description = "The z component of the axis of rotation."
  17197. }
  17198. }
  17199. }
  17200. }
  17201. },
  17202. {
  17203. name = "isDown",
  17204. tag = "input",
  17205. summary = "Get the state of a button on a device.",
  17206. description = "Returns whether a button on a device is pressed.",
  17207. key = "lovr.headset.isDown",
  17208. module = "lovr.headset",
  17209. notes = "When hand tracking is active, pinching will be mapped to the `trigger` button.",
  17210. related = {
  17211. "DeviceButton",
  17212. "lovr.headset.wasPressed",
  17213. "lovr.headset.wasReleased",
  17214. "lovr.headset.isTouched",
  17215. "lovr.headset.getAxis"
  17216. },
  17217. variants = {
  17218. {
  17219. arguments = {
  17220. {
  17221. name = "device",
  17222. type = "Device",
  17223. description = "The device."
  17224. },
  17225. {
  17226. name = "button",
  17227. type = "DeviceButton",
  17228. description = "The button."
  17229. }
  17230. },
  17231. returns = {
  17232. {
  17233. name = "down",
  17234. type = "boolean",
  17235. description = "Whether the button on the device is currently pressed, or `nil` if the device does not have the specified button."
  17236. }
  17237. }
  17238. }
  17239. }
  17240. },
  17241. {
  17242. name = "isTouched",
  17243. tag = "input",
  17244. summary = "Check if a button on a device is touched.",
  17245. description = "Returns whether a button on a device is currently touched.",
  17246. key = "lovr.headset.isTouched",
  17247. module = "lovr.headset",
  17248. related = {
  17249. "DeviceButton",
  17250. "lovr.headset.isDown",
  17251. "lovr.headset.getAxis"
  17252. },
  17253. variants = {
  17254. {
  17255. arguments = {
  17256. {
  17257. name = "device",
  17258. type = "Device",
  17259. description = "The device."
  17260. },
  17261. {
  17262. name = "button",
  17263. type = "DeviceButton",
  17264. description = "The button."
  17265. }
  17266. },
  17267. returns = {
  17268. {
  17269. name = "touched",
  17270. type = "boolean",
  17271. description = "Whether the button on the device is currently touched, or `nil` if the device does not have the button or it isn't touch-sensitive."
  17272. }
  17273. }
  17274. }
  17275. }
  17276. },
  17277. {
  17278. name = "isTracked",
  17279. tag = "input",
  17280. summary = "Check if a device is currently tracked.",
  17281. description = "Returns whether any active headset driver is currently returning pose information for a device.",
  17282. key = "lovr.headset.isTracked",
  17283. module = "lovr.headset",
  17284. notes = "If a device is tracked, it is guaranteed to return a valid pose until the next call to `lovr.headset.update`.",
  17285. variants = {
  17286. {
  17287. arguments = {
  17288. {
  17289. name = "device",
  17290. type = "Device",
  17291. description = "The device to get the pose of.",
  17292. default = "'head'"
  17293. }
  17294. },
  17295. returns = {
  17296. {
  17297. name = "tracked",
  17298. type = "boolean",
  17299. description = "Whether the device is currently tracked."
  17300. }
  17301. }
  17302. }
  17303. }
  17304. },
  17305. {
  17306. name = "newModel",
  17307. tag = "input",
  17308. summary = "Get a Model for a device.",
  17309. description = "Returns a new Model for the specified device.",
  17310. key = "lovr.headset.newModel",
  17311. module = "lovr.headset",
  17312. related = {
  17313. "lovr.headset.animate"
  17314. },
  17315. examples = {
  17316. {
  17317. code = "local models = {}\n\nfunction lovr.draw()\n for i, hand in ipairs(lovr.headset.getHands()) do\n models[hand] = models[hand] or lovr.headset.newModel(hand)\n\n if models[hand] then\n local x, y, z, angle, ax, ay, az = lovr.headset.getPose(hand)\n models[hand]:draw(x, y, z, 1, angle, ax, ay, az)\n end\n end\nend"
  17318. }
  17319. },
  17320. notes = "This is only supported on the `openvr` and `vrapi` drivers right now.",
  17321. variants = {
  17322. {
  17323. arguments = {
  17324. {
  17325. name = "device",
  17326. type = "Device",
  17327. description = "The device to load a model for.",
  17328. default = "'head'"
  17329. },
  17330. {
  17331. name = "options",
  17332. type = "table",
  17333. description = "Options for loading the model.",
  17334. default = "{}",
  17335. table = {
  17336. {
  17337. name = "animated",
  17338. type = "boolean",
  17339. description = "Whether an animatable model should be loaded, for use with `lovr.headset.animate`.",
  17340. default = "false"
  17341. }
  17342. }
  17343. }
  17344. },
  17345. returns = {
  17346. {
  17347. name = "model",
  17348. type = "Model",
  17349. description = "The new Model, or `nil` if a model could not be loaded."
  17350. }
  17351. }
  17352. }
  17353. }
  17354. },
  17355. {
  17356. name = "renderTo",
  17357. tag = "headset",
  17358. summary = "Render to the headset using a function.",
  17359. description = "Renders to each eye of the headset using a function.\n\nThis function takes care of setting the appropriate graphics transformations to ensure that the scene is rendered as though it is being viewed through each eye of the player. It also takes care of setting the correct projection for the headset lenses.\n\nIf the headset module is enabled, this function is called automatically by `lovr.run` with `lovr.draw` as the callback.",
  17360. key = "lovr.headset.renderTo",
  17361. module = "lovr.headset",
  17362. notes = "When using the `pico` headset driver, headset rendering is asynchronous and the callback passed to `lovr.headset.renderTo` will not be called immediately.\n\nAt the beginning of the callback, the display is cleared to the background color. The background color can be changed using `lovr.graphics.setBackgroundColor`.\n\nIf the callback is `nil`, an empty frame cleared to current graphics background color will be submitted to the headset.",
  17363. variants = {
  17364. {
  17365. arguments = {
  17366. {
  17367. name = "callback",
  17368. type = "function",
  17369. description = "The function used to render. Any functions called will render to the headset instead of to the window.",
  17370. arguments = {},
  17371. returns = {},
  17372. variants = {
  17373. {
  17374. arguments = {
  17375. "callback"
  17376. },
  17377. returns = {}
  17378. }
  17379. }
  17380. }
  17381. },
  17382. returns = {}
  17383. }
  17384. }
  17385. },
  17386. {
  17387. name = "setClipDistance",
  17388. tag = "headset",
  17389. summary = "Set the near and far clipping planes of the headset.",
  17390. description = "Sets the near and far clipping planes used to render to the headset. Objects closer than the near clipping plane or further than the far clipping plane will be clipped out of view.",
  17391. key = "lovr.headset.setClipDistance",
  17392. module = "lovr.headset",
  17393. notes = "The default clip distances are 0.1 and 100.0.",
  17394. variants = {
  17395. {
  17396. arguments = {
  17397. {
  17398. name = "near",
  17399. type = "number",
  17400. description = "The distance to the near clipping plane, in meters."
  17401. },
  17402. {
  17403. name = "far",
  17404. type = "number",
  17405. description = "The distance to the far clipping plane, in meters."
  17406. }
  17407. },
  17408. returns = {}
  17409. }
  17410. }
  17411. },
  17412. {
  17413. name = "setDisplayFrequency",
  17414. tag = "headset",
  17415. summary = "Set the display refresh rate.",
  17416. description = "Sets the display refresh rate, in Hz.",
  17417. key = "lovr.headset.setDisplayFrequency",
  17418. module = "lovr.headset",
  17419. notes = "Changing the display refresh-rate also changes the frequency of lovr.update() and lovr.draw() as they depend on the display frequency.",
  17420. variants = {
  17421. {
  17422. arguments = {
  17423. {
  17424. name = "frequency",
  17425. type = "number",
  17426. description = "The new refresh rate, in Hz."
  17427. }
  17428. },
  17429. returns = {
  17430. {
  17431. name = "success",
  17432. type = "boolean",
  17433. description = "Whether the display refresh rate was successfully set."
  17434. }
  17435. }
  17436. }
  17437. }
  17438. },
  17439. {
  17440. name = "vibrate",
  17441. tag = "input",
  17442. summary = "Make a device go BZZZ!",
  17443. description = "Causes the device to vibrate with a custom strength, duration, and frequency, if possible.",
  17444. key = "lovr.headset.vibrate",
  17445. module = "lovr.headset",
  17446. notes = "When using the `openvr` headset driver on an HTC Vive, the value for the `duration` currently must be less than .004 seconds. Call this function several frames in a row for stronger or prolonged vibration patterns.\n\nOn the Oculus Quest, devices can only be vibrated once per frame. Any attempts after the first will return `false`.",
  17447. variants = {
  17448. {
  17449. arguments = {
  17450. {
  17451. name = "device",
  17452. type = "Device",
  17453. description = "The device to vibrate.",
  17454. default = "'head'"
  17455. },
  17456. {
  17457. name = "strength",
  17458. type = "number",
  17459. description = "The strength of the vibration (amplitude), between 0 and 1.",
  17460. default = "1"
  17461. },
  17462. {
  17463. name = "duration",
  17464. type = "number",
  17465. description = "The duration of the vibration, in seconds.",
  17466. default = ".5"
  17467. },
  17468. {
  17469. name = "frequency",
  17470. type = "number",
  17471. description = "The frequency of the vibration, in hertz. 0 will use a default frequency.",
  17472. default = "0"
  17473. }
  17474. },
  17475. returns = {
  17476. {
  17477. name = "vibrated",
  17478. type = "boolean",
  17479. description = "Whether the vibration was successfully triggered by an active headset driver."
  17480. }
  17481. }
  17482. }
  17483. }
  17484. },
  17485. {
  17486. name = "wasPressed",
  17487. tag = "input",
  17488. summary = "Check if a button was just pressed.",
  17489. description = "Returns whether a button on a device was pressed this frame.",
  17490. key = "lovr.headset.wasPressed",
  17491. module = "lovr.headset",
  17492. notes = "Some headset backends are not able to return pressed/released information. These drivers will always return false for `lovr.headset.wasPressed` and `lovr.headset.wasReleased`.\n\nTypically the internal `lovr.headset.update` function will update pressed/released status.",
  17493. related = {
  17494. "DeviceButton",
  17495. "lovr.headset.isDown",
  17496. "lovr.headset.wasReleased",
  17497. "lovr.headset.isTouched",
  17498. "lovr.headset.getAxis"
  17499. },
  17500. variants = {
  17501. {
  17502. arguments = {
  17503. {
  17504. name = "device",
  17505. type = "Device",
  17506. description = "The device."
  17507. },
  17508. {
  17509. name = "button",
  17510. type = "DeviceButton",
  17511. description = "The button to check."
  17512. }
  17513. },
  17514. returns = {
  17515. {
  17516. name = "pressed",
  17517. type = "boolean",
  17518. description = "Whether the button on the device was pressed this frame."
  17519. }
  17520. }
  17521. }
  17522. }
  17523. },
  17524. {
  17525. name = "wasReleased",
  17526. tag = "input",
  17527. summary = "Check if a button was just released.",
  17528. description = "Returns whether a button on a device was released this frame.",
  17529. key = "lovr.headset.wasReleased",
  17530. module = "lovr.headset",
  17531. notes = "Some headset backends are not able to return pressed/released information. These drivers will always return false for `lovr.headset.wasPressed` and `lovr.headset.wasReleased`.\n\nTypically the internal `lovr.headset.update` function will update pressed/released status.",
  17532. related = {
  17533. "DeviceButton",
  17534. "lovr.headset.isDown",
  17535. "lovr.headset.wasPressed",
  17536. "lovr.headset.isTouched",
  17537. "lovr.headset.getAxis"
  17538. },
  17539. variants = {
  17540. {
  17541. arguments = {
  17542. {
  17543. name = "device",
  17544. type = "Device",
  17545. description = "The device."
  17546. },
  17547. {
  17548. name = "button",
  17549. type = "DeviceButton",
  17550. description = "The button to check."
  17551. }
  17552. },
  17553. returns = {
  17554. {
  17555. name = "released",
  17556. type = "boolean",
  17557. description = "Whether the button on the device was released this frame."
  17558. }
  17559. }
  17560. }
  17561. }
  17562. }
  17563. },
  17564. enums = {
  17565. {
  17566. name = "Device",
  17567. description = "Different types of input devices supported by the `lovr.headset` module.",
  17568. key = "Device",
  17569. module = "lovr.headset",
  17570. related = {
  17571. "DeviceAxis",
  17572. "DeviceButton",
  17573. "lovr.headset.getPose",
  17574. "lovr.headset.getPosition",
  17575. "lovr.headset.getOrientation",
  17576. "lovr.headset.getVelocity",
  17577. "lovr.headset.getAngularVelocity",
  17578. "lovr.headset.getSkeleton",
  17579. "lovr.headset.isTracked",
  17580. "lovr.headset.isDown",
  17581. "lovr.headset.isTouched",
  17582. "lovr.headset.wasPressed",
  17583. "lovr.headset.wasReleased",
  17584. "lovr.headset.getAxis",
  17585. "lovr.headset.vibrate",
  17586. "lovr.headset.animate"
  17587. },
  17588. values = {
  17589. {
  17590. name = "head",
  17591. description = "The headset."
  17592. },
  17593. {
  17594. name = "hand/left",
  17595. description = "The left controller."
  17596. },
  17597. {
  17598. name = "hand/right",
  17599. description = "The right controller."
  17600. },
  17601. {
  17602. name = "left",
  17603. description = "A shorthand for hand/left."
  17604. },
  17605. {
  17606. name = "right",
  17607. description = "A shorthand for hand/right."
  17608. },
  17609. {
  17610. name = "elbow/left",
  17611. description = "A device tracking the left elbow."
  17612. },
  17613. {
  17614. name = "elbow/right",
  17615. description = "A device tracking the right elbow."
  17616. },
  17617. {
  17618. name = "shoulder/left",
  17619. description = "A device tracking the left shoulder."
  17620. },
  17621. {
  17622. name = "shoulder/right",
  17623. description = "A device tracking the right shoulder."
  17624. },
  17625. {
  17626. name = "chest",
  17627. description = "A device tracking the chest."
  17628. },
  17629. {
  17630. name = "waist",
  17631. description = "A device tracking the waist."
  17632. },
  17633. {
  17634. name = "knee/left",
  17635. description = "A device tracking the left knee."
  17636. },
  17637. {
  17638. name = "knee/right",
  17639. description = "A device tracking the right knee."
  17640. },
  17641. {
  17642. name = "foot/left",
  17643. description = "A device tracking the left foot or ankle."
  17644. },
  17645. {
  17646. name = "foot/right",
  17647. description = "A device tracking the right foot or ankle."
  17648. },
  17649. {
  17650. name = "camera",
  17651. description = "A camera device, often used for recording \"mixed reality\" footage."
  17652. },
  17653. {
  17654. name = "keyboard",
  17655. description = "A tracked keyboard."
  17656. },
  17657. {
  17658. name = "eye/left",
  17659. description = "The left eye."
  17660. },
  17661. {
  17662. name = "eye/right",
  17663. description = "The right eye."
  17664. }
  17665. }
  17666. },
  17667. {
  17668. name = "DeviceAxis",
  17669. description = "Axes on an input device.",
  17670. key = "DeviceAxis",
  17671. module = "lovr.headset",
  17672. related = {
  17673. "lovr.headset.getAxis",
  17674. "DeviceButton"
  17675. },
  17676. values = {
  17677. {
  17678. name = "trigger",
  17679. description = "A trigger (1D)."
  17680. },
  17681. {
  17682. name = "thumbstick",
  17683. description = "A thumbstick (2D)."
  17684. },
  17685. {
  17686. name = "touchpad",
  17687. description = "A touchpad (2D)."
  17688. },
  17689. {
  17690. name = "grip",
  17691. description = "A grip button or grab gesture (1D)."
  17692. }
  17693. }
  17694. },
  17695. {
  17696. name = "DeviceButton",
  17697. description = "Buttons on an input device.",
  17698. key = "DeviceButton",
  17699. module = "lovr.headset",
  17700. values = {
  17701. {
  17702. name = "trigger",
  17703. description = "The trigger button."
  17704. },
  17705. {
  17706. name = "thumbstick",
  17707. description = "The thumbstick."
  17708. },
  17709. {
  17710. name = "touchpad",
  17711. description = "The touchpad."
  17712. },
  17713. {
  17714. name = "grip",
  17715. description = "The grip button."
  17716. },
  17717. {
  17718. name = "menu",
  17719. description = "The menu button."
  17720. },
  17721. {
  17722. name = "a",
  17723. description = "The A button."
  17724. },
  17725. {
  17726. name = "b",
  17727. description = "The B button."
  17728. },
  17729. {
  17730. name = "x",
  17731. description = "The X button."
  17732. },
  17733. {
  17734. name = "y",
  17735. description = "The Y button."
  17736. },
  17737. {
  17738. name = "proximity",
  17739. description = "The proximity sensor on a headset."
  17740. }
  17741. }
  17742. },
  17743. {
  17744. name = "HeadsetDriver",
  17745. summary = "VR APIs.",
  17746. description = "These are all of the supported VR APIs that LÖVR can use to power the lovr.headset module. You can change the order of headset drivers using `lovr.conf` to prefer or exclude specific VR APIs.\n\nAt startup, LÖVR searches through the list of drivers in order. One headset driver will be used for rendering to the VR display, and all supported headset drivers will be used for device input. The way this works is that when poses or button input is requested, the input drivers are queried (in the order they appear in `conf.lua`) to see if any of them currently have data for the specified device. The first one that returns data will be used to provide the result. This allows projects to support multiple types of hardware devices.",
  17747. key = "HeadsetDriver",
  17748. module = "lovr.headset",
  17749. values = {
  17750. {
  17751. name = "desktop",
  17752. description = "A VR simulator using keyboard/mouse."
  17753. },
  17754. {
  17755. name = "oculus",
  17756. description = "Oculus Desktop SDK."
  17757. },
  17758. {
  17759. name = "openvr",
  17760. description = "OpenVR."
  17761. },
  17762. {
  17763. name = "openxr",
  17764. description = "OpenXR."
  17765. },
  17766. {
  17767. name = "vrapi",
  17768. description = "Oculus Mobile SDK."
  17769. },
  17770. {
  17771. name = "pico",
  17772. description = "Pico."
  17773. },
  17774. {
  17775. name = "webxr",
  17776. description = "WebXR."
  17777. }
  17778. }
  17779. },
  17780. {
  17781. name = "HeadsetOrigin",
  17782. summary = "Different types of coordinate space origins.",
  17783. description = "Represents the different types of origins for coordinate spaces. An origin of \"floor\" means that the origin is on the floor in the middle of a room-scale play area. An origin of \"head\" means that no positional tracking is available, and consequently the origin is always at the position of the headset.",
  17784. key = "HeadsetOrigin",
  17785. module = "lovr.headset",
  17786. values = {
  17787. {
  17788. name = "head",
  17789. description = "The origin is at the head."
  17790. },
  17791. {
  17792. name = "floor",
  17793. description = "The origin is on the floor."
  17794. }
  17795. }
  17796. }
  17797. },
  17798. sections = {
  17799. {
  17800. name = "Headset",
  17801. tag = "headset",
  17802. description = "Functions that return information about the active head mounted display (HMD)."
  17803. },
  17804. {
  17805. name = "Input",
  17806. tag = "input",
  17807. description = "Functions for accessing input devices, like controllers, hands, trackers, or gamepads."
  17808. },
  17809. {
  17810. name = "Play area",
  17811. tag = "playArea",
  17812. description = "Retrieve information about the size and shape of the room the player is in, and provides information about the \"chaperone\", a visual indicator that appears whenever a player is about to run into a wall."
  17813. }
  17814. }
  17815. },
  17816. {
  17817. name = "math",
  17818. tag = "modules",
  17819. summary = "Contains useful math helpers.",
  17820. description = "The `lovr.math` module provides math helpers commonly used for 3D applications.",
  17821. key = "lovr.math",
  17822. objects = {
  17823. {
  17824. name = "Curve",
  17825. summary = "A Bézier curve.",
  17826. description = "A Curve is an object that represents a Bézier curve in three dimensions. Curves are defined by an arbitrary number of control points (note that the curve only passes through the first and last control point).\n\nOnce a Curve is created with `lovr.math.newCurve`, you can use `Curve:evaluate` to get a point on the curve or `Curve:render` to get a list of all of the points on the curve. These points can be passed directly to `lovr.graphics.points` or `lovr.graphics.line` to render the curve.\n\nNote that for longer or more complicated curves (like in a drawing application) it can be easier to store the path as several Curve objects.",
  17827. key = "Curve",
  17828. module = "lovr.math",
  17829. constructors = {
  17830. "lovr.math.newCurve",
  17831. "Curve:slice"
  17832. },
  17833. methods = {
  17834. {
  17835. name = "addPoint",
  17836. summary = "Add a new control point to the Curve.",
  17837. description = "Inserts a new control point into the Curve at the specified index.",
  17838. key = "Curve:addPoint",
  17839. module = "lovr.math",
  17840. notes = "An error will be thrown if the index is less than one or more than the number of control points.",
  17841. variants = {
  17842. {
  17843. arguments = {
  17844. {
  17845. name = "x",
  17846. type = "number",
  17847. description = "The x coordinate of the control point."
  17848. },
  17849. {
  17850. name = "y",
  17851. type = "number",
  17852. description = "The y coordinate of the control point."
  17853. },
  17854. {
  17855. name = "z",
  17856. type = "number",
  17857. description = "The z coordinate of the control point."
  17858. },
  17859. {
  17860. name = "index",
  17861. type = "number",
  17862. description = "The index to insert the control point at. If nil, the control point is added to the end of the list of control points.",
  17863. default = "nil"
  17864. }
  17865. },
  17866. returns = {}
  17867. }
  17868. },
  17869. related = {
  17870. "Curve:getPointCount",
  17871. "Curve:getPoint",
  17872. "Curve:setPoint",
  17873. "Curve:removePoint"
  17874. }
  17875. },
  17876. {
  17877. name = "evaluate",
  17878. summary = "Turn a number from 0 to 1 into a point on the Curve.",
  17879. description = "Returns a point on the Curve given a parameter `t` from 0 to 1. 0 will return the first control point, 1 will return the last point, .5 will return a point in the \"middle\" of the Curve, etc.",
  17880. key = "Curve:evaluate",
  17881. module = "lovr.math",
  17882. notes = "An error will be thrown if `t` is not between 0 and 1, or if the Curve has less than two points.",
  17883. variants = {
  17884. {
  17885. arguments = {
  17886. {
  17887. name = "t",
  17888. type = "number",
  17889. description = "The parameter to evaluate the Curve at."
  17890. }
  17891. },
  17892. returns = {
  17893. {
  17894. name = "x",
  17895. type = "number",
  17896. description = "The x position of the point."
  17897. },
  17898. {
  17899. name = "y",
  17900. type = "number",
  17901. description = "The y position of the point."
  17902. },
  17903. {
  17904. name = "z",
  17905. type = "number",
  17906. description = "The z position of the point."
  17907. }
  17908. }
  17909. }
  17910. },
  17911. related = {
  17912. "Curve:getTangent",
  17913. "Curve:render",
  17914. "Curve:slice"
  17915. }
  17916. },
  17917. {
  17918. name = "getPoint",
  17919. summary = "Get a control point of the Curve.",
  17920. description = "Returns a control point of the Curve.",
  17921. key = "Curve:getPoint",
  17922. module = "lovr.math",
  17923. notes = "An error will be thrown if the index is less than one or more than the number of control points.",
  17924. variants = {
  17925. {
  17926. arguments = {
  17927. {
  17928. name = "index",
  17929. type = "number",
  17930. description = "The index to retrieve."
  17931. }
  17932. },
  17933. returns = {
  17934. {
  17935. name = "x",
  17936. type = "number",
  17937. description = "The x coordinate of the control point."
  17938. },
  17939. {
  17940. name = "y",
  17941. type = "number",
  17942. description = "The y coordinate of the control point."
  17943. },
  17944. {
  17945. name = "z",
  17946. type = "number",
  17947. description = "The z coordinate of the control point."
  17948. }
  17949. }
  17950. }
  17951. },
  17952. related = {
  17953. "Curve:getPointCount",
  17954. "Curve:setPoint",
  17955. "Curve:addPoint",
  17956. "Curve:removePoint"
  17957. }
  17958. },
  17959. {
  17960. name = "getPointCount",
  17961. summary = "Get the number of control points in the Curve.",
  17962. description = "Returns the number of control points in the Curve.",
  17963. key = "Curve:getPointCount",
  17964. module = "lovr.math",
  17965. related = {
  17966. "Curve:getPoint",
  17967. "Curve:setPoint",
  17968. "Curve:addPoint",
  17969. "Curve:removePoint"
  17970. },
  17971. variants = {
  17972. {
  17973. arguments = {},
  17974. returns = {
  17975. {
  17976. name = "count",
  17977. type = "number",
  17978. description = "The number of control points."
  17979. }
  17980. }
  17981. }
  17982. }
  17983. },
  17984. {
  17985. name = "getTangent",
  17986. summary = "Get the direction of the Curve at a point.",
  17987. description = "Returns a direction vector for the Curve given a parameter `t` from 0 to 1. 0 will return the direction at the first control point, 1 will return the direction at the last point, .5 will return the direction at the \"middle\" of the Curve, etc.",
  17988. key = "Curve:getTangent",
  17989. module = "lovr.math",
  17990. notes = "The direction vector returned by this function will have a length of one.",
  17991. variants = {
  17992. {
  17993. arguments = {
  17994. {
  17995. name = "t",
  17996. type = "number",
  17997. description = "Where on the Curve to compute the direction."
  17998. }
  17999. },
  18000. returns = {
  18001. {
  18002. name = "x",
  18003. type = "number",
  18004. description = "The x position of the point."
  18005. },
  18006. {
  18007. name = "y",
  18008. type = "number",
  18009. description = "The y position of the point."
  18010. },
  18011. {
  18012. name = "z",
  18013. type = "number",
  18014. description = "The z position of the point."
  18015. }
  18016. }
  18017. }
  18018. },
  18019. related = {
  18020. "Curve:evaluate",
  18021. "Curve:render",
  18022. "Curve:slice"
  18023. }
  18024. },
  18025. {
  18026. name = "removePoint",
  18027. summary = "Remove a control point from the Curve.",
  18028. description = "Removes a control point from the Curve.",
  18029. key = "Curve:removePoint",
  18030. module = "lovr.math",
  18031. notes = "An error will be thrown if the index is less than one or more than the number of control points.",
  18032. variants = {
  18033. {
  18034. arguments = {
  18035. {
  18036. name = "index",
  18037. type = "number",
  18038. description = "The index of the control point to remove."
  18039. }
  18040. },
  18041. returns = {}
  18042. }
  18043. },
  18044. related = {
  18045. "Curve:getPointCount",
  18046. "Curve:getPoint",
  18047. "Curve:setPoint",
  18048. "Curve:addPoint"
  18049. }
  18050. },
  18051. {
  18052. name = "render",
  18053. summary = "Get a list of points on the Curve.",
  18054. description = "Returns a list of points on the Curve. The number of points can be specified to get a more or less detailed representation, and it is also possible to render a subsection of the Curve.",
  18055. key = "Curve:render",
  18056. module = "lovr.math",
  18057. notes = "This function will always return 2 points if the Curve is a line with only 2 control points.",
  18058. variants = {
  18059. {
  18060. arguments = {
  18061. {
  18062. name = "n",
  18063. type = "number",
  18064. description = "The number of points to use.",
  18065. default = "32"
  18066. },
  18067. {
  18068. name = "t1",
  18069. type = "number",
  18070. description = "How far along the curve to start rendering.",
  18071. default = "0"
  18072. },
  18073. {
  18074. name = "t2",
  18075. type = "number",
  18076. description = "How far along the curve to stop rendering.",
  18077. default = "1"
  18078. }
  18079. },
  18080. returns = {
  18081. {
  18082. name = "t",
  18083. type = "table",
  18084. description = "A (flat) table of 3D points along the curve."
  18085. }
  18086. }
  18087. }
  18088. },
  18089. related = {
  18090. "Curve:evaluate",
  18091. "Curve:slice",
  18092. "lovr.graphics.points",
  18093. "lovr.graphics.line"
  18094. }
  18095. },
  18096. {
  18097. name = "setPoint",
  18098. summary = "Set a control point of the Curve.",
  18099. description = "Changes the position of a control point on the Curve.",
  18100. key = "Curve:setPoint",
  18101. module = "lovr.math",
  18102. notes = "An error will be thrown if the index is less than one or more than the number of control points.",
  18103. variants = {
  18104. {
  18105. arguments = {
  18106. {
  18107. name = "index",
  18108. type = "number",
  18109. description = "The index to modify."
  18110. },
  18111. {
  18112. name = "x",
  18113. type = "number",
  18114. description = "The new x coordinate."
  18115. },
  18116. {
  18117. name = "y",
  18118. type = "number",
  18119. description = "The new y coordinate."
  18120. },
  18121. {
  18122. name = "z",
  18123. type = "number",
  18124. description = "The new z coordinate."
  18125. }
  18126. },
  18127. returns = {}
  18128. }
  18129. },
  18130. related = {
  18131. "Curve:getPointCount",
  18132. "Curve:getPoint",
  18133. "Curve:addPoint",
  18134. "Curve:removePoint"
  18135. }
  18136. },
  18137. {
  18138. name = "slice",
  18139. summary = "Get a new Curve from a slice of an existing one.",
  18140. description = "Returns a new Curve created by slicing the Curve at the specified start and end points.",
  18141. key = "Curve:slice",
  18142. module = "lovr.math",
  18143. notes = "The new Curve will have the same number of control points as the existing curve.\n\nAn error will be thrown if t1 or t2 are not between 0 and 1, or if the Curve has less than two points.",
  18144. variants = {
  18145. {
  18146. arguments = {
  18147. {
  18148. name = "t1",
  18149. type = "number",
  18150. description = "The starting point to slice at."
  18151. },
  18152. {
  18153. name = "t2",
  18154. type = "number",
  18155. description = "The ending point to slice at."
  18156. }
  18157. },
  18158. returns = {
  18159. {
  18160. name = "curve",
  18161. type = "Curve",
  18162. description = "A new Curve."
  18163. }
  18164. }
  18165. }
  18166. },
  18167. related = {
  18168. "Curve:evaluate",
  18169. "Curve:render"
  18170. }
  18171. }
  18172. }
  18173. },
  18174. {
  18175. name = "Mat4",
  18176. summary = "A 4x4 matrix.",
  18177. description = "A `mat4` is a math type that holds 16 values in a 4x4 grid.",
  18178. key = "Mat4",
  18179. module = "lovr.math",
  18180. constructors = {
  18181. "lovr.math.newMat4",
  18182. "lovr.math.mat4"
  18183. },
  18184. related = {
  18185. "Vec3",
  18186. "Quat"
  18187. },
  18188. methods = {
  18189. {
  18190. name = "equals",
  18191. summary = "Check if a matrix equals another matrix.",
  18192. description = "Returns whether a matrix is approximately equal to another matrix.",
  18193. key = "Mat4:equals",
  18194. module = "lovr.math",
  18195. related = {
  18196. "Vec2:equals",
  18197. "Vec3:equals",
  18198. "Vec4:equals",
  18199. "Quat:equals"
  18200. },
  18201. variants = {
  18202. {
  18203. arguments = {
  18204. {
  18205. name = "n",
  18206. type = "Mat4",
  18207. description = "The other matrix."
  18208. }
  18209. },
  18210. returns = {
  18211. {
  18212. name = "equal",
  18213. type = "boolean",
  18214. description = "Whether the 2 matrices approximately equal each other."
  18215. }
  18216. }
  18217. }
  18218. }
  18219. },
  18220. {
  18221. name = "fov",
  18222. summary = "Set a projection using raw FoV angles.",
  18223. description = "Sets a projection matrix using raw projection angles and clipping planes.\n\nThis can be used for asymmetric or oblique projections.",
  18224. key = "Mat4:fov",
  18225. module = "lovr.math",
  18226. related = {
  18227. "Mat4:orthographic",
  18228. "Mat4:perspective",
  18229. "lovr.graphics.setProjection"
  18230. },
  18231. variants = {
  18232. {
  18233. arguments = {
  18234. {
  18235. name = "left",
  18236. type = "number",
  18237. description = "The left half-angle of the projection, in radians."
  18238. },
  18239. {
  18240. name = "right",
  18241. type = "number",
  18242. description = "The right half-angle of the projection, in radians."
  18243. },
  18244. {
  18245. name = "up",
  18246. type = "number",
  18247. description = "The top half-angle of the projection, in radians."
  18248. },
  18249. {
  18250. name = "down",
  18251. type = "number",
  18252. description = "The bottom half-angle of the projection, in radians."
  18253. },
  18254. {
  18255. name = "near",
  18256. type = "number",
  18257. description = "The near plane of the projection."
  18258. },
  18259. {
  18260. name = "far",
  18261. type = "number",
  18262. description = "The far plane of the projection."
  18263. }
  18264. },
  18265. returns = {
  18266. {
  18267. name = "m",
  18268. type = "Mat4",
  18269. description = "The original matrix."
  18270. }
  18271. }
  18272. }
  18273. }
  18274. },
  18275. {
  18276. name = "identity",
  18277. summary = "Reset the matrix to the identity.",
  18278. description = "Resets the matrix to the identity, effectively setting its translation to zero, its scale to 1, and clearing any rotation.",
  18279. key = "Mat4:identity",
  18280. module = "lovr.math",
  18281. related = {
  18282. "lovr.graphics.origin"
  18283. },
  18284. variants = {
  18285. {
  18286. arguments = {},
  18287. returns = {
  18288. {
  18289. name = "m",
  18290. type = "Mat4",
  18291. description = "The original matrix."
  18292. }
  18293. }
  18294. }
  18295. }
  18296. },
  18297. {
  18298. name = "invert",
  18299. summary = "Invert the matrix.",
  18300. description = "Inverts the matrix, causing it to represent the opposite of its old transform.",
  18301. key = "Mat4:invert",
  18302. module = "lovr.math",
  18303. variants = {
  18304. {
  18305. arguments = {},
  18306. returns = {
  18307. {
  18308. name = "m",
  18309. type = "Mat4",
  18310. description = "The original matrix."
  18311. }
  18312. }
  18313. }
  18314. }
  18315. },
  18316. {
  18317. name = "lookAt",
  18318. summary = "Create a view transform that looks from a position to target position.",
  18319. description = "Sets a view transform matrix that moves and orients camera to look at a target point.\n\nThis is useful for changing camera position and orientation. The resulting Mat4 matrix can be passed to `lovr.graphics.transform()` directly (without inverting) before rendering the scene.\n\nThe lookAt() function produces same result as target() after matrix inversion.",
  18320. key = "Mat4:lookAt",
  18321. module = "lovr.math",
  18322. related = {
  18323. "Mat4:target",
  18324. "Quat:direction"
  18325. },
  18326. variants = {
  18327. {
  18328. arguments = {
  18329. {
  18330. name = "from",
  18331. type = "Vec3",
  18332. description = "The position of the viewer."
  18333. },
  18334. {
  18335. name = "to",
  18336. type = "Vec3",
  18337. description = "The position of the target."
  18338. },
  18339. {
  18340. name = "up",
  18341. type = "Vec3",
  18342. description = "The up vector of the viewer.",
  18343. default = "Vec3(0, 1, 0)"
  18344. }
  18345. },
  18346. returns = {
  18347. {
  18348. name = "m",
  18349. type = "Mat4",
  18350. description = "The original matrix."
  18351. }
  18352. }
  18353. }
  18354. }
  18355. },
  18356. {
  18357. name = "mul",
  18358. summary = "Multiply a matrix with another matrix or a vector.",
  18359. description = "Multiplies this matrix by another value. Multiplying by a matrix combines their two transforms together. Multiplying by a vector applies the transformation from the matrix to the vector and returns the vector.",
  18360. key = "Mat4:mul",
  18361. module = "lovr.math",
  18362. notes = "When multiplying by a vec4, the vector is treated as either a point if its w component is 1, or a direction vector if the w is 0 (the matrix translation won't be applied).",
  18363. variants = {
  18364. {
  18365. arguments = {
  18366. {
  18367. name = "n",
  18368. type = "Mat4",
  18369. description = "The matrix."
  18370. }
  18371. },
  18372. returns = {
  18373. {
  18374. name = "m",
  18375. type = "Mat4",
  18376. description = "The original matrix, containing the result."
  18377. }
  18378. }
  18379. },
  18380. {
  18381. arguments = {
  18382. {
  18383. name = "v3",
  18384. type = "Vec3",
  18385. description = "A 3D vector, treated as a point."
  18386. }
  18387. },
  18388. returns = {
  18389. {
  18390. name = "v3",
  18391. type = "Vec3",
  18392. description = "The transformed vector."
  18393. }
  18394. }
  18395. },
  18396. {
  18397. arguments = {
  18398. {
  18399. name = "v4",
  18400. type = "Vec4",
  18401. description = "A 4D vector."
  18402. }
  18403. },
  18404. returns = {
  18405. {
  18406. name = "v4",
  18407. type = "Vec4",
  18408. description = "The transformed vector."
  18409. }
  18410. }
  18411. }
  18412. },
  18413. related = {
  18414. "Mat4:translate",
  18415. "Mat4:rotate",
  18416. "Mat4:scale"
  18417. }
  18418. },
  18419. {
  18420. name = "orthographic",
  18421. summary = "Turn the matrix into an orthographic projection.",
  18422. description = "Sets this matrix to represent an orthographic projection, useful for 2D/isometric rendering.\n\nThis can be used with `lovr.graphics.setProjection`, or it can be sent to a `Shader` for use in GLSL.",
  18423. key = "Mat4:orthographic",
  18424. module = "lovr.math",
  18425. related = {
  18426. "Mat4:perspective",
  18427. "Mat4:fov",
  18428. "lovr.graphics.setProjection"
  18429. },
  18430. variants = {
  18431. {
  18432. arguments = {
  18433. {
  18434. name = "left",
  18435. type = "number",
  18436. description = "The left edge of the projection."
  18437. },
  18438. {
  18439. name = "right",
  18440. type = "number",
  18441. description = "The right edge of the projection."
  18442. },
  18443. {
  18444. name = "top",
  18445. type = "number",
  18446. description = "The top edge of the projection."
  18447. },
  18448. {
  18449. name = "bottom",
  18450. type = "number",
  18451. description = "The bottom edge of the projection."
  18452. },
  18453. {
  18454. name = "near",
  18455. type = "number",
  18456. description = "The position of the near clipping plane."
  18457. },
  18458. {
  18459. name = "far",
  18460. type = "number",
  18461. description = "The position of the far clipping plane."
  18462. }
  18463. },
  18464. returns = {
  18465. {
  18466. name = "m",
  18467. type = "Mat4",
  18468. description = "The original matrix."
  18469. }
  18470. }
  18471. }
  18472. }
  18473. },
  18474. {
  18475. name = "perspective",
  18476. summary = "Turn the matrix into a perspective projection.",
  18477. description = "Sets this matrix to represent a perspective projection.\n\nThis can be used with `lovr.graphics.setProjection`, or it can be sent to a `Shader` for use in GLSL.",
  18478. key = "Mat4:perspective",
  18479. module = "lovr.math",
  18480. related = {
  18481. "Mat4:orthographic",
  18482. "Mat4:fov",
  18483. "lovr.graphics.setProjection"
  18484. },
  18485. variants = {
  18486. {
  18487. arguments = {
  18488. {
  18489. name = "near",
  18490. type = "number",
  18491. description = "The near plane."
  18492. },
  18493. {
  18494. name = "far",
  18495. type = "number",
  18496. description = "The far plane."
  18497. },
  18498. {
  18499. name = "fov",
  18500. type = "number",
  18501. description = "The vertical field of view (in radians)."
  18502. },
  18503. {
  18504. name = "aspect",
  18505. type = "number",
  18506. description = "The horizontal aspect ratio of the projection (width / height)."
  18507. }
  18508. },
  18509. returns = {
  18510. {
  18511. name = "m",
  18512. type = "Mat4",
  18513. description = "The original matrix."
  18514. }
  18515. }
  18516. }
  18517. }
  18518. },
  18519. {
  18520. name = "rotate",
  18521. summary = "Rotate the matrix.",
  18522. description = "Rotates the matrix using a quaternion or an angle/axis rotation.",
  18523. key = "Mat4:rotate",
  18524. module = "lovr.math",
  18525. related = {
  18526. "Mat4:translate",
  18527. "Mat4:scale",
  18528. "Mat4:identity"
  18529. },
  18530. variants = {
  18531. {
  18532. arguments = {
  18533. {
  18534. name = "q",
  18535. type = "Quat",
  18536. description = "The rotation to apply to the matrix."
  18537. }
  18538. },
  18539. returns = {
  18540. {
  18541. name = "m",
  18542. type = "Mat4",
  18543. description = "The original matrix."
  18544. }
  18545. }
  18546. },
  18547. {
  18548. arguments = {
  18549. {
  18550. name = "angle",
  18551. type = "number",
  18552. description = "The angle component of the angle/axis rotation (radians)."
  18553. },
  18554. {
  18555. name = "ax",
  18556. type = "number",
  18557. description = "The x component of the axis of rotation.",
  18558. default = "0"
  18559. },
  18560. {
  18561. name = "ay",
  18562. type = "number",
  18563. description = "The y component of the axis of rotation.",
  18564. default = "1"
  18565. },
  18566. {
  18567. name = "az",
  18568. type = "number",
  18569. description = "The z component of the axis of rotation.",
  18570. default = "0"
  18571. }
  18572. },
  18573. returns = {
  18574. {
  18575. name = "m",
  18576. type = "Mat4",
  18577. description = "The original matrix."
  18578. }
  18579. }
  18580. }
  18581. }
  18582. },
  18583. {
  18584. name = "scale",
  18585. summary = "Scale the matrix.",
  18586. description = "Scales the matrix.",
  18587. key = "Mat4:scale",
  18588. module = "lovr.math",
  18589. related = {
  18590. "Mat4:translate",
  18591. "Mat4:rotate",
  18592. "Mat4:identity"
  18593. },
  18594. variants = {
  18595. {
  18596. arguments = {
  18597. {
  18598. name = "scale",
  18599. type = "Vec3",
  18600. description = "The 3D scale to apply."
  18601. }
  18602. },
  18603. returns = {
  18604. {
  18605. name = "m",
  18606. type = "Mat4",
  18607. description = "The original matrix."
  18608. }
  18609. }
  18610. },
  18611. {
  18612. arguments = {
  18613. {
  18614. name = "sx",
  18615. type = "number",
  18616. description = "The x component of the scale to apply."
  18617. },
  18618. {
  18619. name = "sy",
  18620. type = "number",
  18621. description = "The y component of the scale to apply.",
  18622. default = "sx"
  18623. },
  18624. {
  18625. name = "sz",
  18626. type = "number",
  18627. description = "The z component of the scale to apply.",
  18628. default = "sx"
  18629. }
  18630. },
  18631. returns = {
  18632. {
  18633. name = "m",
  18634. type = "Mat4",
  18635. description = "The original matrix."
  18636. }
  18637. }
  18638. }
  18639. }
  18640. },
  18641. {
  18642. name = "set",
  18643. summary = "Set the components of the matrix.",
  18644. description = "Sets the components of the matrix from separate position, rotation, and scale arguments or an existing matrix.",
  18645. key = "Mat4:set",
  18646. module = "lovr.math",
  18647. related = {
  18648. "Mat4:unpack"
  18649. },
  18650. variants = {
  18651. {
  18652. description = "Resets the matrix to the identity matrix.",
  18653. arguments = {},
  18654. returns = {
  18655. {
  18656. name = "m",
  18657. type = "Mat4",
  18658. description = "The input matrix."
  18659. }
  18660. }
  18661. },
  18662. {
  18663. description = "Copies the values from an existing matrix.",
  18664. arguments = {
  18665. {
  18666. name = "n",
  18667. type = "mat4",
  18668. description = "An existing matrix to copy the values from."
  18669. }
  18670. },
  18671. returns = {
  18672. {
  18673. name = "m",
  18674. type = "Mat4",
  18675. description = "The input matrix."
  18676. }
  18677. }
  18678. },
  18679. {
  18680. arguments = {
  18681. {
  18682. name = "position",
  18683. type = "Vec3",
  18684. description = "The translation of the matrix.",
  18685. default = "0, 0, 0"
  18686. },
  18687. {
  18688. name = "scale",
  18689. type = "Vec3",
  18690. description = "The scale of the matrix.",
  18691. default = "1, 1, 1"
  18692. },
  18693. {
  18694. name = "rotation",
  18695. type = "Quat",
  18696. description = "The rotation of the matrix.",
  18697. default = "0, 0, 0, 1"
  18698. }
  18699. },
  18700. returns = {
  18701. {
  18702. name = "m",
  18703. type = "Mat4",
  18704. description = "The input matrix."
  18705. }
  18706. }
  18707. },
  18708. {
  18709. arguments = {
  18710. {
  18711. name = "position",
  18712. type = "Vec3",
  18713. description = "The translation of the matrix.",
  18714. default = "0, 0, 0"
  18715. },
  18716. {
  18717. name = "rotation",
  18718. type = "Quat",
  18719. description = "The rotation of the matrix.",
  18720. default = "0, 0, 0, 1"
  18721. }
  18722. },
  18723. returns = {
  18724. {
  18725. name = "m",
  18726. type = "Mat4",
  18727. description = "The input matrix."
  18728. }
  18729. }
  18730. },
  18731. {
  18732. arguments = {
  18733. {
  18734. name = "...",
  18735. type = "number",
  18736. description = "16 numbers to use as the raw values of the matrix (column-major)."
  18737. }
  18738. },
  18739. returns = {
  18740. {
  18741. name = "m",
  18742. type = "Mat4",
  18743. description = "The input matrix."
  18744. }
  18745. }
  18746. },
  18747. {
  18748. description = "Sets the diagonal values to a number and everything else to 0.",
  18749. arguments = {
  18750. {
  18751. name = "d",
  18752. type = "number",
  18753. description = "A number to use for the diagonal elements."
  18754. }
  18755. },
  18756. returns = {
  18757. {
  18758. name = "m",
  18759. type = "Mat4",
  18760. description = "The input matrix."
  18761. }
  18762. }
  18763. }
  18764. }
  18765. },
  18766. {
  18767. name = "target",
  18768. summary = "Create a model transform that targets from a position to target position.",
  18769. description = "Sets a model transform matrix that moves to `from` and orients model towards `to` point.\n\nThis is used when rendered model should always point towards a point of interest. The resulting Mat4 object can be used as model pose.\n\nThe target() function produces same result as lookAt() after matrix inversion.",
  18770. key = "Mat4:target",
  18771. module = "lovr.math",
  18772. related = {
  18773. "Mat4:lookAt",
  18774. "Quat:direction"
  18775. },
  18776. variants = {
  18777. {
  18778. arguments = {
  18779. {
  18780. name = "from",
  18781. type = "Vec3",
  18782. description = "The position of the viewer."
  18783. },
  18784. {
  18785. name = "to",
  18786. type = "Vec3",
  18787. description = "The position of the target."
  18788. },
  18789. {
  18790. name = "up",
  18791. type = "Vec3",
  18792. description = "The up vector of the viewer.",
  18793. default = "Vec3(0, 1, 0)"
  18794. }
  18795. },
  18796. returns = {
  18797. {
  18798. name = "m",
  18799. type = "Mat4",
  18800. description = "The original matrix."
  18801. }
  18802. }
  18803. }
  18804. }
  18805. },
  18806. {
  18807. name = "translate",
  18808. summary = "Translate the matrix.",
  18809. description = "Translates the matrix.",
  18810. key = "Mat4:translate",
  18811. module = "lovr.math",
  18812. related = {
  18813. "Mat4:rotate",
  18814. "Mat4:scale",
  18815. "Mat4:identity"
  18816. },
  18817. variants = {
  18818. {
  18819. arguments = {
  18820. {
  18821. name = "v",
  18822. type = "Vec3",
  18823. description = "The translation vector."
  18824. }
  18825. },
  18826. returns = {
  18827. {
  18828. name = "m",
  18829. type = "Mat4",
  18830. description = "The original matrix."
  18831. }
  18832. }
  18833. },
  18834. {
  18835. arguments = {
  18836. {
  18837. name = "x",
  18838. type = "number",
  18839. description = "The x component of the translation."
  18840. },
  18841. {
  18842. name = "y",
  18843. type = "number",
  18844. description = "The y component of the translation."
  18845. },
  18846. {
  18847. name = "z",
  18848. type = "number",
  18849. description = "The z component of the translation."
  18850. }
  18851. },
  18852. returns = {
  18853. {
  18854. name = "m",
  18855. type = "Mat4",
  18856. description = "The original matrix."
  18857. }
  18858. }
  18859. }
  18860. }
  18861. },
  18862. {
  18863. name = "transpose",
  18864. summary = "Transpose the matrix.",
  18865. description = "Transposes the matrix, mirroring its values along the diagonal.",
  18866. key = "Mat4:transpose",
  18867. module = "lovr.math",
  18868. variants = {
  18869. {
  18870. arguments = {},
  18871. returns = {
  18872. {
  18873. name = "m",
  18874. type = "Mat4",
  18875. description = "The original matrix."
  18876. }
  18877. }
  18878. }
  18879. }
  18880. },
  18881. {
  18882. name = "unpack",
  18883. summary = "Get the individual components of the matrix.",
  18884. description = "Returns the components of matrix, either as 10 separated numbers representing the position, scale, and rotation, or as 16 raw numbers representing the individual components of the matrix in column-major order.",
  18885. key = "Mat4:unpack",
  18886. module = "lovr.math",
  18887. related = {
  18888. "Mat4:set"
  18889. },
  18890. variants = {
  18891. {
  18892. arguments = {
  18893. {
  18894. name = "raw",
  18895. type = "boolean",
  18896. description = "Whether to return the 16 raw components."
  18897. }
  18898. },
  18899. returns = {
  18900. {
  18901. name = "...",
  18902. type = "number",
  18903. description = "The requested components of the matrix."
  18904. }
  18905. }
  18906. }
  18907. }
  18908. }
  18909. }
  18910. },
  18911. {
  18912. name = "Quat",
  18913. summary = "A quaternion.",
  18914. description = "A `quat` is a math type that represents a 3D rotation, stored as four numbers.",
  18915. key = "Quat",
  18916. module = "lovr.math",
  18917. constructors = {
  18918. "lovr.math.newQuat",
  18919. "lovr.math.quat"
  18920. },
  18921. related = {
  18922. "Vec3",
  18923. "Mat4"
  18924. },
  18925. methods = {
  18926. {
  18927. name = "conjugate",
  18928. summary = "Conjugate (invert) the quaternion.",
  18929. description = "Conjugates the input quaternion in place, returning the input. If the quaternion is normalized, this is the same as inverting it. It negates the (x, y, z) components of the quaternion.",
  18930. key = "Quat:conjugate",
  18931. module = "lovr.math",
  18932. variants = {
  18933. {
  18934. arguments = {},
  18935. returns = {
  18936. {
  18937. name = "q",
  18938. type = "Quat",
  18939. description = "The original quaternion."
  18940. }
  18941. }
  18942. }
  18943. }
  18944. },
  18945. {
  18946. name = "direction",
  18947. summary = "Get the direction of the quaternion.",
  18948. description = "Creates a new temporary vec3 facing the forward direction, rotates it by this quaternion, and returns the vector.",
  18949. key = "Quat:direction",
  18950. module = "lovr.math",
  18951. related = {
  18952. "Mat4:lookAt"
  18953. },
  18954. variants = {
  18955. {
  18956. arguments = {},
  18957. returns = {
  18958. {
  18959. name = "v",
  18960. type = "Vec3",
  18961. description = "The direction vector."
  18962. }
  18963. }
  18964. }
  18965. }
  18966. },
  18967. {
  18968. name = "equals",
  18969. summary = "Check if a quaternion equals another quaternion.",
  18970. description = "Returns whether a quaternion is approximately equal to another quaternion.",
  18971. key = "Quat:equals",
  18972. module = "lovr.math",
  18973. related = {
  18974. "Vec2:equals",
  18975. "Vec3:equals",
  18976. "Vec4:equals",
  18977. "Mat4:equals"
  18978. },
  18979. variants = {
  18980. {
  18981. arguments = {
  18982. {
  18983. name = "r",
  18984. type = "Quat",
  18985. description = "The other quaternion."
  18986. }
  18987. },
  18988. returns = {
  18989. {
  18990. name = "equal",
  18991. type = "boolean",
  18992. description = "Whether the 2 quaternions approximately equal each other."
  18993. }
  18994. }
  18995. }
  18996. }
  18997. },
  18998. {
  18999. name = "length",
  19000. summary = "Get the length of the quaternion.",
  19001. description = "Returns the length of the quaternion.",
  19002. key = "Quat:length",
  19003. module = "lovr.math",
  19004. related = {
  19005. "Quat:normalize"
  19006. },
  19007. variants = {
  19008. {
  19009. arguments = {},
  19010. returns = {
  19011. {
  19012. name = "length",
  19013. type = "number",
  19014. description = "The length of the quaternion."
  19015. }
  19016. }
  19017. }
  19018. }
  19019. },
  19020. {
  19021. name = "mul",
  19022. summary = "Multiply a quaternion by another quaternion or a vector.",
  19023. description = "Multiplies this quaternion by another value. If the value is a quaternion, the rotations in the two quaternions are applied sequentially and the result is stored in the first quaternion. If the value is a vector, then the input vector is rotated by the quaternion and returned.",
  19024. key = "Quat:mul",
  19025. module = "lovr.math",
  19026. variants = {
  19027. {
  19028. arguments = {
  19029. {
  19030. name = "r",
  19031. type = "quat",
  19032. description = "A quaternion to combine with the original."
  19033. }
  19034. },
  19035. returns = {
  19036. {
  19037. name = "q",
  19038. type = "quat",
  19039. description = "The original quaternion."
  19040. }
  19041. }
  19042. },
  19043. {
  19044. arguments = {
  19045. {
  19046. name = "v3",
  19047. type = "vec3",
  19048. description = "A vector to rotate."
  19049. }
  19050. },
  19051. returns = {
  19052. {
  19053. name = "v3",
  19054. type = "vec3",
  19055. description = "Vector rotated by quaternion."
  19056. }
  19057. }
  19058. }
  19059. }
  19060. },
  19061. {
  19062. name = "normalize",
  19063. summary = "Normalize the length of the quaternion to 1.",
  19064. description = "Adjusts the values in the quaternion so that its length becomes 1.",
  19065. key = "Quat:normalize",
  19066. module = "lovr.math",
  19067. notes = "A common source of bugs with quaternions is to forget to normalize them after performing a series of operations on them. Try normalizing a quaternion if some of the calculations aren't working quite right!",
  19068. variants = {
  19069. {
  19070. arguments = {},
  19071. returns = {
  19072. {
  19073. name = "q",
  19074. type = "Quat",
  19075. description = "The original quaternion."
  19076. }
  19077. }
  19078. }
  19079. },
  19080. related = {
  19081. "Quat:length"
  19082. }
  19083. },
  19084. {
  19085. name = "set",
  19086. summary = "Set the components of the quaternion.",
  19087. description = "Sets the components of the quaternion. There are lots of different ways to specify the new components, the summary is:\n\n- Four numbers can be used to specify an angle/axis rotation, similar to other LÖVR functions.\n- Four numbers plus the fifth `raw` flag can be used to set the raw values of the quaternion.\n- An existing quaternion can be passed in to copy its values.\n- A single direction vector can be specified to turn its direction (relative to the default\n forward direction of \"negative z\") into a rotation.\n- Two direction vectors can be specified to set the quaternion equal to the rotation between the\n two vectors.\n- A matrix can be passed in to extract the rotation of the matrix into a quaternion.",
  19088. key = "Quat:set",
  19089. module = "lovr.math",
  19090. related = {
  19091. "Quat:unpack"
  19092. },
  19093. variants = {
  19094. {
  19095. arguments = {
  19096. {
  19097. name = "angle",
  19098. description = "The angle to use for the rotation, in radians.",
  19099. default = "0"
  19100. },
  19101. {
  19102. name = "ax",
  19103. type = "number",
  19104. description = "The x component of the axis of rotation.",
  19105. default = "0"
  19106. },
  19107. {
  19108. name = "ay",
  19109. type = "number",
  19110. description = "The y component of the axis of rotation.",
  19111. default = "0"
  19112. },
  19113. {
  19114. name = "az",
  19115. type = "number",
  19116. description = "The z component of the axis of rotation.",
  19117. default = "0"
  19118. },
  19119. {
  19120. name = "raw",
  19121. type = "boolean",
  19122. description = "Whether the components should be interpreted as raw `(x, y, z, w)` components.",
  19123. default = "false"
  19124. }
  19125. },
  19126. returns = {
  19127. {
  19128. name = "q",
  19129. type = "quat",
  19130. description = "The original quaternion."
  19131. }
  19132. }
  19133. },
  19134. {
  19135. arguments = {
  19136. {
  19137. name = "r",
  19138. type = "quat",
  19139. description = "An existing quaternion to copy the values from."
  19140. }
  19141. },
  19142. returns = {
  19143. {
  19144. name = "q",
  19145. type = "quat",
  19146. description = "The original quaternion."
  19147. }
  19148. }
  19149. },
  19150. {
  19151. description = "Sets the values from a direction vector.",
  19152. arguments = {
  19153. {
  19154. name = "v",
  19155. type = "vec3",
  19156. description = "A normalized direction vector."
  19157. }
  19158. },
  19159. returns = {
  19160. {
  19161. name = "q",
  19162. type = "quat",
  19163. description = "The original quaternion."
  19164. }
  19165. }
  19166. },
  19167. {
  19168. description = "Sets the values to represent the rotation between two vectors.",
  19169. arguments = {
  19170. {
  19171. name = "v",
  19172. type = "vec3",
  19173. description = "A normalized direction vector."
  19174. },
  19175. {
  19176. name = "u",
  19177. type = "vec3",
  19178. description = "Another normalized direction vector."
  19179. }
  19180. },
  19181. returns = {
  19182. {
  19183. name = "q",
  19184. type = "quat",
  19185. description = "The original quaternion."
  19186. }
  19187. }
  19188. },
  19189. {
  19190. arguments = {
  19191. {
  19192. name = "m",
  19193. type = "mat4",
  19194. description = "A matrix to use the rotation from."
  19195. }
  19196. },
  19197. returns = {
  19198. {
  19199. name = "q",
  19200. type = "quat",
  19201. description = "The original quaternion."
  19202. }
  19203. }
  19204. },
  19205. {
  19206. description = "Reset the quaternion to the identity (0, 0, 0, 1).",
  19207. arguments = {},
  19208. returns = {
  19209. {
  19210. name = "q",
  19211. type = "quat",
  19212. description = "The original quaternion."
  19213. }
  19214. }
  19215. }
  19216. }
  19217. },
  19218. {
  19219. name = "slerp",
  19220. summary = "Moves this quaternion some amount towards another one.",
  19221. description = "Performs a spherical linear interpolation between this quaternion and another one, which can be used for smoothly animating between two rotations.\n\nThe amount of interpolation is controlled by a parameter `t`. A `t` value of zero leaves the original quaternion unchanged, whereas a `t` of one sets the original quaternion exactly equal to the target. A value between `0` and `1` returns a rotation between the two based on the value.",
  19222. key = "Quat:slerp",
  19223. module = "lovr.math",
  19224. related = {
  19225. "Vec3:lerp"
  19226. },
  19227. variants = {
  19228. {
  19229. arguments = {
  19230. {
  19231. name = "r",
  19232. type = "Quat",
  19233. description = "The quaternion to slerp towards."
  19234. },
  19235. {
  19236. name = "t",
  19237. type = "number",
  19238. description = "The lerping parameter."
  19239. }
  19240. },
  19241. returns = {
  19242. {
  19243. name = "q",
  19244. type = "Quat",
  19245. description = "The original quaternion, containing the new lerped values."
  19246. }
  19247. }
  19248. }
  19249. }
  19250. },
  19251. {
  19252. name = "unpack",
  19253. summary = "Get the components of the quaternion.",
  19254. description = "Returns the components of the quaternion as numbers, either in an angle/axis representation or as raw quaternion values.",
  19255. key = "Quat:unpack",
  19256. module = "lovr.math",
  19257. related = {
  19258. "Quat:set"
  19259. },
  19260. variants = {
  19261. {
  19262. arguments = {
  19263. {
  19264. name = "raw",
  19265. type = "boolean",
  19266. description = "Whether the values should be returned as raw values instead of angle/axis.",
  19267. default = "false"
  19268. }
  19269. },
  19270. returns = {
  19271. {
  19272. name = "a",
  19273. type = "number",
  19274. description = "The angle in radians, or the x value."
  19275. },
  19276. {
  19277. name = "b",
  19278. type = "number",
  19279. description = "The x component of the rotation axis or the y value."
  19280. },
  19281. {
  19282. name = "c",
  19283. type = "number",
  19284. description = "The y component of the rotation axis or the z value."
  19285. },
  19286. {
  19287. name = "d",
  19288. type = "number",
  19289. description = "The z component of the rotation axis or the w value."
  19290. }
  19291. }
  19292. }
  19293. }
  19294. }
  19295. }
  19296. },
  19297. {
  19298. name = "RandomGenerator",
  19299. summary = "A pseudo-random number generator.",
  19300. description = "A RandomGenerator is a standalone object that can be used to independently generate pseudo-random numbers. If you just need basic randomness, you can use `lovr.math.random` without needing to create a random generator.",
  19301. key = "RandomGenerator",
  19302. module = "lovr.math",
  19303. constructors = {
  19304. "lovr.math.newRandomGenerator"
  19305. },
  19306. methods = {
  19307. {
  19308. name = "getSeed",
  19309. summary = "Get the seed value of the RandomGenerator.",
  19310. description = "Returns the seed used to initialize the RandomGenerator.",
  19311. key = "RandomGenerator:getSeed",
  19312. module = "lovr.math",
  19313. notes = "Since the seed is a 64 bit integer, each 32 bits of the seed are returned separately to avoid precision issues.",
  19314. variants = {
  19315. {
  19316. arguments = {},
  19317. returns = {
  19318. {
  19319. name = "low",
  19320. type = "number",
  19321. description = "The lower 32 bits of the seed."
  19322. },
  19323. {
  19324. name = "high",
  19325. type = "number",
  19326. description = "The upper 32 bits of the seed."
  19327. }
  19328. }
  19329. }
  19330. },
  19331. related = {
  19332. "lovr.math.newRandomGenerator"
  19333. }
  19334. },
  19335. {
  19336. name = "getState",
  19337. summary = "Get the current state of the RandomGenerator.",
  19338. description = "Returns the current state of the RandomGenerator. This can be used with `RandomGenerator:setState` to reliably restore a previous state of the generator.",
  19339. key = "RandomGenerator:getState",
  19340. module = "lovr.math",
  19341. notes = "The seed represents the starting state of the RandomGenerator, whereas the state represents the current state of the generator.",
  19342. variants = {
  19343. {
  19344. arguments = {},
  19345. returns = {
  19346. {
  19347. name = "state",
  19348. type = "string",
  19349. description = "The serialized state."
  19350. }
  19351. }
  19352. }
  19353. }
  19354. },
  19355. {
  19356. name = "random",
  19357. summary = "Get a random number.",
  19358. description = "Returns the next uniformly distributed pseudo-random number from the RandomGenerator's sequence.",
  19359. key = "RandomGenerator:random",
  19360. module = "lovr.math",
  19361. related = {
  19362. "lovr.math.random",
  19363. "RandomGenerator:randomNormal"
  19364. },
  19365. variants = {
  19366. {
  19367. description = "Generate a pseudo-random floating point number in the range `[0,1)`",
  19368. arguments = {},
  19369. returns = {
  19370. {
  19371. name = "x",
  19372. type = "number",
  19373. description = "A pseudo-random number."
  19374. }
  19375. }
  19376. },
  19377. {
  19378. description = "Generate a pseudo-random integer in the range `[1,high]`",
  19379. arguments = {
  19380. {
  19381. name = "high",
  19382. type = "number",
  19383. description = "The maximum number to generate."
  19384. }
  19385. },
  19386. returns = {
  19387. {
  19388. name = "x",
  19389. type = "number",
  19390. description = "A pseudo-random number."
  19391. }
  19392. }
  19393. },
  19394. {
  19395. description = "Generate a pseudo-random integer in the range `[low,high]`",
  19396. arguments = {
  19397. {
  19398. name = "low",
  19399. type = "number",
  19400. description = "The minimum number to generate."
  19401. },
  19402. {
  19403. name = "high",
  19404. type = "number",
  19405. description = "The maximum number to generate."
  19406. }
  19407. },
  19408. returns = {
  19409. {
  19410. name = "x",
  19411. type = "number",
  19412. description = "A pseudo-random number."
  19413. }
  19414. }
  19415. }
  19416. }
  19417. },
  19418. {
  19419. name = "randomNormal",
  19420. summary = "Get a random number from a normal distribution.",
  19421. description = "Returns a pseudo-random number from a normal distribution (a bell curve). You can control the center of the bell curve (the mean value) and the overall width (sigma, or standard deviation).",
  19422. key = "RandomGenerator:randomNormal",
  19423. module = "lovr.math",
  19424. related = {
  19425. "lovr.math.randomNormal",
  19426. "RandomGenerator:random"
  19427. },
  19428. variants = {
  19429. {
  19430. arguments = {
  19431. {
  19432. name = "sigma",
  19433. type = "number",
  19434. description = "The standard deviation of the distribution. This can be thought of how \"wide\" the range of numbers is or how much variability there is.",
  19435. default = "1"
  19436. },
  19437. {
  19438. name = "mu",
  19439. type = "number",
  19440. description = "The average value returned.",
  19441. default = "0"
  19442. }
  19443. },
  19444. returns = {
  19445. {
  19446. name = "x",
  19447. type = "number",
  19448. description = "A normally distributed pseudo-random number."
  19449. }
  19450. }
  19451. }
  19452. }
  19453. },
  19454. {
  19455. name = "setSeed",
  19456. summary = "Reinitialize the RandomGenerator with a new seed.",
  19457. description = "Seed the RandomGenerator with a new seed. Each seed will cause the RandomGenerator to produce a unique sequence of random numbers.",
  19458. key = "RandomGenerator:setSeed",
  19459. module = "lovr.math",
  19460. notes = "For precise 64 bit seeds, you should specify the lower and upper 32 bits of the seed separately. Otherwise, seeds larger than 2^53 will start to lose precision.",
  19461. variants = {
  19462. {
  19463. arguments = {
  19464. {
  19465. name = "seed",
  19466. type = "number",
  19467. description = "The random seed."
  19468. }
  19469. },
  19470. returns = {}
  19471. },
  19472. {
  19473. arguments = {
  19474. {
  19475. name = "low",
  19476. type = "number",
  19477. description = "The lower 32 bits of the seed."
  19478. },
  19479. {
  19480. name = "high",
  19481. type = "number",
  19482. description = "The upper 32 bits of the seed."
  19483. }
  19484. },
  19485. returns = {}
  19486. }
  19487. }
  19488. },
  19489. {
  19490. name = "setState",
  19491. summary = "Set the state of the RandomGenerator.",
  19492. description = "Sets the state of the RandomGenerator, as previously obtained using `RandomGenerator:getState`. This can be used to reliably restore a previous state of the generator.",
  19493. key = "RandomGenerator:setState",
  19494. module = "lovr.math",
  19495. notes = "The seed represents the starting state of the RandomGenerator, whereas the state represents the current state of the generator.",
  19496. variants = {
  19497. {
  19498. arguments = {
  19499. {
  19500. name = "state",
  19501. type = "string",
  19502. description = "The serialized state."
  19503. }
  19504. },
  19505. returns = {}
  19506. }
  19507. }
  19508. }
  19509. }
  19510. },
  19511. {
  19512. name = "Vec2",
  19513. summary = "A 2D vector.",
  19514. description = "A vector object that holds two numbers.",
  19515. key = "Vec2",
  19516. module = "lovr.math",
  19517. constructors = {
  19518. "lovr.math.newVec2",
  19519. "lovr.math.vec2"
  19520. },
  19521. related = {
  19522. "Vec3",
  19523. "Vec4"
  19524. },
  19525. methods = {
  19526. {
  19527. name = "add",
  19528. summary = "Add a vector or a number to the vector.",
  19529. description = "Adds a vector or a number to the vector.",
  19530. key = "Vec2:add",
  19531. module = "lovr.math",
  19532. related = {
  19533. "Vec2:sub",
  19534. "Vec2:mul",
  19535. "Vec2:div"
  19536. },
  19537. variants = {
  19538. {
  19539. arguments = {
  19540. {
  19541. name = "u",
  19542. type = "Vec2",
  19543. description = "The other vector."
  19544. }
  19545. },
  19546. returns = {
  19547. {
  19548. name = "v",
  19549. type = "Vec2",
  19550. description = "The original vector."
  19551. }
  19552. }
  19553. },
  19554. {
  19555. arguments = {
  19556. {
  19557. name = "x",
  19558. type = "number",
  19559. description = "A value to add to x component."
  19560. },
  19561. {
  19562. name = "y",
  19563. type = "number",
  19564. description = "A value to add to y component.",
  19565. default = "x"
  19566. }
  19567. },
  19568. returns = {
  19569. {
  19570. name = "v",
  19571. type = "Vec2",
  19572. description = "The original vector."
  19573. }
  19574. }
  19575. }
  19576. }
  19577. },
  19578. {
  19579. name = "angle",
  19580. summary = "Get the angle to another vector.",
  19581. description = "Returns the angle between vectors.",
  19582. key = "Vec2:angle",
  19583. module = "lovr.math",
  19584. notes = "If any of the two vectors have a length of zero, the angle between them is not well defined. In this case the function returns `math.pi / 2`.",
  19585. variants = {
  19586. {
  19587. arguments = {
  19588. {
  19589. name = "u",
  19590. type = "Vec2",
  19591. description = "The other vector."
  19592. }
  19593. },
  19594. returns = {
  19595. {
  19596. name = "angle",
  19597. type = "number",
  19598. description = "The angle to the other vector, in radians."
  19599. }
  19600. }
  19601. },
  19602. {
  19603. arguments = {
  19604. {
  19605. name = "x",
  19606. type = "number",
  19607. description = "The x component of the other vector."
  19608. },
  19609. {
  19610. name = "y",
  19611. type = "number",
  19612. description = "The y component of the other vector."
  19613. }
  19614. },
  19615. returns = {
  19616. {
  19617. name = "angle",
  19618. type = "number",
  19619. description = "The angle to the other vector, in radians."
  19620. }
  19621. }
  19622. }
  19623. },
  19624. related = {
  19625. "Vec2:distance",
  19626. "Vec2:length"
  19627. }
  19628. },
  19629. {
  19630. name = "distance",
  19631. summary = "Get the distance to another vector.",
  19632. description = "Returns the distance to another vector.",
  19633. key = "Vec2:distance",
  19634. module = "lovr.math",
  19635. related = {
  19636. "Vec2:angle",
  19637. "Vec2:length"
  19638. },
  19639. variants = {
  19640. {
  19641. arguments = {
  19642. {
  19643. name = "u",
  19644. type = "Vec2",
  19645. description = "The vector to measure the distance to."
  19646. }
  19647. },
  19648. returns = {
  19649. {
  19650. name = "distance",
  19651. type = "number",
  19652. description = "The distance to `u`."
  19653. }
  19654. }
  19655. },
  19656. {
  19657. arguments = {
  19658. {
  19659. name = "x",
  19660. type = "number",
  19661. description = "A value of x component to measure distance to."
  19662. },
  19663. {
  19664. name = "y",
  19665. type = "number",
  19666. description = "A value of y component to measure distance to."
  19667. }
  19668. },
  19669. returns = {
  19670. {
  19671. name = "distance",
  19672. type = "number",
  19673. description = "The distance to `u`."
  19674. }
  19675. }
  19676. }
  19677. }
  19678. },
  19679. {
  19680. name = "div",
  19681. summary = "Divides the vector by a vector or a number.",
  19682. description = "Divides the vector by a vector or a number.",
  19683. key = "Vec2:div",
  19684. module = "lovr.math",
  19685. related = {
  19686. "Vec2:add",
  19687. "Vec2:sub",
  19688. "Vec2:mul"
  19689. },
  19690. variants = {
  19691. {
  19692. arguments = {
  19693. {
  19694. name = "u",
  19695. type = "Vec2",
  19696. description = "The other vector to divide the components by."
  19697. }
  19698. },
  19699. returns = {
  19700. {
  19701. name = "v",
  19702. type = "Vec2",
  19703. description = "The original vector."
  19704. }
  19705. }
  19706. },
  19707. {
  19708. arguments = {
  19709. {
  19710. name = "x",
  19711. type = "number",
  19712. description = "A value to divide x component by."
  19713. },
  19714. {
  19715. name = "y",
  19716. type = "number",
  19717. description = "A value to divide y component by.",
  19718. default = "x"
  19719. }
  19720. },
  19721. returns = {
  19722. {
  19723. name = "v",
  19724. type = "Vec2",
  19725. description = "The original vector."
  19726. }
  19727. }
  19728. }
  19729. }
  19730. },
  19731. {
  19732. name = "dot",
  19733. summary = "Get the dot product with another vector.",
  19734. description = "Returns the dot product between this vector and another one.",
  19735. key = "Vec2:dot",
  19736. module = "lovr.math",
  19737. notes = "This is computed as:\n\n dot = v.x * u.x + v.y * u.y\n\nThe vectors are not normalized before computing the dot product.",
  19738. variants = {
  19739. {
  19740. arguments = {
  19741. {
  19742. name = "u",
  19743. type = "Vec2",
  19744. description = "The vector to compute the dot product with."
  19745. }
  19746. },
  19747. returns = {
  19748. {
  19749. name = "dot",
  19750. type = "number",
  19751. description = "The dot product between `v` and `u`."
  19752. }
  19753. }
  19754. },
  19755. {
  19756. arguments = {
  19757. {
  19758. name = "x",
  19759. type = "number",
  19760. description = "A value of x component to compute the dot product with."
  19761. },
  19762. {
  19763. name = "y",
  19764. type = "number",
  19765. description = "A value of y component to compute the dot product with."
  19766. }
  19767. },
  19768. returns = {
  19769. {
  19770. name = "dot",
  19771. type = "number",
  19772. description = "The dot product between `v` and `u`."
  19773. }
  19774. }
  19775. }
  19776. }
  19777. },
  19778. {
  19779. name = "equals",
  19780. summary = "Check if a vector equals another vector.",
  19781. description = "Returns whether a vector is approximately equal to another vector.",
  19782. key = "Vec2:equals",
  19783. module = "lovr.math",
  19784. notes = "To handle floating point precision issues, this function returns true as long as the squared distance between the vectors is below `1e-10`.",
  19785. variants = {
  19786. {
  19787. arguments = {
  19788. {
  19789. name = "u",
  19790. type = "Vec2",
  19791. description = "The other vector."
  19792. }
  19793. },
  19794. returns = {
  19795. {
  19796. name = "equal",
  19797. type = "boolean",
  19798. description = "Whether the 2 vectors approximately equal each other."
  19799. }
  19800. }
  19801. },
  19802. {
  19803. arguments = {
  19804. {
  19805. name = "x",
  19806. type = "number",
  19807. description = "The x component of the other vector."
  19808. },
  19809. {
  19810. name = "y",
  19811. type = "number",
  19812. description = "The y component of the other vector."
  19813. }
  19814. },
  19815. returns = {
  19816. {
  19817. name = "equal",
  19818. type = "boolean",
  19819. description = "Whether the 2 vectors approximately equal each other."
  19820. }
  19821. }
  19822. }
  19823. },
  19824. related = {
  19825. "Vec3:equals",
  19826. "Vec4:equals",
  19827. "Quat:equals",
  19828. "Mat4:equals"
  19829. }
  19830. },
  19831. {
  19832. name = "length",
  19833. summary = "Get the length of the vector.",
  19834. description = "Returns the length of the vector.",
  19835. key = "Vec2:length",
  19836. module = "lovr.math",
  19837. notes = "The length is equivalent to this:\n\n math.sqrt(v.x * v.x + v.y * v.y)",
  19838. variants = {
  19839. {
  19840. arguments = {},
  19841. returns = {
  19842. {
  19843. name = "length",
  19844. type = "number",
  19845. description = "The length of the vector."
  19846. }
  19847. }
  19848. }
  19849. },
  19850. related = {
  19851. "Vec2:normalize",
  19852. "Vec2:distance"
  19853. }
  19854. },
  19855. {
  19856. name = "lerp",
  19857. summary = "Moves this vector some amount towards another one.",
  19858. description = "Performs a linear interpolation between this vector and another one, which can be used to smoothly animate between two vectors, based on a parameter value. A parameter value of `0` will leave the vector unchanged, a parameter value of `1` will set the vector to be equal to the input vector, and a value of `.5` will set the components to be halfway between the two vectors.",
  19859. key = "Vec2:lerp",
  19860. module = "lovr.math",
  19861. related = {
  19862. "Quat:slerp"
  19863. },
  19864. variants = {
  19865. {
  19866. arguments = {
  19867. {
  19868. name = "u",
  19869. type = "Vec2",
  19870. description = "The vector to lerp towards."
  19871. },
  19872. {
  19873. name = "t",
  19874. type = "number",
  19875. description = "The lerping parameter."
  19876. }
  19877. },
  19878. returns = {
  19879. {
  19880. name = "v",
  19881. type = "Vec2",
  19882. description = "The original vector, containing the new lerped values."
  19883. }
  19884. }
  19885. },
  19886. {
  19887. arguments = {
  19888. {
  19889. name = "x",
  19890. type = "number",
  19891. description = "A value of x component to lerp towards."
  19892. },
  19893. {
  19894. name = "y",
  19895. type = "number",
  19896. description = "A value of y component to lerp towards."
  19897. },
  19898. {
  19899. name = "t",
  19900. type = "number",
  19901. description = "The lerping parameter."
  19902. }
  19903. },
  19904. returns = {
  19905. {
  19906. name = "v",
  19907. type = "Vec2",
  19908. description = "The original vector, containing the new lerped values."
  19909. }
  19910. }
  19911. }
  19912. }
  19913. },
  19914. {
  19915. name = "mul",
  19916. summary = "Multiply the vector by a vector or a number.",
  19917. description = "Multiplies the vector by a vector or a number.",
  19918. key = "Vec2:mul",
  19919. module = "lovr.math",
  19920. related = {
  19921. "Vec2:add",
  19922. "Vec2:sub",
  19923. "Vec2:div"
  19924. },
  19925. variants = {
  19926. {
  19927. arguments = {
  19928. {
  19929. name = "u",
  19930. type = "Vec2",
  19931. description = "The other vector to multiply the components by."
  19932. }
  19933. },
  19934. returns = {
  19935. {
  19936. name = "v",
  19937. type = "Vec2",
  19938. description = "The original vector."
  19939. }
  19940. }
  19941. },
  19942. {
  19943. arguments = {
  19944. {
  19945. name = "x",
  19946. type = "number",
  19947. description = "A value to multiply x component by."
  19948. },
  19949. {
  19950. name = "y",
  19951. type = "number",
  19952. description = "A value to multiply y component by.",
  19953. default = "x"
  19954. }
  19955. },
  19956. returns = {
  19957. {
  19958. name = "v",
  19959. type = "Vec2",
  19960. description = "The original vector."
  19961. }
  19962. }
  19963. }
  19964. }
  19965. },
  19966. {
  19967. name = "normalize",
  19968. summary = "Normalize the length of the vector to 1.",
  19969. description = "Adjusts the values in the vector so that its direction stays the same but its length becomes 1.",
  19970. key = "Vec2:normalize",
  19971. module = "lovr.math",
  19972. related = {
  19973. "Vec2:length"
  19974. },
  19975. variants = {
  19976. {
  19977. arguments = {},
  19978. returns = {
  19979. {
  19980. name = "v",
  19981. type = "Vec2",
  19982. description = "The original vector."
  19983. }
  19984. }
  19985. }
  19986. }
  19987. },
  19988. {
  19989. name = "set",
  19990. summary = "Set the components of the vector.",
  19991. description = "Sets the components of the vector, either from numbers or an existing vector.",
  19992. key = "Vec2:set",
  19993. module = "lovr.math",
  19994. related = {
  19995. "Vec2:unpack"
  19996. },
  19997. variants = {
  19998. {
  19999. arguments = {
  20000. {
  20001. name = "x",
  20002. type = "number",
  20003. description = "The new x value of the vector.",
  20004. default = "0"
  20005. },
  20006. {
  20007. name = "y",
  20008. type = "number",
  20009. description = "The new y value of the vector.",
  20010. default = "x"
  20011. }
  20012. },
  20013. returns = {
  20014. {
  20015. name = "v",
  20016. type = "Vec2",
  20017. description = "The input vector."
  20018. }
  20019. }
  20020. },
  20021. {
  20022. arguments = {
  20023. {
  20024. name = "u",
  20025. type = "Vec2",
  20026. description = "The vector to copy the values from."
  20027. }
  20028. },
  20029. returns = {
  20030. {
  20031. name = "v",
  20032. type = "Vec2",
  20033. description = "The input vector."
  20034. }
  20035. }
  20036. }
  20037. }
  20038. },
  20039. {
  20040. name = "sub",
  20041. summary = "Subtract a vector or a number from the vector.",
  20042. description = "Subtracts a vector or a number from the vector.",
  20043. key = "Vec2:sub",
  20044. module = "lovr.math",
  20045. related = {
  20046. "Vec2:add",
  20047. "Vec2:mul",
  20048. "Vec2:div"
  20049. },
  20050. variants = {
  20051. {
  20052. arguments = {
  20053. {
  20054. name = "u",
  20055. type = "Vec2",
  20056. description = "The other vector."
  20057. }
  20058. },
  20059. returns = {
  20060. {
  20061. name = "v",
  20062. type = "Vec2",
  20063. description = "The original vector."
  20064. }
  20065. }
  20066. },
  20067. {
  20068. arguments = {
  20069. {
  20070. name = "x",
  20071. type = "number",
  20072. description = "A value to subtract from x component."
  20073. },
  20074. {
  20075. name = "y",
  20076. type = "number",
  20077. description = "A value to subtract from y component.",
  20078. default = "x"
  20079. }
  20080. },
  20081. returns = {
  20082. {
  20083. name = "v",
  20084. type = "Vec2",
  20085. description = "The original vector."
  20086. }
  20087. }
  20088. }
  20089. }
  20090. },
  20091. {
  20092. name = "unpack",
  20093. summary = "Get the components of the vector.",
  20094. description = "Returns the 2 components of the vector as numbers.",
  20095. key = "Vec2:unpack",
  20096. module = "lovr.math",
  20097. related = {
  20098. "Vec2:set"
  20099. },
  20100. variants = {
  20101. {
  20102. arguments = {},
  20103. returns = {
  20104. {
  20105. name = "x",
  20106. type = "number",
  20107. description = "The x value."
  20108. },
  20109. {
  20110. name = "y",
  20111. type = "number",
  20112. description = "The y value."
  20113. }
  20114. }
  20115. }
  20116. }
  20117. }
  20118. }
  20119. },
  20120. {
  20121. name = "Vec3",
  20122. summary = "A 3D vector.",
  20123. description = "A vector object that holds three numbers.",
  20124. key = "Vec3",
  20125. module = "lovr.math",
  20126. constructors = {
  20127. "lovr.math.newVec3",
  20128. "lovr.math.vec3"
  20129. },
  20130. related = {
  20131. "Vec2",
  20132. "Vec4"
  20133. },
  20134. methods = {
  20135. {
  20136. name = "add",
  20137. summary = "Add a vector or a number to the vector.",
  20138. description = "Adds a vector or a number to the vector.",
  20139. key = "Vec3:add",
  20140. module = "lovr.math",
  20141. related = {
  20142. "Vec3:sub",
  20143. "Vec3:mul",
  20144. "Vec3:div"
  20145. },
  20146. variants = {
  20147. {
  20148. arguments = {
  20149. {
  20150. name = "u",
  20151. type = "Vec3",
  20152. description = "The other vector."
  20153. }
  20154. },
  20155. returns = {
  20156. {
  20157. name = "v",
  20158. type = "Vec3",
  20159. description = "The original vector."
  20160. }
  20161. }
  20162. },
  20163. {
  20164. arguments = {
  20165. {
  20166. name = "x",
  20167. type = "number",
  20168. description = "A value to add to x component."
  20169. },
  20170. {
  20171. name = "y",
  20172. type = "number",
  20173. description = "A value to add to y component.",
  20174. default = "x"
  20175. },
  20176. {
  20177. name = "z",
  20178. type = "number",
  20179. description = "A value to add to z component.",
  20180. default = "x"
  20181. }
  20182. },
  20183. returns = {
  20184. {
  20185. name = "v",
  20186. type = "Vec3",
  20187. description = "The original vector."
  20188. }
  20189. }
  20190. }
  20191. }
  20192. },
  20193. {
  20194. name = "angle",
  20195. summary = "Get the angle to another vector.",
  20196. description = "Returns the angle between vectors.",
  20197. key = "Vec3:angle",
  20198. module = "lovr.math",
  20199. notes = "If any of the two vectors have a length of zero, the angle between them is not well defined. In this case the function returns `math.pi / 2`.",
  20200. variants = {
  20201. {
  20202. arguments = {
  20203. {
  20204. name = "u",
  20205. type = "Vec3",
  20206. description = "The other vector."
  20207. }
  20208. },
  20209. returns = {
  20210. {
  20211. name = "angle",
  20212. type = "number",
  20213. description = "The angle to the other vector, in radians."
  20214. }
  20215. }
  20216. },
  20217. {
  20218. arguments = {
  20219. {
  20220. name = "x",
  20221. type = "number",
  20222. description = "The x component of the other vector."
  20223. },
  20224. {
  20225. name = "y",
  20226. type = "number",
  20227. description = "The y component of the other vector."
  20228. },
  20229. {
  20230. name = "z",
  20231. type = "number",
  20232. description = "The z component of the other vector."
  20233. }
  20234. },
  20235. returns = {
  20236. {
  20237. name = "angle",
  20238. type = "number",
  20239. description = "The angle to the other vector, in radians."
  20240. }
  20241. }
  20242. }
  20243. },
  20244. related = {
  20245. "Vec3:distance",
  20246. "Vec3:length"
  20247. }
  20248. },
  20249. {
  20250. name = "cross",
  20251. summary = "Get the cross product with another vector.",
  20252. description = "Sets this vector to be equal to the cross product between this vector and another one. The new `v` will be perpendicular to both the old `v` and `u`.",
  20253. key = "Vec3:cross",
  20254. module = "lovr.math",
  20255. notes = "The vectors are not normalized before or after computing the cross product.",
  20256. variants = {
  20257. {
  20258. arguments = {
  20259. {
  20260. name = "u",
  20261. type = "Vec3",
  20262. description = "The vector to compute the cross product with."
  20263. }
  20264. },
  20265. returns = {
  20266. {
  20267. name = "v",
  20268. type = "Vec3",
  20269. description = "The original vector, with the cross product as its values."
  20270. }
  20271. }
  20272. },
  20273. {
  20274. arguments = {
  20275. {
  20276. name = "x",
  20277. type = "number",
  20278. description = "A value of x component to compute cross product with."
  20279. },
  20280. {
  20281. name = "y",
  20282. type = "number",
  20283. description = "A value of y component to compute cross product with."
  20284. },
  20285. {
  20286. name = "z",
  20287. type = "number",
  20288. description = "A value of z component to compute cross product with."
  20289. }
  20290. },
  20291. returns = {
  20292. {
  20293. name = "v",
  20294. type = "Vec3",
  20295. description = "The original vector, with the cross product as its values."
  20296. }
  20297. }
  20298. }
  20299. },
  20300. related = {
  20301. "Vec3:dot"
  20302. }
  20303. },
  20304. {
  20305. name = "distance",
  20306. summary = "Get the distance to another vector.",
  20307. description = "Returns the distance to another vector.",
  20308. key = "Vec3:distance",
  20309. module = "lovr.math",
  20310. related = {
  20311. "Vec3:angle",
  20312. "Vec3:length"
  20313. },
  20314. variants = {
  20315. {
  20316. arguments = {
  20317. {
  20318. name = "u",
  20319. type = "Vec3",
  20320. description = "The vector to measure the distance to."
  20321. }
  20322. },
  20323. returns = {
  20324. {
  20325. name = "distance",
  20326. type = "number",
  20327. description = "The distance to `u`."
  20328. }
  20329. }
  20330. },
  20331. {
  20332. arguments = {
  20333. {
  20334. name = "x",
  20335. type = "number",
  20336. description = "A value of x component to measure distance to."
  20337. },
  20338. {
  20339. name = "y",
  20340. type = "number",
  20341. description = "A value of y component to measure distance to."
  20342. },
  20343. {
  20344. name = "z",
  20345. type = "number",
  20346. description = "A value of z component to measure distance to."
  20347. }
  20348. },
  20349. returns = {
  20350. {
  20351. name = "distance",
  20352. type = "number",
  20353. description = "The distance to `u`."
  20354. }
  20355. }
  20356. }
  20357. }
  20358. },
  20359. {
  20360. name = "div",
  20361. summary = "Divides the vector by a vector or a number.",
  20362. description = "Divides the vector by a vector or a number.",
  20363. key = "Vec3:div",
  20364. module = "lovr.math",
  20365. related = {
  20366. "Vec3:add",
  20367. "Vec3:sub",
  20368. "Vec3:mul"
  20369. },
  20370. variants = {
  20371. {
  20372. arguments = {
  20373. {
  20374. name = "u",
  20375. type = "Vec3",
  20376. description = "The other vector to divide the components by."
  20377. }
  20378. },
  20379. returns = {
  20380. {
  20381. name = "v",
  20382. type = "Vec3",
  20383. description = "The original vector."
  20384. }
  20385. }
  20386. },
  20387. {
  20388. arguments = {
  20389. {
  20390. name = "x",
  20391. type = "number",
  20392. description = "A value to divide x component by."
  20393. },
  20394. {
  20395. name = "y",
  20396. type = "number",
  20397. description = "A value to divide y component by.",
  20398. default = "x"
  20399. },
  20400. {
  20401. name = "z",
  20402. type = "number",
  20403. description = "A value to divide z component by.",
  20404. default = "x"
  20405. }
  20406. },
  20407. returns = {
  20408. {
  20409. name = "v",
  20410. type = "Vec3",
  20411. description = "The original vector."
  20412. }
  20413. }
  20414. }
  20415. }
  20416. },
  20417. {
  20418. name = "dot",
  20419. summary = "Get the dot product with another vector.",
  20420. description = "Returns the dot product between this vector and another one.",
  20421. key = "Vec3:dot",
  20422. module = "lovr.math",
  20423. notes = "This is computed as:\n\n dot = v.x * u.x + v.y * u.y + v.z * u.z\n\nThe vectors are not normalized before computing the dot product.",
  20424. variants = {
  20425. {
  20426. arguments = {
  20427. {
  20428. name = "u",
  20429. type = "Vec3",
  20430. description = "The vector to compute the dot product with."
  20431. }
  20432. },
  20433. returns = {
  20434. {
  20435. name = "dot",
  20436. type = "number",
  20437. description = "The dot product between `v` and `u`."
  20438. }
  20439. }
  20440. },
  20441. {
  20442. arguments = {
  20443. {
  20444. name = "x",
  20445. type = "number",
  20446. description = "A value of x component to compute the dot product with."
  20447. },
  20448. {
  20449. name = "y",
  20450. type = "number",
  20451. description = "A value of y component to compute the dot product with."
  20452. },
  20453. {
  20454. name = "z",
  20455. type = "number",
  20456. description = "A value of z component to compute the dot product with."
  20457. }
  20458. },
  20459. returns = {
  20460. {
  20461. name = "dot",
  20462. type = "number",
  20463. description = "The dot product between `v` and `u`."
  20464. }
  20465. }
  20466. }
  20467. },
  20468. related = {
  20469. "Vec3:cross"
  20470. }
  20471. },
  20472. {
  20473. name = "equals",
  20474. summary = "Check if a vector equals another vector.",
  20475. description = "Returns whether a vector is approximately equal to another vector.",
  20476. key = "Vec3:equals",
  20477. module = "lovr.math",
  20478. notes = "To handle floating point precision issues, this function returns true as long as the squared distance between the vectors is below `1e-10`.",
  20479. variants = {
  20480. {
  20481. arguments = {
  20482. {
  20483. name = "u",
  20484. type = "Vec3",
  20485. description = "The other vector."
  20486. }
  20487. },
  20488. returns = {
  20489. {
  20490. name = "equal",
  20491. type = "boolean",
  20492. description = "Whether the 2 vectors approximately equal each other."
  20493. }
  20494. }
  20495. },
  20496. {
  20497. arguments = {
  20498. {
  20499. name = "x",
  20500. type = "number",
  20501. description = "The x component of the other vector."
  20502. },
  20503. {
  20504. name = "y",
  20505. type = "number",
  20506. description = "The y component of the other vector."
  20507. },
  20508. {
  20509. name = "z",
  20510. type = "number",
  20511. description = "The z component of the other vector."
  20512. }
  20513. },
  20514. returns = {
  20515. {
  20516. name = "equal",
  20517. type = "boolean",
  20518. description = "Whether the 2 vectors approximately equal each other."
  20519. }
  20520. }
  20521. }
  20522. },
  20523. related = {
  20524. "Vec2:equals",
  20525. "Vec4:equals",
  20526. "Quat:equals",
  20527. "Mat4:equals"
  20528. }
  20529. },
  20530. {
  20531. name = "length",
  20532. summary = "Get the length of the vector.",
  20533. description = "Returns the length of the vector.",
  20534. key = "Vec3:length",
  20535. module = "lovr.math",
  20536. notes = "The length is equivalent to this:\n\n math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)",
  20537. variants = {
  20538. {
  20539. arguments = {},
  20540. returns = {
  20541. {
  20542. name = "length",
  20543. type = "number",
  20544. description = "The length of the vector."
  20545. }
  20546. }
  20547. }
  20548. },
  20549. related = {
  20550. "Vec3:normalize",
  20551. "Vec3:distance"
  20552. }
  20553. },
  20554. {
  20555. name = "lerp",
  20556. summary = "Moves this vector some amount towards another one.",
  20557. description = "Performs a linear interpolation between this vector and another one, which can be used to smoothly animate between two vectors, based on a parameter value. A parameter value of `0` will leave the vector unchanged, a parameter value of `1` will set the vector to be equal to the input vector, and a value of `.5` will set the components to be halfway between the two vectors.",
  20558. key = "Vec3:lerp",
  20559. module = "lovr.math",
  20560. related = {
  20561. "Quat:slerp"
  20562. },
  20563. variants = {
  20564. {
  20565. arguments = {
  20566. {
  20567. name = "u",
  20568. type = "Vec3",
  20569. description = "The vector to lerp towards."
  20570. },
  20571. {
  20572. name = "t",
  20573. type = "number",
  20574. description = "The lerping parameter."
  20575. }
  20576. },
  20577. returns = {
  20578. {
  20579. name = "v",
  20580. type = "Vec3",
  20581. description = "The original vector, containing the new lerped values."
  20582. }
  20583. }
  20584. },
  20585. {
  20586. arguments = {
  20587. {
  20588. name = "x",
  20589. type = "number",
  20590. description = "A value of x component to lerp towards."
  20591. },
  20592. {
  20593. name = "y",
  20594. type = "number",
  20595. description = "A value of y component to lerp towards."
  20596. },
  20597. {
  20598. name = "z",
  20599. type = "number",
  20600. description = "A value of z component to lerp towards."
  20601. },
  20602. {
  20603. name = "t",
  20604. type = "number",
  20605. description = "The lerping parameter."
  20606. }
  20607. },
  20608. returns = {
  20609. {
  20610. name = "v",
  20611. type = "Vec3",
  20612. description = "The original vector, containing the new lerped values."
  20613. }
  20614. }
  20615. }
  20616. }
  20617. },
  20618. {
  20619. name = "mul",
  20620. summary = "Multiply the vector by a vector or a number.",
  20621. description = "Multiplies the vector by a vector or a number.",
  20622. key = "Vec3:mul",
  20623. module = "lovr.math",
  20624. related = {
  20625. "Vec3:add",
  20626. "Vec3:sub",
  20627. "Vec3:div"
  20628. },
  20629. variants = {
  20630. {
  20631. arguments = {
  20632. {
  20633. name = "u",
  20634. type = "Vec3",
  20635. description = "The other vector to multiply the components by."
  20636. }
  20637. },
  20638. returns = {
  20639. {
  20640. name = "v",
  20641. type = "Vec3",
  20642. description = "The original vector."
  20643. }
  20644. }
  20645. },
  20646. {
  20647. arguments = {
  20648. {
  20649. name = "x",
  20650. type = "number",
  20651. description = "A value to multiply x component by."
  20652. },
  20653. {
  20654. name = "y",
  20655. type = "number",
  20656. description = "A value to multiply y component by.",
  20657. default = "x"
  20658. },
  20659. {
  20660. name = "z",
  20661. type = "number",
  20662. description = "A value to multiply z component by.",
  20663. default = "x"
  20664. }
  20665. },
  20666. returns = {
  20667. {
  20668. name = "v",
  20669. type = "Vec3",
  20670. description = "The original vector."
  20671. }
  20672. }
  20673. }
  20674. }
  20675. },
  20676. {
  20677. name = "normalize",
  20678. summary = "Normalize the length of the vector to 1.",
  20679. description = "Adjusts the values in the vector so that its direction stays the same but its length becomes 1.",
  20680. key = "Vec3:normalize",
  20681. module = "lovr.math",
  20682. related = {
  20683. "Vec3:length"
  20684. },
  20685. variants = {
  20686. {
  20687. arguments = {},
  20688. returns = {
  20689. {
  20690. name = "v",
  20691. type = "Vec3",
  20692. description = "The original vector."
  20693. }
  20694. }
  20695. }
  20696. }
  20697. },
  20698. {
  20699. name = "set",
  20700. summary = "Set the components of the vector.",
  20701. description = "Sets the components of the vector, either from numbers or an existing vector.",
  20702. key = "Vec3:set",
  20703. module = "lovr.math",
  20704. related = {
  20705. "Vec3:unpack"
  20706. },
  20707. variants = {
  20708. {
  20709. arguments = {
  20710. {
  20711. name = "x",
  20712. type = "number",
  20713. description = "The new x value of the vector.",
  20714. default = "0"
  20715. },
  20716. {
  20717. name = "y",
  20718. type = "number",
  20719. description = "The new y value of the vector.",
  20720. default = "x"
  20721. },
  20722. {
  20723. name = "z",
  20724. type = "number",
  20725. description = "The new z value of the vector.",
  20726. default = "x"
  20727. }
  20728. },
  20729. returns = {
  20730. {
  20731. name = "v",
  20732. type = "Vec3",
  20733. description = "The input vector."
  20734. }
  20735. }
  20736. },
  20737. {
  20738. arguments = {
  20739. {
  20740. name = "u",
  20741. type = "Vec3",
  20742. description = "The vector to copy the values from."
  20743. }
  20744. },
  20745. returns = {
  20746. {
  20747. name = "v",
  20748. type = "Vec3",
  20749. description = "The input vector."
  20750. }
  20751. }
  20752. },
  20753. {
  20754. arguments = {
  20755. {
  20756. name = "m",
  20757. type = "Mat4",
  20758. description = "The matrix to use the position of."
  20759. }
  20760. },
  20761. returns = {
  20762. {
  20763. name = "v",
  20764. type = "Vec3",
  20765. description = "The input vector."
  20766. }
  20767. }
  20768. }
  20769. }
  20770. },
  20771. {
  20772. name = "sub",
  20773. summary = "Subtract a vector or a number from the vector.",
  20774. description = "Subtracts a vector or a number from the vector.",
  20775. key = "Vec3:sub",
  20776. module = "lovr.math",
  20777. related = {
  20778. "Vec3:add",
  20779. "Vec3:mul",
  20780. "Vec3:div"
  20781. },
  20782. variants = {
  20783. {
  20784. arguments = {
  20785. {
  20786. name = "u",
  20787. type = "Vec3",
  20788. description = "The other vector."
  20789. }
  20790. },
  20791. returns = {
  20792. {
  20793. name = "v",
  20794. type = "Vec3",
  20795. description = "The original vector."
  20796. }
  20797. }
  20798. },
  20799. {
  20800. arguments = {
  20801. {
  20802. name = "x",
  20803. type = "number",
  20804. description = "A value to subtract from x component."
  20805. },
  20806. {
  20807. name = "y",
  20808. type = "number",
  20809. description = "A value to subtract from y component.",
  20810. default = "x"
  20811. },
  20812. {
  20813. name = "z",
  20814. type = "number",
  20815. description = "A value to subtract from z component.",
  20816. default = "x"
  20817. }
  20818. },
  20819. returns = {
  20820. {
  20821. name = "v",
  20822. type = "Vec3",
  20823. description = "The original vector."
  20824. }
  20825. }
  20826. }
  20827. }
  20828. },
  20829. {
  20830. name = "unpack",
  20831. summary = "Get the components of the vector.",
  20832. description = "Returns the 3 components of the vector as numbers.",
  20833. key = "Vec3:unpack",
  20834. module = "lovr.math",
  20835. related = {
  20836. "Vec3:set"
  20837. },
  20838. variants = {
  20839. {
  20840. arguments = {},
  20841. returns = {
  20842. {
  20843. name = "x",
  20844. type = "number",
  20845. description = "The x value."
  20846. },
  20847. {
  20848. name = "y",
  20849. type = "number",
  20850. description = "The y value."
  20851. },
  20852. {
  20853. name = "z",
  20854. type = "number",
  20855. description = "The z value."
  20856. }
  20857. }
  20858. }
  20859. }
  20860. }
  20861. }
  20862. },
  20863. {
  20864. name = "Vec4",
  20865. summary = "A 4D vector.",
  20866. description = "A vector object that holds four numbers.",
  20867. key = "Vec4",
  20868. module = "lovr.math",
  20869. constructors = {
  20870. "lovr.math.newVec4",
  20871. "lovr.math.vec4"
  20872. },
  20873. related = {
  20874. "Vec2",
  20875. "Vec3"
  20876. },
  20877. methods = {
  20878. {
  20879. name = "add",
  20880. summary = "Add a vector or a number to the vector.",
  20881. description = "Adds a vector or a number to the vector.",
  20882. key = "Vec4:add",
  20883. module = "lovr.math",
  20884. related = {
  20885. "Vec4:sub",
  20886. "Vec4:mul",
  20887. "Vec4:div"
  20888. },
  20889. variants = {
  20890. {
  20891. arguments = {
  20892. {
  20893. name = "u",
  20894. type = "Vec4",
  20895. description = "The other vector."
  20896. }
  20897. },
  20898. returns = {
  20899. {
  20900. name = "v",
  20901. type = "Vec4",
  20902. description = "The original vector."
  20903. }
  20904. }
  20905. },
  20906. {
  20907. arguments = {
  20908. {
  20909. name = "x",
  20910. type = "number",
  20911. description = "A value to add to x component."
  20912. },
  20913. {
  20914. name = "y",
  20915. type = "number",
  20916. description = "A value to add to y component.",
  20917. default = "x"
  20918. },
  20919. {
  20920. name = "z",
  20921. type = "number",
  20922. description = "A value to add to z component.",
  20923. default = "x"
  20924. },
  20925. {
  20926. name = "w",
  20927. type = "number",
  20928. description = "A value to add to w component.",
  20929. default = "x"
  20930. }
  20931. },
  20932. returns = {
  20933. {
  20934. name = "v",
  20935. type = "Vec4",
  20936. description = "The original vector."
  20937. }
  20938. }
  20939. }
  20940. }
  20941. },
  20942. {
  20943. name = "angle",
  20944. summary = "Get the angle to another vector.",
  20945. description = "Returns the angle between vectors.",
  20946. key = "Vec4:angle",
  20947. module = "lovr.math",
  20948. notes = "If any of the two vectors have a length of zero, the angle between them is not well defined. In this case the function returns `math.pi / 2`.",
  20949. variants = {
  20950. {
  20951. arguments = {
  20952. {
  20953. name = "u",
  20954. type = "Vec4",
  20955. description = "The other vector."
  20956. }
  20957. },
  20958. returns = {
  20959. {
  20960. name = "angle",
  20961. type = "number",
  20962. description = "The angle to other vector, in radians."
  20963. }
  20964. }
  20965. },
  20966. {
  20967. arguments = {
  20968. {
  20969. name = "x",
  20970. type = "number",
  20971. description = "The x component of the other vector."
  20972. },
  20973. {
  20974. name = "y",
  20975. type = "number",
  20976. description = "The y component of the other vector."
  20977. },
  20978. {
  20979. name = "z",
  20980. type = "number",
  20981. description = "The z component of the other vector."
  20982. },
  20983. {
  20984. name = "w",
  20985. type = "number",
  20986. description = "The w component of the other vector."
  20987. }
  20988. },
  20989. returns = {
  20990. {
  20991. name = "angle",
  20992. type = "number",
  20993. description = "The angle to other vector, in radians."
  20994. }
  20995. }
  20996. }
  20997. },
  20998. related = {
  20999. "Vec4:distance",
  21000. "Vec4:length"
  21001. }
  21002. },
  21003. {
  21004. name = "distance",
  21005. summary = "Get the distance to another vector.",
  21006. description = "Returns the distance to another vector.",
  21007. key = "Vec4:distance",
  21008. module = "lovr.math",
  21009. related = {
  21010. "Vec4:angle",
  21011. "Vec4:length"
  21012. },
  21013. variants = {
  21014. {
  21015. arguments = {
  21016. {
  21017. name = "u",
  21018. type = "Vec4",
  21019. description = "The vector to measure the distance to."
  21020. }
  21021. },
  21022. returns = {
  21023. {
  21024. name = "distance",
  21025. type = "number",
  21026. description = "The distance to `u`."
  21027. }
  21028. }
  21029. },
  21030. {
  21031. arguments = {
  21032. {
  21033. name = "x",
  21034. type = "number",
  21035. description = "A value of x component to measure distance to."
  21036. },
  21037. {
  21038. name = "y",
  21039. type = "number",
  21040. description = "A value of y component to measure distance to."
  21041. },
  21042. {
  21043. name = "z",
  21044. type = "number",
  21045. description = "A value of z component to measure distance to."
  21046. },
  21047. {
  21048. name = "w",
  21049. type = "number",
  21050. description = "A value of w component to measure distance to."
  21051. }
  21052. },
  21053. returns = {
  21054. {
  21055. name = "distance",
  21056. type = "number",
  21057. description = "The distance to `u`."
  21058. }
  21059. }
  21060. }
  21061. }
  21062. },
  21063. {
  21064. name = "div",
  21065. summary = "Divides the vector by a vector or a number.",
  21066. description = "Divides the vector by a vector or a number.",
  21067. key = "Vec4:div",
  21068. module = "lovr.math",
  21069. related = {
  21070. "Vec4:add",
  21071. "Vec4:sub",
  21072. "Vec4:mul"
  21073. },
  21074. variants = {
  21075. {
  21076. arguments = {
  21077. {
  21078. name = "u",
  21079. type = "Vec4",
  21080. description = "The other vector to divide the components by."
  21081. }
  21082. },
  21083. returns = {
  21084. {
  21085. name = "v",
  21086. type = "Vec4",
  21087. description = "The original vector."
  21088. }
  21089. }
  21090. },
  21091. {
  21092. arguments = {
  21093. {
  21094. name = "x",
  21095. type = "number",
  21096. description = "A value to divide x component by."
  21097. },
  21098. {
  21099. name = "y",
  21100. type = "number",
  21101. description = "A value to divide y component by.",
  21102. default = "x"
  21103. },
  21104. {
  21105. name = "z",
  21106. type = "number",
  21107. description = "A value to divide z component by.",
  21108. default = "x"
  21109. },
  21110. {
  21111. name = "w",
  21112. type = "number",
  21113. description = "A value to divide w component by.",
  21114. default = "x"
  21115. }
  21116. },
  21117. returns = {
  21118. {
  21119. name = "v",
  21120. type = "Vec4",
  21121. description = "The original vector."
  21122. }
  21123. }
  21124. }
  21125. }
  21126. },
  21127. {
  21128. name = "dot",
  21129. summary = "Get the dot product with another vector.",
  21130. description = "Returns the dot product between this vector and another one.",
  21131. key = "Vec4:dot",
  21132. module = "lovr.math",
  21133. notes = "This is computed as:\n\n dot = v.x * u.x + v.y * u.y + v.z * u.z + v.w * u.w\n\nThe vectors are not normalized before computing the dot product.",
  21134. variants = {
  21135. {
  21136. arguments = {
  21137. {
  21138. name = "u",
  21139. type = "Vec4",
  21140. description = "The vector to compute the dot product with."
  21141. }
  21142. },
  21143. returns = {
  21144. {
  21145. name = "dot",
  21146. type = "number",
  21147. description = "The dot product between `v` and `u`."
  21148. }
  21149. }
  21150. },
  21151. {
  21152. arguments = {
  21153. {
  21154. name = "x",
  21155. type = "number",
  21156. description = "A value of x component to compute the dot product with."
  21157. },
  21158. {
  21159. name = "y",
  21160. type = "number",
  21161. description = "A value of y component to compute the dot product with."
  21162. },
  21163. {
  21164. name = "z",
  21165. type = "number",
  21166. description = "A value of z component to compute the dot product with."
  21167. },
  21168. {
  21169. name = "w",
  21170. type = "number",
  21171. description = "A value of w component to compute the dot product with."
  21172. }
  21173. },
  21174. returns = {
  21175. {
  21176. name = "dot",
  21177. type = "number",
  21178. description = "The dot product between `v` and `u`."
  21179. }
  21180. }
  21181. }
  21182. }
  21183. },
  21184. {
  21185. name = "equals",
  21186. summary = "Check if a vector equals another vector.",
  21187. description = "Returns whether a vector is approximately equal to another vector.",
  21188. key = "Vec4:equals",
  21189. module = "lovr.math",
  21190. notes = "To handle floating point precision issues, this function returns true as long as the squared distance between the vectors is below `1e-10`.",
  21191. variants = {
  21192. {
  21193. arguments = {
  21194. {
  21195. name = "u",
  21196. type = "Vec4",
  21197. description = "The other vector."
  21198. }
  21199. },
  21200. returns = {
  21201. {
  21202. name = "equal",
  21203. type = "boolean",
  21204. description = "Whether the 2 vectors approximately equal each other."
  21205. }
  21206. }
  21207. },
  21208. {
  21209. arguments = {
  21210. {
  21211. name = "x",
  21212. type = "number",
  21213. description = "The x component of the other vector."
  21214. },
  21215. {
  21216. name = "y",
  21217. type = "number",
  21218. description = "The y component of the other vector."
  21219. },
  21220. {
  21221. name = "z",
  21222. type = "number",
  21223. description = "The z component of the other vector."
  21224. },
  21225. {
  21226. name = "w",
  21227. type = "number",
  21228. description = "The w component of the other vector."
  21229. }
  21230. },
  21231. returns = {
  21232. {
  21233. name = "equal",
  21234. type = "boolean",
  21235. description = "Whether the 2 vectors approximately equal each other."
  21236. }
  21237. }
  21238. }
  21239. },
  21240. related = {
  21241. "Vec2:equals",
  21242. "Vec3:equals",
  21243. "Quat:equals",
  21244. "Mat4:equals"
  21245. }
  21246. },
  21247. {
  21248. name = "length",
  21249. summary = "Get the length of the vector.",
  21250. description = "Returns the length of the vector.",
  21251. key = "Vec4:length",
  21252. module = "lovr.math",
  21253. notes = "The length is equivalent to this:\n\n math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w)",
  21254. variants = {
  21255. {
  21256. arguments = {},
  21257. returns = {
  21258. {
  21259. name = "length",
  21260. type = "number",
  21261. description = "The length of the vector."
  21262. }
  21263. }
  21264. }
  21265. },
  21266. related = {
  21267. "Vec4:normalize",
  21268. "Vec4:distance"
  21269. }
  21270. },
  21271. {
  21272. name = "lerp",
  21273. summary = "Moves this vector some amount towards another one.",
  21274. description = "Performs a linear interpolation between this vector and another one, which can be used to smoothly animate between two vectors, based on a parameter value. A parameter value of `0` will leave the vector unchanged, a parameter value of `1` will set the vector to be equal to the input vector, and a value of `.5` will set the components to be halfway between the two vectors.",
  21275. key = "Vec4:lerp",
  21276. module = "lovr.math",
  21277. related = {
  21278. "Quat:slerp"
  21279. },
  21280. variants = {
  21281. {
  21282. arguments = {
  21283. {
  21284. name = "u",
  21285. type = "Vec4",
  21286. description = "The vector to lerp towards."
  21287. },
  21288. {
  21289. name = "t",
  21290. type = "number",
  21291. description = "The lerping parameter."
  21292. }
  21293. },
  21294. returns = {
  21295. {
  21296. name = "v",
  21297. type = "Vec4",
  21298. description = "The original vector, containing the new lerped values."
  21299. }
  21300. }
  21301. },
  21302. {
  21303. arguments = {
  21304. {
  21305. name = "x",
  21306. type = "number",
  21307. description = "A value of x component to lerp towards."
  21308. },
  21309. {
  21310. name = "y",
  21311. type = "number",
  21312. description = "A value of y component to lerp towards."
  21313. },
  21314. {
  21315. name = "z",
  21316. type = "number",
  21317. description = "A value of z component to lerp towards."
  21318. },
  21319. {
  21320. name = "w",
  21321. type = "number",
  21322. description = "A value of w component to lerp towards."
  21323. },
  21324. {
  21325. name = "t",
  21326. type = "number",
  21327. description = "The lerping parameter."
  21328. }
  21329. },
  21330. returns = {
  21331. {
  21332. name = "v",
  21333. type = "Vec4",
  21334. description = "The original vector, containing the new lerped values."
  21335. }
  21336. }
  21337. }
  21338. }
  21339. },
  21340. {
  21341. name = "mul",
  21342. summary = "Multiply the vector by a vector or a number.",
  21343. description = "Multiplies the vector by a vector or a number.",
  21344. key = "Vec4:mul",
  21345. module = "lovr.math",
  21346. related = {
  21347. "Vec4:add",
  21348. "Vec4:sub",
  21349. "Vec4:div"
  21350. },
  21351. variants = {
  21352. {
  21353. arguments = {
  21354. {
  21355. name = "u",
  21356. type = "Vec4",
  21357. description = "The other vector to multiply the components by."
  21358. }
  21359. },
  21360. returns = {
  21361. {
  21362. name = "v",
  21363. type = "Vec4",
  21364. description = "The original vector."
  21365. }
  21366. }
  21367. },
  21368. {
  21369. arguments = {
  21370. {
  21371. name = "x",
  21372. type = "number",
  21373. description = "A value to multiply x component by."
  21374. },
  21375. {
  21376. name = "y",
  21377. type = "number",
  21378. description = "A value to multiply y component by.",
  21379. default = "x"
  21380. },
  21381. {
  21382. name = "z",
  21383. type = "number",
  21384. description = "A value to multiply z component by.",
  21385. default = "x"
  21386. },
  21387. {
  21388. name = "w",
  21389. type = "number",
  21390. description = "A value to multiply w component by.",
  21391. default = "x"
  21392. }
  21393. },
  21394. returns = {
  21395. {
  21396. name = "v",
  21397. type = "Vec4",
  21398. description = "The original vector."
  21399. }
  21400. }
  21401. }
  21402. }
  21403. },
  21404. {
  21405. name = "normalize",
  21406. summary = "Normalize the length of the vector to 1.",
  21407. description = "Adjusts the values in the vector so that its direction stays the same but its length becomes 1.",
  21408. key = "Vec4:normalize",
  21409. module = "lovr.math",
  21410. related = {
  21411. "Vec4:length"
  21412. },
  21413. variants = {
  21414. {
  21415. arguments = {},
  21416. returns = {
  21417. {
  21418. name = "v",
  21419. type = "Vec4",
  21420. description = "The original vector."
  21421. }
  21422. }
  21423. }
  21424. }
  21425. },
  21426. {
  21427. name = "set",
  21428. summary = "Set the components of the vector.",
  21429. description = "Sets the components of the vector, either from numbers or an existing vector.",
  21430. key = "Vec4:set",
  21431. module = "lovr.math",
  21432. related = {
  21433. "Vec4:unpack"
  21434. },
  21435. variants = {
  21436. {
  21437. arguments = {
  21438. {
  21439. name = "x",
  21440. type = "number",
  21441. description = "The new x value of the vector.",
  21442. default = "0"
  21443. },
  21444. {
  21445. name = "y",
  21446. type = "number",
  21447. description = "The new y value of the vector.",
  21448. default = "x"
  21449. },
  21450. {
  21451. name = "z",
  21452. type = "number",
  21453. description = "The new z value of the vector.",
  21454. default = "x"
  21455. },
  21456. {
  21457. name = "w",
  21458. type = "number",
  21459. description = "The new w value of the vector.",
  21460. default = "x"
  21461. }
  21462. },
  21463. returns = {
  21464. {
  21465. name = "v",
  21466. type = "Vec4",
  21467. description = "The input vector."
  21468. }
  21469. }
  21470. },
  21471. {
  21472. arguments = {
  21473. {
  21474. name = "u",
  21475. type = "Vec4",
  21476. description = "The vector to copy the values from."
  21477. }
  21478. },
  21479. returns = {
  21480. {
  21481. name = "v",
  21482. type = "Vec4",
  21483. description = "The input vector."
  21484. }
  21485. }
  21486. }
  21487. }
  21488. },
  21489. {
  21490. name = "sub",
  21491. summary = "Subtract a vector or a number from the vector.",
  21492. description = "Subtracts a vector or a number from the vector.",
  21493. key = "Vec4:sub",
  21494. module = "lovr.math",
  21495. related = {
  21496. "Vec4:add",
  21497. "Vec4:mul",
  21498. "Vec4:div"
  21499. },
  21500. variants = {
  21501. {
  21502. arguments = {
  21503. {
  21504. name = "u",
  21505. type = "Vec4",
  21506. description = "The other vector."
  21507. }
  21508. },
  21509. returns = {
  21510. {
  21511. name = "v",
  21512. type = "Vec4",
  21513. description = "The original vector."
  21514. }
  21515. }
  21516. },
  21517. {
  21518. arguments = {
  21519. {
  21520. name = "x",
  21521. type = "number",
  21522. description = "A value to subtract from x component."
  21523. },
  21524. {
  21525. name = "y",
  21526. type = "number",
  21527. description = "A value to subtract from y component.",
  21528. default = "x"
  21529. },
  21530. {
  21531. name = "z",
  21532. type = "number",
  21533. description = "A value to subtract from z component.",
  21534. default = "x"
  21535. },
  21536. {
  21537. name = "w",
  21538. type = "number",
  21539. description = "A value to subtract from w component.",
  21540. default = "x"
  21541. }
  21542. },
  21543. returns = {
  21544. {
  21545. name = "v",
  21546. type = "Vec4",
  21547. description = "The original vector."
  21548. }
  21549. }
  21550. }
  21551. }
  21552. },
  21553. {
  21554. name = "unpack",
  21555. summary = "Get the components of the vector.",
  21556. description = "Returns the 4 components of the vector as numbers.",
  21557. key = "Vec4:unpack",
  21558. module = "lovr.math",
  21559. related = {
  21560. "Vec4:set"
  21561. },
  21562. variants = {
  21563. {
  21564. arguments = {},
  21565. returns = {
  21566. {
  21567. name = "x",
  21568. type = "number",
  21569. description = "The x value."
  21570. },
  21571. {
  21572. name = "y",
  21573. type = "number",
  21574. description = "The y value."
  21575. },
  21576. {
  21577. name = "z",
  21578. type = "number",
  21579. description = "The z value."
  21580. },
  21581. {
  21582. name = "w",
  21583. type = "number",
  21584. description = "The w value."
  21585. }
  21586. }
  21587. }
  21588. }
  21589. }
  21590. }
  21591. },
  21592. {
  21593. name = "Vectors",
  21594. summary = "What is your vector victor.",
  21595. description = "LÖVR has math objects for vectors, matrices, and quaternions, collectively called \"vector objects\". Vectors are useful because they can represent a multidimensional quantity (like a 3D position) using just a single value.",
  21596. key = "Vectors",
  21597. module = "lovr.math",
  21598. constructors = {
  21599. "lovr.math.vec2",
  21600. "lovr.math.vec3",
  21601. "lovr.math.vec4",
  21602. "lovr.math.quat",
  21603. "lovr.math.mat4",
  21604. "lovr.math.newVec2",
  21605. "lovr.math.newVec3",
  21606. "lovr.math.newVec4",
  21607. "lovr.math.newQuat",
  21608. "lovr.math.newMat4"
  21609. },
  21610. notes = "Most LÖVR functions that accept positions, orientations, transforms, velocities, etc. also accept vector objects, so they can be used interchangeably with numbers:\n\n function lovr.draw()\n -- position and size are vec3's, rotation is a quat\n lovr.graphics.box('fill', position, size, rotation)\n end\n\n### Temporary vs. Permanent\n\nVectors can be created in two different ways: **permanent** and **temporary**.\n\n**Permanent** vectors behave like normal Lua values. They are individual objects that are garbage collected when no longer needed. They're created using the usual `lovr.math.new<Type>` syntax:\n\n self.position = lovr.math.newVec3(x, y, z)\n\n**Temporary** vectors are created from a shared pool of vector objects. This makes them faster because they use temporary memory and do not need to be garbage collected. To make a temporary vector, leave off the `new` prefix:\n\n local position = lovr.math.vec3(x, y, z)\n\nAs a further shorthand, these vector constructors are placed on the global scope. If you prefer to keep the global scope clean, this can be configured using the `t.math.globals` flag in `lovr.conf`.\n\n local position = vec3(x1, y1, z1) + vec3(x2, y2, z2)\n\nTemporary vectors, with all their speed, come with an important restriction: they can only be used during the frame in which they were created. Saving them into variables and using them later on will throw an error:\n\n local position = vec3(1, 2, 3)\n\n function lovr.update(dt)\n -- Reusing a temporary vector across frames will error:\n position:add(vec3(dt))\n end\n\nIt's possible to overflow the temporary vector pool. If that happens, `lovr.math.drain` can be used to periodically drain the pool, invalidating any existing temporary vectors.\n\n### Metamethods\n\nVectors have metamethods, allowing them to be used using the normal math operators like `+`, `-`, `*`, `/`, etc.\n\n print(vec3(2, 4, 6) * .5 + vec3(10, 20, 30))\n\nThese metamethods will create new temporary vectors.\n\n### Components and Swizzles\n\nThe raw components of a vector can be accessed like normal fields:\n\n print(vec3(1, 2, 3).z) --> 3\n print(mat4()[16]) --> 1\n\nAlso, multiple fields can be accessed and combined into a new (temporary) vector, called swizzling:\n\n local position = vec3(10, 5, 1)\n print(position.xy) --> vec2(10, 5)\n print(position.xyy) --> vec3(10, 5, 5)\n print(position.zyxz) --> vec4(1, 5, 10, 1)\n\nThe following fields are supported for vectors:\n\n- `x`, `y`, `z`, `w`\n- `r`, `g`, `b`, `a`\n- `s`, `t`, `p`, `q`\n\nQuaternions support `x`, `y`, `z`, and `w`.\n\nMatrices use numbers for accessing individual components in \"column-major\" order.\n\nAll fields can also be assigned to.\n\n -- Swap the components of a 2D vector\n v.xy = v.yx\n\nThe `unpack` function can be used (on any vector type) to access all of the individual components of a vector object. For quaternions you can choose whether you want to unpack the angle/axis representation or the raw quaternion components. Similarly, matrices support raw unpacking as well as decomposition into translation/scale/rotation values.",
  21611. methods = {}
  21612. }
  21613. },
  21614. functions = {
  21615. {
  21616. name = "drain",
  21617. tag = "vectors",
  21618. summary = "Drain the temporary vector pool.",
  21619. description = "Drains the temporary vector pool, invalidating existing temporary vectors.\n\nThis is called automatically at the end of each frame.",
  21620. key = "lovr.math.drain",
  21621. module = "lovr.math",
  21622. variants = {
  21623. {
  21624. arguments = {},
  21625. returns = {}
  21626. }
  21627. }
  21628. },
  21629. {
  21630. name = "gammaToLinear",
  21631. tag = "mathOther",
  21632. summary = " Convert a color from gamma space to linear space.",
  21633. description = "Converts a color from gamma space to linear space.",
  21634. key = "lovr.math.gammaToLinear",
  21635. module = "lovr.math",
  21636. related = {
  21637. "lovr.math.linearToGamma"
  21638. },
  21639. variants = {
  21640. {
  21641. arguments = {
  21642. {
  21643. name = "gr",
  21644. type = "number",
  21645. description = "The red component of the gamma-space color."
  21646. },
  21647. {
  21648. name = "gg",
  21649. type = "number",
  21650. description = "The green component of the gamma-space color."
  21651. },
  21652. {
  21653. name = "gb",
  21654. type = "number",
  21655. description = "The blue component of the gamma-space color."
  21656. }
  21657. },
  21658. returns = {
  21659. {
  21660. name = "lr",
  21661. type = "number",
  21662. description = "The red component of the resulting linear-space color."
  21663. },
  21664. {
  21665. name = "lg",
  21666. type = "number",
  21667. description = "The green component of the resulting linear-space color."
  21668. },
  21669. {
  21670. name = "lb",
  21671. type = "number",
  21672. description = "The blue component of the resulting linear-space color."
  21673. }
  21674. }
  21675. },
  21676. {
  21677. description = "A table can also be used.",
  21678. arguments = {
  21679. {
  21680. name = "color",
  21681. type = "table",
  21682. description = "A table containing the components of a gamma-space color."
  21683. }
  21684. },
  21685. returns = {
  21686. {
  21687. name = "lr",
  21688. type = "number",
  21689. description = "The red component of the resulting linear-space color."
  21690. },
  21691. {
  21692. name = "lg",
  21693. type = "number",
  21694. description = "The green component of the resulting linear-space color."
  21695. },
  21696. {
  21697. name = "lb",
  21698. type = "number",
  21699. description = "The blue component of the resulting linear-space color."
  21700. }
  21701. }
  21702. },
  21703. {
  21704. description = "Convert a single color channel.",
  21705. arguments = {
  21706. {
  21707. name = "x",
  21708. type = "number",
  21709. description = "The color channel to convert."
  21710. }
  21711. },
  21712. returns = {
  21713. {
  21714. name = "y",
  21715. type = "number",
  21716. description = "The converted color channel."
  21717. }
  21718. }
  21719. }
  21720. }
  21721. },
  21722. {
  21723. name = "getRandomSeed",
  21724. tag = "random",
  21725. summary = "Get the random seed.",
  21726. description = "Get the seed used to initialize the random generator.",
  21727. key = "lovr.math.getRandomSeed",
  21728. module = "lovr.math",
  21729. variants = {
  21730. {
  21731. arguments = {},
  21732. returns = {
  21733. {
  21734. name = "seed",
  21735. type = "number",
  21736. description = "The new seed."
  21737. }
  21738. }
  21739. }
  21740. }
  21741. },
  21742. {
  21743. name = "linearToGamma",
  21744. tag = "mathOther",
  21745. summary = " Convert a color from linear space to gamma space.",
  21746. description = "Converts a color from linear space to gamma space.",
  21747. key = "lovr.math.linearToGamma",
  21748. module = "lovr.math",
  21749. related = {
  21750. "lovr.math.gammaToLinear"
  21751. },
  21752. variants = {
  21753. {
  21754. arguments = {
  21755. {
  21756. name = "lr",
  21757. type = "number",
  21758. description = "The red component of the linear-space color."
  21759. },
  21760. {
  21761. name = "lg",
  21762. type = "number",
  21763. description = "The green component of the linear-space color."
  21764. },
  21765. {
  21766. name = "lb",
  21767. type = "number",
  21768. description = "The blue component of the linear-space color."
  21769. }
  21770. },
  21771. returns = {
  21772. {
  21773. name = "gr",
  21774. type = "number",
  21775. description = "The red component of the resulting gamma-space color."
  21776. },
  21777. {
  21778. name = "gg",
  21779. type = "number",
  21780. description = "The green component of the resulting gamma-space color."
  21781. },
  21782. {
  21783. name = "gb",
  21784. type = "number",
  21785. description = "The blue component of the resulting gamma-space color."
  21786. }
  21787. }
  21788. },
  21789. {
  21790. description = "A table can also be used.",
  21791. arguments = {
  21792. {
  21793. name = "color",
  21794. type = "table",
  21795. description = "A table containing the components of a linear-space color."
  21796. }
  21797. },
  21798. returns = {
  21799. {
  21800. name = "gr",
  21801. type = "number",
  21802. description = "The red component of the resulting gamma-space color."
  21803. },
  21804. {
  21805. name = "gg",
  21806. type = "number",
  21807. description = "The green component of the resulting gamma-space color."
  21808. },
  21809. {
  21810. name = "gb",
  21811. type = "number",
  21812. description = "The blue component of the resulting gamma-space color."
  21813. }
  21814. }
  21815. },
  21816. {
  21817. description = "Convert a single color channel.",
  21818. arguments = {
  21819. {
  21820. name = "x",
  21821. type = "number",
  21822. description = "The color channel to convert."
  21823. }
  21824. },
  21825. returns = {
  21826. {
  21827. name = "y",
  21828. type = "number",
  21829. description = "The converted color channel."
  21830. }
  21831. }
  21832. }
  21833. }
  21834. },
  21835. {
  21836. name = "mat4",
  21837. tag = "vectors",
  21838. summary = "Create a temporary Mat4.",
  21839. description = "Creates a temporary 4D matrix. This function takes the same arguments as `Mat4:set`.",
  21840. key = "lovr.math.mat4",
  21841. module = "lovr.math",
  21842. related = {
  21843. "lovr.math.newMat4",
  21844. "Mat4"
  21845. },
  21846. variants = {
  21847. {
  21848. description = "Sets the matrix to the identity matrix.",
  21849. arguments = {},
  21850. returns = {
  21851. {
  21852. name = "m",
  21853. type = "Mat4",
  21854. description = "The new matrix."
  21855. }
  21856. }
  21857. },
  21858. {
  21859. description = "Copies the values from an existing matrix.",
  21860. arguments = {
  21861. {
  21862. name = "n",
  21863. type = "mat4",
  21864. description = "An existing matrix to copy the values from."
  21865. }
  21866. },
  21867. returns = {
  21868. {
  21869. name = "m",
  21870. type = "Mat4",
  21871. description = "The new matrix."
  21872. }
  21873. }
  21874. },
  21875. {
  21876. arguments = {
  21877. {
  21878. name = "position",
  21879. type = "Vec3",
  21880. description = "The translation of the matrix.",
  21881. default = "0, 0, 0"
  21882. },
  21883. {
  21884. name = "scale",
  21885. type = "Vec3",
  21886. description = "The scale of the matrix.",
  21887. default = "1, 1, 1"
  21888. },
  21889. {
  21890. name = "rotation",
  21891. type = "Quat",
  21892. description = "The rotation of the matrix.",
  21893. default = "0, 0, 0, 1"
  21894. }
  21895. },
  21896. returns = {
  21897. {
  21898. name = "m",
  21899. type = "Mat4",
  21900. description = "The new matrix."
  21901. }
  21902. }
  21903. },
  21904. {
  21905. arguments = {
  21906. {
  21907. name = "position",
  21908. type = "Vec3",
  21909. description = "The translation of the matrix.",
  21910. default = "0, 0, 0"
  21911. },
  21912. {
  21913. name = "rotation",
  21914. type = "Quat",
  21915. description = "The rotation of the matrix.",
  21916. default = "0, 0, 0, 1"
  21917. }
  21918. },
  21919. returns = {
  21920. {
  21921. name = "m",
  21922. type = "Mat4",
  21923. description = "The new matrix."
  21924. }
  21925. }
  21926. },
  21927. {
  21928. arguments = {
  21929. {
  21930. name = "...",
  21931. type = "number",
  21932. description = "16 numbers to use as the raw values of the matrix (column-major)."
  21933. }
  21934. },
  21935. returns = {
  21936. {
  21937. name = "m",
  21938. type = "Mat4",
  21939. description = "The new matrix."
  21940. }
  21941. }
  21942. },
  21943. {
  21944. description = "Sets the diagonal values to a number and everything else to 0.",
  21945. arguments = {
  21946. {
  21947. name = "d",
  21948. type = "number",
  21949. description = "A number to use for the diagonal elements."
  21950. }
  21951. },
  21952. returns = {
  21953. {
  21954. name = "m",
  21955. type = "Mat4",
  21956. description = "The new matrix."
  21957. }
  21958. }
  21959. }
  21960. }
  21961. },
  21962. {
  21963. name = "newCurve",
  21964. tag = "mathOther",
  21965. summary = "Create a new Curve.",
  21966. description = "Creates a new `Curve` from a list of control points.",
  21967. key = "lovr.math.newCurve",
  21968. module = "lovr.math",
  21969. variants = {
  21970. {
  21971. description = "Create a Curve from a set of initial control points.",
  21972. arguments = {
  21973. {
  21974. name = "x",
  21975. type = "number",
  21976. description = "The x coordinate of the first control point."
  21977. },
  21978. {
  21979. name = "y",
  21980. type = "number",
  21981. description = "The y coordinate of the first control point."
  21982. },
  21983. {
  21984. name = "z",
  21985. type = "number",
  21986. description = "The z coordinate of the first control point."
  21987. },
  21988. {
  21989. name = "...",
  21990. type = "*",
  21991. description = "Additional control points."
  21992. }
  21993. },
  21994. returns = {
  21995. {
  21996. name = "curve",
  21997. type = "Curve",
  21998. description = "The new Curve."
  21999. }
  22000. }
  22001. },
  22002. {
  22003. description = "Create a Curve from a (flat) table of points.",
  22004. arguments = {
  22005. {
  22006. name = "points",
  22007. type = "table",
  22008. description = "A table of points, as above."
  22009. }
  22010. },
  22011. returns = {
  22012. {
  22013. name = "curve",
  22014. type = "Curve",
  22015. description = "The new Curve."
  22016. }
  22017. }
  22018. },
  22019. {
  22020. description = "Create an empty Curve, reserving space ahead of time for a certain number of control points.",
  22021. arguments = {
  22022. {
  22023. name = "n",
  22024. type = "number",
  22025. description = "The number of points to reserve for the Curve."
  22026. }
  22027. },
  22028. returns = {
  22029. {
  22030. name = "curve",
  22031. type = "Curve",
  22032. description = "The new Curve."
  22033. }
  22034. }
  22035. }
  22036. }
  22037. },
  22038. {
  22039. name = "newMat4",
  22040. tag = "vectors",
  22041. summary = "Create a new Mat4.",
  22042. description = "Creates a new 4D matrix. This function takes the same arguments as `Mat4:set`.",
  22043. key = "lovr.math.newMat4",
  22044. module = "lovr.math",
  22045. related = {
  22046. "lovr.math.mat4",
  22047. "Mat4"
  22048. },
  22049. variants = {
  22050. {
  22051. description = "Sets the matrix to the identity matrix.",
  22052. arguments = {},
  22053. returns = {
  22054. {
  22055. name = "m",
  22056. type = "Mat4",
  22057. description = "The new matrix."
  22058. }
  22059. }
  22060. },
  22061. {
  22062. description = "Copies the values from an existing matrix.",
  22063. arguments = {
  22064. {
  22065. name = "n",
  22066. type = "mat4",
  22067. description = "An existing matrix to copy the values from."
  22068. }
  22069. },
  22070. returns = {
  22071. {
  22072. name = "m",
  22073. type = "Mat4",
  22074. description = "The new matrix."
  22075. }
  22076. }
  22077. },
  22078. {
  22079. arguments = {
  22080. {
  22081. name = "position",
  22082. type = "Vec3",
  22083. description = "The translation of the matrix.",
  22084. default = "0, 0, 0"
  22085. },
  22086. {
  22087. name = "scale",
  22088. type = "Vec3",
  22089. description = "The scale of the matrix.",
  22090. default = "1, 1, 1"
  22091. },
  22092. {
  22093. name = "rotation",
  22094. type = "Quat",
  22095. description = "The rotation of the matrix.",
  22096. default = "0, 0, 0, 1"
  22097. }
  22098. },
  22099. returns = {
  22100. {
  22101. name = "m",
  22102. type = "Mat4",
  22103. description = "The new matrix."
  22104. }
  22105. }
  22106. },
  22107. {
  22108. arguments = {
  22109. {
  22110. name = "position",
  22111. type = "Vec3",
  22112. description = "The translation of the matrix.",
  22113. default = "0, 0, 0"
  22114. },
  22115. {
  22116. name = "rotation",
  22117. type = "Quat",
  22118. description = "The rotation of the matrix.",
  22119. default = "0, 0, 0, 1"
  22120. }
  22121. },
  22122. returns = {
  22123. {
  22124. name = "m",
  22125. type = "Mat4",
  22126. description = "The new matrix."
  22127. }
  22128. }
  22129. },
  22130. {
  22131. arguments = {
  22132. {
  22133. name = "...",
  22134. type = "number",
  22135. description = "16 numbers to use as the raw values of the matrix (column-major)."
  22136. }
  22137. },
  22138. returns = {
  22139. {
  22140. name = "m",
  22141. type = "Mat4",
  22142. description = "The new matrix."
  22143. }
  22144. }
  22145. },
  22146. {
  22147. description = "Sets the diagonal values to a number and everything else to 0.",
  22148. arguments = {
  22149. {
  22150. name = "d",
  22151. type = "number",
  22152. description = "A number to use for the diagonal elements."
  22153. }
  22154. },
  22155. returns = {
  22156. {
  22157. name = "m",
  22158. type = "Mat4",
  22159. description = "The new matrix."
  22160. }
  22161. }
  22162. }
  22163. }
  22164. },
  22165. {
  22166. name = "newQuat",
  22167. tag = "vectors",
  22168. summary = "Create a new Quat.",
  22169. description = "Creates a new quaternion. This function takes the same arguments as `Quat:set`.",
  22170. key = "lovr.math.newQuat",
  22171. module = "lovr.math",
  22172. related = {
  22173. "lovr.math.quat",
  22174. "Quat"
  22175. },
  22176. variants = {
  22177. {
  22178. arguments = {
  22179. {
  22180. name = "angle",
  22181. description = "An angle to use for the rotation, in radians.",
  22182. default = "0"
  22183. },
  22184. {
  22185. name = "ax",
  22186. type = "number",
  22187. description = "The x component of the axis of rotation.",
  22188. default = "0"
  22189. },
  22190. {
  22191. name = "ay",
  22192. type = "number",
  22193. description = "The y component of the axis of rotation.",
  22194. default = "0"
  22195. },
  22196. {
  22197. name = "az",
  22198. type = "number",
  22199. description = "The z component of the axis of rotation.",
  22200. default = "0"
  22201. },
  22202. {
  22203. name = "raw",
  22204. type = "boolean",
  22205. description = "Whether the components should be interpreted as raw `(x, y, z, w)` components.",
  22206. default = "false"
  22207. }
  22208. },
  22209. returns = {
  22210. {
  22211. name = "q",
  22212. type = "quat",
  22213. description = "The new quaternion."
  22214. }
  22215. }
  22216. },
  22217. {
  22218. arguments = {
  22219. {
  22220. name = "r",
  22221. type = "quat",
  22222. description = "An existing quaternion to copy the values from."
  22223. }
  22224. },
  22225. returns = {
  22226. {
  22227. name = "q",
  22228. type = "quat",
  22229. description = "The new quaternion."
  22230. }
  22231. }
  22232. },
  22233. {
  22234. description = "Uses the direction of a vector.",
  22235. arguments = {
  22236. {
  22237. name = "v",
  22238. type = "vec3",
  22239. description = "A normalized direction vector."
  22240. }
  22241. },
  22242. returns = {
  22243. {
  22244. name = "q",
  22245. type = "quat",
  22246. description = "The new quaternion."
  22247. }
  22248. }
  22249. },
  22250. {
  22251. description = "Sets the rotation to represent the rotation between two vectors.",
  22252. arguments = {
  22253. {
  22254. name = "v",
  22255. type = "vec3",
  22256. description = "A normalized direction vector."
  22257. },
  22258. {
  22259. name = "u",
  22260. type = "vec3",
  22261. description = "Another normalized direction vector."
  22262. }
  22263. },
  22264. returns = {
  22265. {
  22266. name = "q",
  22267. type = "quat",
  22268. description = "The new quaternion."
  22269. }
  22270. }
  22271. },
  22272. {
  22273. arguments = {
  22274. {
  22275. name = "m",
  22276. type = "mat4",
  22277. description = "A matrix to use the rotation from."
  22278. }
  22279. },
  22280. returns = {
  22281. {
  22282. name = "q",
  22283. type = "quat",
  22284. description = "The new quaternion."
  22285. }
  22286. }
  22287. },
  22288. {
  22289. description = "Set the quaternion to the identity (0, 0, 0, 1).",
  22290. arguments = {},
  22291. returns = {
  22292. {
  22293. name = "q",
  22294. type = "quat",
  22295. description = "The new quaternion."
  22296. }
  22297. }
  22298. }
  22299. }
  22300. },
  22301. {
  22302. name = "newRandomGenerator",
  22303. tag = "random",
  22304. summary = "Create a new RandomGenerator.",
  22305. description = "Creates a new `RandomGenerator`, which can be used to generate random numbers. If you just want some random numbers, you can use `lovr.math.random`. Individual RandomGenerator objects are useful if you need more control over the random sequence used or need a random generator isolated from other instances.",
  22306. key = "lovr.math.newRandomGenerator",
  22307. module = "lovr.math",
  22308. variants = {
  22309. {
  22310. description = "Create a RandomGenerator with a default seed.",
  22311. arguments = {},
  22312. returns = {
  22313. {
  22314. name = "randomGenerator",
  22315. type = "RandomGenerator",
  22316. description = "The new RandomGenerator."
  22317. }
  22318. }
  22319. },
  22320. {
  22321. arguments = {
  22322. {
  22323. name = "seed",
  22324. type = "number",
  22325. description = "The initial seed for the RandomGenerator."
  22326. }
  22327. },
  22328. returns = {
  22329. {
  22330. name = "randomGenerator",
  22331. type = "RandomGenerator",
  22332. description = "The new RandomGenerator."
  22333. }
  22334. }
  22335. },
  22336. {
  22337. description = "This variant allows creation of random generators with precise 64-bit seed values, since Lua's number format loses precision with really big numbers.",
  22338. arguments = {
  22339. {
  22340. name = "low",
  22341. type = "number",
  22342. description = "The lower 32 bits of the seed."
  22343. },
  22344. {
  22345. name = "high",
  22346. type = "number",
  22347. description = "The upper 32 bits of the seed."
  22348. }
  22349. },
  22350. returns = {
  22351. {
  22352. name = "randomGenerator",
  22353. type = "RandomGenerator",
  22354. description = "The new RandomGenerator."
  22355. }
  22356. }
  22357. }
  22358. }
  22359. },
  22360. {
  22361. name = "newVec2",
  22362. tag = "vectors",
  22363. summary = "Create a new Vec2.",
  22364. description = "Creates a new 2D vector. This function takes the same arguments as `Vec2:set`.",
  22365. key = "lovr.math.newVec2",
  22366. module = "lovr.math",
  22367. related = {
  22368. "lovr.math.vec2",
  22369. "Vec2"
  22370. },
  22371. variants = {
  22372. {
  22373. arguments = {
  22374. {
  22375. name = "x",
  22376. type = "number",
  22377. description = "The x value of the vector.",
  22378. default = "0"
  22379. },
  22380. {
  22381. name = "y",
  22382. type = "number",
  22383. description = "The y value of the vector.",
  22384. default = "x"
  22385. }
  22386. },
  22387. returns = {
  22388. {
  22389. name = "v",
  22390. type = "Vec2",
  22391. description = "The new vector."
  22392. }
  22393. }
  22394. },
  22395. {
  22396. arguments = {
  22397. {
  22398. name = "u",
  22399. type = "Vec2",
  22400. description = "A vector to copy the values from."
  22401. }
  22402. },
  22403. returns = {
  22404. {
  22405. name = "v",
  22406. type = "Vec2",
  22407. description = "The new vector."
  22408. }
  22409. }
  22410. }
  22411. }
  22412. },
  22413. {
  22414. name = "newVec3",
  22415. tag = "vectors",
  22416. summary = "Create a new Vec3.",
  22417. description = "Creates a new 3D vector. This function takes the same arguments as `Vec3:set`.",
  22418. key = "lovr.math.newVec3",
  22419. module = "lovr.math",
  22420. related = {
  22421. "lovr.math.vec3",
  22422. "Vec3"
  22423. },
  22424. variants = {
  22425. {
  22426. arguments = {
  22427. {
  22428. name = "x",
  22429. type = "number",
  22430. description = "The x value of the vector.",
  22431. default = "0"
  22432. },
  22433. {
  22434. name = "y",
  22435. type = "number",
  22436. description = "The y value of the vector.",
  22437. default = "x"
  22438. },
  22439. {
  22440. name = "z",
  22441. type = "number",
  22442. description = "The z value of the vector.",
  22443. default = "x"
  22444. }
  22445. },
  22446. returns = {
  22447. {
  22448. name = "v",
  22449. type = "Vec3",
  22450. description = "The new vector."
  22451. }
  22452. }
  22453. },
  22454. {
  22455. arguments = {
  22456. {
  22457. name = "u",
  22458. type = "Vec3",
  22459. description = "A vector to copy the values from."
  22460. }
  22461. },
  22462. returns = {
  22463. {
  22464. name = "v",
  22465. type = "Vec3",
  22466. description = "The new vector."
  22467. }
  22468. }
  22469. },
  22470. {
  22471. arguments = {
  22472. {
  22473. name = "m",
  22474. type = "Mat4",
  22475. description = "A matrix to use the position of."
  22476. }
  22477. },
  22478. returns = {
  22479. {
  22480. name = "v",
  22481. type = "Vec3",
  22482. description = "The new vector."
  22483. }
  22484. }
  22485. }
  22486. }
  22487. },
  22488. {
  22489. name = "newVec4",
  22490. tag = "vectors",
  22491. summary = "Create a new Vec4.",
  22492. description = "Creates a new 4D vector. This function takes the same arguments as `Vec4:set`.",
  22493. key = "lovr.math.newVec4",
  22494. module = "lovr.math",
  22495. related = {
  22496. "lovr.math.vec4",
  22497. "Vec4"
  22498. },
  22499. variants = {
  22500. {
  22501. arguments = {
  22502. {
  22503. name = "x",
  22504. type = "number",
  22505. description = "The x value of the vector.",
  22506. default = "0"
  22507. },
  22508. {
  22509. name = "y",
  22510. type = "number",
  22511. description = "The y value of the vector.",
  22512. default = "x"
  22513. },
  22514. {
  22515. name = "z",
  22516. type = "number",
  22517. description = "The z value of the vector.",
  22518. default = "x"
  22519. },
  22520. {
  22521. name = "w",
  22522. type = "number",
  22523. description = "The w value of the vector.",
  22524. default = "x"
  22525. }
  22526. },
  22527. returns = {
  22528. {
  22529. name = "v",
  22530. type = "Vec4",
  22531. description = "The new vector."
  22532. }
  22533. }
  22534. },
  22535. {
  22536. arguments = {
  22537. {
  22538. name = "u",
  22539. type = "Vec4",
  22540. description = "A vector to copy the values from."
  22541. }
  22542. },
  22543. returns = {
  22544. {
  22545. name = "v",
  22546. type = "Vec4",
  22547. description = "The new vector."
  22548. }
  22549. }
  22550. }
  22551. }
  22552. },
  22553. {
  22554. name = "noise",
  22555. tag = "random",
  22556. summary = "Generate perlin noise.",
  22557. description = "Returns a 1D, 2D, 3D, or 4D perlin noise value. The number will be between 0 and 1, and it will always be 0.5 when the inputs are integers.",
  22558. key = "lovr.math.noise",
  22559. module = "lovr.math",
  22560. related = {
  22561. "lovr.math.random"
  22562. },
  22563. variants = {
  22564. {
  22565. arguments = {
  22566. {
  22567. name = "x",
  22568. type = "number",
  22569. description = "The x coordinate of the input."
  22570. }
  22571. },
  22572. returns = {
  22573. {
  22574. name = "noise",
  22575. type = "number",
  22576. description = "The noise value, between 0 and 1."
  22577. }
  22578. }
  22579. },
  22580. {
  22581. arguments = {
  22582. {
  22583. name = "x",
  22584. type = "number",
  22585. description = "The x coordinate of the input."
  22586. },
  22587. {
  22588. name = "y",
  22589. type = "number",
  22590. description = "The y coordinate of the input."
  22591. }
  22592. },
  22593. returns = {
  22594. {
  22595. name = "noise",
  22596. type = "number",
  22597. description = "The noise value, between 0 and 1."
  22598. }
  22599. }
  22600. },
  22601. {
  22602. arguments = {
  22603. {
  22604. name = "x",
  22605. type = "number",
  22606. description = "The x coordinate of the input."
  22607. },
  22608. {
  22609. name = "y",
  22610. type = "number",
  22611. description = "The y coordinate of the input."
  22612. },
  22613. {
  22614. name = "z",
  22615. type = "number",
  22616. description = "The z coordinate of the input."
  22617. }
  22618. },
  22619. returns = {
  22620. {
  22621. name = "noise",
  22622. type = "number",
  22623. description = "The noise value, between 0 and 1."
  22624. }
  22625. }
  22626. },
  22627. {
  22628. arguments = {
  22629. {
  22630. name = "x",
  22631. type = "number",
  22632. description = "The x coordinate of the input."
  22633. },
  22634. {
  22635. name = "y",
  22636. type = "number",
  22637. description = "The y coordinate of the input."
  22638. },
  22639. {
  22640. name = "z",
  22641. type = "number",
  22642. description = "The z coordinate of the input."
  22643. },
  22644. {
  22645. name = "w",
  22646. type = "number",
  22647. description = "The w coordinate of the input."
  22648. }
  22649. },
  22650. returns = {
  22651. {
  22652. name = "noise",
  22653. type = "number",
  22654. description = "The noise value, between 0 and 1."
  22655. }
  22656. }
  22657. }
  22658. }
  22659. },
  22660. {
  22661. name = "quat",
  22662. tag = "vectors",
  22663. summary = "Create a temporary Quat.",
  22664. description = "Creates a temporary quaternion. This function takes the same arguments as `Quat:set`.",
  22665. key = "lovr.math.quat",
  22666. module = "lovr.math",
  22667. related = {
  22668. "lovr.math.newQuat",
  22669. "Quat"
  22670. },
  22671. variants = {
  22672. {
  22673. arguments = {
  22674. {
  22675. name = "angle",
  22676. description = "An angle to use for the rotation, in radians.",
  22677. default = "0"
  22678. },
  22679. {
  22680. name = "ax",
  22681. type = "number",
  22682. description = "The x component of the axis of rotation.",
  22683. default = "0"
  22684. },
  22685. {
  22686. name = "ay",
  22687. type = "number",
  22688. description = "The y component of the axis of rotation.",
  22689. default = "0"
  22690. },
  22691. {
  22692. name = "az",
  22693. type = "number",
  22694. description = "The z component of the axis of rotation.",
  22695. default = "0"
  22696. },
  22697. {
  22698. name = "raw",
  22699. type = "boolean",
  22700. description = "Whether the components should be interpreted as raw `(x, y, z, w)` components.",
  22701. default = "false"
  22702. }
  22703. },
  22704. returns = {
  22705. {
  22706. name = "q",
  22707. type = "quat",
  22708. description = "The new quaternion."
  22709. }
  22710. }
  22711. },
  22712. {
  22713. arguments = {
  22714. {
  22715. name = "r",
  22716. type = "quat",
  22717. description = "An existing quaternion to copy the values from."
  22718. }
  22719. },
  22720. returns = {
  22721. {
  22722. name = "q",
  22723. type = "quat",
  22724. description = "The new quaternion."
  22725. }
  22726. }
  22727. },
  22728. {
  22729. description = "Uses the direction of a vector.",
  22730. arguments = {
  22731. {
  22732. name = "v",
  22733. type = "vec3",
  22734. description = "A normalized direction vector."
  22735. }
  22736. },
  22737. returns = {
  22738. {
  22739. name = "q",
  22740. type = "quat",
  22741. description = "The new quaternion."
  22742. }
  22743. }
  22744. },
  22745. {
  22746. description = "Sets the rotation to represent the rotation between two vectors.",
  22747. arguments = {
  22748. {
  22749. name = "v",
  22750. type = "vec3",
  22751. description = "A normalized direction vector."
  22752. },
  22753. {
  22754. name = "u",
  22755. type = "vec3",
  22756. description = "Another normalized direction vector."
  22757. }
  22758. },
  22759. returns = {
  22760. {
  22761. name = "q",
  22762. type = "quat",
  22763. description = "The new quaternion."
  22764. }
  22765. }
  22766. },
  22767. {
  22768. arguments = {
  22769. {
  22770. name = "m",
  22771. type = "mat4",
  22772. description = "A matrix to use the rotation from."
  22773. }
  22774. },
  22775. returns = {
  22776. {
  22777. name = "q",
  22778. type = "quat",
  22779. description = "The new quaternion."
  22780. }
  22781. }
  22782. },
  22783. {
  22784. description = "Set the quaternion to the identity (0, 0, 0, 1).",
  22785. arguments = {},
  22786. returns = {
  22787. {
  22788. name = "q",
  22789. type = "quat",
  22790. description = "The new quaternion."
  22791. }
  22792. }
  22793. }
  22794. }
  22795. },
  22796. {
  22797. name = "random",
  22798. tag = "random",
  22799. summary = "Get a random number.",
  22800. description = "Returns a uniformly distributed pseudo-random number. This function has improved randomness over Lua's `math.random` and also guarantees that the sequence of random numbers will be the same on all platforms (given the same seed).",
  22801. key = "lovr.math.random",
  22802. module = "lovr.math",
  22803. notes = "You can set the random seed using `lovr.math.setRandomSeed`.",
  22804. related = {
  22805. "lovr.math.randomNormal",
  22806. "RandomGenerator",
  22807. "lovr.math.noise"
  22808. },
  22809. variants = {
  22810. {
  22811. description = "Generate a pseudo-random floating point number in the range `[0,1)`",
  22812. arguments = {},
  22813. returns = {
  22814. {
  22815. name = "x",
  22816. type = "number",
  22817. description = "A pseudo-random number."
  22818. }
  22819. }
  22820. },
  22821. {
  22822. description = "Generate a pseudo-random integer in the range `[1,high]`",
  22823. arguments = {
  22824. {
  22825. name = "high",
  22826. type = "number",
  22827. description = "The maximum number to generate."
  22828. }
  22829. },
  22830. returns = {
  22831. {
  22832. name = "x",
  22833. type = "number",
  22834. description = "A pseudo-random number."
  22835. }
  22836. }
  22837. },
  22838. {
  22839. description = "Generate a pseudo-random integer in the range `[low,high]`",
  22840. arguments = {
  22841. {
  22842. name = "low",
  22843. type = "number",
  22844. description = "The minimum number to generate."
  22845. },
  22846. {
  22847. name = "high",
  22848. type = "number",
  22849. description = "The maximum number to generate."
  22850. }
  22851. },
  22852. returns = {
  22853. {
  22854. name = "x",
  22855. type = "number",
  22856. description = "A pseudo-random number."
  22857. }
  22858. }
  22859. }
  22860. }
  22861. },
  22862. {
  22863. name = "randomNormal",
  22864. tag = "random",
  22865. summary = "Get a random number from a normal distribution.",
  22866. description = "Returns a pseudo-random number from a normal distribution (a bell curve). You can control the center of the bell curve (the mean value) and the overall width (sigma, or standard deviation).",
  22867. key = "lovr.math.randomNormal",
  22868. module = "lovr.math",
  22869. related = {
  22870. "lovr.math.random",
  22871. "RandomGenerator"
  22872. },
  22873. variants = {
  22874. {
  22875. arguments = {
  22876. {
  22877. name = "sigma",
  22878. type = "number",
  22879. description = "The standard deviation of the distribution. This can be thought of how \"wide\" the range of numbers is or how much variability there is.",
  22880. default = "1"
  22881. },
  22882. {
  22883. name = "mu",
  22884. type = "number",
  22885. description = "The average value returned.",
  22886. default = "0"
  22887. }
  22888. },
  22889. returns = {
  22890. {
  22891. name = "x",
  22892. type = "number",
  22893. description = "A normally distributed pseudo-random number."
  22894. }
  22895. }
  22896. }
  22897. }
  22898. },
  22899. {
  22900. name = "setRandomSeed",
  22901. tag = "random",
  22902. summary = "Set the random seed.",
  22903. description = "Seed the random generator with a new seed. Each seed will cause `lovr.math.random` and `lovr.math.randomNormal` to produce a unique sequence of random numbers. This is done once automatically at startup by `lovr.run`.",
  22904. key = "lovr.math.setRandomSeed",
  22905. module = "lovr.math",
  22906. variants = {
  22907. {
  22908. arguments = {
  22909. {
  22910. name = "seed",
  22911. type = "number",
  22912. description = "The new seed."
  22913. }
  22914. },
  22915. returns = {}
  22916. }
  22917. }
  22918. },
  22919. {
  22920. name = "vec2",
  22921. tag = "vectors",
  22922. summary = "Create a temporary Vec2.",
  22923. description = "Creates a temporary 2D vector. This function takes the same arguments as `Vec2:set`.",
  22924. key = "lovr.math.vec2",
  22925. module = "lovr.math",
  22926. related = {
  22927. "lovr.math.newVec2",
  22928. "Vec2"
  22929. },
  22930. variants = {
  22931. {
  22932. arguments = {
  22933. {
  22934. name = "x",
  22935. type = "number",
  22936. description = "The x value of the vector.",
  22937. default = "0"
  22938. },
  22939. {
  22940. name = "y",
  22941. type = "number",
  22942. description = "The y value of the vector.",
  22943. default = "x"
  22944. }
  22945. },
  22946. returns = {
  22947. {
  22948. name = "v",
  22949. type = "Vec2",
  22950. description = "The new vector."
  22951. }
  22952. }
  22953. },
  22954. {
  22955. arguments = {
  22956. {
  22957. name = "u",
  22958. type = "Vec2",
  22959. description = "A vector to copy the values from."
  22960. }
  22961. },
  22962. returns = {
  22963. {
  22964. name = "v",
  22965. type = "Vec2",
  22966. description = "The new vector."
  22967. }
  22968. }
  22969. }
  22970. }
  22971. },
  22972. {
  22973. name = "vec3",
  22974. tag = "vectors",
  22975. summary = "Create a temporary Vec3.",
  22976. description = "Creates a temporary 3D vector. This function takes the same arguments as `Vec3:set`.",
  22977. key = "lovr.math.vec3",
  22978. module = "lovr.math",
  22979. related = {
  22980. "lovr.math.newVec3",
  22981. "Vec3"
  22982. },
  22983. variants = {
  22984. {
  22985. arguments = {
  22986. {
  22987. name = "x",
  22988. type = "number",
  22989. description = "The x value of the vector.",
  22990. default = "0"
  22991. },
  22992. {
  22993. name = "y",
  22994. type = "number",
  22995. description = "The y value of the vector.",
  22996. default = "x"
  22997. },
  22998. {
  22999. name = "z",
  23000. type = "number",
  23001. description = "The z value of the vector.",
  23002. default = "x"
  23003. }
  23004. },
  23005. returns = {
  23006. {
  23007. name = "v",
  23008. type = "Vec3",
  23009. description = "The new vector."
  23010. }
  23011. }
  23012. },
  23013. {
  23014. arguments = {
  23015. {
  23016. name = "u",
  23017. type = "Vec3",
  23018. description = "A vector to copy the values from."
  23019. }
  23020. },
  23021. returns = {
  23022. {
  23023. name = "v",
  23024. type = "Vec3",
  23025. description = "The new vector."
  23026. }
  23027. }
  23028. },
  23029. {
  23030. arguments = {
  23031. {
  23032. name = "m",
  23033. type = "Mat4",
  23034. description = "A matrix to use the position of."
  23035. }
  23036. },
  23037. returns = {
  23038. {
  23039. name = "v",
  23040. type = "Vec3",
  23041. description = "The new vector."
  23042. }
  23043. }
  23044. }
  23045. }
  23046. },
  23047. {
  23048. name = "vec4",
  23049. tag = "vectors",
  23050. summary = "Create a temporary Vec4.",
  23051. description = "Creates a temporary 4D vector. This function takes the same arguments as `Vec4:set`.",
  23052. key = "lovr.math.vec4",
  23053. module = "lovr.math",
  23054. related = {
  23055. "lovr.math.newVec4",
  23056. "Vec4"
  23057. },
  23058. variants = {
  23059. {
  23060. arguments = {
  23061. {
  23062. name = "x",
  23063. type = "number",
  23064. description = "The x value of the vector.",
  23065. default = "0"
  23066. },
  23067. {
  23068. name = "y",
  23069. type = "number",
  23070. description = "The y value of the vector.",
  23071. default = "x"
  23072. },
  23073. {
  23074. name = "z",
  23075. type = "number",
  23076. description = "The z value of the vector.",
  23077. default = "x"
  23078. },
  23079. {
  23080. name = "w",
  23081. type = "number",
  23082. description = "The w value of the vector.",
  23083. default = "x"
  23084. }
  23085. },
  23086. returns = {
  23087. {
  23088. name = "v",
  23089. type = "Vec4",
  23090. description = "The new vector."
  23091. }
  23092. }
  23093. },
  23094. {
  23095. arguments = {
  23096. {
  23097. name = "u",
  23098. type = "Vec4",
  23099. description = "A vector to copy the values from."
  23100. }
  23101. },
  23102. returns = {
  23103. {
  23104. name = "v",
  23105. type = "Vec4",
  23106. description = "The new vector."
  23107. }
  23108. }
  23109. }
  23110. }
  23111. }
  23112. },
  23113. enums = {},
  23114. sections = {
  23115. {
  23116. name = "Randomization",
  23117. tag = "random",
  23118. description = "Functions for generating random numbers and noise."
  23119. },
  23120. {
  23121. name = "Vectors",
  23122. tag = "vectors",
  23123. description = "A collection of vector objects. Check out the `Vectors` guide for an introduction."
  23124. },
  23125. {
  23126. name = "Other",
  23127. tag = "mathOther",
  23128. description = "Other miscellaneous math objects/helpers."
  23129. }
  23130. }
  23131. },
  23132. {
  23133. name = "physics",
  23134. tag = "modules",
  23135. summary = "Simulates 3D physics.",
  23136. description = "The `lovr.physics` module simulates 3D rigid body physics.",
  23137. key = "lovr.physics",
  23138. objects = {
  23139. {
  23140. name = "BallJoint",
  23141. summary = "A ball and socket joint.",
  23142. description = "A BallJoint is a type of `Joint` that acts like a ball and socket between two colliders. It allows the colliders to rotate freely around an anchor point, but does not allow the colliders' distance from the anchor point to change.",
  23143. key = "BallJoint",
  23144. module = "lovr.physics",
  23145. constructors = {
  23146. "lovr.physics.newBallJoint"
  23147. },
  23148. related = {
  23149. "Collider"
  23150. },
  23151. extends = "Joint",
  23152. methods = {
  23153. {
  23154. name = "getAnchors",
  23155. summary = "Get the anchor points of the BallJoint.",
  23156. description = "Returns the anchor points of the BallJoint, in world coordinates. The first point is the anchor on the first collider, and the second point is on the second collider. The joint tries to keep these points the same, but they may be different if the joint is forced apart by some other means.",
  23157. key = "BallJoint:getAnchors",
  23158. module = "lovr.physics",
  23159. variants = {
  23160. {
  23161. arguments = {},
  23162. returns = {
  23163. {
  23164. name = "x1",
  23165. type = "number",
  23166. description = "The x coordinate of the first anchor point, in world coordinates."
  23167. },
  23168. {
  23169. name = "y1",
  23170. type = "number",
  23171. description = "The y coordinate of the first anchor point, in world coordinates."
  23172. },
  23173. {
  23174. name = "z1",
  23175. type = "number",
  23176. description = "The z coordinate of the first anchor point, in world coordinates."
  23177. },
  23178. {
  23179. name = "x2",
  23180. type = "number",
  23181. description = "The x coordinate of the second anchor point, in world coordinates."
  23182. },
  23183. {
  23184. name = "y2",
  23185. type = "number",
  23186. description = "The y coordinate of the second anchor point, in world coordinates."
  23187. },
  23188. {
  23189. name = "z2",
  23190. type = "number",
  23191. description = "The z coordinate of the second anchor point, in world coordinates."
  23192. }
  23193. }
  23194. }
  23195. }
  23196. },
  23197. {
  23198. name = "getResponseTime",
  23199. summary = "Get the response time of the joint.",
  23200. description = "Returns the response time of the joint. See `World:setResponseTime` for more info.",
  23201. key = "BallJoint:getResponseTime",
  23202. module = "lovr.physics",
  23203. related = {
  23204. "DistanceJoint:getResponseTime",
  23205. "DistanceJoint:setResponseTime",
  23206. "World:getResponseTime",
  23207. "World:setResponseTime"
  23208. },
  23209. variants = {
  23210. {
  23211. arguments = {},
  23212. returns = {
  23213. {
  23214. name = "responseTime",
  23215. type = "number",
  23216. description = "The response time setting for the joint."
  23217. }
  23218. }
  23219. }
  23220. }
  23221. },
  23222. {
  23223. name = "getTightness",
  23224. summary = "Get the joint tightness.",
  23225. description = "Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.",
  23226. key = "BallJoint:getTightness",
  23227. module = "lovr.physics",
  23228. related = {
  23229. "DistanceJoint:getTightness",
  23230. "DistanceJoint:setTightness",
  23231. "World:getTightness",
  23232. "World:setTightness"
  23233. },
  23234. variants = {
  23235. {
  23236. arguments = {},
  23237. returns = {
  23238. {
  23239. name = "tightness",
  23240. type = "number",
  23241. description = "The tightness of the joint."
  23242. }
  23243. }
  23244. }
  23245. }
  23246. },
  23247. {
  23248. name = "setAnchor",
  23249. summary = "Set the anchor point of the BallJoint.",
  23250. description = "Sets a new anchor point for the BallJoint.",
  23251. key = "BallJoint:setAnchor",
  23252. module = "lovr.physics",
  23253. variants = {
  23254. {
  23255. arguments = {
  23256. {
  23257. name = "x",
  23258. type = "number",
  23259. description = "The x coordinate of the anchor point, in world coordinates."
  23260. },
  23261. {
  23262. name = "y",
  23263. type = "number",
  23264. description = "The y coordinate of the anchor point, in world coordinates."
  23265. },
  23266. {
  23267. name = "z",
  23268. type = "number",
  23269. description = "The z coordinate of the anchor point, in world coordinates."
  23270. }
  23271. },
  23272. returns = {}
  23273. }
  23274. }
  23275. },
  23276. {
  23277. name = "setResponseTime",
  23278. summary = "Set the response time of the joint.",
  23279. description = "Sets the response time of the joint. See `World:setResponseTime` for more info.",
  23280. key = "BallJoint:setResponseTime",
  23281. module = "lovr.physics",
  23282. related = {
  23283. "DistanceJoint:getResponseTime",
  23284. "DistanceJoint:setResponseTime",
  23285. "World:getResponseTime",
  23286. "World:setResponseTime"
  23287. },
  23288. variants = {
  23289. {
  23290. arguments = {
  23291. {
  23292. name = "responseTime",
  23293. type = "number",
  23294. description = "The new response time setting for the joint."
  23295. }
  23296. },
  23297. returns = {}
  23298. }
  23299. }
  23300. },
  23301. {
  23302. name = "setTightness",
  23303. summary = "Set the joint tightness.",
  23304. description = "Sets the tightness of the joint. See `World:setTightness` for how this affects the joint.",
  23305. key = "BallJoint:setTightness",
  23306. module = "lovr.physics",
  23307. related = {
  23308. "DistanceJoint:getTightness",
  23309. "DistanceJoint:setTightness",
  23310. "World:getTightness",
  23311. "World:setTightness"
  23312. },
  23313. variants = {
  23314. {
  23315. arguments = {
  23316. {
  23317. name = "tightness",
  23318. type = "number",
  23319. description = "The tightness of the joint."
  23320. }
  23321. },
  23322. returns = {}
  23323. }
  23324. }
  23325. }
  23326. }
  23327. },
  23328. {
  23329. name = "BoxShape",
  23330. summary = "A box Shape.",
  23331. description = "A type of `Shape` that can be used for cubes or boxes.",
  23332. key = "BoxShape",
  23333. module = "lovr.physics",
  23334. constructors = {
  23335. "lovr.physics.newBoxShape",
  23336. "World:newBoxCollider"
  23337. },
  23338. extends = "Shape",
  23339. methods = {
  23340. {
  23341. name = "getDimensions",
  23342. summary = "Get the dimensions of the BoxShape.",
  23343. description = "Returns the width, height, and depth of the BoxShape.",
  23344. key = "BoxShape:getDimensions",
  23345. module = "lovr.physics",
  23346. variants = {
  23347. {
  23348. arguments = {},
  23349. returns = {
  23350. {
  23351. name = "width",
  23352. type = "number",
  23353. description = "The width of the box, in meters."
  23354. },
  23355. {
  23356. name = "height",
  23357. type = "number",
  23358. description = "The height of the box, in meters."
  23359. },
  23360. {
  23361. name = "depth",
  23362. type = "number",
  23363. description = "The depth of the box, in meters."
  23364. }
  23365. }
  23366. }
  23367. }
  23368. },
  23369. {
  23370. name = "setDimensions",
  23371. summary = "Set the dimensions of the BoxShape.",
  23372. description = "Sets the width, height, and depth of the BoxShape.",
  23373. key = "BoxShape:setDimensions",
  23374. module = "lovr.physics",
  23375. variants = {
  23376. {
  23377. arguments = {
  23378. {
  23379. name = "width",
  23380. type = "number",
  23381. description = "The width of the box, in meters."
  23382. },
  23383. {
  23384. name = "height",
  23385. type = "number",
  23386. description = "The height of the box, in meters."
  23387. },
  23388. {
  23389. name = "depth",
  23390. type = "number",
  23391. description = "The depth of the box, in meters."
  23392. }
  23393. },
  23394. returns = {}
  23395. }
  23396. }
  23397. }
  23398. }
  23399. },
  23400. {
  23401. name = "CapsuleShape",
  23402. summary = "A capsule Shape.",
  23403. description = "A type of `Shape` that can be used for capsule-shaped things.",
  23404. key = "CapsuleShape",
  23405. module = "lovr.physics",
  23406. constructors = {
  23407. "lovr.physics.newCapsuleShape",
  23408. "World:newCapsuleCollider"
  23409. },
  23410. extends = "Shape",
  23411. methods = {
  23412. {
  23413. name = "getLength",
  23414. summary = "Get the length of the CapsuleShape.",
  23415. description = "Returns the length of the CapsuleShape, not including the caps.",
  23416. key = "CapsuleShape:getLength",
  23417. module = "lovr.physics",
  23418. variants = {
  23419. {
  23420. arguments = {},
  23421. returns = {
  23422. {
  23423. name = "length",
  23424. type = "number",
  23425. description = "The length of the capsule, in meters."
  23426. }
  23427. }
  23428. }
  23429. }
  23430. },
  23431. {
  23432. name = "getRadius",
  23433. summary = "Get the radius of the CapsuleShape.",
  23434. description = "Returns the radius of the CapsuleShape.",
  23435. key = "CapsuleShape:getRadius",
  23436. module = "lovr.physics",
  23437. variants = {
  23438. {
  23439. arguments = {},
  23440. returns = {
  23441. {
  23442. name = "radius",
  23443. type = "number",
  23444. description = "The radius of the capsule, in meters."
  23445. }
  23446. }
  23447. }
  23448. }
  23449. },
  23450. {
  23451. name = "setLength",
  23452. summary = "Set the length of the CapsuleShape.",
  23453. description = "Sets the length of the CapsuleShape.",
  23454. key = "CapsuleShape:setLength",
  23455. module = "lovr.physics",
  23456. variants = {
  23457. {
  23458. arguments = {
  23459. {
  23460. name = "length",
  23461. type = "number",
  23462. description = "The new length, in meters, not including the caps."
  23463. }
  23464. },
  23465. returns = {}
  23466. }
  23467. }
  23468. },
  23469. {
  23470. name = "setRadius",
  23471. summary = "Set the radius of the CapsuleShape.",
  23472. description = "Sets the radius of the CapsuleShape.",
  23473. key = "CapsuleShape:setRadius",
  23474. module = "lovr.physics",
  23475. variants = {
  23476. {
  23477. arguments = {
  23478. {
  23479. name = "radius",
  23480. type = "number",
  23481. description = "The new radius, in meters."
  23482. }
  23483. },
  23484. returns = {}
  23485. }
  23486. }
  23487. }
  23488. }
  23489. },
  23490. {
  23491. name = "Collider",
  23492. summary = "A single entity in a physics simulation.",
  23493. description = "Colliders are objects that represent a single rigid body in a physics simulation. They can have forces applied to them and collide with other colliders.",
  23494. key = "Collider",
  23495. module = "lovr.physics",
  23496. constructors = {
  23497. "World:newCollider",
  23498. "World:newBoxCollider",
  23499. "World:newCapsuleCollider",
  23500. "World:newCylinderCollider",
  23501. "World:newSphereCollider",
  23502. "World:newMeshCollider"
  23503. },
  23504. methods = {
  23505. {
  23506. name = "addShape",
  23507. summary = "Add a Shape to the Collider.",
  23508. description = "Attaches a Shape to the collider. Attached shapes will collide with other shapes in the world.",
  23509. key = "Collider:addShape",
  23510. module = "lovr.physics",
  23511. related = {
  23512. "Collider:removeShape",
  23513. "Collider:getShapes",
  23514. "Shape"
  23515. },
  23516. variants = {
  23517. {
  23518. arguments = {
  23519. {
  23520. name = "shape",
  23521. type = "Shape",
  23522. description = "The Shape to attach."
  23523. }
  23524. },
  23525. returns = {}
  23526. }
  23527. }
  23528. },
  23529. {
  23530. name = "applyForce",
  23531. summary = "Apply a force to the Collider.",
  23532. description = "Applies a force to the Collider.",
  23533. key = "Collider:applyForce",
  23534. module = "lovr.physics",
  23535. notes = "If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any affect.",
  23536. variants = {
  23537. {
  23538. arguments = {
  23539. {
  23540. name = "x",
  23541. type = "number",
  23542. description = "The x component of the force to apply."
  23543. },
  23544. {
  23545. name = "y",
  23546. type = "number",
  23547. description = "The y component of the force to apply."
  23548. },
  23549. {
  23550. name = "z",
  23551. type = "number",
  23552. description = "The z component of the force to apply."
  23553. }
  23554. },
  23555. returns = {}
  23556. },
  23557. {
  23558. arguments = {
  23559. {
  23560. name = "x",
  23561. type = "number",
  23562. description = "The x component of the force to apply."
  23563. },
  23564. {
  23565. name = "y",
  23566. type = "number",
  23567. description = "The y component of the force to apply."
  23568. },
  23569. {
  23570. name = "z",
  23571. type = "number",
  23572. description = "The z component of the force to apply."
  23573. },
  23574. {
  23575. name = "px",
  23576. type = "number",
  23577. description = "The x position to apply the force at, in world coordinates."
  23578. },
  23579. {
  23580. name = "py",
  23581. type = "number",
  23582. description = "The y position to apply the force at, in world coordinates."
  23583. },
  23584. {
  23585. name = "pz",
  23586. type = "number",
  23587. description = "The z position to apply the force at, in world coordinates."
  23588. }
  23589. },
  23590. returns = {}
  23591. }
  23592. },
  23593. related = {
  23594. "Collider:applyTorque"
  23595. }
  23596. },
  23597. {
  23598. name = "applyTorque",
  23599. summary = "Apply torque to the Collider.",
  23600. description = "Applies torque to the Collider.",
  23601. key = "Collider:applyTorque",
  23602. module = "lovr.physics",
  23603. notes = "If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any effect.",
  23604. variants = {
  23605. {
  23606. arguments = {
  23607. {
  23608. name = "x",
  23609. type = "number",
  23610. description = "The x component of the torque."
  23611. },
  23612. {
  23613. name = "y",
  23614. type = "number",
  23615. description = "The y component of the torque."
  23616. },
  23617. {
  23618. name = "z",
  23619. type = "number",
  23620. description = "The z component of the torque."
  23621. }
  23622. },
  23623. returns = {}
  23624. }
  23625. },
  23626. related = {
  23627. "Collider:applyForce"
  23628. }
  23629. },
  23630. {
  23631. name = "destroy",
  23632. summary = "Destroy the Collider.",
  23633. description = "Destroy the Collider, removing it from the World.",
  23634. key = "Collider:destroy",
  23635. module = "lovr.physics",
  23636. notes = "Calling functions on the collider after destroying it is a bad idea.",
  23637. variants = {
  23638. {
  23639. arguments = {},
  23640. returns = {}
  23641. }
  23642. },
  23643. related = {
  23644. "World:destroy",
  23645. "Shape:destroy",
  23646. "Joint:destroy"
  23647. }
  23648. },
  23649. {
  23650. name = "getAABB",
  23651. summary = "Get the Collider's axis aligned bounding box.",
  23652. description = "Returns the bounding box for the Collider, computed from attached shapes.",
  23653. key = "Collider:getAABB",
  23654. module = "lovr.physics",
  23655. related = {
  23656. "Shape:getAABB"
  23657. },
  23658. variants = {
  23659. {
  23660. arguments = {},
  23661. returns = {
  23662. {
  23663. name = "minx",
  23664. type = "number",
  23665. description = "The minimum x coordinate of the box."
  23666. },
  23667. {
  23668. name = "maxx",
  23669. type = "number",
  23670. description = "The maximum x coordinate of the box."
  23671. },
  23672. {
  23673. name = "miny",
  23674. type = "number",
  23675. description = "The minimum y coordinate of the box."
  23676. },
  23677. {
  23678. name = "maxy",
  23679. type = "number",
  23680. description = "The maximum y coordinate of the box."
  23681. },
  23682. {
  23683. name = "minz",
  23684. type = "number",
  23685. description = "The minimum z coordinate of the box."
  23686. },
  23687. {
  23688. name = "maxz",
  23689. type = "number",
  23690. description = "The maximum z coordinate of the box."
  23691. }
  23692. }
  23693. }
  23694. }
  23695. },
  23696. {
  23697. name = "getAngularDamping",
  23698. summary = "Get the angular damping of the Collider.",
  23699. description = "Returns the angular damping parameters of the Collider. Angular damping makes things less \"spinny\", making them slow down their angular velocity over time.",
  23700. key = "Collider:getAngularDamping",
  23701. module = "lovr.physics",
  23702. notes = "Angular damping can also be set on the World.",
  23703. variants = {
  23704. {
  23705. arguments = {},
  23706. returns = {
  23707. {
  23708. name = "damping",
  23709. type = "number",
  23710. description = "The angular damping."
  23711. },
  23712. {
  23713. name = "threshold",
  23714. type = "number",
  23715. description = "Velocity limit below which the damping is not applied."
  23716. }
  23717. }
  23718. }
  23719. },
  23720. related = {
  23721. "World:getAngularDamping",
  23722. "World:setAngularDamping"
  23723. }
  23724. },
  23725. {
  23726. name = "getAngularVelocity",
  23727. summary = "Get the angular velocity of the Collider.",
  23728. description = "Returns the angular velocity of the Collider.",
  23729. key = "Collider:getAngularVelocity",
  23730. module = "lovr.physics",
  23731. related = {
  23732. "Collider:getLinearVelocity",
  23733. "Collider:setLinearVelocity",
  23734. "Collider:applyTorque",
  23735. "Collider:getOrientation",
  23736. "Collider:setOrientation"
  23737. },
  23738. variants = {
  23739. {
  23740. arguments = {},
  23741. returns = {
  23742. {
  23743. name = "vx",
  23744. type = "number",
  23745. description = "The x component of the angular velocity."
  23746. },
  23747. {
  23748. name = "vy",
  23749. type = "number",
  23750. description = "The y component of the angular velocity."
  23751. },
  23752. {
  23753. name = "vz",
  23754. type = "number",
  23755. description = "The z component of the angular velocity."
  23756. }
  23757. }
  23758. }
  23759. }
  23760. },
  23761. {
  23762. name = "getFriction",
  23763. summary = "Get the friction of the Collider.",
  23764. description = "Returns the friction of the Collider. By default, the friction of two Colliders is combined (multiplied) when they collide to generate a friction force. The initial friction is 0.",
  23765. key = "Collider:getFriction",
  23766. module = "lovr.physics",
  23767. related = {
  23768. "Collider:getRestitution",
  23769. "Collider:setRestitution",
  23770. "World:collide"
  23771. },
  23772. variants = {
  23773. {
  23774. arguments = {},
  23775. returns = {
  23776. {
  23777. name = "friction",
  23778. type = "number",
  23779. description = "The friction of the Collider."
  23780. }
  23781. }
  23782. }
  23783. }
  23784. },
  23785. {
  23786. name = "getJoints",
  23787. summary = "Get a list of Joints attached to the Collider.",
  23788. description = "Returns a list of Joints attached to the Collider.",
  23789. key = "Collider:getJoints",
  23790. module = "lovr.physics",
  23791. related = {
  23792. "Joint"
  23793. },
  23794. variants = {
  23795. {
  23796. arguments = {},
  23797. returns = {
  23798. {
  23799. name = "joints",
  23800. type = "table",
  23801. description = "A list of Joints attached to the Collider."
  23802. }
  23803. }
  23804. }
  23805. }
  23806. },
  23807. {
  23808. name = "getLinearDamping",
  23809. summary = "Get the linear damping of the Collider.",
  23810. description = "Returns the Collider's linear damping parameters. Linear damping is similar to drag or air resistance, slowing the Collider down over time.",
  23811. key = "Collider:getLinearDamping",
  23812. module = "lovr.physics",
  23813. notes = "A linear damping of 0 means the Collider won't slow down over time. This is the default.\n\nLinear damping can also be set on the World using `World:setLinearDamping`, which will affect all new colliders.",
  23814. variants = {
  23815. {
  23816. arguments = {},
  23817. returns = {
  23818. {
  23819. name = "damping",
  23820. type = "number",
  23821. description = "The linear damping."
  23822. },
  23823. {
  23824. name = "threshold",
  23825. type = "number",
  23826. description = "Velocity limit below which the damping is not applied."
  23827. }
  23828. }
  23829. }
  23830. },
  23831. related = {
  23832. "World:getLinearDamping",
  23833. "World:setLinearDamping"
  23834. }
  23835. },
  23836. {
  23837. name = "getLinearVelocity",
  23838. summary = "Get the linear velocity of the Collider.",
  23839. description = "Returns the linear velocity of the Collider. This is how fast the Collider is moving. There is also angular velocity, which is how fast the Collider is spinning.",
  23840. key = "Collider:getLinearVelocity",
  23841. module = "lovr.physics",
  23842. related = {
  23843. "Collider:getLinearVelocityFromLocalPoint",
  23844. "Collider:getLinearVelocityFromWorldPoint",
  23845. "Collider:getAngularVelocity",
  23846. "Collider:setAngularVelocity",
  23847. "Collider:applyForce",
  23848. "Collider:getPosition",
  23849. "Collider:setPosition"
  23850. },
  23851. variants = {
  23852. {
  23853. arguments = {},
  23854. returns = {
  23855. {
  23856. name = "vx",
  23857. type = "number",
  23858. description = "The x velocity of the Collider, in meters per second."
  23859. },
  23860. {
  23861. name = "vy",
  23862. type = "number",
  23863. description = "The y velocity of the Collider, in meters per second."
  23864. },
  23865. {
  23866. name = "vz",
  23867. type = "number",
  23868. description = "The z velocity of the Collider, in meters per second."
  23869. }
  23870. }
  23871. }
  23872. }
  23873. },
  23874. {
  23875. name = "getLinearVelocityFromLocalPoint",
  23876. summary = "Get the linear velocity of the Collider at a point.",
  23877. description = "Returns the linear velocity of a point relative to the Collider.",
  23878. key = "Collider:getLinearVelocityFromLocalPoint",
  23879. module = "lovr.physics",
  23880. related = {
  23881. "Collider:getLinearVelocity",
  23882. "Collider:getLinearVelocityFromWorldPoint"
  23883. },
  23884. variants = {
  23885. {
  23886. arguments = {
  23887. {
  23888. name = "x",
  23889. type = "number",
  23890. description = "The x coordinate."
  23891. },
  23892. {
  23893. name = "y",
  23894. type = "number",
  23895. description = "The y coordinate."
  23896. },
  23897. {
  23898. name = "z",
  23899. type = "number",
  23900. description = "The z coordinate."
  23901. }
  23902. },
  23903. returns = {
  23904. {
  23905. name = "vx",
  23906. type = "number",
  23907. description = "The x component of the velocity of the point."
  23908. },
  23909. {
  23910. name = "vy",
  23911. type = "number",
  23912. description = "The y component of the velocity of the point."
  23913. },
  23914. {
  23915. name = "vz",
  23916. type = "number",
  23917. description = "The z component of the velocity of the point."
  23918. }
  23919. }
  23920. }
  23921. }
  23922. },
  23923. {
  23924. name = "getLinearVelocityFromWorldPoint",
  23925. summary = "Get the linear velocity of the Collider at a world space point.",
  23926. description = "Returns the linear velocity of a point on the Collider specified in world space.",
  23927. key = "Collider:getLinearVelocityFromWorldPoint",
  23928. module = "lovr.physics",
  23929. related = {
  23930. "Collider:getLinearVelocity",
  23931. "Collider:getLinearVelocityFromLocalPoint"
  23932. },
  23933. variants = {
  23934. {
  23935. arguments = {
  23936. {
  23937. name = "x",
  23938. type = "number",
  23939. description = "The x coordinate in world space."
  23940. },
  23941. {
  23942. name = "y",
  23943. type = "number",
  23944. description = "The y coordinate in world space."
  23945. },
  23946. {
  23947. name = "z",
  23948. type = "number",
  23949. description = "The z coordinate in world space."
  23950. }
  23951. },
  23952. returns = {
  23953. {
  23954. name = "vx",
  23955. type = "number",
  23956. description = "The x component of the velocity of the point."
  23957. },
  23958. {
  23959. name = "vy",
  23960. type = "number",
  23961. description = "The y component of the velocity of the point."
  23962. },
  23963. {
  23964. name = "vz",
  23965. type = "number",
  23966. description = "The z component of the velocity of the point."
  23967. }
  23968. }
  23969. }
  23970. }
  23971. },
  23972. {
  23973. name = "getLocalCenter",
  23974. summary = "Get the Collider's center of mass.",
  23975. description = "Returns the Collider's center of mass.",
  23976. key = "Collider:getLocalCenter",
  23977. module = "lovr.physics",
  23978. related = {
  23979. "Collider:getLocalPoint",
  23980. "Collider:getMassData",
  23981. "Collider:setMassData"
  23982. },
  23983. variants = {
  23984. {
  23985. arguments = {},
  23986. returns = {
  23987. {
  23988. name = "cx",
  23989. type = "number",
  23990. description = "The x position of the center of mass."
  23991. },
  23992. {
  23993. name = "cy",
  23994. type = "number",
  23995. description = "The y position of the center of mass."
  23996. },
  23997. {
  23998. name = "cz",
  23999. type = "number",
  24000. description = "The z position of the center of mass."
  24001. }
  24002. }
  24003. }
  24004. }
  24005. },
  24006. {
  24007. name = "getLocalPoint",
  24008. summary = "Convert a point from world space to collider space.",
  24009. description = "Converts a point from world coordinates into local coordinates relative to the Collider.",
  24010. key = "Collider:getLocalPoint",
  24011. module = "lovr.physics",
  24012. related = {
  24013. "Collider:getWorldPoint",
  24014. "Collider:getLocalVector",
  24015. "Collider:getWorldVector"
  24016. },
  24017. variants = {
  24018. {
  24019. arguments = {
  24020. {
  24021. name = "wx",
  24022. type = "number",
  24023. description = "The x coordinate of the world point."
  24024. },
  24025. {
  24026. name = "wy",
  24027. type = "number",
  24028. description = "The y coordinate of the world point."
  24029. },
  24030. {
  24031. name = "wz",
  24032. type = "number",
  24033. description = "The z coordinate of the world point."
  24034. }
  24035. },
  24036. returns = {
  24037. {
  24038. name = "x",
  24039. type = "number",
  24040. description = "The x position of the local-space point."
  24041. },
  24042. {
  24043. name = "y",
  24044. type = "number",
  24045. description = "The y position of the local-space point."
  24046. },
  24047. {
  24048. name = "z",
  24049. type = "number",
  24050. description = "The z position of the local-space point."
  24051. }
  24052. }
  24053. }
  24054. }
  24055. },
  24056. {
  24057. name = "getLocalVector",
  24058. summary = "Convert a vector from world space to local space.",
  24059. description = "Converts a direction vector from world space to local space.",
  24060. key = "Collider:getLocalVector",
  24061. module = "lovr.physics",
  24062. related = {
  24063. "Collider:getWorldVector",
  24064. "Collider:getLocalPoint",
  24065. "Collider:getWorldPoint"
  24066. },
  24067. variants = {
  24068. {
  24069. arguments = {
  24070. {
  24071. name = "wx",
  24072. type = "number",
  24073. description = "The x component of the world vector."
  24074. },
  24075. {
  24076. name = "wy",
  24077. type = "number",
  24078. description = "The y component of the world vector."
  24079. },
  24080. {
  24081. name = "wz",
  24082. type = "number",
  24083. description = "The z component of the world vector."
  24084. }
  24085. },
  24086. returns = {
  24087. {
  24088. name = "x",
  24089. type = "number",
  24090. description = "The x coordinate of the local vector."
  24091. },
  24092. {
  24093. name = "y",
  24094. type = "number",
  24095. description = "The y coordinate of the local vector."
  24096. },
  24097. {
  24098. name = "z",
  24099. type = "number",
  24100. description = "The z coordinate of the local vector."
  24101. }
  24102. }
  24103. }
  24104. }
  24105. },
  24106. {
  24107. name = "getMass",
  24108. summary = "Get the total mass of the Collider.",
  24109. description = "Returns the total mass of the Collider. The mass of a Collider depends on its attached shapes.",
  24110. key = "Collider:getMass",
  24111. module = "lovr.physics",
  24112. related = {
  24113. "Collider:getMassData",
  24114. "Collider:setMassData",
  24115. "Shape:getMass"
  24116. },
  24117. variants = {
  24118. {
  24119. arguments = {},
  24120. returns = {
  24121. {
  24122. name = "mass",
  24123. type = "number",
  24124. description = "The mass of the Collider, in kilograms."
  24125. }
  24126. }
  24127. }
  24128. }
  24129. },
  24130. {
  24131. name = "getMassData",
  24132. summary = "Compute mass properties for the Collider.",
  24133. description = "Computes mass properties for the Collider.",
  24134. key = "Collider:getMassData",
  24135. module = "lovr.physics",
  24136. related = {
  24137. "Collider:getMass",
  24138. "Collider:setMass",
  24139. "Shape:getMass"
  24140. },
  24141. variants = {
  24142. {
  24143. arguments = {},
  24144. returns = {
  24145. {
  24146. name = "cx",
  24147. type = "number",
  24148. description = "The x position of the center of mass."
  24149. },
  24150. {
  24151. name = "cy",
  24152. type = "number",
  24153. description = "The y position of the center of mass."
  24154. },
  24155. {
  24156. name = "cz",
  24157. type = "number",
  24158. description = "The z position of the center of mass."
  24159. },
  24160. {
  24161. name = "mass",
  24162. type = "number",
  24163. description = "The computed mass of the Collider."
  24164. },
  24165. {
  24166. name = "inertia",
  24167. type = "table",
  24168. description = "A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix."
  24169. }
  24170. }
  24171. }
  24172. }
  24173. },
  24174. {
  24175. name = "getOrientation",
  24176. summary = "Get the orientation of the Collider.",
  24177. description = "Returns the orientation of the Collider in angle/axis representation.",
  24178. key = "Collider:getOrientation",
  24179. module = "lovr.physics",
  24180. related = {
  24181. "Collider:applyTorque",
  24182. "Collider:getAngularVelocity",
  24183. "Collider:setAngularVelocity",
  24184. "Collider:getPosition",
  24185. "Collider:setPosition",
  24186. "Collider:getPose",
  24187. "Collider:setPose"
  24188. },
  24189. variants = {
  24190. {
  24191. arguments = {},
  24192. returns = {
  24193. {
  24194. name = "angle",
  24195. type = "number",
  24196. description = "The number of radians the Collider is rotated around its axis of rotation."
  24197. },
  24198. {
  24199. name = "ax",
  24200. type = "number",
  24201. description = "The x component of the axis of rotation."
  24202. },
  24203. {
  24204. name = "ay",
  24205. type = "number",
  24206. description = "The y component of the axis of rotation."
  24207. },
  24208. {
  24209. name = "az",
  24210. type = "number",
  24211. description = "The z component of the axis of rotation."
  24212. }
  24213. }
  24214. }
  24215. }
  24216. },
  24217. {
  24218. name = "getPose",
  24219. summary = "Get the pose of the Collider.",
  24220. description = "Returns the position and orientation of the Collider.",
  24221. key = "Collider:getPose",
  24222. module = "lovr.physics",
  24223. related = {
  24224. "Collider:getPosition",
  24225. "Collider:getOrientation"
  24226. },
  24227. variants = {
  24228. {
  24229. arguments = {},
  24230. returns = {
  24231. {
  24232. name = "x",
  24233. type = "number",
  24234. description = "The x position of the Collider, in meters."
  24235. },
  24236. {
  24237. name = "y",
  24238. type = "number",
  24239. description = "The y position of the Collider, in meters."
  24240. },
  24241. {
  24242. name = "z",
  24243. type = "number",
  24244. description = "The z position of the Collider, in meters."
  24245. },
  24246. {
  24247. name = "angle",
  24248. type = "number",
  24249. description = "The number of radians the Collider is rotated around its axis of rotation."
  24250. },
  24251. {
  24252. name = "ax",
  24253. type = "number",
  24254. description = "The x component of the axis of rotation."
  24255. },
  24256. {
  24257. name = "ay",
  24258. type = "number",
  24259. description = "The y component of the axis of rotation."
  24260. },
  24261. {
  24262. name = "az",
  24263. type = "number",
  24264. description = "The z component of the axis of rotation."
  24265. }
  24266. }
  24267. }
  24268. }
  24269. },
  24270. {
  24271. name = "getPosition",
  24272. summary = "Get the position of the Collider.",
  24273. description = "Returns the position of the Collider.",
  24274. key = "Collider:getPosition",
  24275. module = "lovr.physics",
  24276. related = {
  24277. "Collider:applyForce",
  24278. "Collider:getLinearVelocity",
  24279. "Collider:setLinearVelocity",
  24280. "Collider:getOrientation",
  24281. "Collider:setOrientation",
  24282. "Collider:getPose",
  24283. "Collider:setPose"
  24284. },
  24285. variants = {
  24286. {
  24287. arguments = {},
  24288. returns = {
  24289. {
  24290. name = "x",
  24291. type = "number",
  24292. description = "The x position of the Collider, in meters."
  24293. },
  24294. {
  24295. name = "y",
  24296. type = "number",
  24297. description = "The y position of the Collider, in meters."
  24298. },
  24299. {
  24300. name = "z",
  24301. type = "number",
  24302. description = "The z position of the Collider, in meters."
  24303. }
  24304. }
  24305. }
  24306. }
  24307. },
  24308. {
  24309. name = "getRestitution",
  24310. summary = "Get the bounciness of the Collider.",
  24311. description = "Returns the restitution (bounciness) of the Collider. By default, the restitution of two Colliders is combined (the max is used) when they collide to cause them to bounce away from each other. The initial restitution is 0.",
  24312. key = "Collider:getRestitution",
  24313. module = "lovr.physics",
  24314. related = {
  24315. "Collider:getFriction",
  24316. "Collider:setFriction",
  24317. "World:collide"
  24318. },
  24319. variants = {
  24320. {
  24321. arguments = {},
  24322. returns = {
  24323. {
  24324. name = "restitution",
  24325. type = "number",
  24326. description = "The restitution of the Collider."
  24327. }
  24328. }
  24329. }
  24330. }
  24331. },
  24332. {
  24333. name = "getShapes",
  24334. summary = "Get a list of Shapes attached to the Collider.",
  24335. description = "Returns a list of Shapes attached to the Collider.",
  24336. key = "Collider:getShapes",
  24337. module = "lovr.physics",
  24338. related = {
  24339. "Collider:addShape",
  24340. "Collider:removeShape",
  24341. "Shape"
  24342. },
  24343. variants = {
  24344. {
  24345. arguments = {},
  24346. returns = {
  24347. {
  24348. name = "shapes",
  24349. type = "table",
  24350. description = "A list of Shapes attached to the Collider."
  24351. }
  24352. }
  24353. }
  24354. }
  24355. },
  24356. {
  24357. name = "getTag",
  24358. summary = "Get the Collider's tag.",
  24359. description = "Returns the Collider's tag.",
  24360. key = "Collider:getTag",
  24361. module = "lovr.physics",
  24362. notes = "Collision between tags can be enabled and disabled using `World:enableCollisionBetween` and `World:disableCollisionBetween`.",
  24363. variants = {
  24364. {
  24365. arguments = {},
  24366. returns = {
  24367. {
  24368. name = "tag",
  24369. type = "string",
  24370. description = "The Collider's collision tag."
  24371. }
  24372. }
  24373. }
  24374. },
  24375. related = {
  24376. "World:disableCollisionBetween",
  24377. "World:enableCollisionBetween",
  24378. "World:isCollisionEnabledBetween",
  24379. "lovr.physics.newWorld"
  24380. }
  24381. },
  24382. {
  24383. name = "getUserData",
  24384. summary = "Get the Collider's user data.",
  24385. description = "Returns the user data associated with the Collider.",
  24386. key = "Collider:getUserData",
  24387. module = "lovr.physics",
  24388. notes = "User data can be useful to identify the Collider in callbacks.",
  24389. variants = {
  24390. {
  24391. arguments = {},
  24392. returns = {
  24393. {
  24394. name = "data",
  24395. type = "*",
  24396. description = "The custom value associated with the Collider."
  24397. }
  24398. }
  24399. }
  24400. }
  24401. },
  24402. {
  24403. name = "getWorld",
  24404. summary = "Get the World the Collider is in.",
  24405. description = "Returns the World the Collider is in.",
  24406. key = "Collider:getWorld",
  24407. module = "lovr.physics",
  24408. notes = "Colliders can only be in one World at a time.",
  24409. variants = {
  24410. {
  24411. arguments = {},
  24412. returns = {
  24413. {
  24414. name = "world",
  24415. type = "World",
  24416. description = "The World the Collider is in."
  24417. }
  24418. }
  24419. }
  24420. },
  24421. related = {
  24422. "World"
  24423. }
  24424. },
  24425. {
  24426. name = "getWorldPoint",
  24427. summary = "Convert a point from local space to world space.",
  24428. description = "Convert a point relative to the collider to a point in world coordinates.",
  24429. key = "Collider:getWorldPoint",
  24430. module = "lovr.physics",
  24431. related = {
  24432. "Collider:getLocalPoint",
  24433. "Collider:getLocalVector",
  24434. "Collider:getWorldVector"
  24435. },
  24436. variants = {
  24437. {
  24438. arguments = {
  24439. {
  24440. name = "x",
  24441. type = "number",
  24442. description = "The x position of the point."
  24443. },
  24444. {
  24445. name = "y",
  24446. type = "number",
  24447. description = "The y position of the point."
  24448. },
  24449. {
  24450. name = "z",
  24451. type = "number",
  24452. description = "The z position of the point."
  24453. }
  24454. },
  24455. returns = {
  24456. {
  24457. name = "wx",
  24458. type = "number",
  24459. description = "The x coordinate of the world point."
  24460. },
  24461. {
  24462. name = "wy",
  24463. type = "number",
  24464. description = "The y coordinate of the world point."
  24465. },
  24466. {
  24467. name = "wz",
  24468. type = "number",
  24469. description = "The z coordinate of the world point."
  24470. }
  24471. }
  24472. }
  24473. }
  24474. },
  24475. {
  24476. name = "getWorldVector",
  24477. summary = "Convert a vector from local space to world space.",
  24478. description = "Converts a direction vector from local space to world space.",
  24479. key = "Collider:getWorldVector",
  24480. module = "lovr.physics",
  24481. related = {
  24482. "Collider:getLocalVector",
  24483. "Collider:getLocalPoint",
  24484. "Collider:getWorldPoint"
  24485. },
  24486. variants = {
  24487. {
  24488. arguments = {
  24489. {
  24490. name = "x",
  24491. type = "number",
  24492. description = "The x coordinate of the local vector."
  24493. },
  24494. {
  24495. name = "y",
  24496. type = "number",
  24497. description = "The y coordinate of the local vector."
  24498. },
  24499. {
  24500. name = "z",
  24501. type = "number",
  24502. description = "The z coordinate of the local vector."
  24503. }
  24504. },
  24505. returns = {
  24506. {
  24507. name = "wx",
  24508. type = "number",
  24509. description = "The x component of the world vector."
  24510. },
  24511. {
  24512. name = "wy",
  24513. type = "number",
  24514. description = "The y component of the world vector."
  24515. },
  24516. {
  24517. name = "wz",
  24518. type = "number",
  24519. description = "The z component of the world vector."
  24520. }
  24521. }
  24522. }
  24523. }
  24524. },
  24525. {
  24526. name = "isAwake",
  24527. summary = "Check if the Collider is awake.",
  24528. description = "Returns whether the Collider is currently awake.",
  24529. key = "Collider:isAwake",
  24530. module = "lovr.physics",
  24531. related = {
  24532. "World:isSleepingAllowed",
  24533. "World:setSleepingAllowed",
  24534. "Collider:isSleepingAllowed",
  24535. "Collider:setSleepingAllowed"
  24536. },
  24537. variants = {
  24538. {
  24539. arguments = {},
  24540. returns = {
  24541. {
  24542. name = "awake",
  24543. type = "boolean",
  24544. description = "Whether the Collider is awake."
  24545. }
  24546. }
  24547. }
  24548. }
  24549. },
  24550. {
  24551. name = "isGravityIgnored",
  24552. summary = "Check if the Collider ignores gravity.",
  24553. description = "Returns whether the Collider is currently ignoring gravity.",
  24554. key = "Collider:isGravityIgnored",
  24555. module = "lovr.physics",
  24556. variants = {
  24557. {
  24558. arguments = {},
  24559. returns = {
  24560. {
  24561. name = "ignored",
  24562. type = "boolean",
  24563. description = "Whether gravity is ignored for this Collider."
  24564. }
  24565. }
  24566. }
  24567. }
  24568. },
  24569. {
  24570. name = "isKinematic",
  24571. summary = "Check if the Collider is kinematic.",
  24572. description = "Returns whether the Collider is kinematic.",
  24573. key = "Collider:isKinematic",
  24574. module = "lovr.physics",
  24575. notes = "Kinematic colliders behave as though they have infinite mass, ignoring external forces like gravity, joints, or collisions (though non-kinematic colliders will collide with them). They can be useful for static objects like floors or walls.",
  24576. variants = {
  24577. {
  24578. arguments = {},
  24579. returns = {
  24580. {
  24581. name = "kinematic",
  24582. type = "boolean",
  24583. description = "Whether the Collider is kinematic."
  24584. }
  24585. }
  24586. }
  24587. }
  24588. },
  24589. {
  24590. name = "isSleepingAllowed",
  24591. summary = "Check if the Collider is allowed to sleep.",
  24592. description = "Returns whether the Collider is allowed to sleep.",
  24593. key = "Collider:isSleepingAllowed",
  24594. module = "lovr.physics",
  24595. notes = "If sleeping is enabled, the simulation will put the Collider to sleep if it hasn't moved in a while. Sleeping colliders don't impact the physics simulation, which makes updates more efficient and improves physics performance. However, the physics engine isn't perfect at waking up sleeping colliders and this can lead to bugs where colliders don't react to forces or collisions properly.\n\nIt is possible to set the default value for new colliders using `World:setSleepingAllowed`.\n\nColliders can be manually put to sleep or woken up using `Collider:setAwake`.",
  24596. variants = {
  24597. {
  24598. arguments = {},
  24599. returns = {
  24600. {
  24601. name = "allowed",
  24602. type = "boolean",
  24603. description = "Whether the Collider can go to sleep."
  24604. }
  24605. }
  24606. }
  24607. },
  24608. related = {
  24609. "World:isSleepingAllowed",
  24610. "World:setSleepingAllowed",
  24611. "Collider:isAwake",
  24612. "Collider:setAwake"
  24613. }
  24614. },
  24615. {
  24616. name = "removeShape",
  24617. summary = "Remove a Shape from the Collider.",
  24618. description = "Removes a Shape from the Collider.",
  24619. key = "Collider:removeShape",
  24620. module = "lovr.physics",
  24621. notes = "Colliders without any shapes won't collide with anything.",
  24622. variants = {
  24623. {
  24624. arguments = {
  24625. {
  24626. name = "shape",
  24627. type = "Shape",
  24628. description = "The Shape to remove."
  24629. }
  24630. },
  24631. returns = {}
  24632. }
  24633. },
  24634. related = {
  24635. "Collider:addShape",
  24636. "Collider:getShapes",
  24637. "Shape"
  24638. }
  24639. },
  24640. {
  24641. name = "setAngularDamping",
  24642. summary = "Set the angular damping of the Collider.",
  24643. description = "Sets the angular damping of the Collider. Angular damping makes things less \"spinny\", causing them to slow down their angular velocity over time. Damping is only applied when angular velocity is over the threshold value.",
  24644. key = "Collider:setAngularDamping",
  24645. module = "lovr.physics",
  24646. notes = "Angular damping can also be set on the World.",
  24647. variants = {
  24648. {
  24649. arguments = {
  24650. {
  24651. name = "damping",
  24652. type = "number",
  24653. description = "The angular damping."
  24654. },
  24655. {
  24656. name = "threshold",
  24657. type = "number",
  24658. description = "Velocity limit below which the damping is not applied.",
  24659. default = "0"
  24660. }
  24661. },
  24662. returns = {}
  24663. }
  24664. },
  24665. related = {
  24666. "World:getAngularDamping",
  24667. "World:setAngularDamping"
  24668. }
  24669. },
  24670. {
  24671. name = "setAngularVelocity",
  24672. summary = "Set the angular velocity of the Collider.",
  24673. description = "Sets the angular velocity of the Collider.",
  24674. key = "Collider:setAngularVelocity",
  24675. module = "lovr.physics",
  24676. related = {
  24677. "Collider:getLinearVelocity",
  24678. "Collider:setLinearVelocity",
  24679. "Collider:applyTorque",
  24680. "Collider:getOrientation",
  24681. "Collider:setOrientation"
  24682. },
  24683. variants = {
  24684. {
  24685. arguments = {
  24686. {
  24687. name = "vx",
  24688. type = "number",
  24689. description = "The x component of the angular velocity."
  24690. },
  24691. {
  24692. name = "vy",
  24693. type = "number",
  24694. description = "The y component of the angular velocity."
  24695. },
  24696. {
  24697. name = "vz",
  24698. type = "number",
  24699. description = "The z component of the angular velocity."
  24700. }
  24701. },
  24702. returns = {}
  24703. }
  24704. }
  24705. },
  24706. {
  24707. name = "setAwake",
  24708. summary = "Put the Collider to sleep or wake it up.",
  24709. description = "Manually puts the Collider to sleep or wakes it up. You can do this if you know a Collider won't be touched for a while or if you need to it be active.",
  24710. key = "Collider:setAwake",
  24711. module = "lovr.physics",
  24712. related = {
  24713. "World:isSleepingAllowed",
  24714. "World:setSleepingAllowed",
  24715. "Collider:isSleepingAllowed",
  24716. "Collider:setSleepingAllowed"
  24717. },
  24718. variants = {
  24719. {
  24720. arguments = {
  24721. {
  24722. name = "awake",
  24723. type = "boolean",
  24724. description = "Whether the Collider should be awake."
  24725. }
  24726. },
  24727. returns = {}
  24728. }
  24729. }
  24730. },
  24731. {
  24732. name = "setFriction",
  24733. summary = "Set the friction of the Collider.",
  24734. description = "Sets the friction of the Collider. By default, the friction of two Colliders is combined (multiplied) when they collide to generate a friction force. The initial friction is 0.",
  24735. key = "Collider:setFriction",
  24736. module = "lovr.physics",
  24737. related = {
  24738. "Collider:getRestitution",
  24739. "Collider:setRestitution",
  24740. "World:collide"
  24741. },
  24742. variants = {
  24743. {
  24744. arguments = {
  24745. {
  24746. name = "friction",
  24747. type = "number",
  24748. description = "The new friction."
  24749. }
  24750. },
  24751. returns = {}
  24752. }
  24753. }
  24754. },
  24755. {
  24756. name = "setGravityIgnored",
  24757. summary = "Set whether the Collider ignores gravity.",
  24758. description = "Sets whether the Collider should ignore gravity.",
  24759. key = "Collider:setGravityIgnored",
  24760. module = "lovr.physics",
  24761. variants = {
  24762. {
  24763. arguments = {
  24764. {
  24765. name = "ignored",
  24766. type = "boolean",
  24767. description = "Whether gravity should be ignored."
  24768. }
  24769. },
  24770. returns = {}
  24771. }
  24772. }
  24773. },
  24774. {
  24775. name = "setKinematic",
  24776. summary = "Set whether the Collider is kinematic.",
  24777. description = "Sets whether the Collider is kinematic.",
  24778. key = "Collider:setKinematic",
  24779. module = "lovr.physics",
  24780. notes = "Kinematic colliders behave as though they have infinite mass, ignoring external forces like gravity, joints, or collisions (though non-kinematic colliders will collide with them). They can be useful for static objects like floors or walls.",
  24781. variants = {
  24782. {
  24783. arguments = {
  24784. {
  24785. name = "kinematic",
  24786. type = "boolean",
  24787. description = "Whether the Collider is kinematic."
  24788. }
  24789. },
  24790. returns = {}
  24791. }
  24792. }
  24793. },
  24794. {
  24795. name = "setLinearDamping",
  24796. summary = "Set the linear damping of the Collider.",
  24797. description = "Sets the Collider's linear damping parameter. Linear damping is similar to drag or air resistance, slowing the Collider down over time. Damping is only applied when linear velocity is over the threshold value.",
  24798. key = "Collider:setLinearDamping",
  24799. module = "lovr.physics",
  24800. notes = "A linear damping of 0 means the Collider won't slow down over time. This is the default.\n\nLinear damping can also be set on the World using `World:setLinearDamping`, which will affect all new colliders.",
  24801. variants = {
  24802. {
  24803. arguments = {
  24804. {
  24805. name = "damping",
  24806. type = "number",
  24807. description = "The linear damping."
  24808. },
  24809. {
  24810. name = "threshold",
  24811. type = "number",
  24812. description = "Velocity limit below which the damping is not applied.",
  24813. default = "0"
  24814. }
  24815. },
  24816. returns = {}
  24817. }
  24818. },
  24819. related = {
  24820. "World:getLinearDamping",
  24821. "World:setLinearDamping"
  24822. }
  24823. },
  24824. {
  24825. name = "setLinearVelocity",
  24826. summary = "Set the linear velocity of the Collider.",
  24827. description = "Sets the linear velocity of the Collider directly. Usually it's preferred to use `Collider:applyForce` to change velocity since instantaneous velocity changes can lead to weird glitches.",
  24828. key = "Collider:setLinearVelocity",
  24829. module = "lovr.physics",
  24830. related = {
  24831. "Collider:getLinearVelocityFromLocalPoint",
  24832. "Collider:getLinearVelocityFromWorldPoint",
  24833. "Collider:getAngularVelocity",
  24834. "Collider:setAngularVelocity",
  24835. "Collider:applyForce",
  24836. "Collider:getPosition",
  24837. "Collider:setPosition"
  24838. },
  24839. variants = {
  24840. {
  24841. arguments = {
  24842. {
  24843. name = "vx",
  24844. type = "number",
  24845. description = "The x velocity of the Collider, in meters per second."
  24846. },
  24847. {
  24848. name = "vy",
  24849. type = "number",
  24850. description = "The y velocity of the Collider, in meters per second."
  24851. },
  24852. {
  24853. name = "vz",
  24854. type = "number",
  24855. description = "The z velocity of the Collider, in meters per second."
  24856. }
  24857. },
  24858. returns = {}
  24859. }
  24860. }
  24861. },
  24862. {
  24863. name = "setMass",
  24864. summary = "Set the total mass of the Collider.",
  24865. description = "Sets the total mass of the Collider.",
  24866. key = "Collider:setMass",
  24867. module = "lovr.physics",
  24868. related = {
  24869. "Collider:getMassData",
  24870. "Collider:setMassData",
  24871. "Shape:getMass"
  24872. },
  24873. variants = {
  24874. {
  24875. arguments = {
  24876. {
  24877. name = "mass",
  24878. type = "number",
  24879. description = "The new mass for the Collider, in kilograms."
  24880. }
  24881. },
  24882. returns = {}
  24883. }
  24884. }
  24885. },
  24886. {
  24887. name = "setMassData",
  24888. summary = "Set mass properties for the Collider.",
  24889. description = "Sets mass properties for the Collider.",
  24890. key = "Collider:setMassData",
  24891. module = "lovr.physics",
  24892. related = {
  24893. "Collider:getMass",
  24894. "Collider:setMass",
  24895. "Shape:getMass"
  24896. },
  24897. variants = {
  24898. {
  24899. arguments = {
  24900. {
  24901. name = "cx",
  24902. type = "number",
  24903. description = "The x position of the center of mass."
  24904. },
  24905. {
  24906. name = "cy",
  24907. type = "number",
  24908. description = "The y position of the center of mass."
  24909. },
  24910. {
  24911. name = "cz",
  24912. type = "number",
  24913. description = "The z position of the center of mass."
  24914. },
  24915. {
  24916. name = "mass",
  24917. type = "number",
  24918. description = "The computed mass of the Collider."
  24919. },
  24920. {
  24921. name = "inertia",
  24922. type = "table",
  24923. description = "A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix."
  24924. }
  24925. },
  24926. returns = {}
  24927. }
  24928. }
  24929. },
  24930. {
  24931. name = "setOrientation",
  24932. summary = "Set the orientation of the Collider.",
  24933. description = "Sets the orientation of the Collider in angle/axis representation.",
  24934. key = "Collider:setOrientation",
  24935. module = "lovr.physics",
  24936. related = {
  24937. "Collider:applyTorque",
  24938. "Collider:getAngularVelocity",
  24939. "Collider:setAngularVelocity",
  24940. "Collider:getPosition",
  24941. "Collider:setPosition",
  24942. "Collider:getPose",
  24943. "Collider:setPose"
  24944. },
  24945. variants = {
  24946. {
  24947. arguments = {
  24948. {
  24949. name = "angle",
  24950. type = "number",
  24951. description = "The number of radians the Collider is rotated around its axis of rotation."
  24952. },
  24953. {
  24954. name = "ax",
  24955. type = "number",
  24956. description = "The x component of the axis of rotation."
  24957. },
  24958. {
  24959. name = "ay",
  24960. type = "number",
  24961. description = "The y component of the axis of rotation."
  24962. },
  24963. {
  24964. name = "az",
  24965. type = "number",
  24966. description = "The z component of the axis of rotation."
  24967. }
  24968. },
  24969. returns = {}
  24970. }
  24971. }
  24972. },
  24973. {
  24974. name = "setPose",
  24975. summary = "Set the pose of the Collider.",
  24976. description = "Sets the position and orientation of the Collider.",
  24977. key = "Collider:setPose",
  24978. module = "lovr.physics",
  24979. related = {
  24980. "Collider:setPosition",
  24981. "Collider:setOrientation"
  24982. },
  24983. variants = {
  24984. {
  24985. arguments = {
  24986. {
  24987. name = "x",
  24988. type = "number",
  24989. description = "The x position of the Collider, in meters."
  24990. },
  24991. {
  24992. name = "y",
  24993. type = "number",
  24994. description = "The y position of the Collider, in meters."
  24995. },
  24996. {
  24997. name = "z",
  24998. type = "number",
  24999. description = "The z position of the Collider, in meters."
  25000. },
  25001. {
  25002. name = "angle",
  25003. type = "number",
  25004. description = "The number of radians the Collider is rotated around its axis of rotation."
  25005. },
  25006. {
  25007. name = "ax",
  25008. type = "number",
  25009. description = "The x component of the axis of rotation."
  25010. },
  25011. {
  25012. name = "ay",
  25013. type = "number",
  25014. description = "The y component of the axis of rotation."
  25015. },
  25016. {
  25017. name = "az",
  25018. type = "number",
  25019. description = "The z component of the axis of rotation."
  25020. }
  25021. },
  25022. returns = {}
  25023. }
  25024. }
  25025. },
  25026. {
  25027. name = "setPosition",
  25028. summary = "Set the position of the Collider.",
  25029. description = "Sets the position of the Collider.",
  25030. key = "Collider:setPosition",
  25031. module = "lovr.physics",
  25032. related = {
  25033. "Collider:applyForce",
  25034. "Collider:getLinearVelocity",
  25035. "Collider:setLinearVelocity",
  25036. "Collider:getOrientation",
  25037. "Collider:setOrientation",
  25038. "Collider:getPose",
  25039. "Collider:setPose"
  25040. },
  25041. variants = {
  25042. {
  25043. arguments = {
  25044. {
  25045. name = "x",
  25046. type = "number",
  25047. description = "The x position of the Collider, in meters."
  25048. },
  25049. {
  25050. name = "y",
  25051. type = "number",
  25052. description = "The y position of the Collider, in meters."
  25053. },
  25054. {
  25055. name = "z",
  25056. type = "number",
  25057. description = "The z position of the Collider, in meters."
  25058. }
  25059. },
  25060. returns = {}
  25061. }
  25062. }
  25063. },
  25064. {
  25065. name = "setRestitution",
  25066. summary = "Set the bounciness of the Collider.",
  25067. description = "Sets the restitution (bounciness) of the Collider. By default, the restitution of two Colliders is combined (the max is used) when they collide to cause them to bounce away from each other. The initial restitution is 0.",
  25068. key = "Collider:setRestitution",
  25069. module = "lovr.physics",
  25070. related = {
  25071. "Collider:getFriction",
  25072. "Collider:setFriction",
  25073. "World:collide"
  25074. },
  25075. variants = {
  25076. {
  25077. arguments = {
  25078. {
  25079. name = "restitution",
  25080. type = "number",
  25081. description = "The new restitution."
  25082. }
  25083. },
  25084. returns = {}
  25085. }
  25086. }
  25087. },
  25088. {
  25089. name = "setSleepingAllowed",
  25090. summary = "Set whether the Collider is allowed to sleep.",
  25091. description = "Sets whether the Collider is allowed to sleep.",
  25092. key = "Collider:setSleepingAllowed",
  25093. module = "lovr.physics",
  25094. notes = "If sleeping is enabled, the simulation will put the Collider to sleep if it hasn't moved in a while. Sleeping colliders don't impact the physics simulation, which makes updates more efficient and improves physics performance. However, the physics engine isn't perfect at waking up sleeping colliders and this can lead to bugs where colliders don't react to forces or collisions properly.\n\nIt is possible to set the default value for new colliders using `World:setSleepingAllowed`.\n\nColliders can be manually put to sleep or woken up using `Collider:setAwake`.",
  25095. variants = {
  25096. {
  25097. arguments = {
  25098. {
  25099. name = "allowed",
  25100. type = "boolean",
  25101. description = "Whether the Collider can go to sleep."
  25102. }
  25103. },
  25104. returns = {}
  25105. }
  25106. },
  25107. related = {
  25108. "World:isSleepingAllowed",
  25109. "World:setSleepingAllowed",
  25110. "Collider:isAwake",
  25111. "Collider:setAwake"
  25112. }
  25113. },
  25114. {
  25115. name = "setTag",
  25116. summary = "Set the Collider's tag.",
  25117. description = "Sets the Collider's tag.",
  25118. key = "Collider:setTag",
  25119. module = "lovr.physics",
  25120. notes = "Collision between tags can be enabled and disabled using `World:enableCollisionBetween` and `World:disableCollisionBetween`.",
  25121. variants = {
  25122. {
  25123. arguments = {
  25124. {
  25125. name = "tag",
  25126. type = "string",
  25127. description = "The Collider's collision tag."
  25128. }
  25129. },
  25130. returns = {}
  25131. }
  25132. },
  25133. related = {
  25134. "World:disableCollisionBetween",
  25135. "World:enableCollisionBetween",
  25136. "World:isCollisionEnabledBetween",
  25137. "lovr.physics.newWorld"
  25138. }
  25139. },
  25140. {
  25141. name = "setUserData",
  25142. summary = "Set the Collider's user data.",
  25143. description = "Associates a custom value with the Collider.",
  25144. key = "Collider:setUserData",
  25145. module = "lovr.physics",
  25146. notes = "User data can be useful to identify the Collider in callbacks.",
  25147. variants = {
  25148. {
  25149. arguments = {
  25150. {
  25151. name = "data",
  25152. type = "*",
  25153. description = "The custom value to associate with the Collider."
  25154. }
  25155. },
  25156. returns = {}
  25157. }
  25158. }
  25159. }
  25160. }
  25161. },
  25162. {
  25163. name = "CylinderShape",
  25164. summary = "A cylinder Shape.",
  25165. description = "A type of `Shape` that can be used for cylinder-shaped things.",
  25166. key = "CylinderShape",
  25167. module = "lovr.physics",
  25168. constructors = {
  25169. "lovr.physics.newCylinderShape",
  25170. "World:newCylinderCollider"
  25171. },
  25172. extends = "Shape",
  25173. methods = {
  25174. {
  25175. name = "getLength",
  25176. summary = "Get the length of the CylinderShape.",
  25177. description = "Returns the length of the CylinderShape.",
  25178. key = "CylinderShape:getLength",
  25179. module = "lovr.physics",
  25180. variants = {
  25181. {
  25182. arguments = {},
  25183. returns = {
  25184. {
  25185. name = "length",
  25186. type = "number",
  25187. description = "The length of the cylinder, in meters."
  25188. }
  25189. }
  25190. }
  25191. }
  25192. },
  25193. {
  25194. name = "getRadius",
  25195. summary = "Get the radius of the CylinderShape.",
  25196. description = "Returns the radius of the CylinderShape.",
  25197. key = "CylinderShape:getRadius",
  25198. module = "lovr.physics",
  25199. variants = {
  25200. {
  25201. arguments = {},
  25202. returns = {
  25203. {
  25204. name = "radius",
  25205. type = "number",
  25206. description = "The radius of the cylinder, in meters."
  25207. }
  25208. }
  25209. }
  25210. }
  25211. },
  25212. {
  25213. name = "setLength",
  25214. summary = "Set the length of the CylinderShape.",
  25215. description = "Sets the length of the CylinderShape.",
  25216. key = "CylinderShape:setLength",
  25217. module = "lovr.physics",
  25218. variants = {
  25219. {
  25220. arguments = {
  25221. {
  25222. name = "length",
  25223. type = "number",
  25224. description = "The new length, in meters."
  25225. }
  25226. },
  25227. returns = {}
  25228. }
  25229. }
  25230. },
  25231. {
  25232. name = "setRadius",
  25233. summary = "Set the radius of the CylinderShape.",
  25234. description = "Sets the radius of the CylinderShape.",
  25235. key = "CylinderShape:setRadius",
  25236. module = "lovr.physics",
  25237. variants = {
  25238. {
  25239. arguments = {
  25240. {
  25241. name = "radius",
  25242. type = "number",
  25243. description = "The new radius, in meters."
  25244. }
  25245. },
  25246. returns = {}
  25247. }
  25248. }
  25249. }
  25250. }
  25251. },
  25252. {
  25253. name = "DistanceJoint",
  25254. summary = "A fixed distance joint.",
  25255. description = "A DistanceJoint is a type of `Joint` that tries to keep two colliders a fixed distance apart. The distance is determined by the initial distance between the anchor points. The joint allows for rotation on the anchor points.",
  25256. key = "DistanceJoint",
  25257. module = "lovr.physics",
  25258. constructors = {
  25259. "lovr.physics.newDistanceJoint"
  25260. },
  25261. related = {
  25262. "Collider"
  25263. },
  25264. extends = "Joint",
  25265. methods = {
  25266. {
  25267. name = "getAnchors",
  25268. summary = "Get the anchor points of the DistanceJoint.",
  25269. description = "Returns the anchor points of the DistanceJoint.",
  25270. key = "DistanceJoint:getAnchors",
  25271. module = "lovr.physics",
  25272. variants = {
  25273. {
  25274. arguments = {},
  25275. returns = {
  25276. {
  25277. name = "x1",
  25278. type = "number",
  25279. description = "The x coordinate of the first anchor point, in world coordinates."
  25280. },
  25281. {
  25282. name = "y1",
  25283. type = "number",
  25284. description = "The y coordinate of the first anchor point, in world coordinates."
  25285. },
  25286. {
  25287. name = "z1",
  25288. type = "number",
  25289. description = "The z coordinate of the first anchor point, in world coordinates."
  25290. },
  25291. {
  25292. name = "x2",
  25293. type = "number",
  25294. description = "The x coordinate of the second anchor point, in world coordinates."
  25295. },
  25296. {
  25297. name = "y2",
  25298. type = "number",
  25299. description = "The y coordinate of the second anchor point, in world coordinates."
  25300. },
  25301. {
  25302. name = "z2",
  25303. type = "number",
  25304. description = "The z coordinate of the second anchor point, in world coordinates."
  25305. }
  25306. }
  25307. }
  25308. }
  25309. },
  25310. {
  25311. name = "getDistance",
  25312. summary = "Get the target distance of the DistanceJoint.",
  25313. description = "Returns the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.",
  25314. key = "DistanceJoint:getDistance",
  25315. module = "lovr.physics",
  25316. variants = {
  25317. {
  25318. arguments = {},
  25319. returns = {
  25320. {
  25321. name = "distance",
  25322. type = "number",
  25323. description = "The target distance."
  25324. }
  25325. }
  25326. }
  25327. }
  25328. },
  25329. {
  25330. name = "getResponseTime",
  25331. summary = "Get the response time of the joint.",
  25332. description = "Returns the response time of the joint. See `World:setResponseTime` for more info.",
  25333. key = "DistanceJoint:getResponseTime",
  25334. module = "lovr.physics",
  25335. related = {
  25336. "BallJoint:getResponseTime",
  25337. "BallJoint:setResponseTime",
  25338. "World:getResponseTime",
  25339. "World:setResponseTime"
  25340. },
  25341. variants = {
  25342. {
  25343. arguments = {},
  25344. returns = {
  25345. {
  25346. name = "responseTime",
  25347. type = "number",
  25348. description = "The response time setting for the joint."
  25349. }
  25350. }
  25351. }
  25352. }
  25353. },
  25354. {
  25355. name = "getTightness",
  25356. summary = "Get the joint tightness.",
  25357. description = "Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.",
  25358. key = "DistanceJoint:getTightness",
  25359. module = "lovr.physics",
  25360. related = {
  25361. "BallJoint:getTightness",
  25362. "BallJoint:setTightness",
  25363. "World:getTightness",
  25364. "World:setTightness"
  25365. },
  25366. variants = {
  25367. {
  25368. arguments = {},
  25369. returns = {
  25370. {
  25371. name = "tightness",
  25372. type = "number",
  25373. description = "The tightness of the joint."
  25374. }
  25375. }
  25376. }
  25377. }
  25378. },
  25379. {
  25380. name = "setAnchors",
  25381. summary = "Set the anchor points of the DistanceJoint.",
  25382. description = "Sets the anchor points of the DistanceJoint.",
  25383. key = "DistanceJoint:setAnchors",
  25384. module = "lovr.physics",
  25385. variants = {
  25386. {
  25387. arguments = {
  25388. {
  25389. name = "x1",
  25390. type = "number",
  25391. description = "The x coordinate of the first anchor point, in world coordinates."
  25392. },
  25393. {
  25394. name = "y1",
  25395. type = "number",
  25396. description = "The y coordinate of the first anchor point, in world coordinates."
  25397. },
  25398. {
  25399. name = "z1",
  25400. type = "number",
  25401. description = "The z coordinate of the first anchor point, in world coordinates."
  25402. },
  25403. {
  25404. name = "x2",
  25405. type = "number",
  25406. description = "The x coordinate of the second anchor point, in world coordinates."
  25407. },
  25408. {
  25409. name = "y2",
  25410. type = "number",
  25411. description = "The y coordinate of the second anchor point, in world coordinates."
  25412. },
  25413. {
  25414. name = "z2",
  25415. type = "number",
  25416. description = "The z coordinate of the second anchor point, in world coordinates."
  25417. }
  25418. },
  25419. returns = {}
  25420. }
  25421. }
  25422. },
  25423. {
  25424. name = "setDistance",
  25425. summary = "Set the target distance of the DistanceJoint.",
  25426. description = "Sets the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.",
  25427. key = "DistanceJoint:setDistance",
  25428. module = "lovr.physics",
  25429. variants = {
  25430. {
  25431. arguments = {
  25432. {
  25433. name = "distance",
  25434. type = "number",
  25435. description = "The new target distance."
  25436. }
  25437. },
  25438. returns = {}
  25439. }
  25440. }
  25441. },
  25442. {
  25443. name = "setResponseTime",
  25444. summary = "Set the response time of the joint.",
  25445. description = "Sets the response time of the joint. See `World:setResponseTime` for more info.",
  25446. key = "DistanceJoint:setResponseTime",
  25447. module = "lovr.physics",
  25448. related = {
  25449. "BallJoint:getResponseTime",
  25450. "BallJoint:setResponseTime",
  25451. "World:getResponseTime",
  25452. "World:setResponseTime"
  25453. },
  25454. variants = {
  25455. {
  25456. arguments = {
  25457. {
  25458. name = "responseTime",
  25459. type = "number",
  25460. description = "The new response time setting for the joint."
  25461. }
  25462. },
  25463. returns = {}
  25464. }
  25465. }
  25466. },
  25467. {
  25468. name = "setTightness",
  25469. summary = "Set the joint tightness.",
  25470. description = "Sets the tightness of the joint. See `World:setTightness` for how this affects the joint.",
  25471. key = "DistanceJoint:setTightness",
  25472. module = "lovr.physics",
  25473. related = {
  25474. "BallJoint:getTightness",
  25475. "BallJoint:setTightness",
  25476. "World:getTightness",
  25477. "World:setTightness"
  25478. },
  25479. variants = {
  25480. {
  25481. arguments = {
  25482. {
  25483. name = "tightness",
  25484. type = "number",
  25485. description = "The tightness of the joint."
  25486. }
  25487. },
  25488. returns = {}
  25489. }
  25490. }
  25491. }
  25492. }
  25493. },
  25494. {
  25495. name = "HingeJoint",
  25496. summary = "A hinge joint.",
  25497. description = "A HingeJoint is a type of `Joint` that only allows colliders to rotate on a single axis.",
  25498. key = "HingeJoint",
  25499. module = "lovr.physics",
  25500. constructors = {
  25501. "lovr.physics.newHingeJoint"
  25502. },
  25503. related = {
  25504. "Collider"
  25505. },
  25506. extends = "Joint",
  25507. methods = {
  25508. {
  25509. name = "getAnchors",
  25510. summary = "Get the anchor points of the HingeJoint.",
  25511. description = "Returns the anchor points of the HingeJoint.",
  25512. key = "HingeJoint:getAnchors",
  25513. module = "lovr.physics",
  25514. variants = {
  25515. {
  25516. arguments = {},
  25517. returns = {
  25518. {
  25519. name = "x1",
  25520. type = "number",
  25521. description = "The x coordinate of the first anchor point, in world coordinates."
  25522. },
  25523. {
  25524. name = "y1",
  25525. type = "number",
  25526. description = "The y coordinate of the first anchor point, in world coordinates."
  25527. },
  25528. {
  25529. name = "z1",
  25530. type = "number",
  25531. description = "The z coordinate of the first anchor point, in world coordinates."
  25532. },
  25533. {
  25534. name = "x2",
  25535. type = "number",
  25536. description = "The x coordinate of the second anchor point, in world coordinates."
  25537. },
  25538. {
  25539. name = "y2",
  25540. type = "number",
  25541. description = "The y coordinate of the second anchor point, in world coordinates."
  25542. },
  25543. {
  25544. name = "z2",
  25545. type = "number",
  25546. description = "The z coordinate of the second anchor point, in world coordinates."
  25547. }
  25548. }
  25549. }
  25550. }
  25551. },
  25552. {
  25553. name = "getAngle",
  25554. summary = "Get the angle of the HingeJoint.",
  25555. description = "Get the angle between the two colliders attached to the HingeJoint. When the joint is created or when the anchor or axis is set, the current angle is the new \"zero\" angle.",
  25556. key = "HingeJoint:getAngle",
  25557. module = "lovr.physics",
  25558. variants = {
  25559. {
  25560. arguments = {},
  25561. returns = {
  25562. {
  25563. name = "angle",
  25564. type = "number",
  25565. description = "The hinge angle, in radians."
  25566. }
  25567. }
  25568. }
  25569. }
  25570. },
  25571. {
  25572. name = "getAxis",
  25573. summary = "Get the HingeJoint's axis.",
  25574. description = "Returns the axis of the hinge.",
  25575. key = "HingeJoint:getAxis",
  25576. module = "lovr.physics",
  25577. variants = {
  25578. {
  25579. arguments = {},
  25580. returns = {
  25581. {
  25582. name = "x",
  25583. type = "number",
  25584. description = "The x component of the axis."
  25585. },
  25586. {
  25587. name = "y",
  25588. type = "number",
  25589. description = "The y component of the axis."
  25590. },
  25591. {
  25592. name = "z",
  25593. type = "number",
  25594. description = "The z component of the axis."
  25595. }
  25596. }
  25597. }
  25598. }
  25599. },
  25600. {
  25601. name = "getLimits",
  25602. summary = "Get the HingeJoint's angle limits.",
  25603. description = "Returns the upper and lower limits of the hinge angle. These will be between -π and π.",
  25604. key = "HingeJoint:getLimits",
  25605. module = "lovr.physics",
  25606. related = {
  25607. "HingeJoint:getAngle",
  25608. "HingeJoint:getLowerLimit",
  25609. "HingeJoint:setLowerLimit",
  25610. "HingeJoint:getUpperLimit",
  25611. "HingeJoint:setUpperLimit"
  25612. },
  25613. variants = {
  25614. {
  25615. arguments = {},
  25616. returns = {
  25617. {
  25618. name = "lower",
  25619. type = "number",
  25620. description = "The lower limit, in radians."
  25621. },
  25622. {
  25623. name = "upper",
  25624. type = "number",
  25625. description = "The upper limit, in radians."
  25626. }
  25627. }
  25628. }
  25629. }
  25630. },
  25631. {
  25632. name = "getLowerLimit",
  25633. summary = "Get the HingeJoint's lower angle limit.",
  25634. description = "Returns the lower limit of the hinge angle. This will be greater than -π.",
  25635. key = "HingeJoint:getLowerLimit",
  25636. module = "lovr.physics",
  25637. related = {
  25638. "HingeJoint:getAngle",
  25639. "HingeJoint:getUpperLimit",
  25640. "HingeJoint:setUpperLimit",
  25641. "HingeJoint:getLimits",
  25642. "HingeJoint:setLimits"
  25643. },
  25644. variants = {
  25645. {
  25646. arguments = {},
  25647. returns = {
  25648. {
  25649. name = "limit",
  25650. type = "number",
  25651. description = "The lower limit, in radians."
  25652. }
  25653. }
  25654. }
  25655. }
  25656. },
  25657. {
  25658. name = "getUpperLimit",
  25659. summary = "Get the HingeJoint's upper angle limit.",
  25660. description = "Returns the upper limit of the hinge angle. This will be less than π.",
  25661. key = "HingeJoint:getUpperLimit",
  25662. module = "lovr.physics",
  25663. related = {
  25664. "HingeJoint:getAngle",
  25665. "HingeJoint:getLowerLimit",
  25666. "HingeJoint:setLowerLimit",
  25667. "HingeJoint:getLimits",
  25668. "HingeJoint:setLimits"
  25669. },
  25670. variants = {
  25671. {
  25672. arguments = {},
  25673. returns = {
  25674. {
  25675. name = "limit",
  25676. type = "number",
  25677. description = "The upper limit, in radians."
  25678. }
  25679. }
  25680. }
  25681. }
  25682. },
  25683. {
  25684. name = "setAnchor",
  25685. summary = "Set the anchor point of the HingeJoint.",
  25686. description = "Sets a new anchor point for the HingeJoint.",
  25687. key = "HingeJoint:setAnchor",
  25688. module = "lovr.physics",
  25689. variants = {
  25690. {
  25691. arguments = {
  25692. {
  25693. name = "x",
  25694. type = "number",
  25695. description = "The x coordinate of the anchor point, in world coordinates."
  25696. },
  25697. {
  25698. name = "y",
  25699. type = "number",
  25700. description = "The y coordinate of the anchor point, in world coordinates."
  25701. },
  25702. {
  25703. name = "z",
  25704. type = "number",
  25705. description = "The z coordinate of the anchor point, in world coordinates."
  25706. }
  25707. },
  25708. returns = {}
  25709. }
  25710. }
  25711. },
  25712. {
  25713. name = "setAxis",
  25714. summary = "Set the HingeJoint's axis.",
  25715. description = "Sets the axis of the hinge.",
  25716. key = "HingeJoint:setAxis",
  25717. module = "lovr.physics",
  25718. variants = {
  25719. {
  25720. arguments = {
  25721. {
  25722. name = "x",
  25723. type = "number",
  25724. description = "The x component of the axis."
  25725. },
  25726. {
  25727. name = "y",
  25728. type = "number",
  25729. description = "The y component of the axis."
  25730. },
  25731. {
  25732. name = "z",
  25733. type = "number",
  25734. description = "The z component of the axis."
  25735. }
  25736. },
  25737. returns = {}
  25738. }
  25739. }
  25740. },
  25741. {
  25742. name = "setLimits",
  25743. summary = "Set the HingeJoint's angle limits.",
  25744. description = "Sets the upper and lower limits of the hinge angle. These should be between -π and π.",
  25745. key = "HingeJoint:setLimits",
  25746. module = "lovr.physics",
  25747. related = {
  25748. "HingeJoint:getAngle",
  25749. "HingeJoint:getLowerLimit",
  25750. "HingeJoint:setLowerLimit",
  25751. "HingeJoint:getUpperLimit",
  25752. "HingeJoint:setUpperLimit"
  25753. },
  25754. variants = {
  25755. {
  25756. arguments = {
  25757. {
  25758. name = "lower",
  25759. type = "number",
  25760. description = "The lower limit, in radians."
  25761. },
  25762. {
  25763. name = "upper",
  25764. type = "number",
  25765. description = "The upper limit, in radians."
  25766. }
  25767. },
  25768. returns = {}
  25769. }
  25770. }
  25771. },
  25772. {
  25773. name = "setLowerLimit",
  25774. summary = "Set the HingeJoint's lower angle limit.",
  25775. description = "Sets the lower limit of the hinge angle. This should be greater than -π.",
  25776. key = "HingeJoint:setLowerLimit",
  25777. module = "lovr.physics",
  25778. related = {
  25779. "HingeJoint:getAngle",
  25780. "HingeJoint:getUpperLimit",
  25781. "HingeJoint:setUpperLimit",
  25782. "HingeJoint:getLimits",
  25783. "HingeJoint:setLimits"
  25784. },
  25785. variants = {
  25786. {
  25787. arguments = {
  25788. {
  25789. name = "limit",
  25790. type = "number",
  25791. description = "The lower limit, in radians."
  25792. }
  25793. },
  25794. returns = {}
  25795. }
  25796. }
  25797. },
  25798. {
  25799. name = "setUpperLimit",
  25800. summary = "Set the HingeJoint's upper angle limit.",
  25801. description = "Sets the upper limit of the hinge angle. This should be less than π.",
  25802. key = "HingeJoint:setUpperLimit",
  25803. module = "lovr.physics",
  25804. related = {
  25805. "HingeJoint:getAngle",
  25806. "HingeJoint:getLowerLimit",
  25807. "HingeJoint:setLowerLimit",
  25808. "HingeJoint:getLimits",
  25809. "HingeJoint:setLimits"
  25810. },
  25811. variants = {
  25812. {
  25813. arguments = {
  25814. {
  25815. name = "limit",
  25816. type = "number",
  25817. description = "The upper limit, in radians."
  25818. }
  25819. },
  25820. returns = {}
  25821. }
  25822. }
  25823. }
  25824. }
  25825. },
  25826. {
  25827. name = "Joint",
  25828. summary = "Joins two Colliders together.",
  25829. description = "A Joint is a physics object that constrains the movement of two Colliders.",
  25830. key = "Joint",
  25831. module = "lovr.physics",
  25832. constructors = {
  25833. "lovr.physics.newBallJoint",
  25834. "lovr.physics.newDistanceJoint",
  25835. "lovr.physics.newHingeJoint",
  25836. "lovr.physics.newSliderJoint"
  25837. },
  25838. related = {
  25839. "Collider"
  25840. },
  25841. methods = {
  25842. {
  25843. name = "destroy",
  25844. summary = "Destroy the Joint.",
  25845. description = "Destroy the Joint, removing it from Colliders it's attached to.",
  25846. key = "Joint:destroy",
  25847. module = "lovr.physics",
  25848. notes = "Calling functions on the Joint after destroying it is a bad idea.",
  25849. variants = {
  25850. {
  25851. arguments = {},
  25852. returns = {}
  25853. }
  25854. },
  25855. related = {
  25856. "Collider:destroy",
  25857. "Shape:destroy",
  25858. "World:destroy"
  25859. }
  25860. },
  25861. {
  25862. name = "getColliders",
  25863. summary = "Get the Colliders the Joint is attached to.",
  25864. description = "Returns the Colliders the Joint is attached to. All Joints are attached to two colliders.",
  25865. key = "Joint:getColliders",
  25866. module = "lovr.physics",
  25867. variants = {
  25868. {
  25869. arguments = {},
  25870. returns = {
  25871. {
  25872. name = "colliderA",
  25873. type = "Collider",
  25874. description = "The first Collider."
  25875. },
  25876. {
  25877. name = "colliderB",
  25878. type = "Collider",
  25879. description = "The second Collider."
  25880. }
  25881. }
  25882. }
  25883. }
  25884. },
  25885. {
  25886. name = "getType",
  25887. summary = "Get the type of the Joint.",
  25888. description = "Returns the type of the Joint.",
  25889. key = "Joint:getType",
  25890. module = "lovr.physics",
  25891. related = {
  25892. "JointType"
  25893. },
  25894. variants = {
  25895. {
  25896. arguments = {},
  25897. returns = {
  25898. {
  25899. name = "type",
  25900. type = "JointType",
  25901. description = "The type of the Joint."
  25902. }
  25903. }
  25904. }
  25905. }
  25906. },
  25907. {
  25908. name = "getUserData",
  25909. summary = "Get the Joint's user data.",
  25910. description = "Returns the user data associated with the Joint.",
  25911. key = "Joint:getUserData",
  25912. module = "lovr.physics",
  25913. variants = {
  25914. {
  25915. arguments = {},
  25916. returns = {
  25917. {
  25918. name = "data",
  25919. type = "*",
  25920. description = "The custom value associated with the Joint."
  25921. }
  25922. }
  25923. }
  25924. }
  25925. },
  25926. {
  25927. name = "isEnabled",
  25928. summary = "Check if the Joint is enabled.",
  25929. description = "Returns whether the Joint is enabled.",
  25930. key = "Joint:isEnabled",
  25931. module = "lovr.physics",
  25932. variants = {
  25933. {
  25934. arguments = {},
  25935. returns = {
  25936. {
  25937. name = "enabled",
  25938. type = "boolean",
  25939. description = "Whether the Joint is enabled."
  25940. }
  25941. }
  25942. }
  25943. }
  25944. },
  25945. {
  25946. name = "setEnabled",
  25947. summary = "Enable or disable the Joint.",
  25948. description = "Enable or disable the Joint.",
  25949. key = "Joint:setEnabled",
  25950. module = "lovr.physics",
  25951. variants = {
  25952. {
  25953. arguments = {
  25954. {
  25955. name = "enabled",
  25956. type = "boolean",
  25957. description = "Whether the Joint should be enabled."
  25958. }
  25959. },
  25960. returns = {}
  25961. }
  25962. }
  25963. },
  25964. {
  25965. name = "setUserData",
  25966. summary = "Set the Joint's user data.",
  25967. description = "Sets the user data associated with the Joint.",
  25968. key = "Joint:setUserData",
  25969. module = "lovr.physics",
  25970. variants = {
  25971. {
  25972. arguments = {
  25973. {
  25974. name = "data",
  25975. type = "*",
  25976. description = "The custom value associated with the Joint."
  25977. }
  25978. },
  25979. returns = {}
  25980. }
  25981. }
  25982. }
  25983. }
  25984. },
  25985. {
  25986. name = "Shape",
  25987. summary = "Defines the shape of Colliders.",
  25988. description = "A Shape is a physics object that can be attached to colliders to define their shape.",
  25989. key = "Shape",
  25990. module = "lovr.physics",
  25991. constructors = {
  25992. "lovr.physics.newBoxShape",
  25993. "lovr.physics.newCapsuleShape",
  25994. "lovr.physics.newCylinderShape",
  25995. "lovr.physics.newSphereShape",
  25996. "World:newBoxCollider",
  25997. "World:newCapsuleCollider",
  25998. "World:newCylinderCollider",
  25999. "World:newSphereCollider"
  26000. },
  26001. methods = {
  26002. {
  26003. name = "destroy",
  26004. summary = "Destroy the Shape.",
  26005. description = "Destroy the Shape, removing it from Colliders it's attached to.",
  26006. key = "Shape:destroy",
  26007. module = "lovr.physics",
  26008. notes = "Calling functions on the Shape after destroying it is a bad idea.",
  26009. variants = {
  26010. {
  26011. arguments = {},
  26012. returns = {}
  26013. }
  26014. },
  26015. related = {
  26016. "Collider:destroy",
  26017. "Joint:destroy",
  26018. "World:destroy"
  26019. }
  26020. },
  26021. {
  26022. name = "getAABB",
  26023. summary = "Get the Shape's axis aligned bounding box.",
  26024. description = "Returns the bounding box for the Shape.",
  26025. key = "Shape:getAABB",
  26026. module = "lovr.physics",
  26027. related = {
  26028. "Collider:getAABB"
  26029. },
  26030. variants = {
  26031. {
  26032. arguments = {},
  26033. returns = {
  26034. {
  26035. name = "minx",
  26036. type = "number",
  26037. description = "The minimum x coordinate of the box."
  26038. },
  26039. {
  26040. name = "maxx",
  26041. type = "number",
  26042. description = "The maximum x coordinate of the box."
  26043. },
  26044. {
  26045. name = "miny",
  26046. type = "number",
  26047. description = "The minimum y coordinate of the box."
  26048. },
  26049. {
  26050. name = "maxy",
  26051. type = "number",
  26052. description = "The maximum y coordinate of the box."
  26053. },
  26054. {
  26055. name = "minz",
  26056. type = "number",
  26057. description = "The minimum z coordinate of the box."
  26058. },
  26059. {
  26060. name = "maxz",
  26061. type = "number",
  26062. description = "The maximum z coordinate of the box."
  26063. }
  26064. }
  26065. }
  26066. }
  26067. },
  26068. {
  26069. name = "getCollider",
  26070. summary = "Get the Collider the Shape is attached to.",
  26071. description = "Returns the Collider the Shape is attached to.",
  26072. key = "Shape:getCollider",
  26073. module = "lovr.physics",
  26074. notes = "A Shape can only be attached to one Collider at a time.",
  26075. variants = {
  26076. {
  26077. arguments = {},
  26078. returns = {
  26079. {
  26080. name = "collider",
  26081. type = "Collider",
  26082. description = "The Collider the Shape is attached to."
  26083. }
  26084. }
  26085. }
  26086. },
  26087. related = {
  26088. "Collider",
  26089. "Collider:addShape",
  26090. "Collider:removeShape"
  26091. }
  26092. },
  26093. {
  26094. name = "getMass",
  26095. summary = "Compute mass properties of the Shape.",
  26096. description = "Computes mass properties of the Shape.",
  26097. key = "Shape:getMass",
  26098. module = "lovr.physics",
  26099. related = {
  26100. "Collider:getMass",
  26101. "Collider:setMass",
  26102. "Collider:getMassData",
  26103. "Collider:setMassData"
  26104. },
  26105. variants = {
  26106. {
  26107. arguments = {
  26108. {
  26109. name = "density",
  26110. type = "number",
  26111. description = "The density to use, in kilograms per cubic meter."
  26112. }
  26113. },
  26114. returns = {
  26115. {
  26116. name = "cx",
  26117. type = "number",
  26118. description = "The x position of the center of mass."
  26119. },
  26120. {
  26121. name = "cy",
  26122. type = "number",
  26123. description = "The y position of the center of mass."
  26124. },
  26125. {
  26126. name = "cz",
  26127. type = "number",
  26128. description = "The z position of the center of mass."
  26129. },
  26130. {
  26131. name = "mass",
  26132. type = "number",
  26133. description = "The mass of the Shape."
  26134. },
  26135. {
  26136. name = "inertia",
  26137. type = "table",
  26138. description = "A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix."
  26139. }
  26140. }
  26141. }
  26142. }
  26143. },
  26144. {
  26145. name = "getOrientation",
  26146. summary = "Get the Shape's orientation.",
  26147. description = "Get the orientation of the Shape relative to its Collider.",
  26148. key = "Shape:getOrientation",
  26149. module = "lovr.physics",
  26150. related = {
  26151. "Shape:getPosition",
  26152. "Shape:setPosition"
  26153. },
  26154. variants = {
  26155. {
  26156. arguments = {},
  26157. returns = {
  26158. {
  26159. name = "angle",
  26160. type = "number",
  26161. description = "The number of radians the Shape is rotated."
  26162. },
  26163. {
  26164. name = "ax",
  26165. type = "number",
  26166. description = "The x component of the rotation axis."
  26167. },
  26168. {
  26169. name = "ay",
  26170. type = "number",
  26171. description = "The y component of the rotation axis."
  26172. },
  26173. {
  26174. name = "az",
  26175. type = "number",
  26176. description = "The z component of the rotation axis."
  26177. }
  26178. }
  26179. }
  26180. }
  26181. },
  26182. {
  26183. name = "getPosition",
  26184. summary = "Get the Shape's position.",
  26185. description = "Get the position of the Shape relative to its Collider.",
  26186. key = "Shape:getPosition",
  26187. module = "lovr.physics",
  26188. related = {
  26189. "Shape:getOrientation",
  26190. "Shape:setOrientation"
  26191. },
  26192. variants = {
  26193. {
  26194. arguments = {},
  26195. returns = {
  26196. {
  26197. name = "x",
  26198. type = "number",
  26199. description = "The x offset."
  26200. },
  26201. {
  26202. name = "y",
  26203. type = "number",
  26204. description = "The y offset."
  26205. },
  26206. {
  26207. name = "z",
  26208. type = "number",
  26209. description = "The z offset."
  26210. }
  26211. }
  26212. }
  26213. }
  26214. },
  26215. {
  26216. name = "getType",
  26217. summary = "Get the type of the Shape.",
  26218. description = "Returns the type of the Shape.",
  26219. key = "Shape:getType",
  26220. module = "lovr.physics",
  26221. related = {
  26222. "ShapeType"
  26223. },
  26224. variants = {
  26225. {
  26226. arguments = {},
  26227. returns = {
  26228. {
  26229. name = "type",
  26230. type = "ShapeType",
  26231. description = "The type of the Shape."
  26232. }
  26233. }
  26234. }
  26235. }
  26236. },
  26237. {
  26238. name = "getUserData",
  26239. summary = "Get the Shape's user data.",
  26240. description = "Returns the user data associated with the Shape.",
  26241. key = "Shape:getUserData",
  26242. module = "lovr.physics",
  26243. notes = "User data can be useful to identify the Shape in callbacks.",
  26244. variants = {
  26245. {
  26246. arguments = {},
  26247. returns = {
  26248. {
  26249. name = "data",
  26250. type = "*",
  26251. description = "The custom value associated with the Shape."
  26252. }
  26253. }
  26254. }
  26255. }
  26256. },
  26257. {
  26258. name = "isEnabled",
  26259. summary = "Check if the Shape is enabled.",
  26260. description = "Returns whether the Shape is enabled.",
  26261. key = "Shape:isEnabled",
  26262. module = "lovr.physics",
  26263. notes = "Disabled shapes won't collide with anything.",
  26264. variants = {
  26265. {
  26266. arguments = {},
  26267. returns = {
  26268. {
  26269. name = "enabled",
  26270. type = "boolean",
  26271. description = "Whether the Shape is enabled."
  26272. }
  26273. }
  26274. }
  26275. }
  26276. },
  26277. {
  26278. name = "isSensor",
  26279. summary = "Check if the Shape is a sensor.",
  26280. description = "Returns whether the Shape is a sensor. Sensors do not trigger any collision response, but they still report collisions in `World:collide`.",
  26281. key = "Shape:isSensor",
  26282. module = "lovr.physics",
  26283. variants = {
  26284. {
  26285. arguments = {},
  26286. returns = {
  26287. {
  26288. name = "sensor",
  26289. type = "boolean",
  26290. description = "Whether the Shape is a sensor."
  26291. }
  26292. }
  26293. }
  26294. }
  26295. },
  26296. {
  26297. name = "setEnabled",
  26298. summary = "Enable or disable the Shape.",
  26299. description = "Enable or disable the Shape.",
  26300. key = "Shape:setEnabled",
  26301. module = "lovr.physics",
  26302. notes = "Disabled shapes won't collide with anything.",
  26303. variants = {
  26304. {
  26305. arguments = {
  26306. {
  26307. name = "enabled",
  26308. type = "boolean",
  26309. description = "Whether the Shape should be enabled."
  26310. }
  26311. },
  26312. returns = {}
  26313. }
  26314. }
  26315. },
  26316. {
  26317. name = "setOrientation",
  26318. summary = "Set the Shape's orientation.",
  26319. description = "Set the orientation of the Shape relative to its Collider.",
  26320. key = "Shape:setOrientation",
  26321. module = "lovr.physics",
  26322. notes = "If the Shape isn't attached to a Collider, this will error.",
  26323. variants = {
  26324. {
  26325. arguments = {
  26326. {
  26327. name = "angle",
  26328. type = "number",
  26329. description = "The number of radians the Shape is rotated."
  26330. },
  26331. {
  26332. name = "ax",
  26333. type = "number",
  26334. description = "The x component of the rotation axis."
  26335. },
  26336. {
  26337. name = "ay",
  26338. type = "number",
  26339. description = "The y component of the rotation axis."
  26340. },
  26341. {
  26342. name = "az",
  26343. type = "number",
  26344. description = "The z component of the rotation axis."
  26345. }
  26346. },
  26347. returns = {}
  26348. }
  26349. },
  26350. related = {
  26351. "Shape:getPosition",
  26352. "Shape:setPosition"
  26353. }
  26354. },
  26355. {
  26356. name = "setPosition",
  26357. summary = "Set the Shape's position.",
  26358. description = "Set the position of the Shape relative to its Collider.",
  26359. key = "Shape:setPosition",
  26360. module = "lovr.physics",
  26361. notes = "If the Shape isn't attached to a Collider, this will error.",
  26362. variants = {
  26363. {
  26364. arguments = {
  26365. {
  26366. name = "x",
  26367. type = "number",
  26368. description = "The x offset."
  26369. },
  26370. {
  26371. name = "y",
  26372. type = "number",
  26373. description = "The y offset."
  26374. },
  26375. {
  26376. name = "z",
  26377. type = "number",
  26378. description = "The z offset."
  26379. }
  26380. },
  26381. returns = {}
  26382. }
  26383. },
  26384. related = {
  26385. "Shape:getOrientation",
  26386. "Shape:setOrientation"
  26387. }
  26388. },
  26389. {
  26390. name = "setSensor",
  26391. summary = "Set the sensor status for the Shape.",
  26392. description = "Sets whether this Shape is a sensor. Sensors do not trigger any collision response, but they still report collisions in `World:collide`.",
  26393. key = "Shape:setSensor",
  26394. module = "lovr.physics",
  26395. variants = {
  26396. {
  26397. arguments = {
  26398. {
  26399. name = "sensor",
  26400. type = "boolean",
  26401. description = "Whether the Shape should be a sensor."
  26402. }
  26403. },
  26404. returns = {}
  26405. }
  26406. }
  26407. },
  26408. {
  26409. name = "setUserData",
  26410. summary = "Set the Shape's user data.",
  26411. description = "Sets the user data associated with the Shape.",
  26412. key = "Shape:setUserData",
  26413. module = "lovr.physics",
  26414. notes = "User data can be useful to identify the Shape in callbacks.",
  26415. variants = {
  26416. {
  26417. arguments = {
  26418. {
  26419. name = "data",
  26420. type = "*",
  26421. description = "The custom value associated with the Shape."
  26422. }
  26423. },
  26424. returns = {}
  26425. }
  26426. }
  26427. }
  26428. }
  26429. },
  26430. {
  26431. name = "SliderJoint",
  26432. summary = "A slider joint.",
  26433. description = "A SliderJoint is a type of `Joint` that only allows colliders to move on a single axis.",
  26434. key = "SliderJoint",
  26435. module = "lovr.physics",
  26436. constructors = {
  26437. "lovr.physics.newSliderJoint"
  26438. },
  26439. related = {
  26440. "Collider"
  26441. },
  26442. extends = "Joint",
  26443. methods = {
  26444. {
  26445. name = "getAxis",
  26446. summary = "Get the SliderJoint's axis.",
  26447. description = "Returns the axis of the slider.",
  26448. key = "SliderJoint:getAxis",
  26449. module = "lovr.physics",
  26450. variants = {
  26451. {
  26452. arguments = {},
  26453. returns = {
  26454. {
  26455. name = "x",
  26456. type = "number",
  26457. description = "The x component of the axis."
  26458. },
  26459. {
  26460. name = "y",
  26461. type = "number",
  26462. description = "The y component of the axis."
  26463. },
  26464. {
  26465. name = "z",
  26466. type = "number",
  26467. description = "The z component of the axis."
  26468. }
  26469. }
  26470. }
  26471. }
  26472. },
  26473. {
  26474. name = "getLimits",
  26475. summary = "Get the SliderJoint's limits.",
  26476. description = "Returns the upper and lower limits of the slider position.",
  26477. key = "SliderJoint:getLimits",
  26478. module = "lovr.physics",
  26479. related = {
  26480. "SliderJoint:getPosition",
  26481. "SliderJoint:getLowerLimit",
  26482. "SliderJoint:setLowerLimit",
  26483. "SliderJoint:getUpperLimit",
  26484. "SliderJoint:setUpperLimit"
  26485. },
  26486. variants = {
  26487. {
  26488. arguments = {},
  26489. returns = {
  26490. {
  26491. name = "lower",
  26492. type = "number",
  26493. description = "The lower limit."
  26494. },
  26495. {
  26496. name = "upper",
  26497. type = "number",
  26498. description = "The upper limit."
  26499. }
  26500. }
  26501. }
  26502. }
  26503. },
  26504. {
  26505. name = "getLowerLimit",
  26506. summary = "Get the SliderJoint's lower limit.",
  26507. description = "Returns the lower limit of the slider position.",
  26508. key = "SliderJoint:getLowerLimit",
  26509. module = "lovr.physics",
  26510. related = {
  26511. "SliderJoint:getPosition",
  26512. "SliderJoint:getUpperLimit",
  26513. "SliderJoint:setUpperLimit",
  26514. "SliderJoint:getLimits",
  26515. "SliderJoint:setLimits"
  26516. },
  26517. variants = {
  26518. {
  26519. arguments = {},
  26520. returns = {
  26521. {
  26522. name = "limit",
  26523. type = "number",
  26524. description = "The lower limit."
  26525. }
  26526. }
  26527. }
  26528. }
  26529. },
  26530. {
  26531. name = "getUpperLimit",
  26532. summary = "Get the SliderJoint's upper limit.",
  26533. description = "Returns the upper limit of the slider position.",
  26534. key = "SliderJoint:getUpperLimit",
  26535. module = "lovr.physics",
  26536. related = {
  26537. "SliderJoint:getPosition",
  26538. "SliderJoint:getLowerLimit",
  26539. "SliderJoint:setLowerLimit",
  26540. "SliderJoint:getLimits",
  26541. "SliderJoint:setLimits"
  26542. },
  26543. variants = {
  26544. {
  26545. arguments = {},
  26546. returns = {
  26547. {
  26548. name = "limit",
  26549. type = "number",
  26550. description = "The upper limit."
  26551. }
  26552. }
  26553. }
  26554. }
  26555. },
  26556. {
  26557. name = "setAxis",
  26558. summary = "Set the SliderJoint's axis.",
  26559. description = "Sets the axis of the slider.",
  26560. key = "SliderJoint:setAxis",
  26561. module = "lovr.physics",
  26562. variants = {
  26563. {
  26564. arguments = {
  26565. {
  26566. name = "x",
  26567. type = "number",
  26568. description = "The x component of the axis."
  26569. },
  26570. {
  26571. name = "y",
  26572. type = "number",
  26573. description = "The y component of the axis."
  26574. },
  26575. {
  26576. name = "z",
  26577. type = "number",
  26578. description = "The z component of the axis."
  26579. }
  26580. },
  26581. returns = {}
  26582. }
  26583. }
  26584. },
  26585. {
  26586. name = "setLimits",
  26587. summary = "Set the SliderJoint's limits.",
  26588. description = "Sets the upper and lower limits of the slider position.",
  26589. key = "SliderJoint:setLimits",
  26590. module = "lovr.physics",
  26591. related = {
  26592. "SliderJoint:getPosition",
  26593. "SliderJoint:getLowerLimit",
  26594. "SliderJoint:setLowerLimit",
  26595. "SliderJoint:getUpperLimit",
  26596. "SliderJoint:setUpperLimit"
  26597. },
  26598. variants = {
  26599. {
  26600. arguments = {
  26601. {
  26602. name = "lower",
  26603. type = "number",
  26604. description = "The lower limit."
  26605. },
  26606. {
  26607. name = "upper",
  26608. type = "number",
  26609. description = "The upper limit."
  26610. }
  26611. },
  26612. returns = {}
  26613. }
  26614. }
  26615. },
  26616. {
  26617. name = "setLowerLimit",
  26618. summary = "Set the SliderJoint's lower limit.",
  26619. description = "Sets the lower limit of the slider position.",
  26620. key = "SliderJoint:setLowerLimit",
  26621. module = "lovr.physics",
  26622. related = {
  26623. "SliderJoint:getPosition",
  26624. "SliderJoint:getUpperLimit",
  26625. "SliderJoint:setUpperLimit",
  26626. "SliderJoint:getLimits",
  26627. "SliderJoint:setLimits"
  26628. },
  26629. variants = {
  26630. {
  26631. arguments = {
  26632. {
  26633. name = "limit",
  26634. type = "number",
  26635. description = "The lower limit."
  26636. }
  26637. },
  26638. returns = {}
  26639. }
  26640. }
  26641. },
  26642. {
  26643. name = "setUpperLimit",
  26644. summary = "Set the SliderJoint's upper limit.",
  26645. description = "Sets the upper limit of the slider position.",
  26646. key = "SliderJoint:setUpperLimit",
  26647. module = "lovr.physics",
  26648. related = {
  26649. "SliderJoint:getPosition",
  26650. "SliderJoint:getLowerLimit",
  26651. "SliderJoint:setLowerLimit",
  26652. "SliderJoint:getLimits",
  26653. "SliderJoint:setLimits"
  26654. },
  26655. variants = {
  26656. {
  26657. arguments = {
  26658. {
  26659. name = "limit",
  26660. type = "number",
  26661. description = "The upper limit."
  26662. }
  26663. },
  26664. returns = {}
  26665. }
  26666. }
  26667. }
  26668. }
  26669. },
  26670. {
  26671. name = "SphereShape",
  26672. summary = "A sphere Shape.",
  26673. description = "A type of `Shape` that can be used for spheres.",
  26674. key = "SphereShape",
  26675. module = "lovr.physics",
  26676. constructors = {
  26677. "lovr.physics.newSphereShape",
  26678. "World:newSphereCollider"
  26679. },
  26680. extends = "Shape",
  26681. methods = {
  26682. {
  26683. name = "getRadius",
  26684. summary = "Get the radius of the SphereShape.",
  26685. description = "Returns the radius of the SphereShape.",
  26686. key = "SphereShape:getRadius",
  26687. module = "lovr.physics",
  26688. variants = {
  26689. {
  26690. arguments = {},
  26691. returns = {
  26692. {
  26693. name = "radius",
  26694. type = "number",
  26695. description = "The radius of the sphere, in meters."
  26696. }
  26697. }
  26698. }
  26699. }
  26700. },
  26701. {
  26702. name = "setRadius",
  26703. summary = "Set the radius of the SphereShape.",
  26704. description = "Sets the radius of the SphereShape.",
  26705. key = "SphereShape:setRadius",
  26706. module = "lovr.physics",
  26707. variants = {
  26708. {
  26709. arguments = {
  26710. {
  26711. name = "radius",
  26712. type = "number",
  26713. description = "The radius of the sphere, in meters."
  26714. }
  26715. },
  26716. returns = {}
  26717. }
  26718. }
  26719. }
  26720. }
  26721. },
  26722. {
  26723. name = "World",
  26724. summary = "An independent physics simulation.",
  26725. description = "A World is an object that holds the colliders, joints, and shapes in a physics simulation.",
  26726. key = "World",
  26727. module = "lovr.physics",
  26728. constructors = {
  26729. "lovr.physics.newWorld"
  26730. },
  26731. notes = "Be sure to update the World in `lovr.update` using `World:update`, otherwise everything will stand still.",
  26732. sections = {
  26733. {
  26734. name = "Basics",
  26735. tag = "worldBasics"
  26736. },
  26737. {
  26738. name = "Colliders",
  26739. tag = "colliders",
  26740. description = "The following functions add Colliders to the World. `World:newCollider` adds an \"empty\" Collider without any Shapes attached, whereas the other functions are shortcut functions to add Colliders with Shapes already attached to them."
  26741. },
  26742. {
  26743. name = "Properties",
  26744. tag = "worldProperties",
  26745. description = "The following functions are global properties of the simulation that apply to all new Colliders."
  26746. },
  26747. {
  26748. name = "Collision",
  26749. tag = "worldCollision",
  26750. description = "When the World is created using `lovr.physics.newWorld`, it is possible to specify a list of collision tags for the World. Colliders can then be assigned a tag. You can enable and disable collision between pairs of tags. There are also some helper functions to quickly identify pairs of colliders that are near each other and test whether or not they are colliding. These are used internally by default by `World:update`, but you can override this behavior and use the functions directly for custom collision behavior."
  26751. }
  26752. },
  26753. methods = {
  26754. {
  26755. name = "collide",
  26756. tag = "worldCollision",
  26757. summary = "Attempt to collide two shapes.",
  26758. description = "Attempt to collide two shapes. Internally this uses joints and forces to ensure the colliders attached to the shapes do not pass through each other. Collisions can be customized using friction and restitution (bounciness) parameters, and default to using a mix of the colliders' friction and restitution parameters. Usually this is called automatically by `World:update`.",
  26759. key = "World:collide",
  26760. module = "lovr.physics",
  26761. notes = "For friction, numbers in the range of 0-1 are common, but larger numbers can also be used.\n\nFor restitution, numbers in the range 0-1 should be used.\n\nThis function respects collision tags, so using `World:disableCollisionBetween` and `World:enableCollisionBetween` will change the behavior of this function.",
  26762. related = {
  26763. "World:computeOverlaps",
  26764. "World:overlaps",
  26765. "World:disableCollisionBetween",
  26766. "World:enableCollisionBetween",
  26767. "World:isCollisionEnabledBetween"
  26768. },
  26769. variants = {
  26770. {
  26771. arguments = {
  26772. {
  26773. name = "shapeA",
  26774. type = "Shape",
  26775. description = "The first shape."
  26776. },
  26777. {
  26778. name = "shapeB",
  26779. type = "Shape",
  26780. description = "The second shape."
  26781. },
  26782. {
  26783. name = "friction",
  26784. type = "number",
  26785. description = "The friction parameter for the collision.",
  26786. default = "nil"
  26787. },
  26788. {
  26789. name = "restitution",
  26790. type = "number",
  26791. description = "The restitution (bounciness) parameter for the collision.",
  26792. default = "nil"
  26793. }
  26794. },
  26795. returns = {
  26796. {
  26797. name = "collided",
  26798. type = "boolean",
  26799. description = "Whether the shapes collided."
  26800. }
  26801. }
  26802. }
  26803. }
  26804. },
  26805. {
  26806. name = "computeOverlaps",
  26807. tag = "worldCollision",
  26808. summary = "Compute pairs of shapes that are close to each other.",
  26809. description = "Detects which pairs of shapes in the world are near each other and could be colliding. After calling this function, the `World:overlaps` iterator can be used to iterate over the overlaps, and `World:collide` can be used to resolve a collision for the shapes (if any). Usually this is called automatically by `World:update`.",
  26810. key = "World:computeOverlaps",
  26811. module = "lovr.physics",
  26812. examples = {
  26813. {
  26814. code = "world:computeOverlaps()\nfor shapeA, shapeB in world:overlaps() do\n local areColliding = world:collide(shapeA, shapeB)\n print(shapeA, shapeB, areColliding)\nend"
  26815. }
  26816. },
  26817. related = {
  26818. "World:overlaps",
  26819. "World:collide",
  26820. "World:update"
  26821. },
  26822. variants = {
  26823. {
  26824. arguments = {},
  26825. returns = {}
  26826. }
  26827. }
  26828. },
  26829. {
  26830. name = "destroy",
  26831. tag = "worldBasics",
  26832. summary = "Destroy the World!! Muahaha!",
  26833. description = "Destroy the World!",
  26834. key = "World:destroy",
  26835. module = "lovr.physics",
  26836. notes = "Bad things will happen if you destroy the world and then try to access it or anything that was in it.",
  26837. variants = {
  26838. {
  26839. arguments = {},
  26840. returns = {}
  26841. }
  26842. }
  26843. },
  26844. {
  26845. name = "disableCollisionBetween",
  26846. tag = "worldCollision",
  26847. summary = "Disable collision between two tags.",
  26848. description = "Disables collision between two collision tags.",
  26849. key = "World:disableCollisionBetween",
  26850. module = "lovr.physics",
  26851. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags.",
  26852. related = {
  26853. "lovr.physics.newWorld",
  26854. "World:enableCollisionBetween",
  26855. "World:isCollisionEnabledBetween"
  26856. },
  26857. variants = {
  26858. {
  26859. arguments = {
  26860. {
  26861. name = "tag1",
  26862. type = "string",
  26863. description = "The first tag."
  26864. },
  26865. {
  26866. name = "tag2",
  26867. type = "string",
  26868. description = "The second tag."
  26869. }
  26870. },
  26871. returns = {}
  26872. }
  26873. }
  26874. },
  26875. {
  26876. name = "enableCollisionBetween",
  26877. tag = "worldCollision",
  26878. summary = "Enable collision between two tags.",
  26879. description = "Enables collision between two collision tags.",
  26880. key = "World:enableCollisionBetween",
  26881. module = "lovr.physics",
  26882. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags.",
  26883. related = {
  26884. "lovr.physics.newWorld",
  26885. "World:disableCollisionBetween",
  26886. "World:isCollisionEnabledBetween"
  26887. },
  26888. variants = {
  26889. {
  26890. arguments = {
  26891. {
  26892. name = "tag1",
  26893. type = "string",
  26894. description = "The first tag."
  26895. },
  26896. {
  26897. name = "tag2",
  26898. type = "string",
  26899. description = "The second tag."
  26900. }
  26901. },
  26902. returns = {}
  26903. }
  26904. }
  26905. },
  26906. {
  26907. name = "getAngularDamping",
  26908. tag = "worldProperties",
  26909. summary = "Get the angular damping of the World.",
  26910. description = "Returns the angular damping parameters of the World. Angular damping makes things less \"spinny\", making them slow down their angular velocity over time.",
  26911. key = "World:getAngularDamping",
  26912. module = "lovr.physics",
  26913. notes = "Angular damping can also be set on individual colliders.",
  26914. related = {
  26915. "Collider:getAngularDamping",
  26916. "Collider:setAngularDamping"
  26917. },
  26918. variants = {
  26919. {
  26920. arguments = {},
  26921. returns = {
  26922. {
  26923. name = "damping",
  26924. type = "number",
  26925. description = "The angular damping."
  26926. },
  26927. {
  26928. name = "threshold",
  26929. type = "number",
  26930. description = "Velocity limit below which the damping is not applied."
  26931. }
  26932. }
  26933. }
  26934. }
  26935. },
  26936. {
  26937. name = "getColliders",
  26938. tag = "colliders",
  26939. summary = "Get a table of all Colliders in the World.",
  26940. description = "Returns a table of all Colliders in the World.",
  26941. key = "World:getColliders",
  26942. module = "lovr.physics",
  26943. variants = {
  26944. {
  26945. arguments = {},
  26946. returns = {
  26947. {
  26948. name = "colliders",
  26949. type = "table",
  26950. description = "A table of `Collider` objects."
  26951. }
  26952. }
  26953. },
  26954. {
  26955. arguments = {
  26956. {
  26957. name = "t",
  26958. type = "table",
  26959. description = "A table to fill with Colliders and return."
  26960. }
  26961. },
  26962. returns = {
  26963. {
  26964. name = "colliders",
  26965. type = "table",
  26966. description = "A table of `Collider` objects."
  26967. }
  26968. }
  26969. }
  26970. }
  26971. },
  26972. {
  26973. name = "getGravity",
  26974. tag = "worldProperties",
  26975. summary = "Get the gravity of the World.",
  26976. description = "Returns the gravity of the World.",
  26977. key = "World:getGravity",
  26978. module = "lovr.physics",
  26979. variants = {
  26980. {
  26981. arguments = {},
  26982. returns = {
  26983. {
  26984. name = "xg",
  26985. type = "number",
  26986. description = "The x component of the gravity force."
  26987. },
  26988. {
  26989. name = "yg",
  26990. type = "number",
  26991. description = "The y component of the gravity force."
  26992. },
  26993. {
  26994. name = "zg",
  26995. type = "number",
  26996. description = "The z component of the gravity force."
  26997. }
  26998. }
  26999. }
  27000. }
  27001. },
  27002. {
  27003. name = "getLinearDamping",
  27004. tag = "worldProperties",
  27005. summary = "Get the linear damping of the World.",
  27006. description = "Returns the linear damping parameters of the World. Linear damping is similar to drag or air resistance, slowing down colliders over time as they move.",
  27007. key = "World:getLinearDamping",
  27008. module = "lovr.physics",
  27009. notes = "A linear damping of 0 means colliders won't slow down over time. This is the default.\n\nLinear damping can also be set on individual colliders.",
  27010. related = {
  27011. "Collider:getLinearDamping",
  27012. "Collider:setLinearDamping"
  27013. },
  27014. variants = {
  27015. {
  27016. arguments = {},
  27017. returns = {
  27018. {
  27019. name = "damping",
  27020. type = "number",
  27021. description = "The linear damping."
  27022. },
  27023. {
  27024. name = "threshold",
  27025. type = "number",
  27026. description = "Velocity limit below which the damping is not applied."
  27027. }
  27028. }
  27029. }
  27030. }
  27031. },
  27032. {
  27033. name = "getResponseTime",
  27034. tag = "worldProperties",
  27035. summary = "Get the response time of the World.",
  27036. description = "Returns the response time factor of the World.\n\nThe response time controls how relaxed collisions and joints are in the physics simulation, and functions similar to inertia. A low response time means collisions are resolved quickly, and higher values make objects more spongy and soft.\n\nThe value can be any positive number. It can be changed on a per-joint basis for `DistanceJoint` and `BallJoint` objects.",
  27037. key = "World:getResponseTime",
  27038. module = "lovr.physics",
  27039. related = {
  27040. "BallJoint:getResponseTime",
  27041. "BallJoint:setResponseTime",
  27042. "DistanceJoint:getResponseTime",
  27043. "DistanceJoint:setResponseTime",
  27044. "World:getTightness",
  27045. "World:setTightness"
  27046. },
  27047. variants = {
  27048. {
  27049. arguments = {},
  27050. returns = {
  27051. {
  27052. name = "responseTime",
  27053. type = "number",
  27054. description = "The response time setting for the World."
  27055. }
  27056. }
  27057. }
  27058. }
  27059. },
  27060. {
  27061. name = "getStepCount",
  27062. tag = "worldProperties",
  27063. summary = "Get the step count of the World.",
  27064. description = "Returns the step count of the World. The step count influences how many steps are taken during a call to `World:update`. A higher number of steps will be slower, but more accurate. The default step count is 20.",
  27065. key = "World:getStepCount",
  27066. module = "lovr.physics",
  27067. related = {
  27068. "World:update"
  27069. },
  27070. variants = {
  27071. {
  27072. arguments = {
  27073. {
  27074. name = "steps",
  27075. type = "number",
  27076. description = "The step count."
  27077. }
  27078. },
  27079. returns = {}
  27080. }
  27081. }
  27082. },
  27083. {
  27084. name = "getTightness",
  27085. summary = "Get the joint tightness.",
  27086. description = "Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.",
  27087. key = "World:getTightness",
  27088. module = "lovr.physics",
  27089. related = {
  27090. "DistanceJoint:getTightness",
  27091. "DistanceJoint:setTightness",
  27092. "World:getTightness",
  27093. "World:setTightness"
  27094. },
  27095. variants = {
  27096. {
  27097. arguments = {},
  27098. returns = {
  27099. {
  27100. name = "tightness",
  27101. type = "number",
  27102. description = "The tightness of the joint."
  27103. }
  27104. }
  27105. }
  27106. }
  27107. },
  27108. {
  27109. name = "isCollisionEnabledBetween",
  27110. tag = "worldCollision",
  27111. summary = "Check if two tags can collide.",
  27112. description = "Returns whether collisions are currently enabled between two tags.",
  27113. key = "World:isCollisionEnabledBetween",
  27114. module = "lovr.physics",
  27115. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags.",
  27116. related = {
  27117. "lovr.physics.newWorld",
  27118. "World:disableCollisionBetween",
  27119. "World:enableCollisionBetween"
  27120. },
  27121. variants = {
  27122. {
  27123. arguments = {
  27124. {
  27125. name = "tag1",
  27126. type = "string",
  27127. description = "The first tag."
  27128. },
  27129. {
  27130. name = "tag2",
  27131. type = "string",
  27132. description = "The second tag."
  27133. }
  27134. },
  27135. returns = {
  27136. {
  27137. name = "enabled",
  27138. type = "boolean",
  27139. description = "Whether or not two colliders with the specified tags will collide."
  27140. }
  27141. }
  27142. }
  27143. }
  27144. },
  27145. {
  27146. name = "isSleepingAllowed",
  27147. tag = "worldProperties",
  27148. summary = "Check if colliders can go to sleep.",
  27149. description = "Returns whether colliders can go to sleep in the World.",
  27150. key = "World:isSleepingAllowed",
  27151. module = "lovr.physics",
  27152. notes = "If sleeping is enabled, the World will try to detect colliders that haven't moved for a while and put them to sleep. Sleeping colliders don't impact the physics simulation, which makes updates more efficient and improves physics performance. However, the physics engine isn't perfect at waking up sleeping colliders and this can lead to bugs where colliders don't react to forces or collisions properly.\n\nThis can be set on individual colliders.\n\nColliders can be manually put to sleep or woken up using `Collider:setAwake`.",
  27153. related = {
  27154. "Collider:isSleepingAllowed",
  27155. "Collider:setSleepingAllowed",
  27156. "Collider:isAwake",
  27157. "Collider:setAwake"
  27158. },
  27159. variants = {
  27160. {
  27161. arguments = {},
  27162. returns = {
  27163. {
  27164. name = "allowed",
  27165. type = "boolean",
  27166. description = "Whether colliders can sleep."
  27167. }
  27168. }
  27169. }
  27170. }
  27171. },
  27172. {
  27173. name = "newBoxCollider",
  27174. tag = "colliders",
  27175. summary = "Add a Collider with a BoxShape to the World.",
  27176. description = "Adds a new Collider to the World with a BoxShape already attached.",
  27177. key = "World:newBoxCollider",
  27178. module = "lovr.physics",
  27179. related = {
  27180. "BoxShape",
  27181. "Collider",
  27182. "World:newCollider",
  27183. "World:newCapsuleCollider",
  27184. "World:newCylinderCollider",
  27185. "World:newMeshCollider",
  27186. "World:newSphereCollider"
  27187. },
  27188. variants = {
  27189. {
  27190. arguments = {
  27191. {
  27192. name = "x",
  27193. type = "number",
  27194. description = "The x coordinate of the center of the box.",
  27195. default = "0"
  27196. },
  27197. {
  27198. name = "y",
  27199. type = "number",
  27200. description = "The y coordinate of the center of the box.",
  27201. default = "0"
  27202. },
  27203. {
  27204. name = "z",
  27205. type = "number",
  27206. description = "The z coordinate of the center of the box.",
  27207. default = "0"
  27208. },
  27209. {
  27210. name = "width",
  27211. type = "number",
  27212. description = "The total width of the box, in meters.",
  27213. default = "1"
  27214. },
  27215. {
  27216. name = "height",
  27217. type = "number",
  27218. description = "The total height of the box, in meters.",
  27219. default = "width"
  27220. },
  27221. {
  27222. name = "depth",
  27223. type = "number",
  27224. description = "The total depth of the box, in meters.",
  27225. default = "width"
  27226. }
  27227. },
  27228. returns = {
  27229. {
  27230. name = "collider",
  27231. type = "Collider",
  27232. description = "The new Collider."
  27233. }
  27234. }
  27235. }
  27236. }
  27237. },
  27238. {
  27239. name = "newCapsuleCollider",
  27240. tag = "colliders",
  27241. summary = "Add a Collider with a CapsuleShape to the World.",
  27242. description = "Adds a new Collider to the World with a CapsuleShape already attached.",
  27243. key = "World:newCapsuleCollider",
  27244. module = "lovr.physics",
  27245. related = {
  27246. "CapsuleShape",
  27247. "Collider",
  27248. "World:newCollider",
  27249. "World:newBoxCollider",
  27250. "World:newCylinderCollider",
  27251. "World:newMeshCollider",
  27252. "World:newSphereCollider"
  27253. },
  27254. variants = {
  27255. {
  27256. arguments = {
  27257. {
  27258. name = "x",
  27259. type = "number",
  27260. description = "The x coordinate of the center of the capsule.",
  27261. default = "0"
  27262. },
  27263. {
  27264. name = "y",
  27265. type = "number",
  27266. description = "The y coordinate of the center of the capsule.",
  27267. default = "0"
  27268. },
  27269. {
  27270. name = "z",
  27271. type = "number",
  27272. description = "The z coordinate of the center of the capsule.",
  27273. default = "0"
  27274. },
  27275. {
  27276. name = "radius",
  27277. type = "number",
  27278. description = "The radius of the capsule, in meters.",
  27279. default = "1"
  27280. },
  27281. {
  27282. name = "length",
  27283. type = "number",
  27284. description = "The length of the capsule, not including the caps, in meters.",
  27285. default = "1"
  27286. }
  27287. },
  27288. returns = {
  27289. {
  27290. name = "collider",
  27291. type = "Collider",
  27292. description = "The new Collider."
  27293. }
  27294. }
  27295. }
  27296. }
  27297. },
  27298. {
  27299. name = "newCollider",
  27300. tag = "colliders",
  27301. summary = "Add a Collider to the World.",
  27302. description = "Adds a new Collider to the World.",
  27303. key = "World:newCollider",
  27304. module = "lovr.physics",
  27305. related = {
  27306. "World:newBoxCollider",
  27307. "World:newCapsuleCollider",
  27308. "World:newCylinderCollider",
  27309. "World:newMeshCollider",
  27310. "World:newSphereCollider",
  27311. "Collider",
  27312. "Shape"
  27313. },
  27314. examples = {
  27315. {
  27316. description = "Create a new world, add a collider to it, and update it, printing out the collider's position as it falls.",
  27317. code = "function lovr.load()\n world = lovr.physics.newWorld()\n box = world:newBoxCollider()\nend\n\nfunction lovr.update(dt)\n world:update(dt)\n print(box:getPosition())\nend"
  27318. }
  27319. },
  27320. notes = "This function creates a collider without any shapes attached to it, which means it won't collide with anything. To add a shape to the collider, use `Collider:addShape`, or use one of the following functions to create the collider:\n\n- `World:newBoxCollider`\n- `World:newCapsuleCollider`\n- `World:newCylinderCollider`\n- `World:newSphereCollider`",
  27321. variants = {
  27322. {
  27323. arguments = {
  27324. {
  27325. name = "x",
  27326. type = "number",
  27327. description = "The x position of the Collider.",
  27328. default = "0"
  27329. },
  27330. {
  27331. name = "y",
  27332. type = "number",
  27333. description = "The y position of the Collider.",
  27334. default = "0"
  27335. },
  27336. {
  27337. name = "z",
  27338. type = "number",
  27339. description = "The z position of the Collider.",
  27340. default = "0"
  27341. }
  27342. },
  27343. returns = {
  27344. {
  27345. name = "collider",
  27346. type = "Collider",
  27347. description = "The new Collider."
  27348. }
  27349. }
  27350. }
  27351. }
  27352. },
  27353. {
  27354. name = "newCylinderCollider",
  27355. tag = "colliders",
  27356. summary = "Add a Collider with a CylinderShape to the World.",
  27357. description = "Adds a new Collider to the World with a CylinderShape already attached.",
  27358. key = "World:newCylinderCollider",
  27359. module = "lovr.physics",
  27360. related = {
  27361. "CylinderShape",
  27362. "Collider",
  27363. "World:newCollider",
  27364. "World:newBoxCollider",
  27365. "World:newCapsuleCollider",
  27366. "World:newMeshCollider",
  27367. "World:newSphereCollider"
  27368. },
  27369. variants = {
  27370. {
  27371. arguments = {
  27372. {
  27373. name = "x",
  27374. type = "number",
  27375. description = "The x coordinate of the center of the cylinder.",
  27376. default = "0"
  27377. },
  27378. {
  27379. name = "y",
  27380. type = "number",
  27381. description = "The y coordinate of the center of the cylinder.",
  27382. default = "0"
  27383. },
  27384. {
  27385. name = "z",
  27386. type = "number",
  27387. description = "The z coordinate of the center of the cylinder.",
  27388. default = "0"
  27389. },
  27390. {
  27391. name = "radius",
  27392. type = "number",
  27393. description = "The radius of the cylinder, in meters.",
  27394. default = "1"
  27395. },
  27396. {
  27397. name = "length",
  27398. type = "number",
  27399. description = "The length of the cylinder, in meters.",
  27400. default = "1"
  27401. }
  27402. },
  27403. returns = {
  27404. {
  27405. name = "collider",
  27406. type = "Collider",
  27407. description = "The new Collider."
  27408. }
  27409. }
  27410. }
  27411. }
  27412. },
  27413. {
  27414. name = "newMeshCollider",
  27415. tag = "colliders",
  27416. summary = "Add a Collider with a MeshShape to the World.",
  27417. description = "Adds a new Collider to the World with a MeshShape already attached.",
  27418. key = "World:newMeshCollider",
  27419. module = "lovr.physics",
  27420. related = {
  27421. "Collider",
  27422. "World:newCollider",
  27423. "World:newBoxCollider",
  27424. "World:newCapsuleCollider",
  27425. "World:newCylinderCollider",
  27426. "World:newSphereCollider",
  27427. "Model:getTriangles"
  27428. },
  27429. variants = {
  27430. {
  27431. arguments = {
  27432. {
  27433. name = "vertices",
  27434. type = "table",
  27435. description = "The table of vertices in the mesh. Each vertex is a table with 3 numbers."
  27436. },
  27437. {
  27438. name = "indices",
  27439. type = "table",
  27440. description = "A table of triangle indices representing how the vertices are connected in the Mesh."
  27441. }
  27442. },
  27443. returns = {
  27444. {
  27445. name = "collider",
  27446. type = "Collider",
  27447. description = "The new Collider."
  27448. }
  27449. }
  27450. },
  27451. {
  27452. arguments = {
  27453. {
  27454. name = "model",
  27455. type = "Model",
  27456. description = "A Model to use for the mesh data. Similar to calling `Model:getTriangles` and passing it to this function, but has better performance."
  27457. }
  27458. },
  27459. returns = {
  27460. {
  27461. name = "collider",
  27462. type = "Collider",
  27463. description = "The new Collider."
  27464. }
  27465. }
  27466. }
  27467. }
  27468. },
  27469. {
  27470. name = "newSphereCollider",
  27471. tag = "colliders",
  27472. summary = "Add a Collider with a SphereShape to the World.",
  27473. description = "Adds a new Collider to the World with a SphereShape already attached.",
  27474. key = "World:newSphereCollider",
  27475. module = "lovr.physics",
  27476. related = {
  27477. "SphereShape",
  27478. "Collider",
  27479. "World:newCollider",
  27480. "World:newBoxCollider",
  27481. "World:newCapsuleCollider",
  27482. "World:newCylinderCollider",
  27483. "World:newMeshCollider"
  27484. },
  27485. variants = {
  27486. {
  27487. arguments = {
  27488. {
  27489. name = "x",
  27490. type = "number",
  27491. description = "The x coordinate of the center of the sphere.",
  27492. default = "0"
  27493. },
  27494. {
  27495. name = "y",
  27496. type = "number",
  27497. description = "The y coordinate of the center of the sphere.",
  27498. default = "0"
  27499. },
  27500. {
  27501. name = "z",
  27502. type = "number",
  27503. description = "The z coordinate of the center of the sphere.",
  27504. default = "0"
  27505. },
  27506. {
  27507. name = "radius",
  27508. type = "number",
  27509. description = "The radius of the sphere, in meters.",
  27510. default = "1"
  27511. }
  27512. },
  27513. returns = {
  27514. {
  27515. name = "collider",
  27516. type = "Collider",
  27517. description = "The new Collider."
  27518. }
  27519. }
  27520. }
  27521. }
  27522. },
  27523. {
  27524. name = "overlaps",
  27525. tag = "worldCollision",
  27526. summary = "Iterate over pairs of nearby shapes.",
  27527. description = "Returns an iterator that can be used to iterate over \"overlaps\", or potential collisions between pairs of shapes in the World. This should be called after using `World:computeOverlaps` to compute the list of overlaps. Usually this is called automatically by `World:update`.",
  27528. key = "World:overlaps",
  27529. module = "lovr.physics",
  27530. examples = {
  27531. {
  27532. code = "world:computeOverlaps()\nfor shapeA, shapeB in world:overlaps() do\n local areColliding = world:collide(shapeA, shapeB)\n print(shapeA, shapeB, areColliding)\nend"
  27533. }
  27534. },
  27535. related = {
  27536. "World:computeOverlaps",
  27537. "World:collide",
  27538. "World:update"
  27539. },
  27540. variants = {
  27541. {
  27542. arguments = {},
  27543. returns = {
  27544. {
  27545. name = "iterator",
  27546. type = "function",
  27547. description = "A Lua iterator, usable in a for loop.",
  27548. arguments = {},
  27549. returns = {}
  27550. }
  27551. }
  27552. }
  27553. }
  27554. },
  27555. {
  27556. name = "raycast",
  27557. tag = "worldBasics",
  27558. summary = "Cast a ray through the World.",
  27559. description = "Casts a ray through the World, calling a function every time the ray intersects with a Shape.",
  27560. key = "World:raycast",
  27561. module = "lovr.physics",
  27562. notes = "The callback is passed the shape that was hit, the hit position (in world coordinates), and the normal vector of the hit.",
  27563. examples = {
  27564. {
  27565. code = "function lovr.load()\n world = lovr.physics.newWorld()\n world:newSphereCollider(0, 0, 0, 2)\n\n -- Cast a ray through the sphere\n local x1, y1, z1 = .5, 3, 0\n local x2, y2, z2 = -.5, -2, 0\n world:raycast(x1, y1, z1, x2, y2, z2, function(shape, x, y, z, nx, ny, nz)\n print('Collision detected!', shape, x, y, z, nx, ny, nz)\n end)\nend"
  27566. }
  27567. },
  27568. variants = {
  27569. {
  27570. arguments = {
  27571. {
  27572. name = "x1",
  27573. type = "number",
  27574. description = "The x coordinate of the starting position of the ray."
  27575. },
  27576. {
  27577. name = "y1",
  27578. type = "number",
  27579. description = "The y coordinate of the starting position of the ray."
  27580. },
  27581. {
  27582. name = "z1",
  27583. type = "number",
  27584. description = "The z coordinate of the starting position of the ray."
  27585. },
  27586. {
  27587. name = "x2",
  27588. type = "number",
  27589. description = "The x coordinate of the ending position of the ray."
  27590. },
  27591. {
  27592. name = "y2",
  27593. type = "number",
  27594. description = "The y coordinate of the ending position of the ray."
  27595. },
  27596. {
  27597. name = "z2",
  27598. type = "number",
  27599. description = "The z coordinate of the ending position of the ray."
  27600. },
  27601. {
  27602. name = "callback",
  27603. type = "function",
  27604. description = "The function to call when an intersection is detected.",
  27605. arguments = {
  27606. {
  27607. name = "shape",
  27608. type = "Shape"
  27609. },
  27610. {
  27611. name = "x",
  27612. type = "number"
  27613. },
  27614. {
  27615. name = "y",
  27616. type = "number"
  27617. },
  27618. {
  27619. name = "z",
  27620. type = "number"
  27621. },
  27622. {
  27623. name = "nx",
  27624. type = "number"
  27625. },
  27626. {
  27627. name = "ny",
  27628. type = "number"
  27629. },
  27630. {
  27631. name = "nz",
  27632. type = "number"
  27633. }
  27634. },
  27635. returns = {}
  27636. }
  27637. },
  27638. returns = {}
  27639. }
  27640. }
  27641. },
  27642. {
  27643. name = "setAngularDamping",
  27644. tag = "worldProperties",
  27645. summary = "Set the angular damping of the World.",
  27646. description = "Sets the angular damping of the World. Angular damping makes things less \"spinny\", making them slow down their angular velocity over time. Damping is only applied when angular velocity is over the threshold value.",
  27647. key = "World:setAngularDamping",
  27648. module = "lovr.physics",
  27649. notes = "Angular damping can also be set on individual colliders.",
  27650. related = {
  27651. "Collider:getAngularDamping",
  27652. "Collider:setAngularDamping"
  27653. },
  27654. variants = {
  27655. {
  27656. arguments = {
  27657. {
  27658. name = "damping",
  27659. type = "number",
  27660. description = "The angular damping."
  27661. },
  27662. {
  27663. name = "threshold",
  27664. type = "number",
  27665. description = "Velocity limit below which the damping is not applied.",
  27666. default = "0"
  27667. }
  27668. },
  27669. returns = {}
  27670. }
  27671. }
  27672. },
  27673. {
  27674. name = "setGravity",
  27675. tag = "worldProperties",
  27676. summary = "Set the gravity of the World.",
  27677. description = "Sets the gravity of the World.",
  27678. key = "World:setGravity",
  27679. module = "lovr.physics",
  27680. variants = {
  27681. {
  27682. arguments = {
  27683. {
  27684. name = "xg",
  27685. type = "number",
  27686. description = "The x component of the gravity force."
  27687. },
  27688. {
  27689. name = "yg",
  27690. type = "number",
  27691. description = "The y component of the gravity force."
  27692. },
  27693. {
  27694. name = "zg",
  27695. type = "number",
  27696. description = "The z component of the gravity force."
  27697. }
  27698. },
  27699. returns = {}
  27700. }
  27701. }
  27702. },
  27703. {
  27704. name = "setLinearDamping",
  27705. tag = "worldProperties",
  27706. summary = "Set the linear damping of the World.",
  27707. description = "Sets the linear damping of the World. Linear damping is similar to drag or air resistance, slowing down colliders over time as they move. Damping is only applied when linear velocity is over the threshold value.",
  27708. key = "World:setLinearDamping",
  27709. module = "lovr.physics",
  27710. notes = "A linear damping of 0 means colliders won't slow down over time. This is the default.\n\nLinear damping can also be set on individual colliders.",
  27711. related = {
  27712. "Collider:getLinearDamping",
  27713. "Collider:setLinearDamping"
  27714. },
  27715. variants = {
  27716. {
  27717. arguments = {
  27718. {
  27719. name = "damping",
  27720. type = "number",
  27721. description = "The linear damping."
  27722. },
  27723. {
  27724. name = "threshold",
  27725. type = "number",
  27726. description = "Velocity limit below which the damping is not applied.",
  27727. default = "0"
  27728. }
  27729. },
  27730. returns = {}
  27731. }
  27732. }
  27733. },
  27734. {
  27735. name = "setResponseTime",
  27736. tag = "worldProperties",
  27737. summary = "Set the response time of the World.",
  27738. description = "Sets the response time factor of the World.\n\nThe response time controls how relaxed collisions and joints are in the physics simulation, and functions similar to inertia. A low response time means collisions are resolved quickly, and higher values make objects more spongy and soft.\n\nThe value can be any positive number. It can be changed on a per-joint basis for `DistanceJoint` and `BallJoint` objects.",
  27739. key = "World:setResponseTime",
  27740. module = "lovr.physics",
  27741. related = {
  27742. "BallJoint:getResponseTime",
  27743. "BallJoint:setResponseTime",
  27744. "DistanceJoint:getResponseTime",
  27745. "DistanceJoint:setResponseTime",
  27746. "World:getTightness",
  27747. "World:setTightness"
  27748. },
  27749. variants = {
  27750. {
  27751. arguments = {
  27752. {
  27753. name = "responseTime",
  27754. type = "number",
  27755. description = "The new response time setting for the World."
  27756. }
  27757. },
  27758. returns = {}
  27759. }
  27760. }
  27761. },
  27762. {
  27763. name = "setSleepingAllowed",
  27764. tag = "worldProperties",
  27765. summary = "Set whether colliders can go to sleep.",
  27766. description = "Sets whether colliders can go to sleep in the World.",
  27767. key = "World:setSleepingAllowed",
  27768. module = "lovr.physics",
  27769. notes = "If sleeping is enabled, the World will try to detect colliders that haven't moved for a while and put them to sleep. Sleeping colliders don't impact the physics simulation, which makes updates more efficient and improves physics performance. However, the physics engine isn't perfect at waking up sleeping colliders and this can lead to bugs where colliders don't react to forces or collisions properly.\n\nThis can be set on individual colliders.\n\nColliders can be manually put to sleep or woken up using `Collider:setAwake`.",
  27770. related = {
  27771. "Collider:isSleepingAllowed",
  27772. "Collider:setSleepingAllowed",
  27773. "Collider:isAwake",
  27774. "Collider:setAwake"
  27775. },
  27776. variants = {
  27777. {
  27778. arguments = {
  27779. {
  27780. name = "allowed",
  27781. type = "boolean",
  27782. description = "Whether colliders can sleep."
  27783. }
  27784. },
  27785. returns = {}
  27786. }
  27787. }
  27788. },
  27789. {
  27790. name = "setStepCount",
  27791. tag = "worldProperties",
  27792. summary = "Set the step count of the World.",
  27793. description = "Sets the step count of the World. The step count influences how many steps are taken during a call to `World:update`. A higher number of steps will be slower, but more accurate. The default step count is 20.",
  27794. key = "World:setStepCount",
  27795. module = "lovr.physics",
  27796. related = {
  27797. "World:update"
  27798. },
  27799. variants = {
  27800. {
  27801. arguments = {
  27802. {
  27803. name = "steps",
  27804. type = "number",
  27805. description = "The new step count."
  27806. }
  27807. },
  27808. returns = {}
  27809. }
  27810. }
  27811. },
  27812. {
  27813. name = "setTightness",
  27814. tag = "worldProperties",
  27815. summary = "Set the tightness of joints in the World.",
  27816. description = "Sets the tightness of joints in the World.\n\nThe tightness controls how much force is applied to colliders connected by joints. With a value of 0, no force will be applied and joints won't have any effect. With a tightness of 1, a strong force will be used to try to keep the Colliders constrained. A tightness larger than 1 will overcorrect the joints, which can sometimes be desirable. Negative tightness values are not supported.",
  27817. key = "World:setTightness",
  27818. module = "lovr.physics",
  27819. related = {
  27820. "BallJoint:getTightness",
  27821. "BallJoint:setTightness",
  27822. "DistanceJoint:getTightness",
  27823. "DistanceJoint:setTightness",
  27824. "World:getResponseTime",
  27825. "World:setResponseTime"
  27826. },
  27827. variants = {
  27828. {
  27829. arguments = {
  27830. {
  27831. name = "tightness",
  27832. type = "number",
  27833. description = "The new tightness for the World."
  27834. }
  27835. },
  27836. returns = {}
  27837. }
  27838. }
  27839. },
  27840. {
  27841. name = "update",
  27842. tag = "worldBasics",
  27843. summary = "Update the World.",
  27844. description = "Updates the World, advancing the physics simulation forward in time and resolving collisions between colliders in the World.",
  27845. key = "World:update",
  27846. module = "lovr.physics",
  27847. notes = "It is common to pass the `dt` variable from `lovr.update` into this function.\n\nThe default collision resolver function is:\n\n function defaultResolver(world)\n world:computeOverlaps()\n for shapeA, shapeB in world:overlaps() do\n world:collide(shapeA, shapeB)\n end\n end\n\nAdditional logic could be introduced to the collision resolver function to add custom collision behavior or to change the collision parameters (like friction and restitution) on a per-collision basis.\n\n> If possible, use a fixed timestep value for updating the World. It will greatly improve the\n> accuracy of the simulation and reduce bugs. For more information on implementing a fixed\n> timestep loop, see [this article](http://gafferongames.com/game-physics/fix-your-timestep/).",
  27848. related = {
  27849. "World:computeOverlaps",
  27850. "World:overlaps",
  27851. "World:collide"
  27852. },
  27853. variants = {
  27854. {
  27855. arguments = {
  27856. {
  27857. name = "dt",
  27858. type = "number",
  27859. description = "The amount of time to advance the simulation forward."
  27860. },
  27861. {
  27862. name = "resolver",
  27863. type = "function",
  27864. description = "The collision resolver function to use. This will be called before updating to allow for custom collision processing. If absent, a default will be used.",
  27865. arguments = {
  27866. {
  27867. name = "world",
  27868. type = "World"
  27869. }
  27870. },
  27871. returns = {},
  27872. default = "nil"
  27873. }
  27874. },
  27875. returns = {}
  27876. }
  27877. }
  27878. }
  27879. }
  27880. }
  27881. },
  27882. functions = {
  27883. {
  27884. name = "newBallJoint",
  27885. tag = "joints",
  27886. summary = "Create a new BallJoint.",
  27887. description = "Creates a new BallJoint.",
  27888. key = "lovr.physics.newBallJoint",
  27889. module = "lovr.physics",
  27890. notes = "A ball joint is like a ball and socket between the two colliders. It tries to keep the distance between the colliders and the anchor position the same, but does not constrain the angle between them.",
  27891. related = {
  27892. "lovr.physics.newDistanceJoint",
  27893. "lovr.physics.newHingeJoint",
  27894. "lovr.physics.newSliderJoint"
  27895. },
  27896. variants = {
  27897. {
  27898. arguments = {
  27899. {
  27900. name = "colliderA",
  27901. type = "Collider",
  27902. description = "The first collider to attach the Joint to."
  27903. },
  27904. {
  27905. name = "colliderB",
  27906. type = "Collider",
  27907. description = "The second collider to attach the Joint to."
  27908. },
  27909. {
  27910. name = "x",
  27911. type = "number",
  27912. description = "The x position of the joint anchor point, in world coordinates."
  27913. },
  27914. {
  27915. name = "y",
  27916. type = "number",
  27917. description = "The y position of the joint anchor point, in world coordinates."
  27918. },
  27919. {
  27920. name = "z",
  27921. type = "number",
  27922. description = "The z position of the joint anchor point, in world coordinates."
  27923. }
  27924. },
  27925. returns = {
  27926. {
  27927. name = "ball",
  27928. type = "BallJoint",
  27929. description = "The new BallJoint."
  27930. }
  27931. }
  27932. }
  27933. }
  27934. },
  27935. {
  27936. name = "newBoxShape",
  27937. tag = "shapes",
  27938. summary = "Create a new BoxShape.",
  27939. description = "Creates a new BoxShape.",
  27940. key = "lovr.physics.newBoxShape",
  27941. module = "lovr.physics",
  27942. notes = "A Shape can be attached to a Collider using `Collider:addShape`.",
  27943. related = {
  27944. "BoxShape",
  27945. "lovr.physics.newCapsuleShape",
  27946. "lovr.physics.newCylinderShape",
  27947. "lovr.physics.newSphereShape"
  27948. },
  27949. variants = {
  27950. {
  27951. arguments = {
  27952. {
  27953. name = "width",
  27954. type = "number",
  27955. description = "The width of the box, in meters.",
  27956. default = "1"
  27957. },
  27958. {
  27959. name = "height",
  27960. type = "number",
  27961. description = "The height of the box, in meters.",
  27962. default = "width"
  27963. },
  27964. {
  27965. name = "depth",
  27966. type = "number",
  27967. description = "The depth of the box, in meters.",
  27968. default = "width"
  27969. }
  27970. },
  27971. returns = {
  27972. {
  27973. name = "box",
  27974. type = "BoxShape",
  27975. description = "The new BoxShape."
  27976. }
  27977. }
  27978. }
  27979. }
  27980. },
  27981. {
  27982. name = "newCapsuleShape",
  27983. tag = "shapes",
  27984. summary = "Create a new CapsuleShape.",
  27985. description = "Creates a new CapsuleShape. Capsules are cylinders with hemispheres on each end.",
  27986. key = "lovr.physics.newCapsuleShape",
  27987. module = "lovr.physics",
  27988. notes = "A Shape can be attached to a Collider using `Collider:addShape`.",
  27989. related = {
  27990. "CapsuleShape",
  27991. "lovr.physics.newBoxShape",
  27992. "lovr.physics.newCylinderShape",
  27993. "lovr.physics.newSphereShape"
  27994. },
  27995. variants = {
  27996. {
  27997. arguments = {
  27998. {
  27999. name = "radius",
  28000. type = "number",
  28001. description = "The radius of the capsule, in meters.",
  28002. default = "1"
  28003. },
  28004. {
  28005. name = "length",
  28006. type = "number",
  28007. description = "The length of the capsule, not including the caps, in meters.",
  28008. default = "1"
  28009. }
  28010. },
  28011. returns = {
  28012. {
  28013. name = "capsule",
  28014. type = "CapsuleShape",
  28015. description = "The new CapsuleShape."
  28016. }
  28017. }
  28018. }
  28019. }
  28020. },
  28021. {
  28022. name = "newCylinderShape",
  28023. tag = "shapes",
  28024. summary = "Create a new CylinderShape.",
  28025. description = "Creates a new CylinderShape.",
  28026. key = "lovr.physics.newCylinderShape",
  28027. module = "lovr.physics",
  28028. notes = "A Shape can be attached to a Collider using `Collider:addShape`.",
  28029. related = {
  28030. "CylinderShape",
  28031. "lovr.physics.newBoxShape",
  28032. "lovr.physics.newCapsuleShape",
  28033. "lovr.physics.newSphereShape"
  28034. },
  28035. variants = {
  28036. {
  28037. arguments = {
  28038. {
  28039. name = "radius",
  28040. type = "number",
  28041. description = "The radius of the cylinder, in meters.",
  28042. default = "1"
  28043. },
  28044. {
  28045. name = "length",
  28046. type = "number",
  28047. description = "The length of the cylinder, in meters.",
  28048. default = "1"
  28049. }
  28050. },
  28051. returns = {
  28052. {
  28053. name = "cylinder",
  28054. type = "CylinderShape",
  28055. description = "The new CylinderShape."
  28056. }
  28057. }
  28058. }
  28059. }
  28060. },
  28061. {
  28062. name = "newDistanceJoint",
  28063. tag = "joints",
  28064. summary = "Create a new DistanceJoint.",
  28065. description = "Creates a new DistanceJoint.",
  28066. key = "lovr.physics.newDistanceJoint",
  28067. module = "lovr.physics",
  28068. notes = "A distance joint tries to keep the two colliders a fixed distance apart. The distance is determined by the initial distance between the anchor points. The joint allows for rotation on the anchor points.",
  28069. related = {
  28070. "lovr.physics.newBallJoint",
  28071. "lovr.physics.newHingeJoint",
  28072. "lovr.physics.newSliderJoint"
  28073. },
  28074. variants = {
  28075. {
  28076. arguments = {
  28077. {
  28078. name = "colliderA",
  28079. type = "Collider",
  28080. description = "The first collider to attach the Joint to."
  28081. },
  28082. {
  28083. name = "colliderB",
  28084. type = "Collider",
  28085. description = "The second collider to attach the Joint to."
  28086. },
  28087. {
  28088. name = "x1",
  28089. type = "number",
  28090. description = "The x position of the first anchor point, in world coordinates."
  28091. },
  28092. {
  28093. name = "y1",
  28094. type = "number",
  28095. description = "The y position of the first anchor point, in world coordinates."
  28096. },
  28097. {
  28098. name = "z1",
  28099. type = "number",
  28100. description = "The z position of the first anchor point, in world coordinates."
  28101. },
  28102. {
  28103. name = "x2",
  28104. type = "number",
  28105. description = "The x position of the second anchor point, in world coordinates."
  28106. },
  28107. {
  28108. name = "y2",
  28109. type = "number",
  28110. description = "The y position of the second anchor point, in world coordinates."
  28111. },
  28112. {
  28113. name = "z2",
  28114. type = "number",
  28115. description = "The z position of the second anchor point, in world coordinates."
  28116. }
  28117. },
  28118. returns = {
  28119. {
  28120. name = "joint",
  28121. type = "DistanceJoint",
  28122. description = "The new DistanceJoint."
  28123. }
  28124. }
  28125. }
  28126. }
  28127. },
  28128. {
  28129. name = "newHingeJoint",
  28130. tag = "joints",
  28131. summary = "Create a new HingeJoint.",
  28132. description = "Creates a new HingeJoint.",
  28133. key = "lovr.physics.newHingeJoint",
  28134. module = "lovr.physics",
  28135. notes = "A hinge joint constrains two colliders to allow rotation only around the hinge's axis.",
  28136. related = {
  28137. "lovr.physics.newBallJoint",
  28138. "lovr.physics.newDistanceJoint",
  28139. "lovr.physics.newSliderJoint"
  28140. },
  28141. variants = {
  28142. {
  28143. arguments = {
  28144. {
  28145. name = "colliderA",
  28146. type = "Collider",
  28147. description = "The first collider to attach the Joint to."
  28148. },
  28149. {
  28150. name = "colliderB",
  28151. type = "Collider",
  28152. description = "The second collider to attach the Joint to."
  28153. },
  28154. {
  28155. name = "x",
  28156. type = "number",
  28157. description = "The x position of the hinge anchor, in world coordinates."
  28158. },
  28159. {
  28160. name = "y",
  28161. type = "number",
  28162. description = "The y position of the hinge anchor, in world coordinates."
  28163. },
  28164. {
  28165. name = "z",
  28166. type = "number",
  28167. description = "The z position of the hinge anchor, in world coordinates."
  28168. },
  28169. {
  28170. name = "ax",
  28171. type = "number",
  28172. description = "The x component of the hinge axis."
  28173. },
  28174. {
  28175. name = "ay",
  28176. type = "number",
  28177. description = "The y component of the hinge axis."
  28178. },
  28179. {
  28180. name = "az",
  28181. type = "number",
  28182. description = "The z component of the hinge axis."
  28183. }
  28184. },
  28185. returns = {
  28186. {
  28187. name = "hinge",
  28188. type = "HingeJoint",
  28189. description = "The new HingeJoint."
  28190. }
  28191. }
  28192. }
  28193. }
  28194. },
  28195. {
  28196. name = "newSliderJoint",
  28197. tag = "joints",
  28198. summary = "Create a new SliderJoint.",
  28199. description = "Creates a new SliderJoint.",
  28200. key = "lovr.physics.newSliderJoint",
  28201. module = "lovr.physics",
  28202. notes = "A slider joint constrains two colliders to only allow movement along the slider's axis.",
  28203. related = {
  28204. "lovr.physics.newBallJoint",
  28205. "lovr.physics.newDistanceJoint",
  28206. "lovr.physics.newHingeJoint"
  28207. },
  28208. variants = {
  28209. {
  28210. arguments = {
  28211. {
  28212. name = "colliderA",
  28213. type = "Collider",
  28214. description = "The first collider to attach the Joint to."
  28215. },
  28216. {
  28217. name = "colliderB",
  28218. type = "Collider",
  28219. description = "The second collider to attach the Joint to."
  28220. },
  28221. {
  28222. name = "ax",
  28223. type = "number",
  28224. description = "The x component of the slider axis."
  28225. },
  28226. {
  28227. name = "ay",
  28228. type = "number",
  28229. description = "The y component of the slider axis."
  28230. },
  28231. {
  28232. name = "az",
  28233. type = "number",
  28234. description = "The z component of the slider axis."
  28235. }
  28236. },
  28237. returns = {
  28238. {
  28239. name = "slider",
  28240. type = "SliderJoint",
  28241. description = "The new SliderJoint."
  28242. }
  28243. }
  28244. }
  28245. }
  28246. },
  28247. {
  28248. name = "newSphereShape",
  28249. tag = "shapes",
  28250. summary = "Create a new SphereShape.",
  28251. description = "Creates a new SphereShape.",
  28252. key = "lovr.physics.newSphereShape",
  28253. module = "lovr.physics",
  28254. notes = "A Shape can be attached to a Collider using `Collider:addShape`.",
  28255. related = {
  28256. "SphereShape",
  28257. "lovr.physics.newBoxShape",
  28258. "lovr.physics.newCapsuleShape",
  28259. "lovr.physics.newCylinderShape"
  28260. },
  28261. variants = {
  28262. {
  28263. arguments = {
  28264. {
  28265. name = "radius",
  28266. type = "number",
  28267. description = "The radius of the sphere, in meters.",
  28268. default = "1"
  28269. }
  28270. },
  28271. returns = {
  28272. {
  28273. name = "sphere",
  28274. type = "SphereShape",
  28275. description = "The new SphereShape."
  28276. }
  28277. }
  28278. }
  28279. }
  28280. },
  28281. {
  28282. name = "newWorld",
  28283. tag = "world",
  28284. summary = "Create a new World.",
  28285. description = "Creates a new physics World, which tracks the overall physics simulation, holds collider objects, and resolves collisions between them.",
  28286. key = "lovr.physics.newWorld",
  28287. module = "lovr.physics",
  28288. notes = "A World must be updated with `World:update` in `lovr.update` for the physics simulation to advance.",
  28289. examples = {
  28290. {
  28291. description = "Create a new world, add a collider to it, and update it, printing out its position as it falls.",
  28292. code = "function lovr.load()\n world = lovr.physics.newWorld()\n box = world:newBoxCollider()\nend\n\nfunction lovr.update(dt)\n world:update(dt)\n print(box:getPosition())\nend"
  28293. }
  28294. },
  28295. variants = {
  28296. {
  28297. arguments = {
  28298. {
  28299. name = "xg",
  28300. type = "number",
  28301. description = "The x component of the gravity force.",
  28302. default = "0"
  28303. },
  28304. {
  28305. name = "yg",
  28306. type = "number",
  28307. description = "The y component of the gravity force.",
  28308. default = "-9.81"
  28309. },
  28310. {
  28311. name = "zg",
  28312. type = "number",
  28313. description = "The z component of the gravity force.",
  28314. default = "0"
  28315. },
  28316. {
  28317. name = "allowSleep",
  28318. type = "boolean",
  28319. description = "Whether or not colliders will automatically be put to sleep.",
  28320. default = "true"
  28321. },
  28322. {
  28323. name = "tags",
  28324. type = "table",
  28325. description = "A list of collision tags colliders can be assigned to.",
  28326. default = "{}"
  28327. }
  28328. },
  28329. returns = {
  28330. {
  28331. name = "world",
  28332. type = "World",
  28333. description = "A whole new World."
  28334. }
  28335. }
  28336. }
  28337. }
  28338. }
  28339. },
  28340. enums = {
  28341. {
  28342. name = "JointType",
  28343. summary = "Types of physics joints.",
  28344. description = "Represents the different types of physics Joints available.",
  28345. key = "JointType",
  28346. module = "lovr.physics",
  28347. related = {
  28348. "Joint",
  28349. "BallJoint",
  28350. "DistanceJoint",
  28351. "HingeJoint",
  28352. "SliderJoint"
  28353. },
  28354. values = {
  28355. {
  28356. name = "ball",
  28357. description = "A BallJoint."
  28358. },
  28359. {
  28360. name = "distance",
  28361. description = "A DistanceJoint."
  28362. },
  28363. {
  28364. name = "hinge",
  28365. description = "A HingeJoint."
  28366. },
  28367. {
  28368. name = "slider",
  28369. description = "A SliderJoint."
  28370. }
  28371. }
  28372. },
  28373. {
  28374. name = "ShapeType",
  28375. summary = "Types of physics shapes.",
  28376. description = "Represents the different types of physics Shapes available.",
  28377. key = "ShapeType",
  28378. module = "lovr.physics",
  28379. related = {
  28380. "Shape",
  28381. "BoxShape",
  28382. "CapsuleShape",
  28383. "CylinderShape",
  28384. "SphereShape"
  28385. },
  28386. values = {
  28387. {
  28388. name = "box",
  28389. description = "A BoxShape."
  28390. },
  28391. {
  28392. name = "capsule",
  28393. description = "A CapsuleShape."
  28394. },
  28395. {
  28396. name = "cylinder",
  28397. description = "A CylinderShape."
  28398. },
  28399. {
  28400. name = "sphere",
  28401. description = "A SphereShape."
  28402. }
  28403. }
  28404. }
  28405. },
  28406. sections = {
  28407. {
  28408. name = "Worlds",
  28409. tag = "world",
  28410. description = "A physics World holds all of the colliders and joints in the simulation. It must be updated every frame using `World:update`, during which it will move all the colliders and resolve collisions between them."
  28411. },
  28412. {
  28413. name = "Colliders",
  28414. tag = "colliders",
  28415. description = "Colliders are objects that represent a single rigid body in the physics simulation. They can have forces applied to them and collide with other colliders."
  28416. },
  28417. {
  28418. name = "Shapes",
  28419. tag = "shapes",
  28420. description = "Shapes are 3D physics shapes that can be attached to colliders. Shapes define, well, the shape of a Collider and how it collides with other objects. Without any Shapes, a collider wouldn't collide with anything.\n\nNormally, you don't need to create Shapes yourself, as there are convenience functions on the World that will create colliders with shapes already attached. However, you can attach multiple Shapes to a collider to create more complicated objects, and sometimes it can be useful to access the individual Shapes on a collider."
  28421. },
  28422. {
  28423. name = "Joints",
  28424. tag = "joints",
  28425. description = "Joints are objects that constrain the movement of colliders in various ways. Joints are attached to two colliders when they're created and usually have a concept of an \"anchor\", which is where the Joint is attached to relative to the colliders. Joints can be used to create all sorts of neat things like doors, drawers, buttons, levers, or pendulums."
  28426. }
  28427. }
  28428. },
  28429. {
  28430. name = "system",
  28431. tag = "modules",
  28432. summary = "Provides information about the current operating system and platform.",
  28433. description = "The `lovr.system` provides information about the current operating system, and platform, and hardware.",
  28434. key = "lovr.system",
  28435. objects = {},
  28436. functions = {
  28437. {
  28438. name = "getCoreCount",
  28439. summary = "Get the number of logical cores.",
  28440. description = "Returns the number of logical cores on the system.",
  28441. key = "lovr.system.getCoreCount",
  28442. module = "lovr.system",
  28443. related = {
  28444. "lovr.thread"
  28445. },
  28446. variants = {
  28447. {
  28448. arguments = {},
  28449. returns = {
  28450. {
  28451. name = "cores",
  28452. type = "number",
  28453. description = "The number of logical cores on the system."
  28454. }
  28455. }
  28456. }
  28457. }
  28458. },
  28459. {
  28460. name = "getOS",
  28461. summary = "Get the current operating system.",
  28462. description = "Returns the current operating system.",
  28463. key = "lovr.system.getOS",
  28464. module = "lovr.system",
  28465. variants = {
  28466. {
  28467. arguments = {},
  28468. returns = {
  28469. {
  28470. name = "os",
  28471. type = "string",
  28472. description = "Either \"Windows\", \"macOS\", \"Linux\", \"Android\" or \"Web\"."
  28473. }
  28474. }
  28475. }
  28476. }
  28477. },
  28478. {
  28479. name = "isKeyDown",
  28480. summary = "Get the state of a key.",
  28481. description = "Returns whether a key on the keyboard is pressed.",
  28482. key = "lovr.system.isKeyDown",
  28483. module = "lovr.system",
  28484. variants = {
  28485. {
  28486. arguments = {
  28487. {
  28488. name = "key",
  28489. type = "KeyCode",
  28490. description = "The key."
  28491. }
  28492. },
  28493. returns = {
  28494. {
  28495. name = "down",
  28496. type = "boolean",
  28497. description = "Whether the key is currently pressed."
  28498. }
  28499. }
  28500. }
  28501. }
  28502. },
  28503. {
  28504. name = "requestPermission",
  28505. summary = "Request permission to use a feature.",
  28506. description = "Requests permission to use a feature. Usually this will pop up a dialog box that the user needs to confirm. Once the permission request has been acknowledged, the `lovr.permission` callback will be called with the result. Currently, this is only used for requesting microphone access on Android devices.",
  28507. key = "lovr.system.requestPermission",
  28508. module = "lovr.system",
  28509. related = {
  28510. "lovr.permission"
  28511. },
  28512. variants = {
  28513. {
  28514. arguments = {
  28515. {
  28516. name = "permission",
  28517. type = "Permission",
  28518. description = "The permission to request."
  28519. }
  28520. },
  28521. returns = {}
  28522. }
  28523. }
  28524. }
  28525. },
  28526. enums = {
  28527. {
  28528. name = "Permission",
  28529. summary = "Application permissions.",
  28530. description = "These are the different permissions that need to be requested using `lovr.system.requestPermission` on some platforms.",
  28531. key = "Permission",
  28532. module = "lovr.system",
  28533. related = {
  28534. "lovr.system.requestPermission"
  28535. },
  28536. values = {
  28537. {
  28538. name = "audiocapture",
  28539. description = "Requests microphone access."
  28540. }
  28541. }
  28542. }
  28543. }
  28544. },
  28545. {
  28546. name = "thread",
  28547. tag = "modules",
  28548. summary = "Allows the creation of background threads.",
  28549. description = "The `lovr.thread` module provides functions for creating threads and communicating between them.\n\nThese are operating system level threads, which are different from Lua coroutines.\n\nThreads are useful for performing expensive background computation without affecting the framerate or performance of the main thread. Some examples of this include asset loading, networking and network requests, and physics simulation.\n\nThreads come with some caveats:\n\n- Threads run in a bare Lua environment. The `lovr` module (and any of lovr's modules) need to\n be required before they can be used.\n - To get `require` to work properly, add `require 'lovr.filesystem'` to the thread code.\n- Threads are completely isolated from other threads. They do not have access to the variables\n or functions of other threads, and communication between threads must be coordinated through\n `Channel` objects.\n- The graphics module (or any functions that perform rendering) cannot be used in a thread.\n Note that this includes creating graphics objects like Models and Textures. There are \"data\"\n equivalent `ModelData` and `Image` objects that can be used in threads though.\n- `lovr.event.pump` cannot be called from a thread.\n- Crashes or problems can happen if two threads access the same object at the same time, so\n special care must be taken to coordinate access to objects from multiple threads.",
  28550. key = "lovr.thread",
  28551. objects = {
  28552. {
  28553. name = "Channel",
  28554. summary = "A message channel for communicating between threads.",
  28555. description = "A Channel is an object used to communicate between `Thread` objects. Channels are obtained by name using `lovr.thread.getChannel`. Different threads can send messages on the same Channel to communicate with each other. Messages can be sent and received on a Channel using `Channel:push` and `Channel:pop`, and are received in a first-in-first-out fashion. The following types of data can be passed through Channels: nil, boolean, number, string, and any LÖVR object.",
  28556. key = "Channel",
  28557. module = "lovr.thread",
  28558. constructors = {
  28559. "lovr.thread.getChannel"
  28560. },
  28561. methods = {
  28562. {
  28563. name = "clear",
  28564. summary = "Clear all messages from the Channel.",
  28565. description = "Removes all pending messages from the Channel.",
  28566. key = "Channel:clear",
  28567. module = "lovr.thread",
  28568. variants = {
  28569. {
  28570. arguments = {},
  28571. returns = {}
  28572. }
  28573. }
  28574. },
  28575. {
  28576. name = "hasRead",
  28577. summary = "Get whether a message has been read.",
  28578. description = "Returns whether or not the message with the given ID has been read. Every call to `Channel:push` returns a message ID.",
  28579. key = "Channel:hasRead",
  28580. module = "lovr.thread",
  28581. related = {
  28582. "Channel:push"
  28583. },
  28584. variants = {
  28585. {
  28586. arguments = {
  28587. {
  28588. name = "id",
  28589. type = "number",
  28590. description = "The ID of the message to check."
  28591. }
  28592. },
  28593. returns = {
  28594. {
  28595. name = "read",
  28596. type = "boolean",
  28597. description = "Whether the message has been read."
  28598. }
  28599. }
  28600. }
  28601. }
  28602. },
  28603. {
  28604. name = "peek",
  28605. summary = "Look at a message from the Channel without popping it.",
  28606. description = "Returns a message from the Channel without popping it from the queue. If the Channel is empty, `nil` is returned. This can be useful to determine if the Channel is empty.",
  28607. key = "Channel:peek",
  28608. module = "lovr.thread",
  28609. notes = "The second return value can be used to detect if a `nil` message is in the queue.",
  28610. variants = {
  28611. {
  28612. arguments = {},
  28613. returns = {
  28614. {
  28615. name = "message",
  28616. type = "*",
  28617. description = "The message, or `nil` if there is no message."
  28618. },
  28619. {
  28620. name = "present",
  28621. type = "boolean",
  28622. description = "Whether a message was returned (use to detect nil)."
  28623. }
  28624. }
  28625. }
  28626. },
  28627. related = {
  28628. "Channel:pop"
  28629. }
  28630. },
  28631. {
  28632. name = "pop",
  28633. summary = "Pop a message from the Channel.",
  28634. description = "Pops a message from the Channel. If the Channel is empty, an optional timeout argument can be used to wait for a message, otherwise `nil` is returned.",
  28635. key = "Channel:pop",
  28636. module = "lovr.thread",
  28637. notes = "Threads can get stuck forever waiting on Channel messages, so be careful.",
  28638. variants = {
  28639. {
  28640. arguments = {
  28641. {
  28642. name = "wait",
  28643. type = "number",
  28644. description = "How long to wait for a message to be popped, in seconds. `true` can be used to wait forever and `false` can be used to avoid waiting.",
  28645. default = "false"
  28646. }
  28647. },
  28648. returns = {
  28649. {
  28650. name = "message",
  28651. type = "*",
  28652. description = "The received message, or `nil` if nothing was received."
  28653. }
  28654. }
  28655. }
  28656. },
  28657. related = {
  28658. "Channel:peek",
  28659. "Channel:push"
  28660. }
  28661. },
  28662. {
  28663. name = "push",
  28664. summary = "Push a message onto the Channel.",
  28665. description = "Pushes a message onto the Channel. The following types of data can be pushed: nil, boolean, number, string, and userdata. Tables should be serialized to strings.",
  28666. key = "Channel:push",
  28667. module = "lovr.thread",
  28668. notes = "Threads can get stuck forever waiting on Channel messages, so be careful.",
  28669. variants = {
  28670. {
  28671. arguments = {
  28672. {
  28673. name = "message",
  28674. type = "*",
  28675. description = "The message to push."
  28676. },
  28677. {
  28678. name = "wait",
  28679. type = "number",
  28680. description = "How long to wait for the message to be popped, in seconds. `true` can be used to wait forever and `false` can be used to avoid waiting.",
  28681. default = "false"
  28682. }
  28683. },
  28684. returns = {
  28685. {
  28686. name = "id",
  28687. type = "number",
  28688. description = "The ID of the pushed message."
  28689. },
  28690. {
  28691. name = "read",
  28692. type = "boolean",
  28693. description = "Whether the message was read by another thread before the wait timeout."
  28694. }
  28695. }
  28696. }
  28697. },
  28698. related = {
  28699. "Channel:pop",
  28700. "Channel:hasRead"
  28701. }
  28702. }
  28703. }
  28704. },
  28705. {
  28706. name = "Thread",
  28707. summary = "A separate thread of execution that can run code in parallel with other threads.",
  28708. description = "A Thread is an object that runs a chunk of Lua code in the background. Threads are completely isolated from other threads, meaning they have their own Lua context and can't access the variables and functions of other threads. Communication between threads is limited and is accomplished by using `Channel` objects.\n\nTo get `require` to work properly, add `require 'lovr.filesystem'` to the thread code.",
  28709. key = "Thread",
  28710. module = "lovr.thread",
  28711. constructors = {
  28712. "lovr.thread.newThread"
  28713. },
  28714. related = {
  28715. "lovr.threaderror",
  28716. "lovr.system.getCoreCount",
  28717. "Channel"
  28718. },
  28719. methods = {
  28720. {
  28721. name = "getError",
  28722. summary = "Get the Thread's error message.",
  28723. description = "Returns the message for the error that occurred on the Thread, or nil if no error has occurred.",
  28724. key = "Thread:getError",
  28725. module = "lovr.thread",
  28726. related = {
  28727. "lovr.threaderror"
  28728. },
  28729. variants = {
  28730. {
  28731. arguments = {},
  28732. returns = {
  28733. {
  28734. name = "error",
  28735. type = "string",
  28736. description = "The error message, or `nil` if no error has occurred on the Thread."
  28737. }
  28738. }
  28739. }
  28740. }
  28741. },
  28742. {
  28743. name = "isRunning",
  28744. summary = "Check if the Thread is running.",
  28745. description = "Returns whether or not the Thread is currently running.",
  28746. key = "Thread:isRunning",
  28747. module = "lovr.thread",
  28748. related = {
  28749. "Thread:start"
  28750. },
  28751. variants = {
  28752. {
  28753. arguments = {},
  28754. returns = {
  28755. {
  28756. name = "running",
  28757. type = "boolean",
  28758. description = "Whether or not the Thread is running."
  28759. }
  28760. }
  28761. }
  28762. }
  28763. },
  28764. {
  28765. name = "start",
  28766. summary = "Start the Thread.",
  28767. description = "Starts the Thread.",
  28768. key = "Thread:start",
  28769. module = "lovr.thread",
  28770. variants = {
  28771. {
  28772. arguments = {
  28773. {
  28774. name = "...arguments",
  28775. type = "*",
  28776. description = "Up to 4 arguments to pass to the Thread's function."
  28777. }
  28778. },
  28779. returns = {}
  28780. }
  28781. },
  28782. examples = {
  28783. {
  28784. code = "function lovr.load()\n lovr.thread.newThread([[\n print(...)\n ]]):start(lovr.getVersion())\nend"
  28785. }
  28786. }
  28787. },
  28788. {
  28789. name = "wait",
  28790. summary = "Wait for the Thread to complete.",
  28791. description = "Waits for the Thread to complete, then returns.",
  28792. key = "Thread:wait",
  28793. module = "lovr.thread",
  28794. related = {
  28795. "Thread:isRunning"
  28796. },
  28797. variants = {
  28798. {
  28799. arguments = {},
  28800. returns = {}
  28801. }
  28802. }
  28803. }
  28804. }
  28805. }
  28806. },
  28807. functions = {
  28808. {
  28809. name = "getChannel",
  28810. summary = "Get a Channel for communicating between threads.",
  28811. description = "Returns a named Channel for communicating between threads.",
  28812. key = "lovr.thread.getChannel",
  28813. module = "lovr.thread",
  28814. related = {
  28815. "Channel"
  28816. },
  28817. variants = {
  28818. {
  28819. arguments = {
  28820. {
  28821. name = "name",
  28822. type = "string",
  28823. description = "The name of the Channel to get."
  28824. }
  28825. },
  28826. returns = {
  28827. {
  28828. name = "channel",
  28829. type = "Channel",
  28830. description = "The Channel with the specified name."
  28831. }
  28832. }
  28833. }
  28834. }
  28835. },
  28836. {
  28837. name = "newThread",
  28838. summary = "Create a new Thread.",
  28839. description = "Creates a new Thread from Lua code.",
  28840. key = "lovr.thread.newThread",
  28841. module = "lovr.thread",
  28842. notes = "The Thread won\\'t start running immediately. Use `Thread:start` to start it.\n\nThe string argument is assumed to be a filename if there isn't a newline in the first 1024 characters. For really short thread code, an extra newline can be added to trick LÖVR into loading it properly.",
  28843. variants = {
  28844. {
  28845. arguments = {
  28846. {
  28847. name = "code",
  28848. type = "string",
  28849. description = "The code to run in the Thread."
  28850. }
  28851. },
  28852. returns = {
  28853. {
  28854. name = "thread",
  28855. type = "Thread",
  28856. description = "The new Thread."
  28857. }
  28858. }
  28859. },
  28860. {
  28861. arguments = {
  28862. {
  28863. name = "filename",
  28864. type = "string",
  28865. description = "A file containing code to run in the Thread."
  28866. }
  28867. },
  28868. returns = {
  28869. {
  28870. name = "thread",
  28871. type = "Thread",
  28872. description = "The new Thread."
  28873. }
  28874. }
  28875. },
  28876. {
  28877. arguments = {
  28878. {
  28879. name = "blob",
  28880. type = "Blob",
  28881. description = "The code to run in the Thread."
  28882. }
  28883. },
  28884. returns = {
  28885. {
  28886. name = "thread",
  28887. type = "Thread",
  28888. description = "The new Thread."
  28889. }
  28890. }
  28891. }
  28892. },
  28893. related = {
  28894. "Thread:start",
  28895. "lovr.threaderror"
  28896. }
  28897. }
  28898. },
  28899. enums = {},
  28900. related = {
  28901. "lovr.system.getCoreCount"
  28902. }
  28903. },
  28904. {
  28905. name = "timer",
  28906. tag = "modules",
  28907. summary = "Exposes a high resolution timer.",
  28908. description = "The `lovr.timer` module provides a few functions that deal with time. All times are measured in seconds.",
  28909. key = "lovr.timer",
  28910. objects = {},
  28911. functions = {
  28912. {
  28913. name = "getAverageDelta",
  28914. summary = "Get the average delta over the last second.",
  28915. description = "Returns the average delta over the last second.",
  28916. key = "lovr.timer.getAverageDelta",
  28917. module = "lovr.timer",
  28918. related = {
  28919. "lovr.timer.getDelta",
  28920. "lovr.update"
  28921. },
  28922. variants = {
  28923. {
  28924. arguments = {},
  28925. returns = {
  28926. {
  28927. name = "delta",
  28928. type = "number",
  28929. description = "The average delta, in seconds."
  28930. }
  28931. }
  28932. }
  28933. }
  28934. },
  28935. {
  28936. name = "getDelta",
  28937. summary = "Get the time elapsed since the last update.",
  28938. description = "Returns the time between the last two frames. This is the same value as the `dt` argument provided to `lovr.update`.",
  28939. key = "lovr.timer.getDelta",
  28940. module = "lovr.timer",
  28941. notes = "The return value of this function will remain the same until `lovr.timer.step` is called. This function should not be used to measure times for game behavior or benchmarking, use `lovr.timer.getTime` for that.",
  28942. variants = {
  28943. {
  28944. arguments = {},
  28945. returns = {
  28946. {
  28947. name = "dt",
  28948. type = "number",
  28949. description = "The delta time, in seconds."
  28950. }
  28951. }
  28952. }
  28953. },
  28954. related = {
  28955. "lovr.timer.getTime",
  28956. "lovr.update"
  28957. }
  28958. },
  28959. {
  28960. name = "getFPS",
  28961. summary = "Get the current frames per second.",
  28962. description = "Returns the current frames per second, averaged over the last 90 frames.",
  28963. key = "lovr.timer.getFPS",
  28964. module = "lovr.timer",
  28965. variants = {
  28966. {
  28967. arguments = {},
  28968. returns = {
  28969. {
  28970. name = "fps",
  28971. type = "number",
  28972. description = "The current FPS."
  28973. }
  28974. }
  28975. }
  28976. }
  28977. },
  28978. {
  28979. name = "getTime",
  28980. summary = "Get the current time.",
  28981. description = "Returns the time since some time in the past. This can be used to measure the difference between two points in time.",
  28982. key = "lovr.timer.getTime",
  28983. module = "lovr.timer",
  28984. related = {
  28985. "lovr.headset.getTime"
  28986. },
  28987. variants = {
  28988. {
  28989. arguments = {},
  28990. returns = {
  28991. {
  28992. name = "time",
  28993. type = "number",
  28994. description = "The current time, in seconds."
  28995. }
  28996. }
  28997. }
  28998. }
  28999. },
  29000. {
  29001. name = "sleep",
  29002. summary = "Go to sleep.",
  29003. description = "Sleeps the application for a specified number of seconds. While the game is asleep, no code will be run, no graphics will be drawn, and the window will be unresponsive.",
  29004. key = "lovr.timer.sleep",
  29005. module = "lovr.timer",
  29006. variants = {
  29007. {
  29008. arguments = {
  29009. {
  29010. name = "duration",
  29011. type = "number",
  29012. description = "The number of seconds to sleep for."
  29013. }
  29014. },
  29015. returns = {}
  29016. }
  29017. }
  29018. },
  29019. {
  29020. name = "step",
  29021. summary = "Steps the internal clock.",
  29022. description = "Steps the timer, returning the new delta time. This is called automatically in `lovr.run` and it's used to calculate the new `dt` to pass to `lovr.update`.",
  29023. key = "lovr.timer.step",
  29024. module = "lovr.timer",
  29025. variants = {
  29026. {
  29027. arguments = {},
  29028. returns = {
  29029. {
  29030. name = "delta",
  29031. type = "number",
  29032. description = "The amount of time since the last call to this function, in seconds."
  29033. }
  29034. }
  29035. }
  29036. }
  29037. }
  29038. },
  29039. enums = {}
  29040. }
  29041. },
  29042. callbacks = {
  29043. {
  29044. name = "conf",
  29045. tag = "callbacks",
  29046. summary = "Called to read configuration settings at startup.",
  29047. description = "The `lovr.conf` callback lets you configure default settings for LÖVR. It is called once right before the game starts. Make sure you put `lovr.conf` in a file called `conf.lua`, a special file that's loaded before the rest of the framework initializes.",
  29048. key = "lovr.conf",
  29049. module = "lovr",
  29050. related = {
  29051. "lovr.load"
  29052. },
  29053. examples = {
  29054. {
  29055. description = "A noop conf.lua that sets all configuration settings to their defaults:",
  29056. code = "function lovr.conf(t)\n\n -- Set the project version and identity\n t.version = '0.14.0'\n t.identity = 'default'\n\n -- Set save directory precedence\n t.saveprecedence = true\n\n -- Enable or disable different modules\n t.modules.audio = true\n t.modules.data = true\n t.modules.event = true\n t.modules.graphics = true\n t.modules.headset = true\n t.modules.math = true\n t.modules.physics = true\n t.modules.system = true\n t.modules.thread = true\n t.modules.timer = true\n\n -- Audio\n t.audio.spatializer = nil\n t.audio.samplerate = 48000\n t.audio.start = true\n\n -- Graphics\n t.graphics.debug = false\n\n -- Headset settings\n t.headset.drivers = { 'openxr', 'oculus', 'vrapi', 'pico', 'openvr', 'webxr', 'desktop' }\n t.headset.supersample = false\n t.headset.offset = 1.7\n t.headset.msaa = 4\n t.headset.overlay = false\n\n -- Math settings\n t.math.globals = true\n\n -- Configure the desktop window\n t.window.width = 1080\n t.window.height = 600\n t.window.fullscreen = false\n t.window.msaa = 0\n t.window.vsync = 1\n t.window.title = 'LÖVR'\n t.window.icon = nil\nend"
  29057. }
  29058. },
  29059. notes = "Disabling the headset module can improve startup time a lot if you aren't intending to use `lovr.headset`.\n\nYou can set `t.window` to nil to avoid creating the window. You can do it yourself later by using `lovr.graphics.createWindow`.\n\nIf the `lovr.graphics` module is disabled or the window isn't created, attempting to use any functionality requiring graphics may cause a crash.\n\nEnabling the `t.graphics.debug` flag will add additional error checks and will send messages from the GPU driver to the `lovr.log` callback. This will decrease performance but can help provide information on performance problems or other bugs.\n\nThe `headset.offset` field is a vertical offset applied to the scene for headsets that do not center their tracking origin on the floor. This can be thought of as a \"default user height\". Setting this offset makes it easier to design experiences that work in both seated and standing VR configurations.",
  29060. variants = {
  29061. {
  29062. arguments = {
  29063. {
  29064. name = "t",
  29065. type = "table",
  29066. description = "The table to edit the configuration settings on.",
  29067. table = {
  29068. {
  29069. name = "version",
  29070. type = "string",
  29071. description = "The version of LÖVR this project targets (not used yet)."
  29072. },
  29073. {
  29074. name = "identity",
  29075. type = "string",
  29076. description = "A unique label for this project."
  29077. },
  29078. {
  29079. name = "saveprecedence",
  29080. type = "boolean",
  29081. description = "Whether the files in the save directory should have precedence over files in the source archive."
  29082. },
  29083. {
  29084. name = "modules",
  29085. type = "table",
  29086. description = "The set of enabled modules to use.",
  29087. table = {
  29088. {
  29089. name = "audio",
  29090. type = "boolean",
  29091. description = "Whether the audio module should be enabled."
  29092. },
  29093. {
  29094. name = "data",
  29095. type = "boolean",
  29096. description = "Whether the data module should be enabled."
  29097. },
  29098. {
  29099. name = "event",
  29100. type = "boolean",
  29101. description = "Whether the event module should be enabled."
  29102. },
  29103. {
  29104. name = "filesystem",
  29105. type = "boolean",
  29106. description = "Whether the filesystem module should be enabled."
  29107. },
  29108. {
  29109. name = "graphics",
  29110. type = "boolean",
  29111. description = "Whether the graphics module should be enabled."
  29112. },
  29113. {
  29114. name = "headset",
  29115. type = "boolean",
  29116. description = "Whether the headset module should be enabled."
  29117. },
  29118. {
  29119. name = "math",
  29120. type = "boolean",
  29121. description = "Whether the math module should be enabled."
  29122. },
  29123. {
  29124. name = "physics",
  29125. type = "boolean",
  29126. description = "Whether the physics module should be enabled."
  29127. },
  29128. {
  29129. name = "system",
  29130. type = "boolean",
  29131. description = "Whether the system module should be enabled."
  29132. },
  29133. {
  29134. name = "thread",
  29135. type = "boolean",
  29136. description = "Whether the thread module should be enabled."
  29137. },
  29138. {
  29139. name = "timer",
  29140. type = "boolean",
  29141. description = "Whether the timer module should be enabled."
  29142. }
  29143. }
  29144. },
  29145. {
  29146. name = "audio",
  29147. type = "table",
  29148. description = "Configuration for the audio module.",
  29149. table = {
  29150. {
  29151. name = "spatializer",
  29152. type = "string",
  29153. description = "An audio spatializer to use (`simple`, `oculus`, or `phonon`). If `nil`, all of them are attempted."
  29154. },
  29155. {
  29156. name = "samplerate",
  29157. type = "number",
  29158. description = "The sample rate to use for audio playback."
  29159. },
  29160. {
  29161. name = "start",
  29162. type = "boolean",
  29163. description = "Whether the playback device should be automatically started."
  29164. }
  29165. }
  29166. },
  29167. {
  29168. name = "graphics",
  29169. type = "table",
  29170. description = "Configuration for the graphics module.",
  29171. table = {
  29172. {
  29173. name = "debug",
  29174. type = "boolean",
  29175. description = "Whether debug messages from the GPU should get sent to lovr.log."
  29176. }
  29177. }
  29178. },
  29179. {
  29180. name = "headset",
  29181. type = "table",
  29182. description = "Configuration for the headset.",
  29183. table = {
  29184. {
  29185. name = "drivers",
  29186. type = "table",
  29187. description = "An ordered list of preferred headset drivers."
  29188. },
  29189. {
  29190. name = "supersample",
  29191. type = "number",
  29192. description = "A scaling factor to apply to the headset texture. Improves visual quality but reduces performance. Can also be a boolean."
  29193. },
  29194. {
  29195. name = "offset",
  29196. type = "number",
  29197. description = "The vertical offset for seated experiences."
  29198. },
  29199. {
  29200. name = "msaa",
  29201. type = "number",
  29202. description = "The amount of antialiasing to use when rendering to the headset."
  29203. },
  29204. {
  29205. name = "overlay",
  29206. type = "boolean",
  29207. description = "Whether the project should run as an overlay."
  29208. }
  29209. }
  29210. },
  29211. {
  29212. name = "math",
  29213. type = "table",
  29214. description = "Configuration for the math module.",
  29215. table = {
  29216. {
  29217. name = "globals",
  29218. type = "boolean",
  29219. description = "Whether vector object functions should be added to the global scope."
  29220. }
  29221. }
  29222. },
  29223. {
  29224. name = "window",
  29225. type = "table",
  29226. description = "Configuration for the window.",
  29227. table = {
  29228. {
  29229. name = "width",
  29230. type = "number",
  29231. description = "The width of the window."
  29232. },
  29233. {
  29234. name = "height",
  29235. type = "number",
  29236. description = "The height of the window."
  29237. },
  29238. {
  29239. name = "fullscreen",
  29240. type = "boolean",
  29241. description = "Whether the window is fullscreen."
  29242. },
  29243. {
  29244. name = "resizable",
  29245. type = "boolean",
  29246. description = "Whether the window is fullscreen."
  29247. },
  29248. {
  29249. name = "msaa",
  29250. type = "number",
  29251. description = "The number of antialiasing samples to use."
  29252. },
  29253. {
  29254. name = "title",
  29255. type = "string",
  29256. description = "The window title."
  29257. },
  29258. {
  29259. name = "icon",
  29260. type = "string",
  29261. description = "The path to the window icon file."
  29262. },
  29263. {
  29264. name = "vsync",
  29265. type = "number",
  29266. description = "0 to disable vsync, 1 to enable."
  29267. }
  29268. }
  29269. }
  29270. }
  29271. }
  29272. },
  29273. returns = {}
  29274. }
  29275. }
  29276. },
  29277. {
  29278. name = "draw",
  29279. tag = "callbacks",
  29280. summary = "Called continuously to render frames to the display.",
  29281. description = "This callback is called every frame. Use it to render the scene. If a VR headset is connected, anything rendered by this function will appear in the headset display. The display is cleared to the background color before this function is called.",
  29282. key = "lovr.draw",
  29283. module = "lovr",
  29284. related = {
  29285. "lovr.mirror",
  29286. "lovr.headset.getPass",
  29287. "lovr.graphics.setBackgroundColor"
  29288. },
  29289. variants = {
  29290. {
  29291. arguments = {
  29292. {
  29293. name = "pass",
  29294. type = "Pass",
  29295. description = "A render pass targeting the main display (headset or window)."
  29296. }
  29297. },
  29298. returns = {
  29299. {
  29300. name = "skip",
  29301. type = "boolean",
  29302. description = "Whether the input Pass should be submitted to the GPU."
  29303. }
  29304. }
  29305. }
  29306. }
  29307. },
  29308. {
  29309. name = "errhand",
  29310. tag = "callbacks",
  29311. summary = "Called when an error occurs.",
  29312. description = "The \"lovr.errhand\" callback is run whenever an error occurs. It receives two parameters. The first is a string containing the error message. The second is either nil, or a string containing a traceback (as returned by \"debug.traceback()\"); if nil, this means \"lovr.errhand\" is being called in the stack where the error occurred, and it can call \"debug.traceback()\" itself.\n\n\"lovr.errhand\" should return a handler function to run in a loop to show the error screen. This handler function is of the same type as the one returned by \"lovr.run\" and has the same requirements (such as pumping events). If an error occurs while this handler is running, the program will terminate immediately-- \"lovr.errhand\" will not be given a second chance. Errors which occur inside \"lovr.errhand\" or in the handler it returns may not be cleanly reported, so be careful.\n\nA default error handler is supplied that renders the error message as text to the headset and to the window.",
  29313. key = "lovr.errhand",
  29314. module = "lovr",
  29315. examples = {
  29316. {
  29317. code = "function lovr.errhand(message, traceback)\n traceback = traceback or debug.traceback('', 3)\n print('ohh NOOOO!', message)\n print(traceback)\n return function()\n lovr.graphics.print('There was an error', 0, 2, -5)\n end\nend"
  29318. }
  29319. },
  29320. related = {
  29321. "lovr.quit"
  29322. },
  29323. variants = {
  29324. {
  29325. arguments = {
  29326. {
  29327. name = "message",
  29328. type = "string",
  29329. description = "The error message."
  29330. },
  29331. {
  29332. name = "traceback",
  29333. type = "string",
  29334. description = "A traceback string, or nil."
  29335. }
  29336. },
  29337. returns = {
  29338. {
  29339. name = "handler",
  29340. type = "function",
  29341. description = "The error handler function. It should return nil to continue running, \"restart\" to restart the app, or a number representing an exit status.",
  29342. arguments = {},
  29343. returns = {
  29344. {
  29345. name = "result",
  29346. type = "*"
  29347. }
  29348. }
  29349. }
  29350. }
  29351. }
  29352. }
  29353. },
  29354. {
  29355. name = "focus",
  29356. tag = "callbacks",
  29357. summary = "Called when the application gets or loses focus.",
  29358. description = "The `lovr.focus` callback is called whenever the application acquires or loses focus (for example, when opening or closing the Steam dashboard). The callback receives a single argument, focused, which is a boolean indicating whether or not the application is now focused. It may make sense to pause the game or reduce visual fidelity when the application loses focus.",
  29359. key = "lovr.focus",
  29360. module = "lovr",
  29361. related = {},
  29362. variants = {
  29363. {
  29364. arguments = {
  29365. {
  29366. name = "focused",
  29367. type = "boolean",
  29368. description = "Whether the program is now focused."
  29369. }
  29370. },
  29371. returns = {}
  29372. }
  29373. }
  29374. },
  29375. {
  29376. name = "keypressed",
  29377. tag = "callbacks",
  29378. summary = "Called when a key is pressed.",
  29379. description = "This callback is called when a key is pressed.",
  29380. key = "lovr.keypressed",
  29381. module = "lovr",
  29382. related = {
  29383. "lovr.keyreleased",
  29384. "lovr.textinput"
  29385. },
  29386. variants = {
  29387. {
  29388. arguments = {
  29389. {
  29390. name = "key",
  29391. type = "KeyCode",
  29392. description = "The key that was pressed."
  29393. },
  29394. {
  29395. name = "scancode",
  29396. type = "number",
  29397. description = "The id of the key (ignores keyboard layout, may vary between keyboards)."
  29398. },
  29399. {
  29400. name = "repeating",
  29401. type = "boolean",
  29402. description = "Whether the event is the result of a key repeat instead of an actual press."
  29403. }
  29404. },
  29405. returns = {}
  29406. }
  29407. }
  29408. },
  29409. {
  29410. name = "keyreleased",
  29411. tag = "callbacks",
  29412. summary = "Called when a key is released.",
  29413. description = "This callback is called when a key is released.",
  29414. key = "lovr.keyreleased",
  29415. module = "lovr",
  29416. related = {
  29417. "lovr.keypressed",
  29418. "lovr.textinput"
  29419. },
  29420. variants = {
  29421. {
  29422. arguments = {
  29423. {
  29424. name = "key",
  29425. type = "KeyCode",
  29426. description = "The key that was released."
  29427. },
  29428. {
  29429. name = "scancode",
  29430. type = "number",
  29431. description = "The id of the key (ignores keyboard layout, may vary between keyboards)."
  29432. }
  29433. },
  29434. returns = {}
  29435. }
  29436. }
  29437. },
  29438. {
  29439. name = "load",
  29440. tag = "callbacks",
  29441. summary = "Called once at startup.",
  29442. description = "This callback is called once when the app starts. It should be used to perform initial setup work, like loading resources and initializing classes and variables.",
  29443. key = "lovr.load",
  29444. module = "lovr",
  29445. related = {
  29446. "lovr.quit"
  29447. },
  29448. examples = {
  29449. {
  29450. code = "function lovr.load(args)\n model = lovr.graphics.newModel('cena.gltf')\n texture = lovr.graphics.newTexture('cena.png')\n levelGeometry = lovr.graphics.newMesh(1000)\n effects = lovr.graphics.newShader('vert.glsl', 'frag.glsl')\n loadLevel(1)\nend"
  29451. }
  29452. },
  29453. notes = "If the project was loaded from a restart using `lovr.event.restart`, the return value from the previously-run `lovr.restart` callback will be made available to this callback as the `restart` key in the `args` table.\n\nThe `args` table follows the [Lua standard](https://en.wikibooks.org/wiki/Lua_Programming/command_line_parameter). The arguments passed in from the shell are put into a global table named `arg` and passed to `lovr.load`, but with indices offset such that the \"script\" (the project path) is at index 0. So all arguments (if any) intended for the project are at successive indices starting with 1, and the executable and its \"internal\" arguments are in normal order but stored in negative indices.",
  29454. variants = {
  29455. {
  29456. arguments = {
  29457. {
  29458. name = "args",
  29459. type = "table",
  29460. description = "The command line arguments provided to the program."
  29461. }
  29462. },
  29463. returns = {}
  29464. }
  29465. }
  29466. },
  29467. {
  29468. name = "log",
  29469. tag = "callbacks",
  29470. summary = "Called when a message is logged.",
  29471. description = "This callback is called when a message is logged. The default implementation of this callback prints the message to the console using `print`, but it's possible to override this callback to render messages in VR, write them to a file, filter messages, and more.\n\nThe message can have a \"tag\" that is a short string representing the sender, and a \"level\" indicating how severe the message is.\n\nThe `t.graphics.debug` flag in `lovr.conf` can be used to get log messages from the GPU driver (tagged as `GL`). It is also possible to emit your own log messages using `lovr.event.push`.",
  29472. key = "lovr.log",
  29473. module = "lovr",
  29474. related = {
  29475. "lovr.graphics.print"
  29476. },
  29477. variants = {
  29478. {
  29479. arguments = {
  29480. {
  29481. name = "message",
  29482. type = "string",
  29483. description = "The log message. It may end in a newline."
  29484. },
  29485. {
  29486. name = "level",
  29487. type = "string",
  29488. description = "The log level (`debug`, `info`, `warn`, or `error`)."
  29489. },
  29490. {
  29491. name = "tag",
  29492. type = "string",
  29493. description = "The log tag."
  29494. }
  29495. },
  29496. returns = {}
  29497. }
  29498. }
  29499. },
  29500. {
  29501. name = "mirror",
  29502. tag = "callbacks",
  29503. summary = "Called to render content to the desktop window.",
  29504. description = "This callback is called every frame after rendering to the headset and is usually used to render a mirror of the headset display onto the desktop window. It can be overridden for custom mirroring behavior. For example, you could render a single eye instead of a stereo view, apply postprocessing effects, add 2D UI, or render the scene from an entirely different viewpoint for a third person camera.",
  29505. key = "lovr.mirror",
  29506. module = "lovr",
  29507. related = {
  29508. "lovr.headset.renderTo",
  29509. "lovr.headset.getMirrorTexture",
  29510. "lovr.graphics.createWindow",
  29511. "lovr.graphics.setProjection",
  29512. "lovr.draw"
  29513. },
  29514. examples = {
  29515. {
  29516. description = "The default `lovr.mirror` implementation draws the headset mirror texture to the window if the headset is active, or just calls `lovr.draw` if there isn't a headset.",
  29517. code = "function lovr.mirror()\n if lovr.headset then\n local texture = lovr.headset.getMirrorTexture()\n if texture then\n lovr.graphics.fill(texture)\n end\n else\n lovr.graphics.clear()\n lovr.draw()\n end\nend"
  29518. }
  29519. },
  29520. notes = "When this callback is called, the camera is located at `(0, 0, 0)` and is looking down the negative-z axis.\n\nNote that the usual graphics state applies while `lovr.mirror` is invoked, so you may need to reset graphics state at the end of `lovr.draw` to get the result you want.",
  29521. variants = {
  29522. {
  29523. arguments = {},
  29524. returns = {}
  29525. }
  29526. }
  29527. },
  29528. {
  29529. name = "permission",
  29530. tag = "callbacks",
  29531. summary = "Called when a permission request is answered.",
  29532. description = "This callback contains a permission response previously requested with `lovr.system.requestPermission`. The callback contains information on whether permission was granted or denied.",
  29533. key = "lovr.permission",
  29534. module = "lovr",
  29535. related = {
  29536. "lovr.system.requestPermission"
  29537. },
  29538. variants = {
  29539. {
  29540. arguments = {
  29541. {
  29542. name = "permission",
  29543. type = "Permission",
  29544. description = "The type of permission."
  29545. },
  29546. {
  29547. name = "granted",
  29548. type = "boolean",
  29549. description = "Whether permission was granted or denied."
  29550. }
  29551. },
  29552. returns = {}
  29553. }
  29554. }
  29555. },
  29556. {
  29557. name = "quit",
  29558. tag = "callbacks",
  29559. summary = "Called before quitting.",
  29560. description = "This callback is called right before the application is about to quit. Use it to perform any necessary cleanup work. A truthy value can be returned from this callback to abort quitting.",
  29561. key = "lovr.quit",
  29562. module = "lovr",
  29563. examples = {
  29564. {
  29565. code = "function lovr.quit()\n if shouldQuit() then\n return false\n else\n return true\n end\nend"
  29566. }
  29567. },
  29568. related = {
  29569. "lovr.event.quit",
  29570. "lovr.load"
  29571. },
  29572. variants = {
  29573. {
  29574. arguments = {},
  29575. returns = {
  29576. {
  29577. name = "abort",
  29578. type = "boolean",
  29579. description = "Whether quitting should be aborted."
  29580. }
  29581. }
  29582. }
  29583. }
  29584. },
  29585. {
  29586. name = "resize",
  29587. tag = "callbacks",
  29588. summary = "Called when the window is resized.",
  29589. description = "This callback is called when the desktop window is resized.",
  29590. key = "lovr.resize",
  29591. module = "lovr",
  29592. related = {
  29593. "lovr.graphics.getDimensions",
  29594. "lovr.graphics.getWidth",
  29595. "lovr.graphics.getHeight",
  29596. "lovr.headset.getDisplayDimensions",
  29597. "lovr.conf"
  29598. },
  29599. variants = {
  29600. {
  29601. arguments = {
  29602. {
  29603. name = "width",
  29604. type = "number",
  29605. description = "The new width of the window."
  29606. },
  29607. {
  29608. name = "height",
  29609. type = "number",
  29610. description = "The new height of the window."
  29611. }
  29612. },
  29613. returns = {}
  29614. }
  29615. }
  29616. },
  29617. {
  29618. name = "restart",
  29619. tag = "callbacks",
  29620. summary = "Called when restarting.",
  29621. description = "This callback is called when a restart from `lovr.event.restart` is happening. A value can be returned to send it to the next LÖVR instance, available as the `restart` key in the argument table passed to `lovr.load`. Object instances can not be used as the restart value, since they are destroyed as part of the cleanup process.",
  29622. key = "lovr.restart",
  29623. module = "lovr",
  29624. related = {
  29625. "lovr.event.restart",
  29626. "lovr.load",
  29627. "lovr.quit"
  29628. },
  29629. examples = {
  29630. {
  29631. code = "function lovr.restart()\n return currentLevel:getName()\nend"
  29632. }
  29633. },
  29634. notes = "Only nil, booleans, numbers, and strings are supported types for the return value.",
  29635. variants = {
  29636. {
  29637. arguments = {},
  29638. returns = {
  29639. {
  29640. name = "cookie",
  29641. type = "*",
  29642. description = "The value to send to the next `lovr.load`."
  29643. }
  29644. }
  29645. }
  29646. }
  29647. },
  29648. {
  29649. name = "run",
  29650. tag = "callbacks",
  29651. summary = "The main entry point.",
  29652. description = "This callback is the main entry point for a LÖVR program. It is responsible for calling `lovr.load` and returning the main loop function.",
  29653. key = "lovr.run",
  29654. module = "lovr",
  29655. examples = {
  29656. {
  29657. description = "The default `lovr.run`:",
  29658. code = "function lovr.run()\n lovr.timer.step()\n if lovr.load then lovr.load() end\n return function()\n lovr.event.pump()\n for name, a, b, c, d in lovr.event.poll() do\n if name == 'quit' and (not lovr.quit or not lovr.quit()) then\n return a or 0\n end\n if lovr.handlers[name] then lovr.handlers[name](a, b, c, d) end\n end\n local dt = lovr.timer.step()\n if lovr.headset then\n lovr.headset.update(dt)\n end\n if lovr.audio then\n lovr.audio.update()\n if lovr.headset then\n lovr.audio.setOrientation(lovr.headset.getOrientation())\n lovr.audio.setPosition(lovr.headset.getPosition())\n lovr.audio.setVelocity(lovr.headset.getVelocity())\n end\n end\n if lovr.update then lovr.update(dt) end\n if lovr.graphics then\n lovr.graphics.origin()\n if lovr.draw then\n if lovr.headset then\n lovr.headset.renderTo(lovr.draw)\n end\n if lovr.graphics.hasWindow() then\n lovr.mirror()\n end\n end\n lovr.graphics.present()\n end\n lovr.math.drain()\n end\nend"
  29659. }
  29660. },
  29661. related = {
  29662. "lovr.load",
  29663. "lovr.quit"
  29664. },
  29665. variants = {
  29666. {
  29667. arguments = {},
  29668. returns = {
  29669. {
  29670. name = "loop",
  29671. type = "function",
  29672. description = "The main loop function. It should return nil to continue running, \"restart\" to restart the app, or a number representing an exit status.\n\nMost users should overload lovr.load, lovr.update and lovr.draw instead, since if a custom lovr.run does not do everything it is expected that some features may not work. For example, if lovr.run does not respond to \"quit\" events the program will not be able to quit, and if it does not call \"present\" then no graphics will be drawn.",
  29673. arguments = {},
  29674. returns = {
  29675. {
  29676. name = "result",
  29677. type = "*"
  29678. }
  29679. }
  29680. }
  29681. }
  29682. }
  29683. }
  29684. },
  29685. {
  29686. name = "textinput",
  29687. tag = "callbacks",
  29688. summary = "Called when text has been entered.",
  29689. description = "This callback is called when text has been entered.\n\nFor example, when `shift + 1` is pressed on an American keyboard, `lovr.textinput` will be called with `!`.",
  29690. key = "lovr.textinput",
  29691. module = "lovr",
  29692. notes = "Some characters in UTF-8 unicode take multiple bytes to encode. Due to the way Lua works, the length of these strings will be bigger than 1 even though they are just a single character. `lovr.graphics.print` is compatible with UTF-8 but doing other string processing on these strings may require a library. Lua 5.3+ has support for working with UTF-8 strings.",
  29693. related = {
  29694. "lovr.keypressed",
  29695. "lovr.keyreleased"
  29696. },
  29697. variants = {
  29698. {
  29699. arguments = {
  29700. {
  29701. name = "text",
  29702. type = "string",
  29703. description = "The UTF-8 encoded character."
  29704. },
  29705. {
  29706. name = "code",
  29707. type = "number",
  29708. description = "The integer codepoint of the character."
  29709. }
  29710. },
  29711. returns = {}
  29712. }
  29713. }
  29714. },
  29715. {
  29716. name = "threaderror",
  29717. tag = "callbacks",
  29718. summary = "Called when an error occurs in a thread.",
  29719. description = "The `lovr.threaderror` callback is called whenever an error occurs in a Thread. It receives the Thread object where the error occurred and an error message.\n\nThe default implementation of this callback will call `lovr.errhand` with the error.",
  29720. key = "lovr.threaderror",
  29721. module = "lovr",
  29722. related = {
  29723. "Thread",
  29724. "Thread:getError",
  29725. "lovr.errhand"
  29726. },
  29727. variants = {
  29728. {
  29729. arguments = {
  29730. {
  29731. name = "thread",
  29732. type = "Thread",
  29733. description = "The Thread that errored."
  29734. },
  29735. {
  29736. name = "message",
  29737. type = "string",
  29738. description = "The error message."
  29739. }
  29740. },
  29741. returns = {}
  29742. }
  29743. }
  29744. },
  29745. {
  29746. name = "update",
  29747. tag = "callbacks",
  29748. summary = "Called every frame to update the application logic.",
  29749. description = "The `lovr.update` callback should be used to update your game's logic. It receives a single parameter, `dt`, which represents the amount of elapsed time between frames. You can use this value to scale timers, physics, and animations in your game so they play at a smooth, consistent speed.",
  29750. key = "lovr.update",
  29751. module = "lovr",
  29752. examples = {
  29753. {
  29754. code = "function lovr.update(dt)\n ball.vy = ball.vy + ball.gravity * dt\n ball.y = ball.y + ball.vy * dt\nend"
  29755. }
  29756. },
  29757. related = {
  29758. "lovr.timer.getDelta"
  29759. },
  29760. variants = {
  29761. {
  29762. arguments = {
  29763. {
  29764. name = "dt",
  29765. type = "number",
  29766. description = "The number of seconds elapsed since the last update."
  29767. }
  29768. },
  29769. returns = {}
  29770. }
  29771. }
  29772. }
  29773. }
  29774. }