init.lua 455 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605
  1. return {
  2. callbacks = {
  3. {
  4. name = "conf",
  5. tag = "callbacks",
  6. summary = "Called to read configuration settings at startup.",
  7. 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.",
  8. key = "lovr.conf",
  9. module = "lovr",
  10. variants = {
  11. {
  12. arguments = {
  13. {
  14. name = "t",
  15. type = "table",
  16. description = "The table to edit the configuration settings on.",
  17. table = {
  18. {
  19. name = "identity",
  20. type = "string",
  21. description = "A unique label for this project."
  22. },
  23. {
  24. name = "headset",
  25. type = "table",
  26. description = "Configuration for the headset.",
  27. table = {
  28. {
  29. name = "mirrored",
  30. type = "boolean",
  31. description = " Whether the desktop window should display a mirror of what's in the headset.\n "
  32. }
  33. }
  34. },
  35. {
  36. name = "modules",
  37. type = "table",
  38. description = "The set of enabled modules to use.",
  39. table = {
  40. {
  41. name = "audio",
  42. type = "boolean",
  43. description = "Whether the audio module should be enabled."
  44. },
  45. {
  46. name = "event",
  47. type = "boolean",
  48. description = "Whether the event module should be enabled."
  49. },
  50. {
  51. name = "filesystem",
  52. type = "boolean",
  53. description = "Whether the filesystem module should be enabled."
  54. },
  55. {
  56. name = "graphics",
  57. type = "boolean",
  58. description = "Whether the graphics module should be enabled."
  59. },
  60. {
  61. name = "headset",
  62. type = "boolean",
  63. description = "Whether the headset module should be enabled."
  64. },
  65. {
  66. name = "math",
  67. type = "boolean",
  68. description = "Whether the math module should be enabled."
  69. },
  70. {
  71. name = "physics",
  72. type = "boolean",
  73. description = "Whether the physics module should be enabled."
  74. },
  75. {
  76. name = "timer",
  77. type = "boolean",
  78. description = "Whether the timer module should be enabled."
  79. }
  80. }
  81. }
  82. }
  83. }
  84. },
  85. returns = {}
  86. }
  87. },
  88. related = {
  89. "lovr.load"
  90. },
  91. examples = {
  92. {
  93. description = "A noop conf.lua that sets all configuration settings to their defaults:",
  94. code = "function lovr.conf(t)\n -- Set the project identity\n t.identity = 'default'\n\n -- Headset settings\n t.headset.mirror = true\n\n -- Enable or disable different modules\n t.modules.audio = 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.timer = true\nend"
  95. }
  96. },
  97. notes = "Disabling the `headset` module can improve startup time a lot if you aren't intending to use `lovr.headset`."
  98. },
  99. {
  100. name = "controlleradded",
  101. tag = "callbacks",
  102. summary = "Called when a Controller is connected.",
  103. description = "This callback is called when a Controller is connected, discovered, or woken up.",
  104. key = "lovr.controlleradded",
  105. module = "lovr",
  106. related = {
  107. "lovr.controllerremoved",
  108. "lovr.headset.getControllers",
  109. "lovr.headset.getControllerCount"
  110. },
  111. variants = {
  112. {
  113. arguments = {
  114. {
  115. name = "controller",
  116. type = "Controller",
  117. description = "The new controller object."
  118. }
  119. },
  120. returns = {}
  121. }
  122. }
  123. },
  124. {
  125. name = "controllerpressed",
  126. tag = "callbacks",
  127. summary = "Called when a Controller button is pressed.",
  128. description = "This callback is called when a button on a Controller is pressed.",
  129. key = "lovr.controllerpressed",
  130. module = "lovr",
  131. related = {
  132. "lovr.controllerreleased",
  133. "Controller:isDown",
  134. "ControllerButton"
  135. },
  136. variants = {
  137. {
  138. arguments = {
  139. {
  140. name = "controller",
  141. type = "Controller",
  142. description = "The new controller object."
  143. },
  144. {
  145. name = "button",
  146. type = "ControllerButton",
  147. description = "The button that was pressed."
  148. }
  149. },
  150. returns = {}
  151. }
  152. }
  153. },
  154. {
  155. name = "controllerreleased",
  156. tag = "callbacks",
  157. summary = "Called when a Controller button is released.",
  158. description = "This callback is called when a button on a Controller is released.",
  159. key = "lovr.controllerreleased",
  160. module = "lovr",
  161. related = {
  162. "lovr.controllerpressed",
  163. "Controller:isDown",
  164. "ControllerButton"
  165. },
  166. variants = {
  167. {
  168. arguments = {
  169. {
  170. name = "controller",
  171. type = "Controller",
  172. description = "The new controller object."
  173. },
  174. {
  175. name = "button",
  176. type = "ControllerButton",
  177. description = "The button that was released."
  178. }
  179. },
  180. returns = {}
  181. }
  182. }
  183. },
  184. {
  185. name = "controllerremoved",
  186. tag = "callbacks",
  187. summary = "Called when a Controller is disconnected.",
  188. description = "This callback is called when a Controller is disconnected or turned off.",
  189. key = "lovr.controllerremoved",
  190. module = "lovr",
  191. related = {
  192. "lovr.controlleradded",
  193. "lovr.headset.getControllers",
  194. "lovr.headset.getControllerCount"
  195. },
  196. variants = {
  197. {
  198. arguments = {
  199. {
  200. name = "controller",
  201. type = "Controller",
  202. description = "The controller that was removed."
  203. }
  204. },
  205. returns = {}
  206. }
  207. }
  208. },
  209. {
  210. name = "draw",
  211. tag = "callbacks",
  212. summary = "Called continuously to render frames to the display.",
  213. description = "This callback is called every frame. Use it to render the scene. If a VR headset is connected, this function will be called twice per frame (once for each eye) and the function will instead draw to the headset's display.",
  214. key = "lovr.draw",
  215. module = "lovr",
  216. related = {
  217. "lovr.headset.renderTo"
  218. },
  219. variants = {
  220. {
  221. arguments = {
  222. {
  223. name = "eye",
  224. type = "HeadsetEye",
  225. description = "The eye currently being rendered to."
  226. }
  227. },
  228. returns = {}
  229. }
  230. }
  231. },
  232. {
  233. name = "errhand",
  234. tag = "callbacks",
  235. summary = "Called when an error occurs.",
  236. description = "The `lovr.errhand` callback is run whenever an error occurs. It receives a single string parameter containing the error message.\n\nThe program exits after this callback returns.\n\nA default error handler is supplied that renders the error message as text in a loop.",
  237. key = "lovr.errhand",
  238. module = "lovr",
  239. variants = {
  240. {
  241. arguments = {
  242. {
  243. name = "message",
  244. type = "string",
  245. description = "The error message."
  246. }
  247. },
  248. returns = {}
  249. }
  250. },
  251. examples = {
  252. {
  253. code = "function lovr.errhand(message)\n print('ohh NOOOO!', message)\nend"
  254. }
  255. },
  256. related = {
  257. "lovr.quit"
  258. }
  259. },
  260. {
  261. name = "focus",
  262. tag = "callbacks",
  263. summary = "Called when the application gets or loses focus.",
  264. 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.",
  265. key = "lovr.focus",
  266. module = "lovr",
  267. related = {},
  268. variants = {
  269. {
  270. arguments = {
  271. {
  272. name = "focused",
  273. type = "boolean",
  274. description = "Whether the program is now focused."
  275. }
  276. },
  277. returns = {}
  278. }
  279. }
  280. },
  281. {
  282. name = "load",
  283. tag = "callbacks",
  284. summary = "Called once at startup.",
  285. 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.",
  286. key = "lovr.load",
  287. module = "lovr",
  288. variants = {
  289. {
  290. arguments = {
  291. {
  292. name = "args",
  293. type = "table",
  294. description = "The command line arguments provided to the program."
  295. }
  296. },
  297. returns = {}
  298. }
  299. },
  300. examples = {
  301. {
  302. code = "function lovr.load(args)\n model = lovr.graphics.newModel('cena.fbx')\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"
  303. }
  304. },
  305. related = {
  306. "lovr.quit"
  307. }
  308. },
  309. {
  310. name = "quit",
  311. tag = "callbacks",
  312. summary = "Called before quitting.",
  313. description = "This callback is called right before the game is about to quit. Use it to perform any cleanup you need to do. You can also return a \"truthy\" value from this callback to abort quitting.",
  314. key = "lovr.quit",
  315. module = "lovr",
  316. variants = {
  317. {
  318. arguments = {},
  319. returns = {
  320. {
  321. name = "abort",
  322. type = "boolean",
  323. description = "Whether quitting should be aborted."
  324. }
  325. }
  326. }
  327. },
  328. examples = {
  329. {
  330. code = "function lovr.quit()\n if shouldQuit() then\n return false\n else\n return true\n end\nend"
  331. }
  332. },
  333. related = {
  334. "lovr.event.quit",
  335. "lovr.load"
  336. }
  337. },
  338. {
  339. name = "run",
  340. tag = "callbacks",
  341. summary = "The main entry point.",
  342. description = "This callback is the main entry point for a LÖVR program. It is responsible for calling `lovr.load` and `lovr.step`.",
  343. key = "lovr.run",
  344. module = "lovr",
  345. variants = {
  346. {
  347. arguments = {},
  348. returns = {
  349. {
  350. name = "exit",
  351. type = "number",
  352. description = "The exit code. A nonzero exit code indicates an error."
  353. }
  354. }
  355. }
  356. },
  357. examples = {
  358. {
  359. description = "The default `lovr.run`:",
  360. code = "function lovr.run()\n if lovr.load then lovr.load() end\n while true do\n local exit = lovr.step()\n if exit then return exit end\n end\nend"
  361. }
  362. },
  363. related = {
  364. "lovr.step",
  365. "lovr.load",
  366. "lovr.quit"
  367. }
  368. },
  369. {
  370. name = "step",
  371. tag = "callbacks",
  372. summary = "The main loop.",
  373. description = "This callback is called continuously and contains a single iteration of the main loop. The default is usually suitable, but sometimes it is helpful to override this callback for custom behavior.",
  374. key = "lovr.step",
  375. module = "lovr",
  376. variants = {
  377. {
  378. arguments = {},
  379. returns = {
  380. {
  381. name = "exit",
  382. type = "number",
  383. description = "The exit code. A nonzero exit code indicates an error."
  384. }
  385. }
  386. }
  387. },
  388. examples = {
  389. {
  390. description = "The default `lovr.step`:",
  391. code = "function lovr.step()\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\n end\n lovr.handlers[name](a, b, c, d)\n end\n\n local dt = lovr.timer.step()\n if lovr.audio then\n lovr.audio.update()\n if lovr.headset and lovr.headset.isPresent() 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\n lovr.graphics.clear()\n lovr.graphics.origin()\n if lovr.draw then\n if lovr.headset and lovr.headset.isPresent() then\n lovr.headset.renderTo(lovr.draw)\n else\n lovr.draw()\n end\n end\n lovr.graphics.present()\n\n lovr.timer.sleep(.001)\nend"
  392. }
  393. },
  394. related = {
  395. "lovr.run",
  396. "lovr.load",
  397. "lovr.quit"
  398. }
  399. },
  400. {
  401. name = "update",
  402. tag = "callbacks",
  403. summary = "Called every frame to update the application logic.",
  404. 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.",
  405. key = "lovr.update",
  406. module = "lovr",
  407. variants = {
  408. {
  409. arguments = {
  410. {
  411. name = "dt",
  412. type = "number",
  413. description = "The number of seconds elapsed since the last update."
  414. }
  415. },
  416. returns = {}
  417. }
  418. },
  419. examples = {
  420. {
  421. code = "function lovr.update(dt)\n ball.vy = ball.vy + ball.gravity * dt\n ball.y = ball.y + ball.vy * dt\nend"
  422. }
  423. },
  424. related = {
  425. "lovr.timer.getDelta"
  426. }
  427. }
  428. },
  429. modules = {
  430. {
  431. name = "json",
  432. tag = "library",
  433. summary = "Encodes and decodes JSON.",
  434. description = "The json module exposes functions for encoding and decoding JSON. You can use it by requiring the `json` module.",
  435. key = "json",
  436. functions = {},
  437. objects = {},
  438. enums = {},
  439. external = true,
  440. examples = {
  441. {
  442. code = "local json = require 'json'\nlocal data = { health = 10, position = { 1, 2, 3 } }\nlocal encoded = json.encode(data)\nprint(encoded)\nlocal decoded = json.decode(encoded)\nprint(decoded.health, unpack(decoded.position))"
  443. }
  444. }
  445. },
  446. {
  447. name = "lovr",
  448. summary = "In the beginning, there was nothing.",
  449. 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**.",
  450. key = "lovr",
  451. enums = {},
  452. sections = {
  453. {
  454. name = "Modules",
  455. tag = "modules",
  456. 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."
  457. },
  458. {
  459. name = "Callbacks",
  460. tag = "callbacks",
  461. 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.controlleradded` is called when controllers are connected."
  462. },
  463. {
  464. name = "System",
  465. tag = "system",
  466. description = "The lovr module also exposes some functions for retrieving information about the system."
  467. },
  468. {
  469. name = "Libraries",
  470. tag = "library",
  471. description = "A few helpful third-party libraries are included with LÖVR for convenience."
  472. }
  473. },
  474. functions = {
  475. {
  476. name = "getOS",
  477. tag = "system",
  478. summary = "Get the current operating system.",
  479. description = "Returns the current operating system.",
  480. key = "lovr.getOS",
  481. module = "lovr",
  482. variants = {
  483. {
  484. arguments = {},
  485. returns = {
  486. {
  487. name = "os",
  488. type = "string",
  489. description = "Either \"Windows\", \"macOS\", or \"Web\"."
  490. }
  491. }
  492. }
  493. }
  494. },
  495. {
  496. name = "getVersion",
  497. tag = "system",
  498. summary = "Get the current version.",
  499. description = "Get the current major, minor, and patch version of LÖVR.",
  500. key = "lovr.getVersion",
  501. module = "lovr",
  502. variants = {
  503. {
  504. arguments = {},
  505. returns = {
  506. {
  507. name = "major",
  508. type = "number",
  509. description = "The major version."
  510. },
  511. {
  512. name = "minor",
  513. type = "number",
  514. description = "The minor version."
  515. },
  516. {
  517. name = "patch",
  518. type = "number",
  519. description = "The patch number."
  520. }
  521. }
  522. }
  523. }
  524. }
  525. },
  526. objects = {}
  527. },
  528. {
  529. name = "audio",
  530. tag = "modules",
  531. summary = "Plays sound.",
  532. description = "The `lovr.audio` module is responsible for playing sound effects and music. Currently, the only supported audio format is .ogg (Vorbis). Playing a sound involves creating a `Source` object for the sound and calling `Source:play` on it.",
  533. key = "lovr.audio",
  534. sections = {
  535. {
  536. name = "Sources",
  537. tag = "sources",
  538. description = "Sources are objects that represent a single sound instance."
  539. },
  540. {
  541. name = "Listener",
  542. tag = "listener",
  543. description = "The listener is a virtual object in 3D space that \"hears\" all the sounds that are playing. The listener can be positioned and oriented in 3D space, which controls how Sources in the world are heard. For example, sounds further away from the listener will be more quiet, and sounds to the left of the listener will be heard from the left speaker. By default, the listener will be synchronized with any connected headset so audio is positioned properly as the headset is moved around and rotated."
  544. }
  545. },
  546. enums = {
  547. {
  548. name = "TimeUnit",
  549. summary = "Time units for sound samples.",
  550. 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 samples.",
  551. key = "TimeUnit",
  552. module = "audio",
  553. values = {
  554. {
  555. name = "seconds",
  556. description = "Seconds."
  557. },
  558. {
  559. name = "samples",
  560. description = "Samples."
  561. }
  562. }
  563. }
  564. },
  565. functions = {
  566. {
  567. name = "getOrientation",
  568. tag = "listener",
  569. summary = "Get the orientation of the listener.",
  570. description = "Returns the orientation of the virtual audio listener in angle/axis representation.",
  571. key = "lovr.audio.getOrientation",
  572. module = "lovr.audio",
  573. variants = {
  574. {
  575. arguments = {},
  576. returns = {
  577. {
  578. name = "angle",
  579. type = "number",
  580. description = "The number of radians the listener is rotated around its axis of rotation."
  581. },
  582. {
  583. name = "ax",
  584. type = "number",
  585. description = "The x component of the axis of rotation."
  586. },
  587. {
  588. name = "ay",
  589. type = "number",
  590. description = "The y component of the axis of rotation."
  591. },
  592. {
  593. name = "az",
  594. type = "number",
  595. description = "The z component of the axis of rotation."
  596. }
  597. }
  598. }
  599. }
  600. },
  601. {
  602. name = "getPosition",
  603. tag = "listener",
  604. summary = "Get the position of the listener.",
  605. description = "Returns the position of the virtual audio listener, in meters.",
  606. key = "lovr.audio.getPosition",
  607. module = "lovr.audio",
  608. variants = {
  609. {
  610. arguments = {},
  611. returns = {
  612. {
  613. name = "x",
  614. type = "number",
  615. description = "The x position of the listener."
  616. },
  617. {
  618. name = "y",
  619. type = "number",
  620. description = "The y position of the listener."
  621. },
  622. {
  623. name = "z",
  624. type = "number",
  625. description = "The z position of the listener."
  626. }
  627. }
  628. }
  629. }
  630. },
  631. {
  632. name = "getVelocity",
  633. tag = "listener",
  634. summary = "Get the velocity of the audio listener.",
  635. description = "Returns the velocity of the audio listener, in meters per second. This affects the doppler effect.",
  636. key = "lovr.audio.getVelocity",
  637. module = "lovr.audio",
  638. variants = {
  639. {
  640. arguments = {},
  641. returns = {
  642. {
  643. name = "x",
  644. type = "number",
  645. description = "The x velocity."
  646. },
  647. {
  648. name = "y",
  649. type = "number",
  650. description = "The y velocity."
  651. },
  652. {
  653. name = "z",
  654. type = "number",
  655. description = "The z velocity."
  656. }
  657. }
  658. }
  659. },
  660. notes = "The audio listener does not move based on its velocity."
  661. },
  662. {
  663. name = "getVolume",
  664. tag = "listener",
  665. summary = "Get the master volume.",
  666. description = "Returns the master volume. All Source objects have their volume multiplied by this factor.",
  667. key = "lovr.audio.getVolume",
  668. module = "lovr.audio",
  669. variants = {
  670. {
  671. arguments = {},
  672. returns = {
  673. {
  674. name = "volume",
  675. type = "number",
  676. description = "The master volume."
  677. }
  678. }
  679. }
  680. },
  681. notes = "The default is 1.0."
  682. },
  683. {
  684. name = "isSpatialized",
  685. tag = "listener",
  686. summary = "Check if audio is spatialized.",
  687. description = "Returns whether or not audio is currently spatialized with HRTFs. Spatialized audio is much more immersive.",
  688. key = "lovr.audio.isSpatialized",
  689. module = "lovr.audio",
  690. variants = {
  691. {
  692. arguments = {},
  693. returns = {
  694. {
  695. name = "spatialized",
  696. type = "boolean",
  697. description = "Whether or not audio is spatialized."
  698. }
  699. }
  700. }
  701. }
  702. },
  703. {
  704. name = "newSource",
  705. tag = "sources",
  706. summary = "Create a new Source.",
  707. description = "Creates a new Source from an ogg file.",
  708. key = "lovr.audio.newSource",
  709. module = "lovr.audio",
  710. variants = {
  711. {
  712. arguments = {
  713. {
  714. name = "filename",
  715. type = "string",
  716. description = "The filename of the sound to load."
  717. }
  718. },
  719. returns = {
  720. {
  721. name = "source",
  722. type = "Source",
  723. description = "The new Source."
  724. }
  725. }
  726. }
  727. }
  728. },
  729. {
  730. name = "pause",
  731. tag = "sources",
  732. summary = "Pause all Sources.",
  733. description = "Pause all playing audio.",
  734. key = "lovr.audio.pause",
  735. module = "lovr.audio",
  736. variants = {
  737. {
  738. arguments = {},
  739. returns = {}
  740. }
  741. }
  742. },
  743. {
  744. name = "resume",
  745. tag = "sources",
  746. summary = "Resume all Sources.",
  747. description = "Resume all Sources. Has no effect on Sources that are playing or stopped.",
  748. key = "lovr.audio.resume",
  749. module = "lovr.audio",
  750. variants = {
  751. {
  752. arguments = {},
  753. returns = {}
  754. }
  755. }
  756. },
  757. {
  758. name = "rewind",
  759. tag = "sources",
  760. summary = "Rewind all Sources.",
  761. description = "Rewind all playing audio.",
  762. key = "lovr.audio.rewind",
  763. module = "lovr.audio",
  764. variants = {
  765. {
  766. arguments = {},
  767. returns = {}
  768. }
  769. },
  770. notes = "Sources that are paused will remain paused. Sources that are currently playing will restart from the beginning."
  771. },
  772. {
  773. name = "setOrientation",
  774. tag = "listener",
  775. summary = "Set the orientation of the listener.",
  776. description = "Sets the orientation of the virtual audio listener in angle/axis representation.",
  777. key = "lovr.audio.setOrientation",
  778. module = "lovr.audio",
  779. variants = {
  780. {
  781. arguments = {
  782. {
  783. name = "angle",
  784. type = "number",
  785. description = "The number of radians the listener should be rotated around its rotation axis."
  786. },
  787. {
  788. name = "ax",
  789. type = "number",
  790. description = "The x component of the axis of rotation."
  791. },
  792. {
  793. name = "ay",
  794. type = "number",
  795. description = "The y component of the axis of rotation."
  796. },
  797. {
  798. name = "az",
  799. type = "number",
  800. description = "The z component of the axis of rotation."
  801. }
  802. },
  803. returns = {}
  804. }
  805. }
  806. },
  807. {
  808. name = "setPosition",
  809. tag = "listener",
  810. summary = "Set the position of the listener.",
  811. description = "Sets the position of the virtual audio listener, in meters.",
  812. key = "lovr.audio.setPosition",
  813. module = "lovr.audio",
  814. variants = {
  815. {
  816. arguments = {
  817. {
  818. name = "x",
  819. type = "number",
  820. description = "The x position of the listener."
  821. },
  822. {
  823. name = "y",
  824. type = "number",
  825. description = "The y position of the listener."
  826. },
  827. {
  828. name = "z",
  829. type = "number",
  830. description = "The z position of the listener."
  831. }
  832. },
  833. returns = {}
  834. }
  835. }
  836. },
  837. {
  838. name = "setVelocity",
  839. tag = "listener",
  840. summary = "Set the velocity of the audio listener.",
  841. description = "Sets the velocity of the audio listener, in meters per second. This affects the doppler effect.",
  842. key = "lovr.audio.setVelocity",
  843. module = "lovr.audio",
  844. variants = {
  845. {
  846. arguments = {
  847. {
  848. name = "x",
  849. type = "number",
  850. description = "The x velocity."
  851. },
  852. {
  853. name = "y",
  854. type = "number",
  855. description = "The y velocity."
  856. },
  857. {
  858. name = "z",
  859. type = "number",
  860. description = "The z velocity."
  861. }
  862. },
  863. returns = {}
  864. }
  865. },
  866. notes = "The audio listener does not move based on its velocity."
  867. },
  868. {
  869. name = "setVolume",
  870. tag = "listener",
  871. summary = "Set the master volume.",
  872. description = "Sets the master volume. The volume of all Sources will be multiplied by this factor.",
  873. key = "lovr.audio.setVolume",
  874. module = "lovr.audio",
  875. variants = {
  876. {
  877. arguments = {},
  878. returns = {
  879. {
  880. name = "volume",
  881. type = "number",
  882. description = "The master volume."
  883. }
  884. }
  885. }
  886. },
  887. notes = "The default is 1.0."
  888. },
  889. {
  890. name = "stop",
  891. tag = "sources",
  892. summary = "Stop all Sources.",
  893. description = "Stops all audio.",
  894. key = "lovr.audio.stop",
  895. module = "lovr.audio",
  896. variants = {
  897. {
  898. arguments = {},
  899. returns = {}
  900. }
  901. },
  902. notes = "If you want to resume the stopped audio later, see `lovr.audio.pause`."
  903. },
  904. {
  905. name = "update",
  906. tag = "sources",
  907. summary = "Updates the audio system.",
  908. description = "Updates all playing sources. This must be called regularly for audio playback to occur. Normally this is called for you by `lovr.step`.",
  909. key = "lovr.audio.update",
  910. module = "lovr.audio",
  911. variants = {
  912. {
  913. arguments = {},
  914. returns = {}
  915. }
  916. }
  917. }
  918. },
  919. objects = {
  920. {
  921. name = "Source",
  922. summary = "A playable sound object.",
  923. description = "A Source is an object representing a single sound. Currently, only ogg sounds are supported. Sources can be in three different states:\n\n<table>\n <tr>\n <td>Playing</td>\n <td>The source is currently playing. It can be stopped, paused, or rewound.</td>\n </tr>\n <tr>\n <td>Paused</td>\n <td>The source is paused. It can be stopped, played/resumed, or rewound.</td>\n </tr>\n <tr>\n <td>Stopped</td>\n <td>The source has been stopped. It can be played.</td>\n </tr> </table>",
  924. key = "Source",
  925. module = "lovr.audio",
  926. methods = {
  927. {
  928. name = "getBitDepth",
  929. summary = "Get the bit depth of the Source.",
  930. description = "Returns the number of bits per sample in the Source. This is a rough indicator of the resolution of the Source, and is usually 16.",
  931. key = "Source:getBitDepth",
  932. module = "lovr.audio",
  933. variants = {
  934. {
  935. arguments = {},
  936. returns = {
  937. {
  938. name = "bits",
  939. type = "number",
  940. description = "The number of bits per sample."
  941. }
  942. }
  943. }
  944. }
  945. },
  946. {
  947. name = "getChannels",
  948. summary = "Get the number of channels in the Source.",
  949. description = "Returns the number of channels in the Source. Mono sounds have 1 channel and stereo sounds have 2 channels.",
  950. key = "Source:getChannels",
  951. module = "lovr.audio",
  952. variants = {
  953. {
  954. arguments = {},
  955. returns = {
  956. {
  957. name = "channels",
  958. type = "number",
  959. description = "The number of channels."
  960. }
  961. }
  962. }
  963. }
  964. },
  965. {
  966. name = "getCone",
  967. summary = "Get the Source's volume cone.",
  968. description = "Returns the directional volume cone of the Source. The cone is specified by three values: `innerAngle`, `outerAngle`, and `outerVolume`. If the listener is inside the `innerAngle`, the Source won't have its volume changed. Otherwise, the volume will start to decrease, reaching a minimum volume of `outerVolume` once the listener is `outerAngle` degrees from the direction of the Source.",
  969. key = "Source:getCone",
  970. module = "lovr.audio",
  971. notes = "The default `innerAngle` for a Source is `0`.\n\nThe default `outerAngle` for a Source is `2 * math.pi`.\n\nThe default `outerVolume` for a Source is `0`.\n\nMake sure to set the direction of a Source before setting its cone.",
  972. variants = {
  973. {
  974. arguments = {},
  975. returns = {
  976. {
  977. name = "innerAngle",
  978. type = "number",
  979. description = "The inner cone angle, in radians."
  980. },
  981. {
  982. name = "outerAngle",
  983. type = "number",
  984. description = "The outer cone angle, in radians."
  985. },
  986. {
  987. name = "outerVolume",
  988. type = "number",
  989. description = "The outer cone angle, in radians."
  990. }
  991. }
  992. }
  993. }
  994. },
  995. {
  996. name = "getDirection",
  997. summary = "Get the direction vector of the Source.",
  998. description = "Returns the direction vector of the Source (the direction it's playing in).",
  999. key = "Source:getDirection",
  1000. module = "lovr.audio",
  1001. variants = {
  1002. {
  1003. arguments = {},
  1004. returns = {
  1005. {
  1006. name = "x",
  1007. type = "number",
  1008. description = "The x component of the direction vector."
  1009. },
  1010. {
  1011. name = "y",
  1012. type = "number",
  1013. description = "The y component of the direction vector."
  1014. },
  1015. {
  1016. name = "z",
  1017. type = "number",
  1018. description = "The z component of the direction vector."
  1019. }
  1020. }
  1021. }
  1022. }
  1023. },
  1024. {
  1025. name = "getDuration",
  1026. summary = "Get the duration of the Source.",
  1027. description = "Returns the duration of the Source.",
  1028. key = "Source:getDuration",
  1029. module = "lovr.audio",
  1030. variants = {
  1031. {
  1032. arguments = {
  1033. {
  1034. name = "unit",
  1035. type = "TimeUnit",
  1036. description = "The unit to return.",
  1037. default = "'seconds'"
  1038. }
  1039. },
  1040. returns = {
  1041. {
  1042. name = "duration",
  1043. type = "number",
  1044. description = "The duration of the Source."
  1045. }
  1046. }
  1047. }
  1048. }
  1049. },
  1050. {
  1051. name = "getFalloff",
  1052. summary = "Get the falloff parameters for the Source.",
  1053. description = "Returns parameters that control how the volume of the Source falls of with distance.",
  1054. key = "Source:getFalloff",
  1055. module = "lovr.audio",
  1056. related = {
  1057. "Source:getVolumeLimits",
  1058. "Source:setVolumeLimits"
  1059. },
  1060. variants = {
  1061. {
  1062. arguments = {},
  1063. returns = {
  1064. {
  1065. name = "reference",
  1066. type = "number",
  1067. description = "The distance at which the volume will start to decrease."
  1068. },
  1069. {
  1070. name = "max",
  1071. type = "number",
  1072. description = "The distance at which the Source will be its quietest."
  1073. },
  1074. {
  1075. name = "rolloff",
  1076. type = "number",
  1077. description = "How quickly the sound falls off between the reference and max distances (1.0 is the default)."
  1078. }
  1079. }
  1080. }
  1081. }
  1082. },
  1083. {
  1084. name = "getPitch",
  1085. summary = "Get the pitch of the Source.",
  1086. description = "Returns the current pitch factor of the Source. The default is 1.0.",
  1087. key = "Source:getPitch",
  1088. module = "lovr.audio",
  1089. variants = {
  1090. {
  1091. arguments = {},
  1092. returns = {
  1093. {
  1094. name = "pitch",
  1095. type = "number",
  1096. description = "The current pitch."
  1097. }
  1098. }
  1099. }
  1100. }
  1101. },
  1102. {
  1103. name = "getPosition",
  1104. summary = "Get the position of the Source.",
  1105. 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.",
  1106. key = "Source:getPosition",
  1107. module = "lovr.audio",
  1108. variants = {
  1109. {
  1110. arguments = {},
  1111. returns = {
  1112. {
  1113. name = "x",
  1114. type = "number",
  1115. description = "The x coordinate."
  1116. },
  1117. {
  1118. name = "y",
  1119. type = "number",
  1120. description = "The y coordinate."
  1121. },
  1122. {
  1123. name = "z",
  1124. type = "number",
  1125. description = "The z coordinate."
  1126. }
  1127. }
  1128. }
  1129. }
  1130. },
  1131. {
  1132. name = "getSampleRate",
  1133. summary = "Get the sample rate of the Source.",
  1134. description = "Returns the number of samples per second in the Source. This is usually a high number like 44100.",
  1135. key = "Source:getSampleRate",
  1136. module = "lovr.audio",
  1137. variants = {
  1138. {
  1139. arguments = {},
  1140. returns = {
  1141. {
  1142. name = "frequency",
  1143. type = "number",
  1144. description = "The number of samples per second in the Source."
  1145. }
  1146. }
  1147. }
  1148. }
  1149. },
  1150. {
  1151. name = "getVelocity",
  1152. summary = "Get the velocity of the Source.",
  1153. description = "Returns the velocity of the Source, in meters per second. This affects the doppler effect.",
  1154. key = "Source:getVelocity",
  1155. module = "lovr.audio",
  1156. notes = "The Source does not move based on its velocity.",
  1157. variants = {
  1158. {
  1159. arguments = {},
  1160. returns = {
  1161. {
  1162. name = "x",
  1163. type = "number",
  1164. description = "The x velocity."
  1165. },
  1166. {
  1167. name = "y",
  1168. type = "number",
  1169. description = "The y velocity."
  1170. },
  1171. {
  1172. name = "z",
  1173. type = "number",
  1174. description = "The z velocity."
  1175. }
  1176. }
  1177. }
  1178. }
  1179. },
  1180. {
  1181. name = "getVolume",
  1182. summary = "Get the volume of the Source.",
  1183. description = "Returns the current volume factor for the Source. 1.0 is the default and the maximum.",
  1184. key = "Source:getVolume",
  1185. module = "lovr.audio",
  1186. variants = {
  1187. {
  1188. arguments = {},
  1189. returns = {
  1190. {
  1191. name = "volume",
  1192. type = "number",
  1193. description = "The volume of the Source."
  1194. }
  1195. }
  1196. }
  1197. }
  1198. },
  1199. {
  1200. name = "getVolumeLimits",
  1201. summary = "Get the volume limits of the Source.",
  1202. description = "Returns the minimum and maximum volume of the Source. These limits have priority over the parameters set by `Source:setFalloff` and `Source:setCone`, so they can be used to make sure a Source can always be heard even if it's far away.",
  1203. key = "Source:getVolumeLimits",
  1204. module = "lovr.audio",
  1205. variants = {
  1206. {
  1207. arguments = {},
  1208. returns = {
  1209. {
  1210. name = "min",
  1211. type = "number",
  1212. description = "The minimum volume of the Source."
  1213. },
  1214. {
  1215. name = "max",
  1216. type = "number",
  1217. description = "The maximum volume of the Source."
  1218. }
  1219. }
  1220. }
  1221. }
  1222. },
  1223. {
  1224. name = "isLooping",
  1225. summary = "Check if the Source is looping.",
  1226. description = "Returns whether or not the Source will loop when it finishes.",
  1227. key = "Source:isLooping",
  1228. module = "lovr.audio",
  1229. variants = {
  1230. {
  1231. arguments = {},
  1232. returns = {
  1233. {
  1234. name = "looping",
  1235. type = "boolean",
  1236. description = "Whether or not the Source is looping."
  1237. }
  1238. }
  1239. }
  1240. }
  1241. },
  1242. {
  1243. name = "isPaused",
  1244. summary = "Check if the Source is paused.",
  1245. description = "Returns whether or not the Source is paused.",
  1246. key = "Source:isPaused",
  1247. module = "lovr.audio",
  1248. variants = {
  1249. {
  1250. arguments = {},
  1251. returns = {
  1252. {
  1253. name = "paused",
  1254. type = "boolean",
  1255. description = "Whether the Source is paused."
  1256. }
  1257. }
  1258. }
  1259. }
  1260. },
  1261. {
  1262. name = "isPlaying",
  1263. summary = "Check if the Source is playing.",
  1264. description = "Returns whether or not the Source is playing.",
  1265. key = "Source:isPlaying",
  1266. module = "lovr.audio",
  1267. variants = {
  1268. {
  1269. arguments = {},
  1270. returns = {
  1271. {
  1272. name = "playing",
  1273. type = "boolean",
  1274. description = "Whether the Source is playing."
  1275. }
  1276. }
  1277. }
  1278. }
  1279. },
  1280. {
  1281. name = "isRelative",
  1282. summary = "Check if the Source is relative to the listener.",
  1283. description = "Returns whether or not the Source is relative to the listener. If a Source is relative then its position, velocity, cone, and direction are all relative to the audio listener.",
  1284. key = "Source:isRelative",
  1285. module = "lovr.audio",
  1286. variants = {
  1287. {
  1288. arguments = {},
  1289. returns = {
  1290. {
  1291. name = "relative",
  1292. type = "boolean",
  1293. description = "Whether or not the Source is relative."
  1294. }
  1295. }
  1296. }
  1297. }
  1298. },
  1299. {
  1300. name = "isStopped",
  1301. summary = "Check if the Source is stopped.",
  1302. description = "Returns whether or not the Source is stopped.",
  1303. key = "Source:isStopped",
  1304. module = "lovr.audio",
  1305. variants = {
  1306. {
  1307. arguments = {},
  1308. returns = {
  1309. {
  1310. name = "stopped",
  1311. type = "boolean",
  1312. description = "Whether the Source is stopped."
  1313. }
  1314. }
  1315. }
  1316. }
  1317. },
  1318. {
  1319. name = "pause",
  1320. summary = "Pause the Source.",
  1321. description = "Pauses the source. It can be resumed with `Source:resume` or `Source:play`. If a paused source is rewound, it will remain paused.",
  1322. key = "Source:pause",
  1323. module = "lovr.audio",
  1324. variants = {
  1325. {
  1326. arguments = {},
  1327. returns = {}
  1328. }
  1329. }
  1330. },
  1331. {
  1332. name = "play",
  1333. summary = "Play the Source.",
  1334. description = "Plays the Source. This has no effect if the Source is already playing.",
  1335. key = "Source:play",
  1336. module = "lovr.audio",
  1337. variants = {
  1338. {
  1339. arguments = {},
  1340. returns = {}
  1341. }
  1342. }
  1343. },
  1344. {
  1345. name = "resume",
  1346. summary = "Resume the Source.",
  1347. description = "Resumes the Source.",
  1348. key = "Source:resume",
  1349. module = "lovr.audio",
  1350. variants = {
  1351. {
  1352. arguments = {},
  1353. returns = {}
  1354. }
  1355. }
  1356. },
  1357. {
  1358. name = "rewind",
  1359. summary = "Rewind the Source.",
  1360. description = "Rewinds the Source, starting it over at the beginning. Paused Sources will remain paused.",
  1361. key = "Source:rewind",
  1362. module = "lovr.audio",
  1363. variants = {
  1364. {
  1365. arguments = {},
  1366. returns = {}
  1367. }
  1368. }
  1369. },
  1370. {
  1371. name = "seek",
  1372. summary = "Set the playback position of the Source.",
  1373. description = "Seeks the Source to the specified position.",
  1374. key = "Source:seek",
  1375. module = "lovr.audio",
  1376. variants = {
  1377. {
  1378. arguments = {
  1379. {
  1380. name = "position",
  1381. type = "number",
  1382. description = "The position to seek to."
  1383. },
  1384. {
  1385. name = "unit",
  1386. type = "TimeUnit",
  1387. description = "The units for the seek position.",
  1388. default = "'seconds'"
  1389. }
  1390. },
  1391. returns = {}
  1392. }
  1393. }
  1394. },
  1395. {
  1396. name = "setCone",
  1397. summary = "Set the Source's volume cone.",
  1398. description = "Sets the directional volume cone of the Source. The cone is specified by three values: `innerAngle`, `outerAngle`, and `outerVolume`. If the listener is inside the `innerAngle`, the Source won't have its volume changed. Otherwise, the volume will start to decrease, reaching a minimum volume of `outerVolume` once the listener is `outerAngle` degrees from the direction of the Source.",
  1399. key = "Source:setCone",
  1400. module = "lovr.audio",
  1401. notes = "The default `innerAngle` for a Source is `0`.\n\nThe default `outerAngle` for a Source is `2 * math.pi`.\n\nThe default `outerVolume` for a Source is `0`.\n\nMake sure to set the direction of a Source before setting its cone.",
  1402. variants = {
  1403. {
  1404. arguments = {
  1405. {
  1406. name = "innerAngle",
  1407. type = "number",
  1408. description = "The inner cone angle, in radians."
  1409. },
  1410. {
  1411. name = "outerAngle",
  1412. type = "number",
  1413. description = "The outer cone angle, in radians."
  1414. },
  1415. {
  1416. name = "outerVolume",
  1417. type = "number",
  1418. description = "The outer cone angle, in radians."
  1419. }
  1420. },
  1421. returns = {}
  1422. }
  1423. }
  1424. },
  1425. {
  1426. name = "setDirection",
  1427. summary = "Set the direction vector of the Source.",
  1428. description = "Sets the direction vector of the Source (the direction it's playing in).",
  1429. key = "Source:setDirection",
  1430. module = "lovr.audio",
  1431. variants = {
  1432. {
  1433. arguments = {
  1434. {
  1435. name = "x",
  1436. type = "number",
  1437. description = "The x component of the direction vector."
  1438. },
  1439. {
  1440. name = "y",
  1441. type = "number",
  1442. description = "The y component of the direction vector."
  1443. },
  1444. {
  1445. name = "z",
  1446. type = "number",
  1447. description = "The z component of the direction vector."
  1448. }
  1449. },
  1450. returns = {}
  1451. }
  1452. }
  1453. },
  1454. {
  1455. name = "setFalloff",
  1456. summary = "Set the falloff parameters for the Source.",
  1457. description = "Sets parameters that control how the volume of the Source falls of with distance.",
  1458. key = "Source:setFalloff",
  1459. module = "lovr.audio",
  1460. related = {
  1461. "Source:getVolumeLimits",
  1462. "Source:setVolumeLimits"
  1463. },
  1464. variants = {
  1465. {
  1466. arguments = {
  1467. {
  1468. name = "reference",
  1469. type = "number",
  1470. description = "The distance at which the volume will start to decrease."
  1471. },
  1472. {
  1473. name = "max",
  1474. type = "number",
  1475. description = "The distance at which the Source will be its quietest."
  1476. },
  1477. {
  1478. name = "rolloff",
  1479. type = "number",
  1480. description = "How quickly the sound falls off between the reference and max distances (1.0 is the default)."
  1481. }
  1482. },
  1483. returns = {}
  1484. }
  1485. }
  1486. },
  1487. {
  1488. name = "setLooping",
  1489. summary = "Set whether or not the Source loops.",
  1490. description = "Sets whether or not the Source loops.",
  1491. key = "Source:setLooping",
  1492. module = "lovr.audio",
  1493. variants = {
  1494. {
  1495. arguments = {
  1496. {
  1497. name = "loop",
  1498. type = "boolean",
  1499. description = "Whether or not the Source will loop."
  1500. }
  1501. },
  1502. returns = {}
  1503. }
  1504. }
  1505. },
  1506. {
  1507. name = "setPitch",
  1508. summary = "Set the pitch of the Source.",
  1509. description = "Sets the pitch of the Source. The default is 1.0.",
  1510. key = "Source:setPitch",
  1511. module = "lovr.audio",
  1512. variants = {
  1513. {
  1514. arguments = {
  1515. {
  1516. name = "pitch",
  1517. type = "number",
  1518. description = "The new pitch."
  1519. }
  1520. },
  1521. returns = {}
  1522. }
  1523. }
  1524. },
  1525. {
  1526. name = "setPosition",
  1527. summary = "Set the position of the Source.",
  1528. 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.",
  1529. key = "Source:setPosition",
  1530. module = "lovr.audio",
  1531. variants = {
  1532. {
  1533. arguments = {
  1534. {
  1535. name = "x",
  1536. type = "number",
  1537. description = "The x coordinate."
  1538. },
  1539. {
  1540. name = "y",
  1541. type = "number",
  1542. description = "The y coordinate."
  1543. },
  1544. {
  1545. name = "z",
  1546. type = "number",
  1547. description = "The z coordinate."
  1548. }
  1549. },
  1550. returns = {}
  1551. }
  1552. }
  1553. },
  1554. {
  1555. name = "setRelative",
  1556. summary = "Set whether or not the Source is relative.",
  1557. description = "Sets whether or not the Source is relative to the listener. If a Source is relative then its position, velocity, cone, and direction are all relative to the audio listener.",
  1558. key = "Source:setRelative",
  1559. module = "lovr.audio",
  1560. variants = {
  1561. {
  1562. arguments = {
  1563. {
  1564. name = "relative",
  1565. type = "boolean",
  1566. description = "Whether or not the Source is relative."
  1567. }
  1568. },
  1569. returns = {}
  1570. }
  1571. }
  1572. },
  1573. {
  1574. name = "setVelocity",
  1575. summary = "Set the velocity of the Source.",
  1576. description = "Sets the velocity of the Source, in meters per second. This affects the doppler effect.",
  1577. key = "Source:setVelocity",
  1578. module = "lovr.audio",
  1579. notes = "The Source does not move based on its velocity.",
  1580. variants = {
  1581. {
  1582. arguments = {
  1583. {
  1584. name = "x",
  1585. type = "number",
  1586. description = "The x velocity."
  1587. },
  1588. {
  1589. name = "y",
  1590. type = "number",
  1591. description = "The y velocity."
  1592. },
  1593. {
  1594. name = "z",
  1595. type = "number",
  1596. description = "The z velocity."
  1597. }
  1598. },
  1599. returns = {}
  1600. }
  1601. }
  1602. },
  1603. {
  1604. name = "setVolume",
  1605. summary = "Set the volume of the Source.",
  1606. description = "Sets the current volume factor for the Source. 1.0 is the default and the maximum.",
  1607. key = "Source:setVolume",
  1608. module = "lovr.audio",
  1609. variants = {
  1610. {
  1611. arguments = {
  1612. {
  1613. name = "volume",
  1614. type = "number",
  1615. description = "The new volume."
  1616. }
  1617. },
  1618. returns = {}
  1619. }
  1620. }
  1621. },
  1622. {
  1623. name = "setVolumeLimits",
  1624. summary = "Set the volume limits of the Source.",
  1625. description = "Sets the minimum and maximum volume of the Source. These limits have priority over the parameters set by `Source:setFalloff` and `Source:setCone`, so they can be used to make sure a Source can always be heard even if it's far away.",
  1626. key = "Source:setVolumeLimits",
  1627. module = "lovr.audio",
  1628. variants = {
  1629. {
  1630. arguments = {
  1631. {
  1632. name = "min",
  1633. type = "number",
  1634. description = "The minimum volume of the Source."
  1635. },
  1636. {
  1637. name = "max",
  1638. type = "number",
  1639. description = "The maximum volume of the Source."
  1640. }
  1641. },
  1642. returns = {}
  1643. }
  1644. }
  1645. },
  1646. {
  1647. name = "stop",
  1648. summary = "Stop the Source.",
  1649. description = "Stops the source.",
  1650. key = "Source:stop",
  1651. module = "lovr.audio",
  1652. variants = {
  1653. {
  1654. arguments = {},
  1655. returns = {}
  1656. }
  1657. }
  1658. },
  1659. {
  1660. name = "tell",
  1661. summary = "Get the playback position of the Source.",
  1662. description = "Returns the current playback position of the Source.",
  1663. key = "Source:tell",
  1664. module = "lovr.audio",
  1665. variants = {
  1666. {
  1667. arguments = {
  1668. {
  1669. name = "unit",
  1670. type = "TimeUnit",
  1671. description = "The unit to return.",
  1672. default = "'seconds'"
  1673. }
  1674. },
  1675. returns = {
  1676. {
  1677. name = "position",
  1678. type = "number",
  1679. description = "The current playback position."
  1680. }
  1681. }
  1682. }
  1683. }
  1684. }
  1685. },
  1686. constructors = {
  1687. "lovr.audio.newSource"
  1688. }
  1689. }
  1690. }
  1691. },
  1692. {
  1693. name = "event",
  1694. tag = "modules",
  1695. summary = "Handles events from the operating system.",
  1696. 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.",
  1697. key = "lovr.event",
  1698. functions = {
  1699. {
  1700. name = "clear",
  1701. summary = "Clear the event queue.",
  1702. description = "Clears the event queue, removing any unprocessed events.",
  1703. key = "lovr.event.clear",
  1704. module = "lovr.event",
  1705. variants = {
  1706. {
  1707. arguments = {},
  1708. returns = {}
  1709. }
  1710. }
  1711. },
  1712. {
  1713. name = "poll",
  1714. summary = "Iterate over unprocessed events in the queue.",
  1715. 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. Typically this function is automatically called for you by `lovr.step`.",
  1716. key = "lovr.event.poll",
  1717. module = "lovr.event",
  1718. variants = {
  1719. {
  1720. arguments = {},
  1721. returns = {
  1722. {
  1723. name = "iterator",
  1724. type = "function",
  1725. description = "The iterator function, usable in a for loop.",
  1726. arguments = {},
  1727. returns = {}
  1728. }
  1729. }
  1730. }
  1731. }
  1732. },
  1733. {
  1734. name = "pump",
  1735. summary = "Pump new events into the queue for processing.",
  1736. description = "Fills the event queue with unprocessed events from the operating system. This function should be called often, otherwise the operating system will consider your application unresponsive. By default, this function is called automatically by `lovr.step`.",
  1737. key = "lovr.event.pump",
  1738. module = "lovr.event",
  1739. related = {
  1740. "lovr.event.poll"
  1741. },
  1742. variants = {
  1743. {
  1744. arguments = {},
  1745. returns = {}
  1746. }
  1747. }
  1748. },
  1749. {
  1750. name = "push",
  1751. summary = "Manually push an event onto the queue.",
  1752. 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.",
  1753. key = "lovr.event.push",
  1754. module = "lovr.event",
  1755. related = {
  1756. "lovr.event.poll",
  1757. "lovr.event.quit"
  1758. },
  1759. variants = {
  1760. {
  1761. arguments = {
  1762. {
  1763. name = "name",
  1764. type = "string",
  1765. description = "The name of the event."
  1766. },
  1767. {
  1768. name = "...",
  1769. type = "*",
  1770. description = "The arguments for the event."
  1771. }
  1772. },
  1773. returns = {}
  1774. }
  1775. }
  1776. },
  1777. {
  1778. name = "quit",
  1779. summary = "Quit the application.",
  1780. description = "Pushes an event to quit the game. 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.",
  1781. key = "lovr.event.quit",
  1782. module = "lovr.event",
  1783. related = {
  1784. "lovr.quit",
  1785. "lovr.event.poll"
  1786. },
  1787. variants = {
  1788. {
  1789. arguments = {
  1790. {
  1791. name = "code",
  1792. type = "number",
  1793. description = "The exit code of the program.",
  1794. default = "0"
  1795. }
  1796. },
  1797. returns = {}
  1798. }
  1799. },
  1800. notes = "This function is equivalent to:\n\n lovr.event.push('quit', code)\n\nThe program won't actually exit until the next time `lovr.event.poll` is called."
  1801. }
  1802. },
  1803. examples = {
  1804. {
  1805. description = "Adding a custom event.",
  1806. 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"
  1807. }
  1808. },
  1809. enums = {},
  1810. objects = {},
  1811. 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`."
  1812. },
  1813. {
  1814. name = "filesystem",
  1815. tag = "modules",
  1816. summary = "Provides access to the filesystem.",
  1817. description = "The `lovr.filesystem` module provides access to the filesystem.",
  1818. key = "lovr.filesystem",
  1819. enums = {},
  1820. 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>\n <tr>\n <td>Linux</td>\n <td><code>/home/&lt;user&gt;/.local/share/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.",
  1821. functions = {
  1822. {
  1823. name = "append",
  1824. summary = "Append content to the end of a file.",
  1825. description = "Appends content to the end of the file.",
  1826. key = "lovr.filesystem.append",
  1827. module = "lovr.filesystem",
  1828. notes = "If the file does not exist, it is created.",
  1829. variants = {
  1830. {
  1831. arguments = {
  1832. {
  1833. name = "filename",
  1834. type = "string",
  1835. description = "The file to append to."
  1836. },
  1837. {
  1838. name = "content",
  1839. type = "string",
  1840. description = "A string to write to the end of the file."
  1841. }
  1842. },
  1843. returns = {
  1844. {
  1845. name = "bytes",
  1846. type = "number",
  1847. description = "The number of bytes written."
  1848. }
  1849. }
  1850. }
  1851. }
  1852. },
  1853. {
  1854. name = "createDirectory",
  1855. summary = "Create a directory.",
  1856. description = "Creates a directory in the save directory.",
  1857. key = "lovr.filesystem.createDirectory",
  1858. module = "lovr.filesystem",
  1859. variants = {
  1860. {
  1861. arguments = {
  1862. {
  1863. name = "path",
  1864. type = "string",
  1865. description = "The directory to create."
  1866. }
  1867. },
  1868. returns = {
  1869. {
  1870. name = "success",
  1871. type = "boolean",
  1872. description = "Whether the directory was created."
  1873. }
  1874. }
  1875. }
  1876. }
  1877. },
  1878. {
  1879. name = "exists",
  1880. summary = "Check whether a file exists.",
  1881. description = "Determine if a file exists.",
  1882. key = "lovr.filesystem.exists",
  1883. module = "lovr.filesystem",
  1884. notes = "This function checks both the source directory and the save directory.",
  1885. variants = {
  1886. {
  1887. arguments = {
  1888. {
  1889. name = "path",
  1890. type = "string",
  1891. description = "The path to check."
  1892. }
  1893. },
  1894. returns = {
  1895. {
  1896. name = "exists",
  1897. type = "boolean",
  1898. description = "Whether the path is a file or directory."
  1899. }
  1900. }
  1901. }
  1902. }
  1903. },
  1904. {
  1905. name = "getAppdataDirectory",
  1906. summary = "Get the application data directory.",
  1907. description = "Returns the application data directory. This will be something like `C:\\Users\\user\\AppData` on Windows, or `/Users/user/Library/Application Support` on macOS.",
  1908. key = "lovr.filesystem.getAppdataDirectory",
  1909. module = "lovr.filesystem",
  1910. variants = {
  1911. {
  1912. arguments = {},
  1913. returns = {
  1914. {
  1915. name = "path",
  1916. type = "string",
  1917. description = "The absolute path to the appdata directory."
  1918. }
  1919. }
  1920. }
  1921. }
  1922. },
  1923. {
  1924. name = "getDirectoryItems",
  1925. summary = "Get a list of files in a directory..",
  1926. description = "Returns an unsorted table containing all files and subfolders in a directory.",
  1927. key = "lovr.filesystem.getDirectoryItems",
  1928. module = "lovr.filesystem",
  1929. variants = {
  1930. {
  1931. arguments = {
  1932. {
  1933. name = "path",
  1934. type = "string",
  1935. description = "The directory."
  1936. }
  1937. },
  1938. returns = {
  1939. {
  1940. name = "table",
  1941. type = "items",
  1942. description = "A table with a string for each file and subfolder in the directory."
  1943. }
  1944. }
  1945. }
  1946. }
  1947. },
  1948. {
  1949. name = "getExecutablePath",
  1950. summary = "Get the path of the LÖVR executable.",
  1951. description = "Returns the absolute path of the LÖVR executable.",
  1952. key = "lovr.filesystem.getExecutablePath",
  1953. module = "lovr.filesystem",
  1954. variants = {
  1955. {
  1956. arguments = {},
  1957. returns = {
  1958. {
  1959. name = "path",
  1960. type = "string",
  1961. description = "The absolute path of the LÖVR executable."
  1962. }
  1963. }
  1964. }
  1965. }
  1966. },
  1967. {
  1968. name = "getIdentity",
  1969. summary = "Get the name of the save directory.",
  1970. description = "Returns the identity of the game, which is used as the name of the save directory. The default is `default`.",
  1971. key = "lovr.filesystem.getIdentity",
  1972. module = "lovr.filesystem",
  1973. variants = {
  1974. {
  1975. arguments = {},
  1976. returns = {
  1977. {
  1978. name = "identity",
  1979. type = "string",
  1980. description = "The name of the save directory."
  1981. }
  1982. }
  1983. }
  1984. }
  1985. },
  1986. {
  1987. name = "getLastModified",
  1988. summary = "Get the modification time of a file.",
  1989. description = "Returns when a file was last modified.",
  1990. key = "lovr.filesystem.getLastModified",
  1991. module = "lovr.filesystem",
  1992. variants = {
  1993. {
  1994. arguments = {
  1995. {
  1996. name = "file",
  1997. type = "string",
  1998. description = "The file."
  1999. }
  2000. },
  2001. returns = {
  2002. {
  2003. name = "time",
  2004. type = "number",
  2005. description = "The time when the file was last modified, in seconds."
  2006. }
  2007. }
  2008. }
  2009. }
  2010. },
  2011. {
  2012. name = "getRealDirectory",
  2013. summary = "Get the absolute path to a file.",
  2014. description = "Get the absolute path of a directory 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.",
  2015. key = "lovr.filesystem.getRealDirectory",
  2016. module = "lovr.filesystem",
  2017. variants = {
  2018. {
  2019. arguments = {
  2020. {
  2021. name = "path",
  2022. type = "string",
  2023. description = "The path to check."
  2024. }
  2025. },
  2026. returns = {
  2027. {
  2028. name = "realpath",
  2029. type = "string",
  2030. description = "The absolute path of the directory containing `path`."
  2031. }
  2032. }
  2033. }
  2034. }
  2035. },
  2036. {
  2037. name = "getSaveDirectory",
  2038. summary = "Get the location of the save directory.",
  2039. description = "Returns the absolute path to the save directory.",
  2040. key = "lovr.filesystem.getSaveDirectory",
  2041. module = "lovr.filesystem",
  2042. variants = {
  2043. {
  2044. arguments = {},
  2045. returns = {
  2046. {
  2047. name = "path",
  2048. type = "string",
  2049. description = "The absolute path to the save directory."
  2050. }
  2051. }
  2052. }
  2053. }
  2054. },
  2055. {
  2056. name = "getSize",
  2057. summary = "Get the size of a file.",
  2058. description = "Returns the size of a file, in bytes.",
  2059. key = "lovr.filesystem.getSize",
  2060. module = "lovr.filesystem",
  2061. variants = {
  2062. {
  2063. arguments = {
  2064. {
  2065. name = "file",
  2066. type = "string",
  2067. description = "The file."
  2068. }
  2069. },
  2070. returns = {
  2071. {
  2072. name = "size",
  2073. type = "number",
  2074. description = "The size of the file, in bytes."
  2075. }
  2076. }
  2077. }
  2078. }
  2079. },
  2080. {
  2081. name = "getSource",
  2082. summary = "Get the location of the project source.",
  2083. description = "Get the absolute path of the project's source directory or archive.",
  2084. key = "lovr.filesystem.getSource",
  2085. module = "lovr.filesystem",
  2086. variants = {
  2087. {
  2088. arguments = {},
  2089. returns = {
  2090. {
  2091. name = "path",
  2092. type = "string",
  2093. description = "The absolute path of the project's source."
  2094. }
  2095. }
  2096. }
  2097. }
  2098. },
  2099. {
  2100. name = "getUserDirectory",
  2101. summary = "Get the location of the user's home directory.",
  2102. description = "Returns the absolute path of the user's home directory.",
  2103. key = "lovr.filesystem.getUserDirectory",
  2104. module = "lovr.filesystem",
  2105. variants = {
  2106. {
  2107. arguments = {},
  2108. returns = {
  2109. {
  2110. name = "path",
  2111. type = "string",
  2112. description = "The absolute path of the user's home directory."
  2113. }
  2114. }
  2115. }
  2116. }
  2117. },
  2118. {
  2119. name = "isDirectory",
  2120. summary = "Check whether a path is a directory.",
  2121. description = "Check if a path exists and is a directory.",
  2122. key = "lovr.filesystem.isDirectory",
  2123. module = "lovr.filesystem",
  2124. related = {
  2125. "lovr.filesystem.isFile"
  2126. },
  2127. variants = {
  2128. {
  2129. arguments = {
  2130. {
  2131. name = "path",
  2132. type = "string",
  2133. description = "The path to check."
  2134. }
  2135. },
  2136. returns = {
  2137. {
  2138. name = "isDirectory",
  2139. type = "boolean",
  2140. description = "Whether or not path is a directory."
  2141. }
  2142. }
  2143. }
  2144. }
  2145. },
  2146. {
  2147. name = "isFile",
  2148. summary = "Check whether a path is a file.",
  2149. description = "Check if a path exists and is a file.",
  2150. key = "lovr.filesystem.isFile",
  2151. module = "lovr.filesystem",
  2152. related = {
  2153. "lovr.filesystem.isDirectory"
  2154. },
  2155. variants = {
  2156. {
  2157. arguments = {
  2158. {
  2159. name = "path",
  2160. type = "string",
  2161. description = "The path to check."
  2162. }
  2163. },
  2164. returns = {
  2165. {
  2166. name = "isFile",
  2167. type = "boolean",
  2168. description = "Whether or not path is a file."
  2169. }
  2170. }
  2171. }
  2172. }
  2173. },
  2174. {
  2175. name = "isFused",
  2176. summary = "Check if the project is fused.",
  2177. description = "Returns whether the current project source is fused to the executable.",
  2178. key = "lovr.filesystem.isFused",
  2179. module = "lovr.filesystem",
  2180. variants = {
  2181. {
  2182. arguments = {},
  2183. returns = {
  2184. {
  2185. name = "fused",
  2186. type = "boolean",
  2187. description = "Whether or not the project is fused."
  2188. }
  2189. }
  2190. }
  2191. }
  2192. },
  2193. {
  2194. name = "load",
  2195. summary = "Load a file as Lua code.",
  2196. description = "Load a file containing Lua code, returning a Lua chunk that can be run.",
  2197. key = "lovr.filesystem.load",
  2198. module = "lovr.filesystem",
  2199. notes = "An error is thrown if the file contains syntax errors.",
  2200. variants = {
  2201. {
  2202. arguments = {
  2203. {
  2204. name = "filename",
  2205. type = "string",
  2206. description = "The file to load."
  2207. }
  2208. },
  2209. returns = {
  2210. {
  2211. name = "chunk",
  2212. type = "function",
  2213. description = "The runnable chunk.",
  2214. arguments = {
  2215. {
  2216. name = "...",
  2217. type = "*"
  2218. }
  2219. },
  2220. returns = {
  2221. {
  2222. name = "...",
  2223. type = "*"
  2224. }
  2225. }
  2226. }
  2227. }
  2228. }
  2229. },
  2230. examples = {
  2231. {
  2232. description = "Safely loading code:",
  2233. 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"
  2234. }
  2235. }
  2236. },
  2237. {
  2238. name = "mount",
  2239. summary = "Mount a directory or archive.",
  2240. description = "Mounts a directory or `.zip` archive, adding it to the virtual filesystem. This allows you to read files from it.",
  2241. key = "lovr.filesystem.mount",
  2242. module = "lovr.filesystem",
  2243. related = {
  2244. "lovr.filesystem.unmount"
  2245. },
  2246. notes = "The `append` option lets you control the priority of the archive's files in the event of naming collisions.",
  2247. variants = {
  2248. {
  2249. arguments = {
  2250. {
  2251. name = "path",
  2252. type = "string",
  2253. description = "The path to mount."
  2254. },
  2255. {
  2256. name = "mountpoint",
  2257. type = "string",
  2258. description = "The path in the virtual filesystem to mount to.",
  2259. default = "'/'"
  2260. },
  2261. {
  2262. name = "append",
  2263. type = "boolean",
  2264. description = "Whether the archive will be added to the end or the beginning of the search path.",
  2265. default = "false"
  2266. }
  2267. },
  2268. returns = {}
  2269. }
  2270. },
  2271. examples = {
  2272. {
  2273. description = "Mount `data.zip` with a file `images/background.png`:",
  2274. code = "lovr.filesystem.mount('data.zip', 'assets')\nprint(lovr.filesystem.exists('assets/images/background.png')) -- true"
  2275. }
  2276. }
  2277. },
  2278. {
  2279. name = "newBlob",
  2280. summary = "Create a new Blob.",
  2281. description = "Creates a new Blob from a file.",
  2282. key = "lovr.filesystem.newBlob",
  2283. module = "lovr.filesystem",
  2284. variants = {
  2285. {
  2286. arguments = {
  2287. name = {
  2288. type = "string",
  2289. description = "A name for the Blob (used in error messages)"
  2290. },
  2291. filename = {
  2292. type = "string",
  2293. description = "The file to load."
  2294. },
  2295. str = {
  2296. type = "string",
  2297. description = "A string containing the Blob's contents."
  2298. }
  2299. },
  2300. returns = {
  2301. {
  2302. name = "blob",
  2303. type = "Blob",
  2304. description = "The new Blob."
  2305. }
  2306. }
  2307. }
  2308. }
  2309. },
  2310. {
  2311. name = "read",
  2312. summary = "Read a file.",
  2313. description = "Read the contents of a file.",
  2314. key = "lovr.filesystem.read",
  2315. module = "lovr.filesystem",
  2316. notes = "If the file does not exist or cannot be read, an error is thrown.",
  2317. variants = {
  2318. {
  2319. arguments = {
  2320. {
  2321. name = "filename",
  2322. type = "string",
  2323. description = "The name of the file to read."
  2324. }
  2325. },
  2326. returns = {
  2327. {
  2328. name = "contents",
  2329. type = "string",
  2330. description = "The contents of the file."
  2331. }
  2332. }
  2333. }
  2334. }
  2335. },
  2336. {
  2337. name = "remove",
  2338. summary = "Remove a file or directory.",
  2339. description = "Remove a file or directory in the save directory.",
  2340. key = "lovr.filesystem.remove",
  2341. module = "lovr.filesystem",
  2342. notes = "A directory can only be removed if it is empty.",
  2343. variants = {
  2344. {
  2345. arguments = {
  2346. {
  2347. name = "path",
  2348. type = "string",
  2349. description = "The file or folder to remove.."
  2350. }
  2351. },
  2352. returns = {
  2353. {
  2354. name = "success",
  2355. type = "boolean",
  2356. description = "Whether the path was removed."
  2357. }
  2358. }
  2359. }
  2360. }
  2361. },
  2362. {
  2363. name = "setIdentity",
  2364. summary = "Set the name of the save directory.",
  2365. description = "Set the name of the save directory.",
  2366. key = "lovr.filesystem.setIdentity",
  2367. module = "lovr.filesystem",
  2368. variants = {
  2369. {
  2370. arguments = {
  2371. {
  2372. name = "identity",
  2373. type = "string",
  2374. description = "The new name of the save directory."
  2375. }
  2376. },
  2377. returns = {}
  2378. }
  2379. }
  2380. },
  2381. {
  2382. name = "setSource",
  2383. summary = "Set the project source.",
  2384. description = "Sets the location of the project's source. This can only be done once, and is usually done internally.",
  2385. key = "lovr.filesystem.setSource",
  2386. module = "lovr.filesystem",
  2387. variants = {
  2388. {
  2389. arguments = {
  2390. {
  2391. name = "identity",
  2392. type = "string",
  2393. description = "The path containing the project's source."
  2394. }
  2395. },
  2396. returns = {}
  2397. }
  2398. }
  2399. },
  2400. {
  2401. name = "unmount",
  2402. summary = "Unmount a mounted archive.",
  2403. description = "Unmounts a directory or archive previously mounted with `lovr.filesystem.mount`.",
  2404. key = "lovr.filesystem.unmount",
  2405. module = "lovr.filesystem",
  2406. related = {
  2407. "lovr.filesystem.mount"
  2408. },
  2409. variants = {
  2410. {
  2411. arguments = {
  2412. {
  2413. name = "path",
  2414. type = "string",
  2415. description = "The path to unmount."
  2416. }
  2417. },
  2418. returns = {
  2419. {
  2420. name = "success",
  2421. type = "boolean",
  2422. description = "Whether the archive was unmounted."
  2423. }
  2424. }
  2425. }
  2426. }
  2427. },
  2428. {
  2429. name = "write",
  2430. summary = "Write to a file.",
  2431. description = "Write to a file.",
  2432. key = "lovr.filesystem.write",
  2433. module = "lovr.filesystem",
  2434. notes = "If the file does not exist, it is created.",
  2435. variants = {
  2436. {
  2437. arguments = {
  2438. {
  2439. name = "filename",
  2440. type = "string",
  2441. description = "The file to write to."
  2442. },
  2443. {
  2444. name = "content",
  2445. type = "string",
  2446. description = "A string to write to the file."
  2447. }
  2448. },
  2449. returns = {
  2450. {
  2451. name = "bytes",
  2452. type = "number",
  2453. description = "The number of bytes written."
  2454. }
  2455. }
  2456. }
  2457. }
  2458. }
  2459. },
  2460. objects = {
  2461. {
  2462. name = "Blob",
  2463. summary = "A loaded file object.",
  2464. description = "A Blob is an object that loads and holds the contents of a file. It can be passed to most functions that take filename arguments, like `lovr.graphics.newModel` or `lovr.audio.newSource`. Loading many objects this way is often faster because the file data only needs to be read once and can be reused. It can also be useful if file data is retrieved from some non-filesystem source, such as a network request.",
  2465. key = "Blob",
  2466. module = "lovr.filesystem",
  2467. methods = {
  2468. {
  2469. name = "getFilename",
  2470. summary = "Get the file the Blob was loaded from.",
  2471. description = "Returns the name of the file used to load the Blob, or the custom name given to it when it was created.",
  2472. key = "Blob:getFilename",
  2473. module = "lovr.filesystem",
  2474. variants = {
  2475. {
  2476. arguments = {},
  2477. returns = {
  2478. {
  2479. name = "filename",
  2480. type = "string",
  2481. description = "The name of the Blob."
  2482. }
  2483. }
  2484. }
  2485. }
  2486. },
  2487. {
  2488. name = "getPointer",
  2489. summary = "Get a raw pointer to the Blob's data.",
  2490. 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!",
  2491. key = "Blob:getPointer",
  2492. module = "lovr.filesystem",
  2493. variants = {
  2494. {
  2495. arguments = {},
  2496. returns = {
  2497. {
  2498. name = "pointer",
  2499. type = "userdata",
  2500. description = "A pointer to the data."
  2501. }
  2502. }
  2503. }
  2504. }
  2505. },
  2506. {
  2507. name = "getSize",
  2508. summary = "Get the size of the Blob's data.",
  2509. description = "Returns the size of the Blob's contents, in bytes.",
  2510. key = "Blob:getSize",
  2511. module = "lovr.filesystem",
  2512. variants = {
  2513. {
  2514. arguments = {},
  2515. returns = {
  2516. {
  2517. name = "bytes",
  2518. type = "number",
  2519. description = "The size of the Blob, in bytes."
  2520. }
  2521. }
  2522. }
  2523. }
  2524. },
  2525. {
  2526. name = "getString",
  2527. summary = "Get the Blob's contents as a string.",
  2528. description = "Returns a binary string containing the Blob's data.",
  2529. key = "Blob:getString",
  2530. module = "lovr.filesystem",
  2531. variants = {
  2532. {
  2533. arguments = {},
  2534. returns = {
  2535. {
  2536. name = "data",
  2537. type = "string",
  2538. description = "The Blob's data."
  2539. }
  2540. }
  2541. }
  2542. },
  2543. examples = {
  2544. {
  2545. description = "Manually copy a file using Blobs:",
  2546. code = "blob = lovr.filesystem.newBlob('image.png')\nlovr.filesystem.write('copy.png', blob:getString())"
  2547. }
  2548. }
  2549. }
  2550. },
  2551. constructors = {
  2552. "lovr.filesystem.newBlob"
  2553. }
  2554. }
  2555. }
  2556. },
  2557. {
  2558. name = "graphics",
  2559. tag = "modules",
  2560. summary = "Renders graphics.",
  2561. description = "The `lovr.graphics` module renders graphics to displays. Anything rendered using this module will automatically show up in the VR headset if one is connected, otherwise it will just show up in a window on the desktop.",
  2562. key = "lovr.graphics",
  2563. sections = {
  2564. {
  2565. name = "Drawing",
  2566. tag = "graphicsPrimitives",
  2567. description = "Simple functions for drawing simple shapes."
  2568. },
  2569. {
  2570. name = "Objects",
  2571. tag = "graphicsObjects",
  2572. description = "Several graphics-related objects can be created with the graphics module. Try to avoid calling these functions in `lovr.update` or `lovr.draw`, because then the objects will be loaded every frame, which can really slow things down!"
  2573. },
  2574. {
  2575. name = "Transforms",
  2576. tag = "graphicsTransforms",
  2577. description = "These functions manipulate the 3D coordinate system. By default the negative z axis points forwards and the positive y axis points up. Manipulating the coordinate system can be used to create a hierarchy of rendered objects. Thinking in many different coordinate systems can be challenging though, so be sure to brush up on 3D math first!"
  2578. },
  2579. {
  2580. name = "State",
  2581. tag = "graphicsState",
  2582. description = "These functions get or set graphics state. Graphics state is is a collection of small settings like the background color of the scene or the active shader. Keep in mind that all this state is **global**, so if you change a setting, the change will persist until that piece of state is changed again."
  2583. },
  2584. {
  2585. name = "Window",
  2586. tag = "window",
  2587. description = "Get info about the desktop window or operate on the underlying graphics context."
  2588. }
  2589. },
  2590. enums = {
  2591. {
  2592. name = "BlendAlphaMode",
  2593. summary = "Different ways of blending alpha.",
  2594. description = "Different ways the alpha channel of pixels affects blending.",
  2595. key = "BlendAlphaMode",
  2596. module = "graphics",
  2597. notes = "The premultiplied mode should be used if pixels being drawn have already been blended, or \"pre-multiplied\", by the alpha channel. This happens when rendering a framebuffer that contains pixels with transparent alpha values, since the stored color values have already been faded by alpha and don't need to be faded a second time with the alphamultiply blend mode.",
  2598. related = {
  2599. "BlendMode",
  2600. "lovr.graphics.getBlendMode",
  2601. "lovr.graphics.setBlendMode"
  2602. },
  2603. values = {
  2604. {
  2605. name = "alphamultiply",
  2606. description = "Color channel values are multiplied by the alpha channel during blending."
  2607. },
  2608. {
  2609. name = "premultiplied",
  2610. description = "Color channels are not multiplied by the alpha channel. This should be used if the pixels being drawn have already been blended, or \"pre-multiplied\", by the alpha channel."
  2611. }
  2612. }
  2613. },
  2614. {
  2615. name = "BlendMode",
  2616. summary = "Different blend modes.",
  2617. description = "Blend modes control how overlapping pixels are blended together, similar to layers in Photoshop.",
  2618. key = "BlendMode",
  2619. module = "graphics",
  2620. values = {
  2621. {
  2622. name = "alpha",
  2623. description = "Normal blending where the alpha value controls how the colors are blended."
  2624. },
  2625. {
  2626. name = "add",
  2627. description = "The incoming pixel color is added to the destination pixel color."
  2628. },
  2629. {
  2630. name = "subtract",
  2631. description = "The incoming pixel color is subtracted from the destination pixel color."
  2632. },
  2633. {
  2634. name = "multiply",
  2635. description = "The color channels from the two pixel values are multiplied together to produce a result."
  2636. },
  2637. {
  2638. name = "lighten",
  2639. description = "The maximum value from each color channel is used, resulting in a lightening effect."
  2640. },
  2641. {
  2642. name = "darken",
  2643. description = "The minimum value from each color channel is used, resulting in a darkening effect."
  2644. },
  2645. {
  2646. name = "screen",
  2647. description = "The opposite of multiply: The pixel values are inverted, multiplied, and inverted again, resulting in a lightening effect."
  2648. },
  2649. {
  2650. name = "replace",
  2651. description = "The incoming pixel replaces the destination pixel."
  2652. }
  2653. },
  2654. related = {
  2655. "BlendAlphaMode",
  2656. "lovr.graphics.getBlendMode",
  2657. "lovr.graphics.setBlendMode"
  2658. }
  2659. },
  2660. {
  2661. name = "CompareMode",
  2662. summary = "Different depth test modes.",
  2663. description = "The method used to compare z values when deciding how to overlap rendered objects. This is called the \"depth test\", and it happens on a pixel-by-pixel basis every time new objects are drawn. If the depth test \"passes\" for a pixel, then the pixel color will be replaced by the new color and the depth value in the depth buffer will be updated. Otherwise, the pixel will not be changed and the depth value will not be updated.",
  2664. key = "CompareMode",
  2665. module = "graphics",
  2666. values = {
  2667. {
  2668. name = "equal",
  2669. description = "The depth test passes when the depth values are equal."
  2670. },
  2671. {
  2672. name = "notequal",
  2673. description = "The depth test passes when the depth values are not equal."
  2674. },
  2675. {
  2676. name = "less",
  2677. description = "The depth test passes when the new depth value is less than the existing one."
  2678. },
  2679. {
  2680. name = "lequal",
  2681. description = "The depth test passes when the new depth value is less than or equal to the existing one."
  2682. },
  2683. {
  2684. name = "gequal",
  2685. description = "The depth test passes when the new depth value is greater than or equal to the existing one."
  2686. },
  2687. {
  2688. name = "greater",
  2689. description = "The depth test passes when the new depth value is greater than the existing one."
  2690. }
  2691. }
  2692. },
  2693. {
  2694. name = "DrawMode",
  2695. summary = "Different ways graphics primitives can be drawn.",
  2696. description = "Most graphics primitives can be drawn in one of two modes: a filled mode and a wireframe mode.",
  2697. key = "DrawMode",
  2698. module = "graphics",
  2699. values = {
  2700. {
  2701. name = "fill",
  2702. description = "The shape is drawn as a filled object."
  2703. },
  2704. {
  2705. name = "line",
  2706. description = "The shape is drawn as a wireframe object."
  2707. }
  2708. }
  2709. },
  2710. {
  2711. name = "FilterMode",
  2712. summary = "How textures are sampled.",
  2713. description = "The method used to downsample (or upsample) a texture. \"nearest\" can be used for a pixelated effect, whereas \"linear\" leads to more smooth results. Nearest is slightly faster than linear.",
  2714. key = "FilterMode",
  2715. module = "graphics",
  2716. values = {
  2717. {
  2718. name = "linear",
  2719. description = "The texture will be smoothed."
  2720. },
  2721. {
  2722. name = "nearest",
  2723. description = "The texture will be pixelated."
  2724. }
  2725. }
  2726. },
  2727. {
  2728. name = "HorizontalAlign",
  2729. summary = "Different ways to horizontally align text.",
  2730. description = "Different ways to horizontally align text when using `lovr.graphics.print`.",
  2731. key = "HorizontalAlign",
  2732. module = "graphics",
  2733. values = {
  2734. {
  2735. name = "left",
  2736. description = "Left aligned lines of text."
  2737. },
  2738. {
  2739. name = "center",
  2740. description = "Centered aligned lines of text."
  2741. },
  2742. {
  2743. name = "right",
  2744. description = "Right aligned lines of text."
  2745. }
  2746. },
  2747. related = {
  2748. "VerticalAlign",
  2749. "lovr.graphics.print"
  2750. }
  2751. },
  2752. {
  2753. name = "MeshDrawMode",
  2754. summary = "Different ways Mesh objects can be drawn.",
  2755. description = "Meshes are lists of arbitrary vertices. These vertices can be drawn in a few different ways, leading to different results.",
  2756. key = "MeshDrawMode",
  2757. module = "graphics",
  2758. values = {
  2759. {
  2760. name = "points",
  2761. description = "Draw each vertex as a single point."
  2762. },
  2763. {
  2764. name = "strip",
  2765. description = "The first three vertices define a triangle. Each vertex after that creates a triangle using the new vertex and last two vertices."
  2766. },
  2767. {
  2768. name = "triangles",
  2769. description = "Each set of three vertices represents a discrete triangle."
  2770. },
  2771. {
  2772. name = "fan",
  2773. description = "Draws a set of triangles. Each one shares the first vertex as a common point, leading to a fan-like shape."
  2774. }
  2775. }
  2776. },
  2777. {
  2778. name = "MeshUsage",
  2779. summary = "How a Mesh is going to be updated.",
  2780. description = "Meshes can have a usage hint, describing how they are planning on being updated. Setting the usage hint allows the graphics driver optimize how it handles the data in the Mesh.",
  2781. key = "MeshUsage",
  2782. module = "graphics",
  2783. values = {
  2784. {
  2785. name = "static",
  2786. description = "The Mesh contents will rarely change."
  2787. },
  2788. {
  2789. name = "dynamic",
  2790. description = "The Mesh contents will change often."
  2791. },
  2792. {
  2793. name = "stream",
  2794. description = "The Mesh contents will change constantly, potentially multiple times each frame."
  2795. }
  2796. }
  2797. },
  2798. {
  2799. name = "PolygonWinding",
  2800. summary = "Different winding directions.",
  2801. description = "Whether the points on triangles are specified in a clockwise or counterclockwise order.",
  2802. key = "PolygonWinding",
  2803. module = "graphics",
  2804. values = {
  2805. {
  2806. name = "clockwise",
  2807. description = "Triangle vertices are specified in a clockwise order."
  2808. },
  2809. {
  2810. name = "counterclockwise",
  2811. description = "Triangle vertices are specified in a counterclockwise order."
  2812. }
  2813. }
  2814. },
  2815. {
  2816. name = "TextureProjection",
  2817. summary = "Different projection types for renderable textures.",
  2818. description = "When creating Textures to be used as render targets, they can be created in either \"2d\" or \"3d\" mode. 2D mode is good for 2D user interfaces or postprocessing, whereas 3d is useful for portals, weapon scopes, mirrors, and other situations where 3D content needs to be rendered.",
  2819. key = "TextureProjection",
  2820. module = "graphics",
  2821. values = {
  2822. {
  2823. name = "2d",
  2824. description = "Use an orthographic projection."
  2825. },
  2826. {
  2827. name = "3d",
  2828. description = "Use a perspective projection."
  2829. }
  2830. }
  2831. },
  2832. {
  2833. name = "VerticalAlign",
  2834. summary = "Different ways to vertically align text.",
  2835. description = "Different ways to vertically align text when using `lovr.graphics.print`.",
  2836. key = "VerticalAlign",
  2837. module = "graphics",
  2838. values = {
  2839. {
  2840. name = "top",
  2841. description = "Align the top of the text to the origin."
  2842. },
  2843. {
  2844. name = "middle",
  2845. description = "Vertically center the text."
  2846. },
  2847. {
  2848. name = "bottom",
  2849. description = "Align the bottom of the text to the origin."
  2850. }
  2851. },
  2852. related = {
  2853. "HorizontalAlign",
  2854. "lovr.graphics.print"
  2855. }
  2856. },
  2857. {
  2858. name = "WrapMode",
  2859. summary = "How to wrap Textures.",
  2860. description = "The method used to render textures when texture coordinates are outside of the 0-1 range.",
  2861. key = "WrapMode",
  2862. module = "graphics",
  2863. values = {
  2864. {
  2865. name = "clamp",
  2866. description = "The texture will be clamped at its edges."
  2867. },
  2868. {
  2869. name = "repeat",
  2870. description = "The texture repeats."
  2871. },
  2872. {
  2873. name = "mirroredrepeat",
  2874. description = "The texture will repeat, mirroring its appearance each time it repeats."
  2875. }
  2876. }
  2877. }
  2878. },
  2879. functions = {
  2880. {
  2881. name = "box",
  2882. tag = "graphicsPrimitives",
  2883. summary = "Draw a box.",
  2884. description = "Draws a box. This is similar to `lovr.graphics.cube` except you can have different values for the width, height, and depth of the box.",
  2885. key = "lovr.graphics.box",
  2886. module = "lovr.graphics",
  2887. variants = {
  2888. {
  2889. arguments = {
  2890. {
  2891. name = "mode",
  2892. type = "DrawMode",
  2893. description = "How to draw the box."
  2894. },
  2895. {
  2896. name = "x",
  2897. type = "number",
  2898. description = "The x coordinate of the center of the box.",
  2899. default = "0"
  2900. },
  2901. {
  2902. name = "y",
  2903. type = "number",
  2904. description = "The y coordinate of the center of the box.",
  2905. default = "0"
  2906. },
  2907. {
  2908. name = "z",
  2909. type = "number",
  2910. description = "The z coordinate of the center of the box.",
  2911. default = "0"
  2912. },
  2913. {
  2914. name = "width",
  2915. type = "number",
  2916. description = "The width of the box, in meters.",
  2917. default = "1"
  2918. },
  2919. {
  2920. name = "height",
  2921. type = "number",
  2922. description = "The height of the box, in meters.",
  2923. default = "1"
  2924. },
  2925. {
  2926. name = "depth",
  2927. type = "number",
  2928. description = "The depth of the box, in meters.",
  2929. default = "1"
  2930. },
  2931. {
  2932. name = "angle",
  2933. type = "number",
  2934. description = "The rotation of the box around its rotation axis, in radians.",
  2935. default = "0"
  2936. },
  2937. {
  2938. name = "ax",
  2939. type = "number",
  2940. description = "The x coordinate of the axis of rotation.",
  2941. default = "0"
  2942. },
  2943. {
  2944. name = "ay",
  2945. type = "number",
  2946. description = "The y coordinate of the axis of rotation.",
  2947. default = "1"
  2948. },
  2949. {
  2950. name = "az",
  2951. type = "number",
  2952. description = "The z coordinate of the axis of rotation.",
  2953. default = "0"
  2954. }
  2955. },
  2956. returns = {}
  2957. },
  2958. {
  2959. arguments = {
  2960. {
  2961. name = "texture",
  2962. type = "Texture",
  2963. description = "The Texture to apply to the box."
  2964. },
  2965. {
  2966. name = "x",
  2967. type = "number",
  2968. description = "The x coordinate of the center of the box.",
  2969. default = "0"
  2970. },
  2971. {
  2972. name = "y",
  2973. type = "number",
  2974. description = "The y coordinate of the center of the box.",
  2975. default = "0"
  2976. },
  2977. {
  2978. name = "z",
  2979. type = "number",
  2980. description = "The z coordinate of the center of the box.",
  2981. default = "0"
  2982. },
  2983. {
  2984. name = "width",
  2985. type = "number",
  2986. description = "The width of the box, in meters.",
  2987. default = "1"
  2988. },
  2989. {
  2990. name = "height",
  2991. type = "number",
  2992. description = "The height of the box, in meters.",
  2993. default = "1"
  2994. },
  2995. {
  2996. name = "depth",
  2997. type = "number",
  2998. description = "The depth of the box, in meters.",
  2999. default = "1"
  3000. },
  3001. {
  3002. name = "angle",
  3003. type = "number",
  3004. description = "The rotation of the box around its rotation axis, in radians.",
  3005. default = "0"
  3006. },
  3007. {
  3008. name = "ax",
  3009. type = "number",
  3010. description = "The x coordinate of the axis of rotation.",
  3011. default = "0"
  3012. },
  3013. {
  3014. name = "ay",
  3015. type = "number",
  3016. description = "The y coordinate of the axis of rotation.",
  3017. default = "1"
  3018. },
  3019. {
  3020. name = "az",
  3021. type = "number",
  3022. description = "The z coordinate of the axis of rotation.",
  3023. default = "0"
  3024. }
  3025. },
  3026. returns = {}
  3027. },
  3028. {
  3029. arguments = {
  3030. {
  3031. name = "mode",
  3032. type = "DrawMode",
  3033. description = "How to draw the box."
  3034. },
  3035. {
  3036. name = "transform",
  3037. type = "Transform",
  3038. description = "The transform of the box."
  3039. }
  3040. },
  3041. returns = {}
  3042. },
  3043. {
  3044. arguments = {
  3045. {
  3046. name = "texture",
  3047. type = "Texture",
  3048. description = "The Texture to apply to the box."
  3049. },
  3050. {
  3051. name = "transform",
  3052. type = "Transform",
  3053. description = "The transform of the box."
  3054. }
  3055. },
  3056. returns = {}
  3057. }
  3058. }
  3059. },
  3060. {
  3061. name = "clear",
  3062. tag = "window",
  3063. summary = "Clear the screen.",
  3064. description = "Clears the screen to the background color. This function is called automatically by `lovr.step`.",
  3065. key = "lovr.graphics.clear",
  3066. module = "lovr.graphics",
  3067. related = {
  3068. "lovr.graphics.setBackgroundColor"
  3069. },
  3070. variants = {
  3071. {
  3072. arguments = {
  3073. {
  3074. name = "color",
  3075. type = "boolean",
  3076. description = "Whether or not to clear color information on the screen.",
  3077. default = "true"
  3078. },
  3079. {
  3080. name = "depth",
  3081. type = "boolean",
  3082. description = "Whether or not to clear the depth information on the screen.",
  3083. default = "true"
  3084. }
  3085. },
  3086. returns = {}
  3087. }
  3088. }
  3089. },
  3090. {
  3091. name = "cube",
  3092. tag = "graphicsPrimitives",
  3093. summary = "Draw a cube.",
  3094. description = "Draws a cube.",
  3095. key = "lovr.graphics.cube",
  3096. module = "lovr.graphics",
  3097. variants = {
  3098. {
  3099. arguments = {
  3100. {
  3101. name = "mode",
  3102. type = "DrawMode",
  3103. description = "How to draw the cube."
  3104. },
  3105. {
  3106. name = "x",
  3107. type = "number",
  3108. description = "The x coordinate of the center of the cube.",
  3109. default = "0"
  3110. },
  3111. {
  3112. name = "y",
  3113. type = "number",
  3114. description = "The y coordinate of the center of the cube.",
  3115. default = "0"
  3116. },
  3117. {
  3118. name = "z",
  3119. type = "number",
  3120. description = "The z coordinate of the center of the cube.",
  3121. default = "0"
  3122. },
  3123. {
  3124. name = "size",
  3125. type = "number",
  3126. description = "The size of the cube, in meters.",
  3127. default = "1"
  3128. },
  3129. {
  3130. name = "angle",
  3131. type = "number",
  3132. description = "The rotation of the cube around its rotation axis, in radians.",
  3133. default = "0"
  3134. },
  3135. {
  3136. name = "ax",
  3137. type = "number",
  3138. description = "The x coordinate of the cube's axis of rotation.",
  3139. default = "0"
  3140. },
  3141. {
  3142. name = "ay",
  3143. type = "number",
  3144. description = "The y coordinate of the cube's axis of rotation.",
  3145. default = "1"
  3146. },
  3147. {
  3148. name = "az",
  3149. type = "number",
  3150. description = "The z coordinate of the cube's axis of rotation.",
  3151. default = "0"
  3152. }
  3153. },
  3154. returns = {}
  3155. },
  3156. {
  3157. arguments = {
  3158. {
  3159. name = "texture",
  3160. type = "Texture",
  3161. description = "The Texture to apply to the cube faces."
  3162. },
  3163. {
  3164. name = "x",
  3165. type = "number",
  3166. description = "The x coordinate of the center of the cube.",
  3167. default = "0"
  3168. },
  3169. {
  3170. name = "y",
  3171. type = "number",
  3172. description = "The y coordinate of the center of the cube.",
  3173. default = "0"
  3174. },
  3175. {
  3176. name = "z",
  3177. type = "number",
  3178. description = "The z coordinate of the center of the cube.",
  3179. default = "0"
  3180. },
  3181. {
  3182. name = "size",
  3183. type = "number",
  3184. description = "The size of the cube, in meters.",
  3185. default = "1"
  3186. },
  3187. {
  3188. name = "angle",
  3189. type = "number",
  3190. description = "The rotation of the cube around its rotation axis, in radians.",
  3191. default = "0"
  3192. },
  3193. {
  3194. name = "ax",
  3195. type = "number",
  3196. description = "The x coordinate of the cube's axis of rotation.",
  3197. default = "0"
  3198. },
  3199. {
  3200. name = "ay",
  3201. type = "number",
  3202. description = "The y coordinate of the cube's axis of rotation.",
  3203. default = "1"
  3204. },
  3205. {
  3206. name = "az",
  3207. type = "number",
  3208. description = "The z coordinate of the cube's axis of rotation.",
  3209. default = "0"
  3210. }
  3211. },
  3212. returns = {}
  3213. },
  3214. {
  3215. arguments = {
  3216. {
  3217. name = "mode",
  3218. type = "DrawMode",
  3219. description = "How to draw the cube."
  3220. },
  3221. {
  3222. name = "transform",
  3223. type = "Transform",
  3224. description = "The cube's transform."
  3225. }
  3226. },
  3227. returns = {}
  3228. },
  3229. {
  3230. arguments = {
  3231. {
  3232. name = "texture",
  3233. type = "Texture",
  3234. description = "The Texture to apply to the cube faces."
  3235. },
  3236. {
  3237. name = "transform",
  3238. type = "Transform",
  3239. description = "The cube's transform."
  3240. }
  3241. },
  3242. returns = {}
  3243. }
  3244. }
  3245. },
  3246. {
  3247. name = "cylinder",
  3248. tag = "graphicsPrimitives",
  3249. summary = "Draw a cylinder.",
  3250. description = "Draws a cylinder.",
  3251. key = "lovr.graphics.cylinder",
  3252. module = "lovr.graphics",
  3253. variants = {
  3254. {
  3255. arguments = {
  3256. {
  3257. name = "x1",
  3258. type = "number",
  3259. description = "The x coordinate of the top of the cylinder."
  3260. },
  3261. {
  3262. name = "y1",
  3263. type = "number",
  3264. description = "The y coordinate of the top of the cylinder."
  3265. },
  3266. {
  3267. name = "z1",
  3268. type = "number",
  3269. description = "The z coordinate of the top of the cylinder."
  3270. },
  3271. {
  3272. name = "x2",
  3273. type = "number",
  3274. description = "The x coordinate of the bottom of the cylinder."
  3275. },
  3276. {
  3277. name = "y2",
  3278. type = "number",
  3279. description = "The y coordinate of the bottom of the cylinder."
  3280. },
  3281. {
  3282. name = "z2",
  3283. type = "number",
  3284. description = "The z coordinate of the bottom of the cylinder."
  3285. },
  3286. {
  3287. name = "r1",
  3288. type = "number",
  3289. description = "The radius of the top of the cylinder.",
  3290. default = "1"
  3291. },
  3292. {
  3293. name = "r2",
  3294. type = "number",
  3295. description = "The radius of the bottom of the cylinder.",
  3296. default = "1"
  3297. },
  3298. {
  3299. name = "capped",
  3300. type = "boolean",
  3301. description = "Whether the top and bottom should be rendered.",
  3302. default = "true"
  3303. },
  3304. {
  3305. name = "segments",
  3306. type = "number",
  3307. description = "The number of radial segments to use for the cylinder. If nil, the segment count is automatically determined from the radii.",
  3308. default = "nil"
  3309. }
  3310. },
  3311. returns = {}
  3312. }
  3313. }
  3314. },
  3315. {
  3316. name = "getBackgroundColor",
  3317. tag = "graphicsState",
  3318. summary = "Get the background color.",
  3319. description = "Returns the current background color. Color components are from 0 to 255.",
  3320. key = "lovr.graphics.getBackgroundColor",
  3321. module = "lovr.graphics",
  3322. variants = {
  3323. {
  3324. arguments = {},
  3325. returns = {
  3326. {
  3327. name = "r",
  3328. type = "number",
  3329. description = "The red component of the background color."
  3330. },
  3331. {
  3332. name = "g",
  3333. type = "number",
  3334. description = "The green component of the background color."
  3335. },
  3336. {
  3337. name = "b",
  3338. type = "number",
  3339. description = "The blue component of the background color."
  3340. },
  3341. {
  3342. name = "a",
  3343. type = "number",
  3344. description = "The alpha component of the background color."
  3345. }
  3346. }
  3347. }
  3348. },
  3349. notes = "The default background color is black."
  3350. },
  3351. {
  3352. name = "getBlendMode",
  3353. tag = "graphicsState",
  3354. summary = "Get the blend mode.",
  3355. description = "Returns the current blend mode. The blend mode controls how each pixel's color is blended with the previous pixel's color when drawn.",
  3356. key = "lovr.graphics.getBlendMode",
  3357. module = "lovr.graphics",
  3358. related = {
  3359. "BlendMode",
  3360. "BlendAlphaMode"
  3361. },
  3362. variants = {
  3363. {
  3364. arguments = {},
  3365. returns = {
  3366. {
  3367. name = "blend",
  3368. type = "BlendMode",
  3369. description = "The current blend mode."
  3370. },
  3371. {
  3372. name = "alphaBlend",
  3373. type = "BlendAlphaMode",
  3374. description = "The current alpha blend mode."
  3375. }
  3376. }
  3377. }
  3378. }
  3379. },
  3380. {
  3381. name = "getColor",
  3382. tag = "graphicsState",
  3383. summary = "Get the global color factor.",
  3384. description = "Returns the current global color factor. Color components are from 0 to 255. Every pixel drawn will be multiplied (i.e. tinted) by this color.",
  3385. key = "lovr.graphics.getColor",
  3386. module = "lovr.graphics",
  3387. variants = {
  3388. {
  3389. arguments = {},
  3390. returns = {
  3391. {
  3392. name = "r",
  3393. type = "number",
  3394. description = "The red component of the color."
  3395. },
  3396. {
  3397. name = "g",
  3398. type = "number",
  3399. description = "The green component of the color."
  3400. },
  3401. {
  3402. name = "b",
  3403. type = "number",
  3404. description = "The blue component of the color."
  3405. },
  3406. {
  3407. name = "a",
  3408. type = "number",
  3409. description = "The alpha component of the color."
  3410. }
  3411. }
  3412. }
  3413. },
  3414. notes = "The default color is white."
  3415. },
  3416. {
  3417. name = "getColorMask",
  3418. tag = "graphicsState",
  3419. summary = "Get the color mask.",
  3420. description = "Returns the active color channels. If a color channel is active, then drawing operations will affect that particular channel.",
  3421. key = "lovr.graphics.getColorMask",
  3422. module = "lovr.graphics",
  3423. variants = {
  3424. {
  3425. arguments = {},
  3426. returns = {
  3427. {
  3428. name = "r",
  3429. type = "boolean",
  3430. description = "Whether or not the red channel is enabled."
  3431. },
  3432. {
  3433. name = "g",
  3434. type = "boolean",
  3435. description = "Whether or not the green channel is enabled."
  3436. },
  3437. {
  3438. name = "b",
  3439. type = "boolean",
  3440. description = "Whether or not the blue channel is enabled."
  3441. },
  3442. {
  3443. name = "a",
  3444. type = "boolean",
  3445. description = "Whether or not the alpha channel is enabled."
  3446. }
  3447. }
  3448. }
  3449. },
  3450. notes = "Initially, all color channels are enabled."
  3451. },
  3452. {
  3453. name = "getDepthTest",
  3454. tag = "graphicsState",
  3455. summary = "Get the depth test mode.",
  3456. description = "Returns the current depth test. The depth test controls how overlapping objects are rendered.",
  3457. key = "lovr.graphics.getDepthTest",
  3458. module = "lovr.graphics",
  3459. variants = {
  3460. {
  3461. arguments = {},
  3462. returns = {
  3463. {
  3464. name = "compareMode",
  3465. type = "CompareMode",
  3466. description = "The current depth test."
  3467. }
  3468. }
  3469. }
  3470. },
  3471. notes = "The default depth test is `less`."
  3472. },
  3473. {
  3474. name = "getDimensions",
  3475. tag = "window",
  3476. summary = "Get the dimensions of the window.",
  3477. description = "Returns the dimensions of the desktop window.",
  3478. key = "lovr.graphics.getDimensions",
  3479. module = "lovr.graphics",
  3480. related = {
  3481. "lovr.graphics.getWidth",
  3482. "lovr.graphics.getHeight"
  3483. },
  3484. variants = {
  3485. {
  3486. arguments = {},
  3487. returns = {
  3488. {
  3489. name = "width",
  3490. type = "number",
  3491. description = "The width of the window, in pixels."
  3492. },
  3493. {
  3494. name = "height",
  3495. type = "number",
  3496. description = "The height of the window, in pixels."
  3497. }
  3498. }
  3499. }
  3500. }
  3501. },
  3502. {
  3503. name = "getFont",
  3504. tag = "graphicsState",
  3505. summary = "Get the active font.",
  3506. description = "Returns the active font.",
  3507. key = "lovr.graphics.getFont",
  3508. module = "lovr.graphics",
  3509. related = {
  3510. "lovr.graphics.print"
  3511. },
  3512. variants = {
  3513. {
  3514. arguments = {},
  3515. returns = {
  3516. {
  3517. name = "font",
  3518. type = "Font",
  3519. description = "The active font object."
  3520. }
  3521. }
  3522. }
  3523. }
  3524. },
  3525. {
  3526. name = "getHeight",
  3527. tag = "window",
  3528. summary = "Get the height of the window.",
  3529. description = "Returns the height of the desktop window.",
  3530. key = "lovr.graphics.getHeight",
  3531. module = "lovr.graphics",
  3532. related = {
  3533. "lovr.graphics.getWidth",
  3534. "lovr.graphics.getDimensions"
  3535. },
  3536. variants = {
  3537. {
  3538. arguments = {},
  3539. returns = {
  3540. {
  3541. name = "height",
  3542. type = "number",
  3543. description = "The height of the window, in pixels."
  3544. }
  3545. }
  3546. }
  3547. }
  3548. },
  3549. {
  3550. name = "getLineWidth",
  3551. tag = "graphicsState",
  3552. summary = "Get the line width.",
  3553. description = "Returns the current line width.",
  3554. key = "lovr.graphics.getLineWidth",
  3555. module = "lovr.graphics",
  3556. variants = {
  3557. {
  3558. arguments = {},
  3559. returns = {
  3560. {
  3561. name = "width",
  3562. type = "number",
  3563. description = "The current line width, in pixels."
  3564. }
  3565. }
  3566. }
  3567. },
  3568. related = {
  3569. "lovr.graphics.line"
  3570. },
  3571. notes = "The default line width is `1.0`."
  3572. },
  3573. {
  3574. name = "getPointSize",
  3575. tag = "graphicsState",
  3576. summary = "Get the point size.",
  3577. description = "Returns the current point size.",
  3578. key = "lovr.graphics.getPointSize",
  3579. module = "lovr.graphics",
  3580. variants = {
  3581. {
  3582. arguments = {},
  3583. returns = {
  3584. {
  3585. name = "size",
  3586. type = "number",
  3587. description = "The current point size, in pixels."
  3588. }
  3589. }
  3590. }
  3591. },
  3592. related = {
  3593. "lovr.graphics.points"
  3594. },
  3595. notes = "The default point size is `1.0`."
  3596. },
  3597. {
  3598. name = "getPolygonWinding",
  3599. tag = "graphicsState",
  3600. summary = "Get the winding direction.",
  3601. description = "Returns the current polygon winding. The winding direction determines which face of a triangle is the front face and which is the back face. This lets the graphics engine cull the back faces of polygons, improving performance.",
  3602. key = "lovr.graphics.getPolygonWinding",
  3603. module = "lovr.graphics",
  3604. variants = {
  3605. {
  3606. arguments = {},
  3607. returns = {
  3608. {
  3609. name = "winding",
  3610. type = "PolygonWinding",
  3611. description = "The current winding direction."
  3612. }
  3613. }
  3614. }
  3615. },
  3616. related = {
  3617. "lovr.graphics.setCullingEnabled",
  3618. "lovr.graphics.isCullingEnabled"
  3619. },
  3620. notes = "Culling is initially disabled and must be enabled using `lovr.graphics.setCullingEnabled`.\n\nThe default winding direction is counterclockwise."
  3621. },
  3622. {
  3623. name = "getScissor",
  3624. tag = "graphicsState",
  3625. summary = "Get the scissor rectangle.",
  3626. description = "Returns the current scissor. The scissor is a rectangular area of the screen. Any pixels outside the scissor region will be unaffected by drawing operations.",
  3627. key = "lovr.graphics.getScissor",
  3628. module = "lovr.graphics",
  3629. variants = {
  3630. {
  3631. arguments = {},
  3632. returns = {
  3633. {
  3634. name = "x",
  3635. type = "number",
  3636. description = "The x position of the upper left corner of the scissor."
  3637. },
  3638. {
  3639. name = "y",
  3640. type = "number",
  3641. description = "The y position of the upper left corner of the scissor."
  3642. },
  3643. {
  3644. name = "w",
  3645. type = "number",
  3646. description = "The width of the scissor in pixels."
  3647. },
  3648. {
  3649. name = "h",
  3650. type = "number",
  3651. description = "The height of the scissor in pixels."
  3652. }
  3653. }
  3654. }
  3655. }
  3656. },
  3657. {
  3658. name = "getShader",
  3659. tag = "graphicsState",
  3660. summary = "Get the active shader.",
  3661. description = "Returns the active shader.",
  3662. key = "lovr.graphics.getShader",
  3663. module = "lovr.graphics",
  3664. variants = {
  3665. {
  3666. arguments = {},
  3667. returns = {
  3668. {
  3669. name = "shader",
  3670. type = "Shader",
  3671. description = "The active shader object, or `nil` if none is active."
  3672. }
  3673. }
  3674. }
  3675. }
  3676. },
  3677. {
  3678. name = "getSystemLimits",
  3679. tag = "graphicsState",
  3680. summary = "Get capabilities of the graphics card.",
  3681. description = "Returns information about the capabilities of the graphics card, such as the maximum texture size or the amount of supported antialiasing.",
  3682. key = "lovr.graphics.getSystemLimits",
  3683. module = "lovr.graphics",
  3684. variants = {
  3685. {
  3686. arguments = {},
  3687. returns = {
  3688. {
  3689. name = "limits",
  3690. type = "table",
  3691. description = "The table of limits.",
  3692. table = {
  3693. {
  3694. name = "pointsize",
  3695. type = "number",
  3696. description = "The maximum size of points, in pixels."
  3697. },
  3698. {
  3699. name = "texturesize",
  3700. type = "number",
  3701. description = "The maximum width or height of textures, in pixels."
  3702. },
  3703. {
  3704. name = "texturemsaa",
  3705. type = "number",
  3706. description = "The maximum MSAA value supported by `lovr.graphics.newTexture`."
  3707. }
  3708. }
  3709. }
  3710. }
  3711. }
  3712. }
  3713. },
  3714. {
  3715. name = "getWidth",
  3716. tag = "window",
  3717. summary = "Get the width of the window.",
  3718. description = "Returns the width of the desktop window.",
  3719. key = "lovr.graphics.getWidth",
  3720. module = "lovr.graphics",
  3721. related = {
  3722. "lovr.graphics.getHeight",
  3723. "lovr.graphics.getDimensions"
  3724. },
  3725. variants = {
  3726. {
  3727. arguments = {},
  3728. returns = {
  3729. {
  3730. name = "width",
  3731. type = "number",
  3732. description = "The width of the window, in pixels."
  3733. }
  3734. }
  3735. }
  3736. }
  3737. },
  3738. {
  3739. name = "isCullingEnabled",
  3740. tag = "graphicsState",
  3741. summary = "Get whether backface culling is enabled.",
  3742. description = "Returns whether or not culling is active. Culling is an optimization that avoids rendering the back face of polygons. This improves performance by reducing the number of polygons drawn, but requires that the vertices in triangles are specified in a consistent clockwise or counter clockwise order.",
  3743. key = "lovr.graphics.isCullingEnabled",
  3744. module = "lovr.graphics",
  3745. variants = {
  3746. {
  3747. arguments = {},
  3748. returns = {
  3749. {
  3750. name = "isEnabled",
  3751. type = "boolean",
  3752. description = "Whether or not culling is enabled."
  3753. }
  3754. }
  3755. }
  3756. },
  3757. notes = "Culling is disabled by default."
  3758. },
  3759. {
  3760. name = "isWireframe",
  3761. tag = "graphicsState",
  3762. summary = "Get whether wireframe mode is enabled.",
  3763. description = "Returns a boolean indicating whether or not wireframe rendering is enabled.",
  3764. key = "lovr.graphics.isWireframe",
  3765. module = "lovr.graphics",
  3766. variants = {
  3767. {
  3768. arguments = {},
  3769. returns = {
  3770. {
  3771. name = "isWireframe",
  3772. type = "boolean",
  3773. description = "Whether or not wireframe rendering is enabled."
  3774. }
  3775. }
  3776. }
  3777. },
  3778. notes = "Wireframe rendering is initially disabled."
  3779. },
  3780. {
  3781. name = "line",
  3782. tag = "graphicsPrimitives",
  3783. summary = "Draw lines.",
  3784. description = "Draws lines between points. Each point will be connected to the previous point in the list.",
  3785. key = "lovr.graphics.line",
  3786. module = "lovr.graphics",
  3787. variants = {
  3788. {
  3789. arguments = {
  3790. {
  3791. name = "x1",
  3792. type = "number",
  3793. description = "The x coordinate of the first point."
  3794. },
  3795. {
  3796. name = "y1",
  3797. type = "number",
  3798. description = "The y coordinate of the first point."
  3799. },
  3800. {
  3801. name = "z1",
  3802. type = "number",
  3803. description = "The z coordinate of the first point."
  3804. },
  3805. {
  3806. name = "x2",
  3807. type = "number",
  3808. description = "The x coordinate of the second point."
  3809. },
  3810. {
  3811. name = "y2",
  3812. type = "number",
  3813. description = "The y coordinate of the second point."
  3814. },
  3815. {
  3816. name = "z2",
  3817. type = "number",
  3818. description = "The z coordinate of the second point."
  3819. },
  3820. {
  3821. name = "...",
  3822. type = "number",
  3823. description = "More points."
  3824. }
  3825. },
  3826. returns = {}
  3827. },
  3828. {
  3829. arguments = {
  3830. {
  3831. name = "points",
  3832. type = "table",
  3833. description = "A table of point positions, as described above."
  3834. }
  3835. },
  3836. returns = {}
  3837. }
  3838. }
  3839. },
  3840. {
  3841. name = "newFont",
  3842. tag = "graphicsObjects",
  3843. summary = "Create a new Font.",
  3844. description = "Creates a new Font. It can be used to render text with `lovr.graphics.print`.\n\nCurrently, the only supported font format is TTF.",
  3845. key = "lovr.graphics.newFont",
  3846. module = "lovr.graphics",
  3847. notes = "Larger font sizes will lead to sharper text at the cost of performance.",
  3848. variants = {
  3849. {
  3850. arguments = {
  3851. {
  3852. name = "filename",
  3853. type = "string",
  3854. description = "The filename of the font file."
  3855. },
  3856. {
  3857. name = "size",
  3858. type = "number",
  3859. description = "The size of the font, in pixels.",
  3860. default = "32"
  3861. }
  3862. },
  3863. returns = {
  3864. {
  3865. name = "font",
  3866. type = "Font",
  3867. description = "The new Font."
  3868. }
  3869. }
  3870. },
  3871. {
  3872. description = "Creates a new Font from the default font included with LÖVR (Cabin).",
  3873. arguments = {
  3874. {
  3875. name = "size",
  3876. type = "number",
  3877. description = "The size of the font, in pixels.",
  3878. default = "32"
  3879. }
  3880. },
  3881. returns = {
  3882. {
  3883. name = "font",
  3884. type = "Font",
  3885. description = "The new Font."
  3886. }
  3887. }
  3888. }
  3889. }
  3890. },
  3891. {
  3892. name = "newMesh",
  3893. tag = "graphicsObjects",
  3894. summary = "Create a new Mesh.",
  3895. description = "Creates a new Mesh. You must specify either the capacity for the Mesh or an initial set of vertex data. The draw mode and usage hint can also optionally be specified.",
  3896. key = "lovr.graphics.newMesh",
  3897. module = "lovr.graphics",
  3898. notes = "Once created, the size of the Mesh can't be changed.",
  3899. variants = {
  3900. {
  3901. arguments = {
  3902. {
  3903. name = "size",
  3904. type = "number",
  3905. description = "The maximum number of vertices the Mesh can store."
  3906. },
  3907. {
  3908. name = "mode",
  3909. type = "MeshDrawMode",
  3910. description = "How the Mesh will render its vertices.",
  3911. default = "'fan'"
  3912. },
  3913. {
  3914. name = "usage",
  3915. type = "MeshUsage",
  3916. description = "How the Mesh will be updated.",
  3917. default = "'dynamic'"
  3918. }
  3919. },
  3920. returns = {
  3921. {
  3922. name = "mesh",
  3923. type = "Mesh",
  3924. description = "The new Mesh."
  3925. }
  3926. }
  3927. },
  3928. {
  3929. arguments = {
  3930. {
  3931. name = "vertices",
  3932. type = "table",
  3933. description = "A table of vertices. Each vertex is a table containing the vertex data."
  3934. },
  3935. {
  3936. name = "mode",
  3937. type = "MeshDrawMode",
  3938. description = "How the Mesh will render its vertices.",
  3939. default = "'fan'"
  3940. },
  3941. {
  3942. name = "usage",
  3943. type = "MeshUsage",
  3944. description = "How the Mesh will be updated.",
  3945. default = "'dynamic'"
  3946. }
  3947. },
  3948. returns = {
  3949. {
  3950. name = "mesh",
  3951. type = "Mesh",
  3952. description = "The new Mesh."
  3953. }
  3954. }
  3955. },
  3956. {
  3957. description = "These variants accept a custom vertex format. For more info, see the <a data-key=\"Mesh\">`Mesh`</a> page.",
  3958. arguments = {
  3959. {
  3960. name = "format",
  3961. type = "table",
  3962. description = "A table describing the attribute format for the vertices."
  3963. },
  3964. {
  3965. name = "size",
  3966. type = "number",
  3967. description = "The maximum number of vertices the Mesh can store."
  3968. },
  3969. {
  3970. name = "mode",
  3971. type = "MeshDrawMode",
  3972. description = "How the Mesh will render its vertices.",
  3973. default = "'fan'"
  3974. },
  3975. {
  3976. name = "usage",
  3977. type = "MeshUsage",
  3978. description = "How the Mesh will be updated.",
  3979. default = "'dynamic'"
  3980. }
  3981. },
  3982. returns = {
  3983. {
  3984. name = "mesh",
  3985. type = "Mesh",
  3986. description = "The new Mesh."
  3987. }
  3988. }
  3989. },
  3990. {
  3991. arguments = {
  3992. {
  3993. name = "format",
  3994. type = "table",
  3995. description = "A table describing the attribute format for the vertices."
  3996. },
  3997. {
  3998. name = "vertices",
  3999. type = "table",
  4000. description = "A table of vertices. Each vertex is a table containing the vertex data."
  4001. },
  4002. {
  4003. name = "mode",
  4004. type = "MeshDrawMode",
  4005. description = "How the Mesh will render its vertices.",
  4006. default = "'fan'"
  4007. },
  4008. {
  4009. name = "usage",
  4010. type = "MeshUsage",
  4011. description = "How the Mesh will be updated.",
  4012. default = "'dynamic'"
  4013. }
  4014. },
  4015. returns = {
  4016. {
  4017. name = "mesh",
  4018. type = "Mesh",
  4019. description = "The new Mesh."
  4020. }
  4021. }
  4022. }
  4023. }
  4024. },
  4025. {
  4026. name = "newModel",
  4027. tag = "graphicsObjects",
  4028. summary = "Create a new Model.",
  4029. description = "Creates a new Model from a file. The supported 3D file formats are `obj`, `fbx`, and collada. Models use normals and texture coordinates, if provided.\n\nThe following features are not supported yet: animations, materials, vertex colors.",
  4030. key = "lovr.graphics.newModel",
  4031. module = "lovr.graphics",
  4032. variants = {
  4033. {
  4034. arguments = {
  4035. {
  4036. name = "filename",
  4037. type = "string",
  4038. description = "The filename of the model to load."
  4039. },
  4040. {
  4041. name = "texture",
  4042. type = "string",
  4043. description = "A filename for a texture to apply to the Model, or `nil` for no texture.",
  4044. default = "nil"
  4045. }
  4046. },
  4047. returns = {
  4048. {
  4049. name = "model",
  4050. type = "Model",
  4051. description = "The new Model."
  4052. }
  4053. }
  4054. }
  4055. }
  4056. },
  4057. {
  4058. name = "newShader",
  4059. tag = "graphicsObjects",
  4060. summary = "Create a new Shader.",
  4061. description = "Creates a new Shader.",
  4062. key = "lovr.graphics.newShader",
  4063. module = "lovr.graphics",
  4064. variants = {
  4065. {
  4066. arguments = {
  4067. {
  4068. name = "vertex",
  4069. type = "string",
  4070. description = "The code or filename of the vertex shader. If `nil`, the default vertex shader is used."
  4071. },
  4072. {
  4073. name = "fragment",
  4074. type = "string",
  4075. description = "The code or filename of the fragment shader. If `nil`, the default fragment shader is used."
  4076. }
  4077. },
  4078. returns = {
  4079. {
  4080. name = "shader",
  4081. type = "Shader",
  4082. description = "The new Shader."
  4083. }
  4084. }
  4085. }
  4086. }
  4087. },
  4088. {
  4089. name = "newSkybox",
  4090. tag = "graphicsObjects",
  4091. summary = "Create a new Skybox.",
  4092. description = "Creates a new Skybox from a set of 6 images.",
  4093. key = "lovr.graphics.newSkybox",
  4094. module = "lovr.graphics",
  4095. variants = {
  4096. {
  4097. arguments = {
  4098. {
  4099. name = "right",
  4100. type = "string",
  4101. description = "The filename of the image for the right face of the skybox."
  4102. },
  4103. {
  4104. name = "left",
  4105. type = "string",
  4106. description = "The filename of the image for the left face of the skybox."
  4107. },
  4108. {
  4109. name = "top",
  4110. type = "string",
  4111. description = "The filename of the image for the top face of the skybox."
  4112. },
  4113. {
  4114. name = "bottom",
  4115. type = "string",
  4116. description = "The filename of the image for the bottom face of the skybox."
  4117. },
  4118. {
  4119. name = "back",
  4120. type = "string",
  4121. description = "The filename of the image for the back face of the skybox."
  4122. },
  4123. {
  4124. name = "front",
  4125. type = "string",
  4126. description = "The filename of the image for the front face of the skybox."
  4127. }
  4128. },
  4129. returns = {
  4130. {
  4131. name = "skybox",
  4132. type = "Skybox",
  4133. description = "The new Skybox."
  4134. }
  4135. }
  4136. },
  4137. {
  4138. arguments = {
  4139. {
  4140. name = "images",
  4141. type = "table",
  4142. description = "A table containing 6 images, as described above."
  4143. }
  4144. },
  4145. returns = {
  4146. {
  4147. name = "skybox",
  4148. type = "Skybox",
  4149. description = "The new Skybox."
  4150. }
  4151. }
  4152. },
  4153. {
  4154. description = "Creates a Skybox from a single equirectangular image.",
  4155. arguments = {
  4156. {
  4157. name = "image",
  4158. type = "string",
  4159. description = "A filename for an equirectangular image to load."
  4160. }
  4161. },
  4162. returns = {
  4163. {
  4164. name = "skybox",
  4165. type = "Skybox",
  4166. description = "The new Skybox."
  4167. }
  4168. }
  4169. }
  4170. }
  4171. },
  4172. {
  4173. name = "newTexture",
  4174. tag = "graphicsObjects",
  4175. summary = "Create a new Texture.",
  4176. description = "Creates a new Texture from an image file.",
  4177. key = "lovr.graphics.newTexture",
  4178. module = "lovr.graphics",
  4179. variants = {
  4180. {
  4181. arguments = {
  4182. {
  4183. name = "filename",
  4184. type = "string",
  4185. description = "The filename of the image to load."
  4186. }
  4187. },
  4188. returns = {
  4189. {
  4190. name = "texture",
  4191. type = "Texture",
  4192. description = "The new Texture."
  4193. }
  4194. }
  4195. },
  4196. {
  4197. arguments = {
  4198. {
  4199. name = "width",
  4200. type = "number",
  4201. description = "The width of the Texture, in pixels."
  4202. },
  4203. {
  4204. name = "height",
  4205. type = "number",
  4206. description = "The height of the Texture, in pixels."
  4207. },
  4208. {
  4209. name = "projection",
  4210. type = "TextureProjection",
  4211. description = "The type of projection to use when rendering to the Texture."
  4212. },
  4213. {
  4214. name = "msaa",
  4215. type = "number",
  4216. description = "The number of samples to use for multisample antialiasing.",
  4217. default = "0"
  4218. }
  4219. },
  4220. returns = {
  4221. {
  4222. name = "texture",
  4223. type = "Texture",
  4224. description = "The new Texture."
  4225. }
  4226. }
  4227. }
  4228. }
  4229. },
  4230. {
  4231. name = "origin",
  4232. tag = "graphicsTransforms",
  4233. summary = "Reset the coordinate system.",
  4234. description = "Resets the transformation to the origin.",
  4235. key = "lovr.graphics.origin",
  4236. module = "lovr.graphics",
  4237. variants = {
  4238. {
  4239. arguments = {},
  4240. returns = {}
  4241. }
  4242. },
  4243. notes = "This is called at the beginning of every frame to reset the coordinate space."
  4244. },
  4245. {
  4246. name = "plane",
  4247. tag = "graphicsPrimitives",
  4248. summary = "Draw a plane.",
  4249. description = "Draws a plane with a given position, size, and orientation.",
  4250. key = "lovr.graphics.plane",
  4251. module = "lovr.graphics",
  4252. variants = {
  4253. {
  4254. arguments = {
  4255. {
  4256. name = "mode",
  4257. type = "DrawMode",
  4258. description = "How to draw the plane."
  4259. },
  4260. {
  4261. name = "x",
  4262. type = "number",
  4263. description = "The x coordinate of the center of the plane.",
  4264. default = "0"
  4265. },
  4266. {
  4267. name = "y",
  4268. type = "number",
  4269. description = "The y coordinate of the center of the plane.",
  4270. default = "0"
  4271. },
  4272. {
  4273. name = "z",
  4274. type = "number",
  4275. description = "The z coordinate of the center of the plane.",
  4276. default = "0"
  4277. },
  4278. {
  4279. name = "size",
  4280. type = "number",
  4281. description = "The size of the plane, in meters.",
  4282. default = "1"
  4283. },
  4284. {
  4285. name = "nx",
  4286. type = "number",
  4287. description = "The x coordinate of the normal vector of the plane.",
  4288. default = "0"
  4289. },
  4290. {
  4291. name = "ny",
  4292. type = "number",
  4293. description = "The y coordinate of the normal vector of the plane.",
  4294. default = "1"
  4295. },
  4296. {
  4297. name = "nz",
  4298. type = "number",
  4299. description = "The z coordinate of the normal vector of the plane.",
  4300. default = "0"
  4301. }
  4302. },
  4303. returns = {}
  4304. },
  4305. {
  4306. description = "Draw a textured plane.",
  4307. arguments = {
  4308. {
  4309. name = "texture",
  4310. type = "Texture",
  4311. description = "The texture to apply to the plane."
  4312. },
  4313. {
  4314. name = "x",
  4315. type = "number",
  4316. description = "The x coordinate of the center of the plane.",
  4317. default = "0"
  4318. },
  4319. {
  4320. name = "y",
  4321. type = "number",
  4322. description = "The y coordinate of the center of the plane.",
  4323. default = "0"
  4324. },
  4325. {
  4326. name = "z",
  4327. type = "number",
  4328. description = "The z coordinate of the center of the plane.",
  4329. default = "0"
  4330. },
  4331. {
  4332. name = "size",
  4333. type = "number",
  4334. description = "The size of the plane, in meters.",
  4335. default = "1"
  4336. },
  4337. {
  4338. name = "nx",
  4339. type = "number",
  4340. description = "The x coordinate of the normal vector of the plane.",
  4341. default = "0"
  4342. },
  4343. {
  4344. name = "ny",
  4345. type = "number",
  4346. description = "The y coordinate of the normal vector of the plane.",
  4347. default = "1"
  4348. },
  4349. {
  4350. name = "nz",
  4351. type = "number",
  4352. description = "The z coordinate of the normal vector of the plane.",
  4353. default = "0"
  4354. }
  4355. },
  4356. returns = {}
  4357. },
  4358. {
  4359. description = "Draw a fullscreen textured plane.",
  4360. arguments = {
  4361. {
  4362. name = "texture",
  4363. type = "Texture",
  4364. description = "The texture to apply to the plane."
  4365. }
  4366. },
  4367. returns = {}
  4368. }
  4369. }
  4370. },
  4371. {
  4372. name = "points",
  4373. tag = "graphicsPrimitives",
  4374. summary = "Draw one or more points.",
  4375. description = "Draws one or more points.",
  4376. key = "lovr.graphics.points",
  4377. module = "lovr.graphics",
  4378. variants = {
  4379. {
  4380. arguments = {
  4381. {
  4382. name = "x",
  4383. type = "number",
  4384. description = "The x coordinate of the point."
  4385. },
  4386. {
  4387. name = "y",
  4388. type = "number",
  4389. description = "The y coordinate of the point."
  4390. },
  4391. {
  4392. name = "z",
  4393. type = "number",
  4394. description = "The z coordinate of the point."
  4395. },
  4396. {
  4397. name = "...",
  4398. type = "number",
  4399. description = "More points."
  4400. }
  4401. },
  4402. returns = {}
  4403. },
  4404. {
  4405. arguments = {
  4406. {
  4407. name = "points",
  4408. type = "table",
  4409. description = "A table of points, as described above."
  4410. }
  4411. },
  4412. returns = {}
  4413. }
  4414. }
  4415. },
  4416. {
  4417. name = "pop",
  4418. tag = "graphicsTransforms",
  4419. summary = "Pop the current transform off the stack.",
  4420. description = "Pops the current transform from the stack, returning to the transformation that was applied before `lovr.graphics.push` was called.",
  4421. key = "lovr.graphics.pop",
  4422. module = "lovr.graphics",
  4423. variants = {
  4424. {
  4425. arguments = {},
  4426. returns = {}
  4427. }
  4428. },
  4429. related = {
  4430. "lovr.graphics.push"
  4431. },
  4432. notes = "An error is thrown if there isn't a transform to pop. This can happen if you forget to call push before calling pop, or if you have an unbalanced sequence of pushes and pops."
  4433. },
  4434. {
  4435. name = "present",
  4436. tag = "window",
  4437. summary = "Present a frame to the window.",
  4438. description = "Presents the results of pending drawing operations to the window. This is automatically called after `lovr.draw` by the default `lovr.step` function.",
  4439. key = "lovr.graphics.present",
  4440. module = "lovr.graphics",
  4441. variants = {
  4442. {
  4443. arguments = {},
  4444. returns = {}
  4445. }
  4446. }
  4447. },
  4448. {
  4449. name = "print",
  4450. tag = "graphicsPrimitives",
  4451. summary = "Render text.",
  4452. description = "Draws text in 3D space using the active font.",
  4453. key = "lovr.graphics.print",
  4454. module = "lovr.graphics",
  4455. variants = {
  4456. {
  4457. arguments = {
  4458. {
  4459. name = "str",
  4460. type = "string",
  4461. description = "The text to render."
  4462. },
  4463. {
  4464. name = "x",
  4465. type = "number",
  4466. description = "The x coordinate of the center of the text.",
  4467. default = 0
  4468. },
  4469. {
  4470. name = "y",
  4471. type = "number",
  4472. description = "The y coordinate of the center of the text.",
  4473. default = 0
  4474. },
  4475. {
  4476. name = "z",
  4477. type = "number",
  4478. description = "The z coordinate of the center of the text.",
  4479. default = 0
  4480. },
  4481. {
  4482. name = "scale",
  4483. type = "number",
  4484. description = "The scale of the text.",
  4485. default = 1
  4486. },
  4487. {
  4488. name = "angle",
  4489. type = "number",
  4490. description = "The number of radians to rotate the text around its rotation axis.",
  4491. default = 0
  4492. },
  4493. {
  4494. name = "ax",
  4495. type = "number",
  4496. description = "The x component of the axis of rotation.",
  4497. default = 0
  4498. },
  4499. {
  4500. name = "ay",
  4501. type = "number",
  4502. description = "The y component of the axis of rotation.",
  4503. default = 1
  4504. },
  4505. {
  4506. name = "az",
  4507. type = "number",
  4508. description = "The z component of the axis of rotation.",
  4509. default = 0
  4510. },
  4511. {
  4512. name = "wrap",
  4513. type = "number",
  4514. description = "The maximum width of each line, in meters (affected by `scale`). Set to 0 or `nil` for no wrapping.",
  4515. default = "0"
  4516. },
  4517. {
  4518. name = "halign",
  4519. type = "HorizontalAlign",
  4520. description = "The horizontal alignment.",
  4521. default = "'center'"
  4522. },
  4523. {
  4524. name = "valign",
  4525. type = "VerticalAlign",
  4526. description = "The vertical alignment.",
  4527. default = "'middle'"
  4528. }
  4529. },
  4530. returns = {}
  4531. }
  4532. },
  4533. related = {
  4534. "lovr.graphics.getFont",
  4535. "lovr.graphics.setFont",
  4536. "lovr.graphics.newFont",
  4537. "Font"
  4538. },
  4539. notes = "Unicode text is supported.\n\nUse `\\n` to add line breaks."
  4540. },
  4541. {
  4542. name = "push",
  4543. tag = "graphicsTransforms",
  4544. summary = "Push a copy of the current transform onto the stack.",
  4545. description = "Pushes a copy of the current transform onto the transformation stack. After changing the transform using `lovr.graphics.translate`, `lovr.graphics.rotate`, and `lovr.graphics.scale`, the original state can be restored using `lovr.graphics.pop`.",
  4546. key = "lovr.graphics.push",
  4547. module = "lovr.graphics",
  4548. variants = {
  4549. {
  4550. arguments = {},
  4551. returns = {}
  4552. }
  4553. },
  4554. related = {
  4555. "lovr.graphics.pop"
  4556. },
  4557. notes = "An error is thrown if more than 64 matrices are pushed. This can happen accidentally if a push isn't followed by a corresponding pop."
  4558. },
  4559. {
  4560. name = "reset",
  4561. tag = "graphicsState",
  4562. summary = "Reset all graphics state.",
  4563. description = "Resets the graphics state. This includes the coordinate transformation, projection, shader, colors, scissor, and culling state.",
  4564. key = "lovr.graphics.reset",
  4565. module = "lovr.graphics",
  4566. variants = {
  4567. {
  4568. arguments = {},
  4569. returns = {}
  4570. }
  4571. }
  4572. },
  4573. {
  4574. name = "rotate",
  4575. tag = "graphicsTransforms",
  4576. summary = "Rotate the coordinate system.",
  4577. description = "Rotates the coordinate system around an axis.\n\nThe rotation will last until `lovr.draw` returns or the transformation is popped off the transformation stack.",
  4578. key = "lovr.graphics.rotate",
  4579. module = "lovr.graphics",
  4580. variants = {
  4581. {
  4582. arguments = {
  4583. {
  4584. name = "angle",
  4585. type = "number",
  4586. description = "The amount to rotate the coordinate system by, in radians."
  4587. },
  4588. {
  4589. name = "ax",
  4590. type = "number",
  4591. description = "The x component of the axis of rotation.",
  4592. default = "0"
  4593. },
  4594. {
  4595. name = "ay",
  4596. type = "number",
  4597. description = "The y component of the axis of rotation.",
  4598. default = "1"
  4599. },
  4600. {
  4601. name = "az",
  4602. type = "number",
  4603. description = "The z component of the axis of rotation.",
  4604. default = "0"
  4605. }
  4606. },
  4607. returns = {}
  4608. }
  4609. },
  4610. related = {
  4611. "lovr.graphics.scale",
  4612. "lovr.graphics.translate",
  4613. "lovr.graphics.transform"
  4614. },
  4615. notes = "Order matters when scaling, translating, and rotating the coordinate system."
  4616. },
  4617. {
  4618. name = "scale",
  4619. tag = "graphicsTransforms",
  4620. summary = "Scale the coordinate system.",
  4621. description = "Scales the coordinate system in 3 dimensions. This will cause objects to appear bigger or smaller.\n\nThe scaling will last until `lovr.draw` returns or the transformation is popped off the transformation stack.",
  4622. key = "lovr.graphics.scale",
  4623. module = "lovr.graphics",
  4624. variants = {
  4625. {
  4626. arguments = {
  4627. {
  4628. name = "x",
  4629. type = "number",
  4630. description = "The amount to scale on the x axis."
  4631. },
  4632. {
  4633. name = "y",
  4634. type = "number",
  4635. description = "The amount to scale on the y axis.",
  4636. default = "x"
  4637. },
  4638. {
  4639. name = "z",
  4640. type = "number",
  4641. description = "The amount to scale on the z axis.",
  4642. default = "x"
  4643. }
  4644. },
  4645. returns = {}
  4646. }
  4647. },
  4648. related = {
  4649. "lovr.graphics.rotate",
  4650. "lovr.graphics.translate",
  4651. "lovr.graphics.transform"
  4652. },
  4653. notes = "Order matters when scaling, translating, and rotating the coordinate system."
  4654. },
  4655. {
  4656. name = "setBackgroundColor",
  4657. tag = "graphicsState",
  4658. summary = "Set the background color.",
  4659. description = "Sets the background color used to clear the screen. Color components are from 0 to 255.",
  4660. key = "lovr.graphics.setBackgroundColor",
  4661. module = "lovr.graphics",
  4662. variants = {
  4663. {
  4664. arguments = {
  4665. {
  4666. name = "r",
  4667. type = "number",
  4668. description = "The red component of the background color."
  4669. },
  4670. {
  4671. name = "g",
  4672. type = "number",
  4673. description = "The green component of the background color."
  4674. },
  4675. {
  4676. name = "b",
  4677. type = "number",
  4678. description = "The blue component of the background color."
  4679. },
  4680. {
  4681. name = "a",
  4682. type = "number",
  4683. description = "The alpha component of the background color.",
  4684. default = "255"
  4685. }
  4686. },
  4687. returns = {}
  4688. }
  4689. },
  4690. notes = "The default background color is black."
  4691. },
  4692. {
  4693. name = "setBlendMode",
  4694. tag = "graphicsState",
  4695. summary = "Set the blend mode.",
  4696. description = "Sets the blend mode. The blend mode controls how each pixel's color is blended with the previous pixel's color when drawn.",
  4697. key = "lovr.graphics.setBlendMode",
  4698. module = "lovr.graphics",
  4699. related = {
  4700. "BlendMode",
  4701. "BlendAlphaMode"
  4702. },
  4703. variants = {
  4704. {
  4705. arguments = {
  4706. {
  4707. name = "blend",
  4708. type = "BlendMode",
  4709. description = "The blend mode."
  4710. },
  4711. {
  4712. name = "alphaBlend",
  4713. type = "BlendAlphaMode",
  4714. description = "The alpha blend mode."
  4715. }
  4716. },
  4717. returns = {}
  4718. }
  4719. }
  4720. },
  4721. {
  4722. name = "setColor",
  4723. tag = "graphicsState",
  4724. summary = "Set the global color factor.",
  4725. description = "Sets the color used for drawing objects. Color components are from 0 to 255. Every pixel drawn will be multiplied (i.e. tinted) by this color. This is a global setting, so it will affect all subsequent drawing operations.",
  4726. key = "lovr.graphics.setColor",
  4727. module = "lovr.graphics",
  4728. notes = "The default color is white.",
  4729. variants = {
  4730. {
  4731. arguments = {
  4732. {
  4733. name = "r",
  4734. type = "number",
  4735. description = "The red component of the color."
  4736. },
  4737. {
  4738. name = "g",
  4739. type = "number",
  4740. description = "The green component of the color."
  4741. },
  4742. {
  4743. name = "b",
  4744. type = "number",
  4745. description = "The blue component of the color."
  4746. },
  4747. {
  4748. name = "a",
  4749. type = "number",
  4750. description = "The alpha component of the color.",
  4751. default = "255"
  4752. }
  4753. },
  4754. returns = {}
  4755. },
  4756. {
  4757. arguments = {
  4758. {
  4759. name = "color",
  4760. type = "table",
  4761. description = "A table containing the color components."
  4762. }
  4763. },
  4764. returns = {}
  4765. },
  4766. {
  4767. arguments = {
  4768. {
  4769. name = "hex",
  4770. type = "number",
  4771. description = "An integer containing all four color components."
  4772. }
  4773. },
  4774. returns = {}
  4775. }
  4776. },
  4777. examples = {
  4778. {
  4779. description = "Draw a red cube.",
  4780. code = "function lovr.draw()\n lovr.graphics.setColor(255, 0, 0)\n lovr.graphics.cube('fill', 0, 1.7, -1, .5, lovr.timer.getTime())\nend"
  4781. }
  4782. }
  4783. },
  4784. {
  4785. name = "setColorMask",
  4786. tag = "graphicsState",
  4787. summary = "Set the color mask.",
  4788. description = "Sets which color channels are affected by drawing operations.",
  4789. key = "lovr.graphics.setColorMask",
  4790. module = "lovr.graphics",
  4791. variants = {
  4792. {
  4793. arguments = {
  4794. {
  4795. name = "r",
  4796. type = "boolean",
  4797. description = "Whether or not the red channel should be enabled.",
  4798. default = "true"
  4799. },
  4800. {
  4801. name = "g",
  4802. type = "boolean",
  4803. description = "Whether or not the green channel should be enabled.",
  4804. default = "true"
  4805. },
  4806. {
  4807. name = "b",
  4808. type = "boolean",
  4809. description = "Whether or not the blue channel should be enabled.",
  4810. default = "true"
  4811. },
  4812. {
  4813. name = "a",
  4814. type = "boolean",
  4815. description = "Whether or not the alpha channel should be enabled.",
  4816. default = "true"
  4817. }
  4818. },
  4819. returns = {}
  4820. }
  4821. },
  4822. notes = "Initially, all color channels are enabled."
  4823. },
  4824. {
  4825. name = "setCullingEnabled",
  4826. tag = "graphicsState",
  4827. summary = "Enable or disable backface culling.",
  4828. description = "Enables or disables culling. Culling is an optimization that avoids rendering the back face of polygons. This improves performance by reducing the number of polygons drawn, but requires that the vertices in triangles are specified in a consistent clockwise or counter clockwise order.",
  4829. key = "lovr.graphics.setCullingEnabled",
  4830. module = "lovr.graphics",
  4831. variants = {
  4832. {
  4833. arguments = {
  4834. {
  4835. name = "isEnabled",
  4836. type = "boolean",
  4837. description = "Whether or not culling should be enabled."
  4838. }
  4839. },
  4840. returns = {}
  4841. }
  4842. },
  4843. notes = "Culling is disabled by default."
  4844. },
  4845. {
  4846. name = "setDepthTest",
  4847. tag = "graphicsState",
  4848. summary = "Set or disable the depth test.",
  4849. description = "Sets the current depth test. The depth test controls how overlapping objects are rendered.",
  4850. key = "lovr.graphics.setDepthTest",
  4851. module = "lovr.graphics",
  4852. notes = "The default depth test is `less`.",
  4853. variants = {
  4854. {
  4855. description = "Set a new depth test.",
  4856. arguments = {
  4857. {
  4858. name = "compareMode",
  4859. type = "CompareMode",
  4860. description = "The new depth test."
  4861. }
  4862. },
  4863. returns = {}
  4864. },
  4865. {
  4866. description = "Disable the depth test.",
  4867. arguments = {},
  4868. returns = {}
  4869. }
  4870. }
  4871. },
  4872. {
  4873. name = "setFont",
  4874. tag = "graphicsState",
  4875. summary = "Set the active font.",
  4876. description = "Sets the active font used to render text with `lovr.graphics.print`.",
  4877. key = "lovr.graphics.setFont",
  4878. module = "lovr.graphics",
  4879. related = {
  4880. "lovr.graphics.print"
  4881. },
  4882. variants = {
  4883. {
  4884. arguments = {
  4885. {
  4886. name = "font",
  4887. type = "Font",
  4888. description = "The font to use."
  4889. }
  4890. },
  4891. returns = {}
  4892. }
  4893. }
  4894. },
  4895. {
  4896. name = "setLineWidth",
  4897. tag = "graphicsState",
  4898. summary = "Set the line width.",
  4899. description = "Sets the width of lines rendered using `lovr.graphics.line`.",
  4900. key = "lovr.graphics.setLineWidth",
  4901. module = "lovr.graphics",
  4902. variants = {
  4903. {
  4904. arguments = {
  4905. {
  4906. name = "width",
  4907. type = "number",
  4908. description = "The new line width, in pixels."
  4909. }
  4910. },
  4911. returns = {}
  4912. }
  4913. },
  4914. related = {
  4915. "lovr.graphics.line"
  4916. },
  4917. notes = "The default line width is `1.0`.\n\nDriver support for line widths is poor. The actual width of lines may be different from what is set here. In particular, some graphics drivers only support a line width of `1.0`."
  4918. },
  4919. {
  4920. name = "setPointSize",
  4921. tag = "graphicsState",
  4922. summary = "Set the point size.",
  4923. description = "Sets the width of drawn points, in pixels.",
  4924. key = "lovr.graphics.setPointSize",
  4925. module = "lovr.graphics",
  4926. variants = {
  4927. {
  4928. arguments = {
  4929. {
  4930. name = "size",
  4931. type = "number",
  4932. description = "The new point size."
  4933. }
  4934. },
  4935. returns = {}
  4936. }
  4937. },
  4938. related = {
  4939. "lovr.graphics.points"
  4940. },
  4941. notes = "The default point size is `1.0`."
  4942. },
  4943. {
  4944. name = "setPolygonWinding",
  4945. tag = "graphicsState",
  4946. summary = "Set the winding direction.",
  4947. description = "Sets the polygon winding. The winding direction determines which face of a triangle is the front face and which is the back face. This lets the graphics engine cull the back faces of polygons, improving performance. The default is counterclockwise.",
  4948. key = "lovr.graphics.setPolygonWinding",
  4949. module = "lovr.graphics",
  4950. variants = {
  4951. {
  4952. arguments = {
  4953. {
  4954. name = "winding",
  4955. type = "PolygonWinding",
  4956. description = "The new winding direction."
  4957. }
  4958. },
  4959. returns = {}
  4960. }
  4961. },
  4962. related = {
  4963. "lovr.graphics.setCullingEnabled",
  4964. "lovr.graphics.isCullingEnabled"
  4965. },
  4966. notes = "Culling is initially disabled and must be enabled using `lovr.graphics.setCullingEnabled`.\n\nThe default winding direction is counterclockwise."
  4967. },
  4968. {
  4969. name = "setScissor",
  4970. tag = "graphicsState",
  4971. summary = "Set the scissor rectangle.",
  4972. description = "Sets the scissor region. The scissor is a rectangular area of the screen. Any pixels outside the scissor region will be unaffected by drawing operations.",
  4973. key = "lovr.graphics.setScissor",
  4974. module = "lovr.graphics",
  4975. variants = {
  4976. {
  4977. arguments = {
  4978. {
  4979. name = "x",
  4980. type = "number",
  4981. description = "The x position of the upper left corner of the scissor."
  4982. },
  4983. {
  4984. name = "y",
  4985. type = "number",
  4986. description = "The y position of the upper left corner of the scissor."
  4987. },
  4988. {
  4989. name = "w",
  4990. type = "number",
  4991. description = "The width of the scissor in pixels."
  4992. },
  4993. {
  4994. name = "h",
  4995. type = "number",
  4996. description = "The height of the scissor in pixels."
  4997. }
  4998. },
  4999. returns = {}
  5000. }
  5001. }
  5002. },
  5003. {
  5004. name = "setShader",
  5005. tag = "graphicsState",
  5006. summary = "Set or disable the active shader.",
  5007. description = "Sets or disables the Shader used for drawing.",
  5008. key = "lovr.graphics.setShader",
  5009. module = "lovr.graphics",
  5010. variants = {
  5011. {
  5012. arguments = {
  5013. {
  5014. name = "shader",
  5015. type = "Shader",
  5016. description = "The shader to use."
  5017. }
  5018. },
  5019. returns = {}
  5020. },
  5021. {
  5022. description = "Revert back to the default shader.",
  5023. arguments = {},
  5024. returns = {}
  5025. }
  5026. }
  5027. },
  5028. {
  5029. name = "setWireframe",
  5030. tag = "graphicsState",
  5031. summary = "Enable or disable wireframe rendering.",
  5032. description = "Enables or disables wireframe rendering. This is meant to be used as a debugging tool.",
  5033. key = "lovr.graphics.setWireframe",
  5034. module = "lovr.graphics",
  5035. variants = {
  5036. {
  5037. arguments = {
  5038. {
  5039. name = "wireframe",
  5040. type = "boolean",
  5041. description = "Whether or not wireframe rendering should be enabled."
  5042. }
  5043. },
  5044. returns = {}
  5045. }
  5046. },
  5047. notes = "Wireframe rendering is initially disabled."
  5048. },
  5049. {
  5050. name = "sphere",
  5051. tag = "graphicsPrimitives",
  5052. summary = "Draw a sphere.",
  5053. description = "Draws a sphere.",
  5054. key = "lovr.graphics.sphere",
  5055. module = "lovr.graphics",
  5056. variants = {
  5057. {
  5058. arguments = {
  5059. {
  5060. name = "x",
  5061. type = "number",
  5062. description = "The x coordinate of the center of the sphere.",
  5063. default = "0"
  5064. },
  5065. {
  5066. name = "y",
  5067. type = "number",
  5068. description = "The y coordinate of the center of the sphere.",
  5069. default = "0"
  5070. },
  5071. {
  5072. name = "z",
  5073. type = "number",
  5074. description = "The z coordinate of the center of the sphere.",
  5075. default = "0"
  5076. },
  5077. {
  5078. name = "size",
  5079. type = "number",
  5080. description = "The size of the sphere, in meters.",
  5081. default = "1"
  5082. },
  5083. {
  5084. name = "angle",
  5085. type = "number",
  5086. description = "The rotation of the sphere around its rotation axis, in radians.",
  5087. default = "0"
  5088. },
  5089. {
  5090. name = "ax",
  5091. type = "number",
  5092. description = "The x coordinate of the sphere's axis of rotation.",
  5093. default = "0"
  5094. },
  5095. {
  5096. name = "ay",
  5097. type = "number",
  5098. description = "The y coordinate of the sphere's axis of rotation.",
  5099. default = "1"
  5100. },
  5101. {
  5102. name = "az",
  5103. type = "number",
  5104. description = "The z coordinate of the sphere's axis of rotation.",
  5105. default = "0"
  5106. }
  5107. },
  5108. returns = {}
  5109. },
  5110. {
  5111. arguments = {
  5112. {
  5113. name = "texture",
  5114. type = "Texture",
  5115. description = "The Texture to apply to the sphere."
  5116. },
  5117. {
  5118. name = "x",
  5119. type = "number",
  5120. description = "The x coordinate of the center of the sphere.",
  5121. default = "0"
  5122. },
  5123. {
  5124. name = "y",
  5125. type = "number",
  5126. description = "The y coordinate of the center of the sphere.",
  5127. default = "0"
  5128. },
  5129. {
  5130. name = "z",
  5131. type = "number",
  5132. description = "The z coordinate of the center of the sphere.",
  5133. default = "0"
  5134. },
  5135. {
  5136. name = "size",
  5137. type = "number",
  5138. description = "The size of the sphere, in meters.",
  5139. default = "1"
  5140. },
  5141. {
  5142. name = "angle",
  5143. type = "number",
  5144. description = "The rotation of the sphere around its rotation axis, in radians.",
  5145. default = "0"
  5146. },
  5147. {
  5148. name = "ax",
  5149. type = "number",
  5150. description = "The x coordinate of the sphere's axis of rotation.",
  5151. default = "0"
  5152. },
  5153. {
  5154. name = "ay",
  5155. type = "number",
  5156. description = "The y coordinate of the sphere's axis of rotation.",
  5157. default = "1"
  5158. },
  5159. {
  5160. name = "az",
  5161. type = "number",
  5162. description = "The z coordinate of the sphere's axis of rotation.",
  5163. default = "0"
  5164. }
  5165. },
  5166. returns = {}
  5167. },
  5168. {
  5169. arguments = {
  5170. {
  5171. name = "transform",
  5172. type = "Transform",
  5173. description = "The sphere's transform."
  5174. }
  5175. },
  5176. returns = {}
  5177. },
  5178. {
  5179. arguments = {
  5180. {
  5181. name = "texture",
  5182. type = "Texture",
  5183. description = "The Texture to apply to the sphere."
  5184. },
  5185. {
  5186. name = "transform",
  5187. type = "Transform",
  5188. description = "The sphere's transform."
  5189. }
  5190. },
  5191. returns = {}
  5192. }
  5193. }
  5194. },
  5195. {
  5196. name = "transform",
  5197. tag = "graphicsTransforms",
  5198. summary = "Apply a general transform to the coordinate system.",
  5199. description = "Apply a transform to the coordinate system, changing its translation, rotation, and scale using a single function. A Transform object can also be used.\n\nThe transformation will last until `lovr.draw` returns or the transformation is popped off the transformation stack.",
  5200. key = "lovr.graphics.transform",
  5201. module = "lovr.graphics",
  5202. related = {
  5203. "lovr.graphics.rotate",
  5204. "lovr.graphics.scale",
  5205. "lovr.graphics.translate"
  5206. },
  5207. variants = {
  5208. {
  5209. arguments = {
  5210. {
  5211. name = "x",
  5212. type = "number",
  5213. description = "The x component of the translation.",
  5214. default = 0
  5215. },
  5216. {
  5217. name = "y",
  5218. type = "number",
  5219. description = "The y component of the translation.",
  5220. default = 0
  5221. },
  5222. {
  5223. name = "z",
  5224. type = "number",
  5225. description = "The z component of the translation.",
  5226. default = 0
  5227. },
  5228. {
  5229. name = "sx",
  5230. type = "number",
  5231. description = "The x scale factor.",
  5232. default = 1
  5233. },
  5234. {
  5235. name = "sy",
  5236. type = "number",
  5237. description = "The y scale factor.",
  5238. default = 1
  5239. },
  5240. {
  5241. name = "sz",
  5242. type = "number",
  5243. description = "The z scale factor.",
  5244. default = 1
  5245. },
  5246. {
  5247. name = "angle",
  5248. type = "number",
  5249. description = "The number of radians to rotate around the rotation axis.",
  5250. default = 0
  5251. },
  5252. {
  5253. name = "ax",
  5254. type = "number",
  5255. description = "The x component of the axis of rotation.",
  5256. default = 0
  5257. },
  5258. {
  5259. name = "ay",
  5260. type = "number",
  5261. description = "The y component of the axis of rotation.",
  5262. default = 1
  5263. },
  5264. {
  5265. name = "az",
  5266. type = "number",
  5267. description = "The z component of the axis of rotation.",
  5268. default = 0
  5269. }
  5270. },
  5271. returns = {}
  5272. },
  5273. {
  5274. description = "Modify the coordinate system using a Transform object.",
  5275. arguments = {
  5276. {
  5277. name = "transform",
  5278. type = "Transform",
  5279. description = "The Transform to apply to the coordinate system."
  5280. }
  5281. },
  5282. returns = {}
  5283. }
  5284. }
  5285. },
  5286. {
  5287. name = "translate",
  5288. tag = "graphicsTransforms",
  5289. summary = "Translate the coordinate system.",
  5290. description = "Translates the coordinate system in three dimensions. All graphics operations that use coordinates will behave as if they are offset by the translation value.\n\nThe translation will last until `lovr.draw` returns or the transformation is popped off the transformation stack.",
  5291. key = "lovr.graphics.translate",
  5292. module = "lovr.graphics",
  5293. variants = {
  5294. {
  5295. arguments = {
  5296. {
  5297. name = "x",
  5298. type = "number",
  5299. description = "The amount to translate on the x axis."
  5300. },
  5301. {
  5302. name = "y",
  5303. type = "number",
  5304. description = "The amount to translate on the y axis."
  5305. },
  5306. {
  5307. name = "z",
  5308. type = "number",
  5309. description = "The amount to translate on the z axis."
  5310. }
  5311. },
  5312. returns = {}
  5313. }
  5314. },
  5315. related = {
  5316. "lovr.graphics.rotate",
  5317. "lovr.graphics.scale",
  5318. "lovr.graphics.transform"
  5319. },
  5320. notes = "Order matters when scaling, translating, and rotating the coordinate system."
  5321. },
  5322. {
  5323. name = "triangle",
  5324. tag = "graphicsPrimitives",
  5325. summary = "Draw a triangle.",
  5326. description = "Draws a triangle from three points.",
  5327. key = "lovr.graphics.triangle",
  5328. module = "lovr.graphics",
  5329. variants = {
  5330. {
  5331. arguments = {
  5332. {
  5333. name = "mode",
  5334. type = "DrawMode",
  5335. description = "How to draw the triangle."
  5336. },
  5337. {
  5338. name = "x1",
  5339. type = "number",
  5340. description = "The x coordinate of the first point."
  5341. },
  5342. {
  5343. name = "y1",
  5344. type = "number",
  5345. description = "The y coordinate of the first point."
  5346. },
  5347. {
  5348. name = "z1",
  5349. type = "number",
  5350. description = "The z coordinate of the first point."
  5351. },
  5352. {
  5353. name = "x2",
  5354. type = "number",
  5355. description = "The x coordinate of the second point."
  5356. },
  5357. {
  5358. name = "y2",
  5359. type = "number",
  5360. description = "The y coordinate of the second point."
  5361. },
  5362. {
  5363. name = "z2",
  5364. type = "number",
  5365. description = "The z coordinate of the second point."
  5366. },
  5367. {
  5368. name = "x3",
  5369. type = "number",
  5370. description = "The x coordinate of the third point."
  5371. },
  5372. {
  5373. name = "y3",
  5374. type = "number",
  5375. description = "The y coordinate of the third point."
  5376. },
  5377. {
  5378. name = "z3",
  5379. type = "number",
  5380. description = "The z coordinate of the third point."
  5381. }
  5382. },
  5383. returns = {}
  5384. }
  5385. },
  5386. notes = "Unlike some of the other primitives, exactly 3 points are required here."
  5387. }
  5388. },
  5389. objects = {
  5390. {
  5391. name = "Font",
  5392. summary = "A loaded font used to render text.",
  5393. description = "A Font is an object created from a TTF file. It can be used to render text with `lovr.graphics.print`.",
  5394. key = "Font",
  5395. module = "lovr.graphics",
  5396. methods = {
  5397. {
  5398. name = "getAscent",
  5399. summary = "Get the ascent of the Font.",
  5400. description = "Returns the maximum distance that any glyph will extend above the Font's baseline. Units are generally in meters, see `Font:getPixelDensity`.",
  5401. key = "Font:getAscent",
  5402. module = "lovr.graphics",
  5403. variants = {
  5404. {
  5405. arguments = {},
  5406. returns = {
  5407. {
  5408. name = "ascent",
  5409. type = "number",
  5410. description = "The ascent of the Font."
  5411. }
  5412. }
  5413. }
  5414. }
  5415. },
  5416. {
  5417. name = "getBaseline",
  5418. summary = "Get the baseline of the Font.",
  5419. description = "Returns the baseline of the Font. This is where the characters \"rest on\", relative to the y coordinate of the drawn text. Units are generally in meters, see `Font:setPixelDensity`.",
  5420. key = "Font:getBaseline",
  5421. module = "lovr.graphics",
  5422. variants = {
  5423. {
  5424. arguments = {},
  5425. returns = {
  5426. {
  5427. name = "baseline",
  5428. type = "number",
  5429. description = "The baseline of the Font."
  5430. }
  5431. }
  5432. }
  5433. }
  5434. },
  5435. {
  5436. name = "getDescent",
  5437. summary = "Get the descent of the Font.",
  5438. description = "Returns the maximum distance that any glyph will extend below the Font's baseline. Units are generally in meters, see `Font:getPixelDensity` for more information. Note that due to the coordinate system for fonts, this is a negative value.",
  5439. key = "Font:getDescent",
  5440. module = "lovr.graphics",
  5441. variants = {
  5442. {
  5443. arguments = {},
  5444. returns = {
  5445. {
  5446. name = "descent",
  5447. type = "number",
  5448. description = "The descent of the Font."
  5449. }
  5450. }
  5451. }
  5452. }
  5453. },
  5454. {
  5455. name = "getHeight",
  5456. summary = "Get the height of a line of text.",
  5457. description = "Returns the height of a line of text, in meters. Units are in meters, see `Font:setPixelDensity`.",
  5458. key = "Font:getHeight",
  5459. module = "lovr.graphics",
  5460. variants = {
  5461. {
  5462. arguments = {},
  5463. returns = {
  5464. {
  5465. name = "height",
  5466. type = "number",
  5467. description = "The height of a rendered line of text."
  5468. }
  5469. }
  5470. }
  5471. }
  5472. },
  5473. {
  5474. name = "getLineHeight",
  5475. summary = "Get the line height of the Font.",
  5476. description = "Returns the current line height of the Font. The default is 1.0.",
  5477. key = "Font:getLineHeight",
  5478. module = "lovr.graphics",
  5479. variants = {
  5480. {
  5481. arguments = {},
  5482. returns = {
  5483. {
  5484. name = "lineHeight",
  5485. type = "number",
  5486. description = "The line height."
  5487. }
  5488. }
  5489. }
  5490. }
  5491. },
  5492. {
  5493. name = "getPixelDensity",
  5494. summary = "Get the pixel density of the Font.",
  5495. description = "Returns the current pixel density for the Font. The default is 1.0. Normally, this is in pixels per meter. When rendering to a 2D texture, the units are pixels.",
  5496. key = "Font:getPixelDensity",
  5497. module = "lovr.graphics",
  5498. variants = {
  5499. {
  5500. arguments = {},
  5501. returns = {
  5502. {
  5503. name = "pixelDensity",
  5504. type = "number",
  5505. description = "The current pixel density."
  5506. }
  5507. }
  5508. }
  5509. }
  5510. },
  5511. {
  5512. name = "getWidth",
  5513. summary = "Get the width of a line of text.",
  5514. description = "Returns the width of a string when rendered using the font, with an optional wrap. To get the correct units returned, make sure the pixel density is set with `Font:setPixelDensity`.",
  5515. key = "Font:getWidth",
  5516. module = "lovr.graphics",
  5517. variants = {
  5518. {
  5519. arguments = {
  5520. {
  5521. name = "text",
  5522. type = "string",
  5523. description = "The text to get the width of."
  5524. },
  5525. {
  5526. name = "wrap",
  5527. type = "number",
  5528. description = "The width at which to wrap lines, or 0 for no wrap.",
  5529. default = "0"
  5530. }
  5531. },
  5532. returns = {
  5533. {
  5534. name = "width",
  5535. type = "number",
  5536. description = "The maximum width of any line in the text."
  5537. }
  5538. }
  5539. }
  5540. }
  5541. },
  5542. {
  5543. name = "setLineHeight",
  5544. summary = "Set the line height of the Font.",
  5545. description = "Sets the line height of the Font, which controls how far lines apart lines are vertically separated. This value is a ratio and the default is 1.0.",
  5546. key = "Font:setLineHeight",
  5547. module = "lovr.graphics",
  5548. variants = {
  5549. {
  5550. arguments = {
  5551. {
  5552. name = "lineHeight",
  5553. type = "number",
  5554. description = "The new line height."
  5555. }
  5556. },
  5557. returns = {}
  5558. }
  5559. }
  5560. },
  5561. {
  5562. name = "setPixelDensity",
  5563. summary = "Set the pixel density of the Font.",
  5564. description = "Sets the pixel density for the Font. Normally, this is in pixels per meter. When rendering to a 2D texture, the units are pixels.",
  5565. key = "Font:setPixelDensity",
  5566. module = "lovr.graphics",
  5567. variants = {
  5568. {
  5569. arguments = {
  5570. {
  5571. name = "pixelDensity",
  5572. type = "number",
  5573. description = "The new pixel density."
  5574. }
  5575. },
  5576. returns = {}
  5577. }
  5578. }
  5579. }
  5580. },
  5581. constructors = {
  5582. "lovr.graphics.newFont"
  5583. }
  5584. },
  5585. {
  5586. name = "Mesh",
  5587. summary = "A drawable list of vertices.",
  5588. description = "A Mesh is a low-level graphics object that stores and renders a list of vertices.\n\nMeshes are really flexible since you can pack pretty much whatever you want in them. This makes them great for rendering arbitrary geometry, but it also makes them kinda difficult to use since you have to place each vertex yourself.\n\nIt's possible to batch geometry with Meshes too. Instead of drawing a shape 100 times, it's much faster to pack 100 copies of the shape into a Mesh and draw the Mesh once.\n\nMeshes are also a good choice if you have a mesh that changes its shape over time.",
  5589. key = "Mesh",
  5590. module = "lovr.graphics",
  5591. constructors = {
  5592. "lovr.graphics.newMesh"
  5593. },
  5594. notes = "Each vertex in a Mesh can hold several pieces of data. For example, you might want a vertex to keep track of its position, color, and a weight. Each one of these pieces of information is called a vertex **attribute**. A vertex attribute must have a name, a type, and a size. Here's what the \"position\" attribute would look like as a Lua table:\n\n { 'vPosition', 'float', 3 } -- 3 floats for x, y, and z\n\nEvery vertex in a Mesh must have the same set of attributes. We call this set of attributes the **format** of the Mesh, and it's specified as a simple table of attributes. For example, we could represent the format described above as:\n\n {\n { 'vPosition', 'float', 3 },\n { 'vColor', 'byte', 4 },\n { 'vWeight', 'int', 1 }\n }\n\nWhen creating a Mesh, you can give it any format you want, or use the default. The default Mesh format looks like this:\n\n {\n { 'lovrPosition', 'float', 3 },\n { 'lovrNormal', 'float', 3 },\n { 'lovrTexCoord', 'float', 2 }\n }\n\nGreat, so why do we go through the trouble of naming everything in our vertex and saying what type and size it is? The cool part is that we can access this data in a Shader. We can write a vertex Shader that has `in` variables for every vertex attribute in our Mesh:\n\n in vec3 vPosition;\n in vec4 vColor;\n in int vWeight;\n\n vec4 position(mat4 projection, mat4 transform, vec4 vertex) {\n // Here we can access the vPosition, vColor, and vWeight of each vertex in the Mesh!\n }\n\nSpecifying custom vertex data is really powerful and is often used for lighting, animation, and more!",
  5595. methods = {
  5596. {
  5597. name = "draw",
  5598. summary = "Draw the Mesh.",
  5599. description = "Draws the contents of the Mesh.",
  5600. key = "Mesh:draw",
  5601. module = "lovr.graphics",
  5602. variants = {
  5603. {
  5604. arguments = {
  5605. {
  5606. name = "x",
  5607. type = "number",
  5608. description = "The x coordinate to draw the Mesh at.",
  5609. default = "0"
  5610. },
  5611. {
  5612. name = "y",
  5613. type = "number",
  5614. description = "The y coordinate to draw the Mesh at.",
  5615. default = "0"
  5616. },
  5617. {
  5618. name = "z",
  5619. type = "number",
  5620. description = "The z coordinate to draw the Mesh at.",
  5621. default = "0"
  5622. },
  5623. {
  5624. name = "scale",
  5625. type = "number",
  5626. description = "The scale to draw the Mesh at.",
  5627. default = "1"
  5628. },
  5629. {
  5630. name = "angle",
  5631. type = "number",
  5632. description = "The angle to rotate the Mesh around its axis of rotation.",
  5633. default = "0"
  5634. },
  5635. {
  5636. name = "ax",
  5637. type = "number",
  5638. description = "The x component of the axis of rotation.",
  5639. default = "0"
  5640. },
  5641. {
  5642. name = "ay",
  5643. type = "number",
  5644. description = "The y component of the axis of rotation.",
  5645. default = "1"
  5646. },
  5647. {
  5648. name = "az",
  5649. type = "number",
  5650. description = "The z component of the axis of rotation.",
  5651. default = "0"
  5652. }
  5653. },
  5654. returns = {}
  5655. },
  5656. {
  5657. arguments = {
  5658. {
  5659. name = "transform",
  5660. type = "Transform",
  5661. description = "The transform to apply before drawing."
  5662. }
  5663. },
  5664. returns = {}
  5665. }
  5666. }
  5667. },
  5668. {
  5669. name = "getDrawMode",
  5670. summary = "Get the draw mode of the Mesh.",
  5671. description = "Get the draw mode of the Mesh, which controls how the vertices are connected together.",
  5672. key = "Mesh:getDrawMode",
  5673. module = "lovr.graphics",
  5674. variants = {
  5675. {
  5676. arguments = {},
  5677. returns = {
  5678. {
  5679. name = "mode",
  5680. type = "MeshDrawMode",
  5681. description = "The draw mode of the Mesh."
  5682. }
  5683. }
  5684. }
  5685. }
  5686. },
  5687. {
  5688. name = "getDrawRange",
  5689. summary = "Get the draw range of the Mesh.",
  5690. description = "Retrieve the current draw range for the Mesh. The draw range is a subset of the vertices of the Mesh that will be drawn.",
  5691. key = "Mesh:getDrawRange",
  5692. module = "lovr.graphics",
  5693. variants = {
  5694. {
  5695. arguments = {},
  5696. returns = {
  5697. {
  5698. name = "start",
  5699. type = "number",
  5700. description = "The index of the first vertex that will be drawn, or `nil` if no draw range is set."
  5701. },
  5702. {
  5703. name = "count",
  5704. type = "number",
  5705. description = "The number of vertices that will be drawn, or `nil` if no draw range is set."
  5706. }
  5707. }
  5708. }
  5709. }
  5710. },
  5711. {
  5712. name = "getTexture",
  5713. summary = "Get the Texture applied to the Mesh.",
  5714. description = "Get the Texture applied to the Mesh.",
  5715. key = "Mesh:getTexture",
  5716. module = "lovr.graphics",
  5717. variants = {
  5718. {
  5719. arguments = {},
  5720. returns = {
  5721. {
  5722. name = "texture",
  5723. type = "Texture",
  5724. description = "The current texture applied to the Mesh."
  5725. }
  5726. }
  5727. }
  5728. }
  5729. },
  5730. {
  5731. name = "getVertex",
  5732. summary = "Get a single vertex in the Mesh.",
  5733. description = "Gets the data for a single vertex in the Mesh. The set of data returned depends on the Mesh's vertex format. The default vertex format consists of 8 floating point numbers: the vertex position, the vertex normal, and the texture coordinates.",
  5734. key = "Mesh:getVertex",
  5735. module = "lovr.graphics",
  5736. variants = {
  5737. {
  5738. arguments = {
  5739. {
  5740. name = "index",
  5741. type = "number",
  5742. description = "The index of the vertex to retrieve."
  5743. }
  5744. },
  5745. returns = {
  5746. {
  5747. name = "...",
  5748. type = "number",
  5749. description = "All attributes of the vertex."
  5750. }
  5751. }
  5752. }
  5753. }
  5754. },
  5755. {
  5756. name = "getVertexAttribute",
  5757. summary = "Get an attribute of a single vertex in the Mesh.",
  5758. description = "Get the components of a specific attribute of a single vertex in the Mesh.",
  5759. key = "Mesh:getVertexAttribute",
  5760. module = "lovr.graphics",
  5761. notes = "Meshes without a custom format have the vertex position as their first attribute, the normal vector as the second attribute, and the texture coordinate as the third attribute.",
  5762. variants = {
  5763. {
  5764. arguments = {
  5765. {
  5766. name = "index",
  5767. type = "number",
  5768. description = "The index of the vertex to retrieve the attribute of."
  5769. },
  5770. {
  5771. name = "attribute",
  5772. type = "number",
  5773. description = "The index of the attribute to retrieve the components of."
  5774. }
  5775. },
  5776. returns = {
  5777. {
  5778. name = "...",
  5779. type = "number",
  5780. description = "The components of the vertex attribute."
  5781. }
  5782. }
  5783. }
  5784. }
  5785. },
  5786. {
  5787. name = "getVertexCount",
  5788. summary = "Get the number of vertices the Mesh can hold.",
  5789. description = "Returns the maximum number of vertices the Mesh can hold.",
  5790. key = "Mesh:getVertexCount",
  5791. module = "lovr.graphics",
  5792. notes = "The size can only be set when creating the Mesh, and cannot be changed afterwards.",
  5793. variants = {
  5794. {
  5795. arguments = {},
  5796. returns = {
  5797. {
  5798. name = "size",
  5799. type = "number",
  5800. description = "The number of vertices the Mesh can hold."
  5801. }
  5802. }
  5803. }
  5804. }
  5805. },
  5806. {
  5807. name = "getVertexFormat",
  5808. summary = "Get the vertex format of the Mesh.",
  5809. description = "Get the format table of the Mesh's vertices. The format table describes the set of data that each vertex contains.",
  5810. key = "Mesh:getVertexFormat",
  5811. module = "lovr.graphics",
  5812. variants = {
  5813. {
  5814. arguments = {},
  5815. returns = {
  5816. {
  5817. name = "format",
  5818. type = "table",
  5819. description = "The table of vertex attributes. Each attribute is a table containing the name of the attribute, the data type, and the number of components."
  5820. }
  5821. }
  5822. }
  5823. }
  5824. },
  5825. {
  5826. name = "getVertexMap",
  5827. summary = "Get the current vertex map of the Mesh.",
  5828. description = "Returns the current vertex map for the Mesh. The vertex map is a list of indices in the Mesh, allowing the reordering or reuse of vertices.",
  5829. key = "Mesh:getVertexMap",
  5830. module = "lovr.graphics",
  5831. variants = {
  5832. {
  5833. arguments = {},
  5834. returns = {
  5835. {
  5836. name = "map",
  5837. type = "table",
  5838. description = "The list of indices in the vertex map, or `nil` if no vertex map is set."
  5839. }
  5840. }
  5841. }
  5842. }
  5843. },
  5844. {
  5845. name = "isAttributeEnabled",
  5846. summary = "Check if a vertex attribute is enabled.",
  5847. description = "Returns whether or not a vertex attribute is enabled. Disabled attributes won't be sent to shaders.",
  5848. key = "Mesh:isAttributeEnabled",
  5849. module = "lovr.graphics",
  5850. variants = {
  5851. {
  5852. arguments = {
  5853. {
  5854. name = "attribute",
  5855. type = "string",
  5856. description = "The name of the attribute."
  5857. }
  5858. },
  5859. returns = {
  5860. {
  5861. name = "enabled",
  5862. type = "boolean",
  5863. description = "Whether or not the attribute is enabled when drawing the Mesh."
  5864. }
  5865. }
  5866. }
  5867. }
  5868. },
  5869. {
  5870. name = "setAttributeEnabled",
  5871. summary = "Enable or disable a vertex attribute.",
  5872. description = "Sets whether a vertex attribute is enabled. Disabled attributes won't be sent to shaders.",
  5873. key = "Mesh:setAttributeEnabled",
  5874. module = "lovr.graphics",
  5875. variants = {
  5876. {
  5877. arguments = {
  5878. {
  5879. name = "attribute",
  5880. type = "string",
  5881. description = "The name of the attribute."
  5882. },
  5883. {
  5884. name = "enabled",
  5885. type = "boolean",
  5886. description = "Whether or not the attribute is enabled when drawing the Mesh."
  5887. }
  5888. },
  5889. returns = {}
  5890. }
  5891. }
  5892. },
  5893. {
  5894. name = "setDrawMode",
  5895. summary = "Change the draw mode of the Mesh.",
  5896. description = "Set a new draw mode for the Mesh.",
  5897. key = "Mesh:setDrawMode",
  5898. module = "lovr.graphics",
  5899. variants = {
  5900. {
  5901. arguments = {
  5902. {
  5903. name = "mode",
  5904. type = "MeshDrawMode",
  5905. description = "The new draw mode for the Mesh."
  5906. }
  5907. },
  5908. returns = {}
  5909. }
  5910. }
  5911. },
  5912. {
  5913. name = "setDrawRange",
  5914. summary = "Set the draw range of the Mesh.",
  5915. description = "Set the draw range for the Mesh. The draw range is a subset of the vertices of the Mesh that will be drawn.",
  5916. key = "Mesh:setDrawRange",
  5917. module = "lovr.graphics",
  5918. variants = {
  5919. {
  5920. arguments = {
  5921. {
  5922. name = "start",
  5923. type = "number",
  5924. description = "The first vertex that will be drawn."
  5925. },
  5926. {
  5927. name = "count",
  5928. type = "number",
  5929. description = "The number of vertices that will be drawn."
  5930. }
  5931. },
  5932. returns = {}
  5933. }
  5934. }
  5935. },
  5936. {
  5937. name = "setTexture",
  5938. summary = "Apply a Texture to the Mesh.",
  5939. description = "Applies a Texture to the Mesh.",
  5940. key = "Mesh:setTexture",
  5941. module = "lovr.graphics",
  5942. variants = {
  5943. {
  5944. arguments = {
  5945. {
  5946. name = "texture",
  5947. type = "Texture",
  5948. description = "The new texture."
  5949. }
  5950. },
  5951. returns = {}
  5952. }
  5953. }
  5954. },
  5955. {
  5956. name = "setVertex",
  5957. summary = "Update a single vertex in the Mesh.",
  5958. description = "Update a single vertex in the Mesh.",
  5959. key = "Mesh:setVertex",
  5960. module = "lovr.graphics",
  5961. notes = "Any unspecified components will be set to 0 for float and int attributes, or 255 for byte attributes.",
  5962. variants = {
  5963. {
  5964. arguments = {
  5965. {
  5966. name = "index",
  5967. type = "number",
  5968. description = "The index of the vertex to set."
  5969. },
  5970. {
  5971. name = "...",
  5972. type = "number",
  5973. description = "The attributes of the vertex."
  5974. }
  5975. },
  5976. returns = {}
  5977. },
  5978. {
  5979. arguments = {
  5980. {
  5981. name = "index",
  5982. type = "number",
  5983. description = "The index of the vertex to set."
  5984. },
  5985. {
  5986. name = "vertexData",
  5987. type = "table",
  5988. description = "A table containing the attributes of the vertex."
  5989. }
  5990. },
  5991. returns = {}
  5992. }
  5993. },
  5994. examples = {
  5995. {
  5996. description = "Set the position of a vertex:",
  5997. code = "function lovr.load()\n mesh = lovr.graphics.newMesh({\n { -1, 1, 0, 0, 0, 1, 0, 0 },\n { 1, 1, 0, 0, 0, 1, 1, 0 },\n { -1, -1, 0, 0, 0, 1, 0, 1 },\n { 1, -1, 0, 0, 0, 1, 1, 1 }\n }, 'strip')\n\n mesh:setVertex(2, { 7, 7, 7 })\n print(mesh:getVertex(2)) -- 7, 7, 7, 0, 0, 0, 0, 0\nend"
  5998. }
  5999. }
  6000. },
  6001. {
  6002. name = "setVertexAttribute",
  6003. summary = "Update a specific attribute of a single vertex in the Mesh.",
  6004. description = "Set the components of a specific attribute of a vertex in the Mesh.",
  6005. key = "Mesh:setVertexAttribute",
  6006. module = "lovr.graphics",
  6007. notes = "Meshes without a custom format have the vertex position as their first attribute, the normal vector as the second attribute, and the texture coordinate as the third attribute.",
  6008. variants = {
  6009. {
  6010. arguments = {
  6011. {
  6012. name = "index",
  6013. type = "number",
  6014. description = "The index of the vertex to update."
  6015. },
  6016. {
  6017. name = "attribute",
  6018. type = "number",
  6019. description = "The index of the attribute to update."
  6020. },
  6021. {
  6022. name = "...",
  6023. type = "number",
  6024. description = "Thew new components for the attribute."
  6025. }
  6026. },
  6027. returns = {}
  6028. }
  6029. }
  6030. },
  6031. {
  6032. name = "setVertexMap",
  6033. summary = "Set the vertex map of the Mesh.",
  6034. description = "Sets the vertex map. The vertex map is a list of indices in the Mesh, allowing the reordering or reuse of vertices.\n\nOften, a vertex map is used to improve performance, since it usually requires less data to specify the index of a vertex than it does to specify all of the data for a vertex.",
  6035. key = "Mesh:setVertexMap",
  6036. module = "lovr.graphics",
  6037. variants = {
  6038. {
  6039. arguments = {
  6040. {
  6041. name = "map",
  6042. type = "table",
  6043. description = "The new vertex map. Each element of the table is an index of a vertex."
  6044. }
  6045. },
  6046. returns = {}
  6047. }
  6048. }
  6049. },
  6050. {
  6051. name = "setVertices",
  6052. summary = "Update multiple vertices in the Mesh.",
  6053. description = "Update multiple vertices in the Mesh.",
  6054. key = "Mesh:setVertices",
  6055. module = "lovr.graphics",
  6056. notes = "The start index plus the number of vertices in the table should not exceed the maximum size of the Mesh.",
  6057. variants = {
  6058. {
  6059. arguments = {
  6060. {
  6061. name = "vertices",
  6062. type = "table",
  6063. description = "The new set of vertices."
  6064. },
  6065. {
  6066. name = "start",
  6067. type = "number",
  6068. description = "The index of the vertex to start replacing at.",
  6069. default = "1"
  6070. }
  6071. },
  6072. returns = {}
  6073. }
  6074. }
  6075. }
  6076. },
  6077. examples = {
  6078. {
  6079. description = "Draw a circle using a Mesh.",
  6080. code = "function lovr.load()\n local x, y, z = 0, 1, -2\n local radius = .3\n local points = 40\n\n -- A table to hold the Mesh data\n local vertices = {}\n\n for i = 0, points do\n local angle = i / points * 2 * math.pi\n local vx = x + math.cos(angle)\n local vy = y + math.sin(angle)\n table.insert(vertices, { vx, vy, z })\n end\n\n mesh = lovr.graphics.newMesh(vertices, 'fan')\nend\n\nfunction lovr.draw()\n mesh:draw()\nend"
  6081. }
  6082. }
  6083. },
  6084. {
  6085. name = "Model",
  6086. summary = "An asset imported from a 3D model file.",
  6087. description = "A Model is a drawable object loaded from a 3D file format. The supported 3D file formats are `obj`, `fbx`, and collada. Models will use normals and texture coordinates, if provided.\n\nThe following advanced features are not supported yet: animations, materials, and vertex colors.",
  6088. key = "Model",
  6089. module = "lovr.graphics",
  6090. examples = {
  6091. {
  6092. code = "local model\n\nfunction lovr.load()\n model = lovr.graphics.newModel('assets/model.fbx', 'assets/texture.png')\nend\n\nfunction lovr.draw()\n model:draw(0, 1, -1, 1, lovr.timer.getTime())\nend"
  6093. }
  6094. },
  6095. constructors = {
  6096. "lovr.graphics.newModel",
  6097. "Controller:newModel"
  6098. },
  6099. methods = {
  6100. {
  6101. name = "draw",
  6102. summary = "Draw the Model.",
  6103. description = "Draw the Model.",
  6104. key = "Model:draw",
  6105. module = "lovr.graphics",
  6106. variants = {
  6107. {
  6108. arguments = {
  6109. {
  6110. name = "x",
  6111. type = "number",
  6112. description = "The x coordinate to draw the Model at.",
  6113. default = "0"
  6114. },
  6115. {
  6116. name = "y",
  6117. type = "number",
  6118. description = "The y coordinate to draw the Model at.",
  6119. default = "0"
  6120. },
  6121. {
  6122. name = "z",
  6123. type = "number",
  6124. description = "The z coordinate to draw the Model at.",
  6125. default = "0"
  6126. },
  6127. {
  6128. name = "scale",
  6129. type = "number",
  6130. description = "The scale to draw the Model at.",
  6131. default = "1"
  6132. },
  6133. {
  6134. name = "angle",
  6135. type = "number",
  6136. description = "The angle to rotate the Model around its axis of rotation.",
  6137. default = "0"
  6138. },
  6139. {
  6140. name = "ax",
  6141. type = "number",
  6142. description = "The x component of the axis of rotation.",
  6143. default = "0"
  6144. },
  6145. {
  6146. name = "ay",
  6147. type = "number",
  6148. description = "The y component of the axis of rotation.",
  6149. default = "1"
  6150. },
  6151. {
  6152. name = "az",
  6153. type = "number",
  6154. description = "The z component of the axis of rotation.",
  6155. default = "0"
  6156. }
  6157. },
  6158. returns = {}
  6159. },
  6160. {
  6161. arguments = {
  6162. {
  6163. name = "transform",
  6164. type = "Transform",
  6165. description = "The transform to apply before drawing."
  6166. }
  6167. },
  6168. returns = {}
  6169. }
  6170. }
  6171. },
  6172. {
  6173. name = "getAABB",
  6174. summary = "Get the Model's axis aligned bounding box.",
  6175. description = "Returns a bounding box that encloses the vertices of the Model.",
  6176. key = "Model:getAABB",
  6177. module = "lovr.graphics",
  6178. related = {
  6179. "Collider:getAABB"
  6180. },
  6181. variants = {
  6182. {
  6183. arguments = {},
  6184. returns = {
  6185. {
  6186. name = "minx",
  6187. type = "number",
  6188. description = "The minimum x coordinate of the box."
  6189. },
  6190. {
  6191. name = "maxx",
  6192. type = "number",
  6193. description = "The maximum x coordinate of the box."
  6194. },
  6195. {
  6196. name = "miny",
  6197. type = "number",
  6198. description = "The minimum y coordinate of the box."
  6199. },
  6200. {
  6201. name = "maxy",
  6202. type = "number",
  6203. description = "The maximum y coordinate of the box."
  6204. },
  6205. {
  6206. name = "minz",
  6207. type = "number",
  6208. description = "The minimum z coordinate of the box."
  6209. },
  6210. {
  6211. name = "maxz",
  6212. type = "number",
  6213. description = "The maximum z coordinate of the box."
  6214. }
  6215. }
  6216. }
  6217. }
  6218. },
  6219. {
  6220. name = "getTexture",
  6221. summary = "Get the Texture applied to the Model.",
  6222. description = "Get the Texture applied to the Model.",
  6223. key = "Model:getTexture",
  6224. module = "lovr.graphics",
  6225. variants = {
  6226. {
  6227. arguments = {},
  6228. returns = {
  6229. {
  6230. name = "texture",
  6231. type = "Texture",
  6232. description = "The current texture applied to the Model."
  6233. }
  6234. }
  6235. }
  6236. }
  6237. },
  6238. {
  6239. name = "setTexture",
  6240. summary = "Apply a Texture to the Model.",
  6241. description = "Apply a Texture to the Model.",
  6242. key = "Model:setTexture",
  6243. module = "lovr.graphics",
  6244. variants = {
  6245. {
  6246. arguments = {
  6247. {
  6248. name = "texture",
  6249. type = "Texture",
  6250. description = "The texture to apply to the Model."
  6251. }
  6252. },
  6253. returns = {}
  6254. }
  6255. }
  6256. }
  6257. }
  6258. },
  6259. {
  6260. name = "Shader",
  6261. summary = "A GLSL program used for low-level control over rendering.",
  6262. description = "Shaders are GLSL programs that transform the way vertices and pixels show up on the screen. They can be used for lighting, postprocessing, particles, animation, and much more. You can use `lovr.graphics.setShader` to change the active Shader.",
  6263. key = "Shader",
  6264. module = "lovr.graphics",
  6265. constructors = {
  6266. "lovr.graphics.newShader"
  6267. },
  6268. notes = "The current GLSL version used is 150.\n\nThe default vertex shader:\n\n vec4 position(mat4 projection, mat4 transform, vec4 vertex) {\n return projection * transform * vertex;\n }\n\nThe default fragment shader:\n\n vec4 color(vec4 graphicsColor, sampler2D image, vec2 uv) {\n return graphicsColor * texture(image, uv);\n }\n\nAdditionally, the following headers are prepended to the shader source, giving you convenient access to a default set of uniform variables and vertex attributes.\n\nVertex shader header:\n\n uniform mat4 lovrTransform;\n uniform mat4 lovrNormalMatrix;\n uniform mat4 lovrProjection;\n in vec3 lovrPosition;\n in vec3 lovrNormal;\n in vec2 lovrTexCoord;\n out vec2 texCoord;\n\nFragment shader header:\n\n uniform vec4 lovrColor;\n uniform sampler2D lovrTexture;\n in vec2 texCoord;\n in vec4 gl_FragCoord;\n out vec4 lovrFragColor;",
  6269. methods = {
  6270. {
  6271. name = "send",
  6272. summary = "Update a uniform variable in the Shader.",
  6273. description = "Update a uniform variable in the Shader.",
  6274. key = "Shader:send",
  6275. module = "lovr.graphics",
  6276. notes = "The shader does not need to be active to update its uniforms. However, the types must match up. Uniform variables declared as `float`s must be sent a single number, whereas uniforms declared as `vec4`s must be sent a table containing 4 numbers, etc.\n\nAn error is thrown if the uniform does not exist or is not used in the shader.",
  6277. variants = {
  6278. {
  6279. arguments = {
  6280. {
  6281. name = "uniform",
  6282. type = "string",
  6283. description = "The name of the uniform to update."
  6284. },
  6285. {
  6286. name = "value",
  6287. type = "*",
  6288. description = "The new value of the uniform."
  6289. }
  6290. },
  6291. returns = {}
  6292. }
  6293. },
  6294. examples = {
  6295. {
  6296. description = "Updating a `vec3` uniform:",
  6297. code = "function lovr.load()\n shader = lovr.graphics.newShader [[\n uniform vec3 offset;\n vec4 position(mat4 projection, mat4 transform, vec4 vertex) {\n vertex.xyz += offset;\n return projection * transform * vertex;\n }\n ]]\n\n shader:send('offset', { .3, .7, 0 })\nend"
  6298. }
  6299. }
  6300. }
  6301. },
  6302. examples = {
  6303. {
  6304. description = "Set a simple shader that colors pixels based on vertex normals.",
  6305. code = "function lovr.load()\n lovr.graphics.setShader(lovr.graphics.newShader([[\n out vec3 vNormal; // This gets passed to the fragment shader\n\n vec4 position(mat4 projection, mat4 transform, vec4 vertex) {\n vNormal = lovrNormal;\n return projection * transform * vertex;\n }\n ]], [[\n in vec3 vNormal; // This gets passed from the vertex shader\n\n vec4 color(vec4 graphicsColor, sampler2D image, vec2 uv) {\n return vec4(vNormal * .5 + .5, 1.0);\n }\n ]]))\n\n model = lovr.graphics.newModel('model.fbx')\nend\n\nfunction lovr.draw()\n model:draw(x, y, z, 1)\nend"
  6306. }
  6307. }
  6308. },
  6309. {
  6310. name = "Skybox",
  6311. summary = "A cube wrapped around the camera, used as a 3D background.",
  6312. description = "A Skybox is a collection of six images used to apply a background to a three dimensional scene. Each image is used to texture the face of a cube, and the cube is drawn around the camera, giving an illusion of a 360-degree background.",
  6313. key = "Skybox",
  6314. module = "lovr.graphics",
  6315. constructors = {
  6316. "lovr.graphics.newSkybox"
  6317. },
  6318. notes = "To prevent problems with the depth test, make sure you draw Skyboxes before drawing other things, or disable the depth test while drawing them.",
  6319. methods = {
  6320. {
  6321. name = "draw",
  6322. summary = "Draw the Skybox.",
  6323. description = "Draws the Skybox at a specified angle.",
  6324. key = "Skybox:draw",
  6325. module = "lovr.graphics",
  6326. notes = "To prevent problems with the depth test, make sure you draw Skyboxes before drawing other things, or disable the depth test while drawing them.",
  6327. variants = {
  6328. {
  6329. arguments = {
  6330. {
  6331. name = "angle",
  6332. type = "number",
  6333. description = "The number of radians to rotate the skybox around its axis of rotation"
  6334. },
  6335. {
  6336. name = "ax",
  6337. type = "number",
  6338. description = "The x component of the axis of rotation."
  6339. },
  6340. {
  6341. name = "ay",
  6342. type = "number",
  6343. description = "The y component of the axis of rotation."
  6344. },
  6345. {
  6346. name = "az",
  6347. type = "number",
  6348. description = "The z component of the axis of rotation."
  6349. }
  6350. },
  6351. returns = {}
  6352. }
  6353. }
  6354. }
  6355. },
  6356. examples = {
  6357. {
  6358. description = "Drawing a Skybox in VR:",
  6359. code = "function lovr.load()\n skybox = lovr.graphics.newSkybox({\n '1.png',\n '2.png',\n '3.png',\n '4.png',\n '5.png',\n '6.png'\n })\nend\n\nfunction lovr.draw()\n lovr.graphics.setColor(255, 255, 255)\n skybox:draw(lovr.headset.getOrientation())\n\n -- Draw everything else\nend"
  6360. }
  6361. }
  6362. },
  6363. {
  6364. name = "Texture",
  6365. summary = "An image that can be applied to Meshes and Models.",
  6366. description = "A Texture is an image that can be applied to `Model`s and `Mesh`s. Supported file formats include `.png`, `.jpg`, `.tga`, and `.bmp`.",
  6367. key = "Texture",
  6368. module = "lovr.graphics",
  6369. methods = {
  6370. {
  6371. name = "getDimensions",
  6372. summary = "Get the dimensions of the Texture.",
  6373. description = "Returns the dimensions of the Texture.",
  6374. key = "Texture:getDimensions",
  6375. module = "lovr.graphics",
  6376. variants = {
  6377. {
  6378. arguments = {},
  6379. returns = {
  6380. {
  6381. name = "width",
  6382. type = "number",
  6383. description = "The width of the Texture, in pixels."
  6384. },
  6385. {
  6386. name = "height",
  6387. type = "number",
  6388. description = "The height of the Texture, in pixels."
  6389. }
  6390. }
  6391. }
  6392. }
  6393. },
  6394. {
  6395. name = "getFilter",
  6396. summary = "Get the FilterMode for the Texture.",
  6397. description = "Returns the current FilterMode for the Texture.",
  6398. key = "Texture:getFilter",
  6399. module = "lovr.graphics",
  6400. variants = {
  6401. {
  6402. arguments = {},
  6403. returns = {
  6404. {
  6405. name = "min",
  6406. type = "FilterMode",
  6407. description = "The filter mode used for minification."
  6408. },
  6409. {
  6410. name = "mag",
  6411. type = "FilterMode",
  6412. description = "The filter mode used for magnification."
  6413. }
  6414. }
  6415. }
  6416. }
  6417. },
  6418. {
  6419. name = "getHeight",
  6420. summary = "Get the height of the Texture.",
  6421. description = "Returns the height of the Texture.",
  6422. key = "Texture:getHeight",
  6423. module = "lovr.graphics",
  6424. variants = {
  6425. {
  6426. arguments = {},
  6427. returns = {
  6428. {
  6429. name = "height",
  6430. type = "number",
  6431. description = "The height of the Texture, in pixels."
  6432. }
  6433. }
  6434. }
  6435. }
  6436. },
  6437. {
  6438. name = "getWidth",
  6439. summary = "Get the width of the Texture.",
  6440. description = "Returns the width of the Texture.",
  6441. key = "Texture:getWidth",
  6442. module = "lovr.graphics",
  6443. variants = {
  6444. {
  6445. arguments = {},
  6446. returns = {
  6447. {
  6448. name = "width",
  6449. type = "number",
  6450. description = "The width of the Texture, in pixels."
  6451. }
  6452. }
  6453. }
  6454. }
  6455. },
  6456. {
  6457. name = "getWrap",
  6458. summary = "Get the WrapMode for the Texture.",
  6459. description = "Returns the current WrapMode for the Texture.",
  6460. key = "Texture:getWrap",
  6461. module = "lovr.graphics",
  6462. variants = {
  6463. {
  6464. arguments = {},
  6465. returns = {
  6466. {
  6467. name = "horizontal",
  6468. type = "WrapMode",
  6469. description = "How the texture wraps horizontally."
  6470. },
  6471. {
  6472. name = "vertical",
  6473. type = "WrapMode",
  6474. description = "How the texture wraps vertically."
  6475. }
  6476. }
  6477. }
  6478. }
  6479. },
  6480. {
  6481. name = "renderTo",
  6482. summary = "Render to a Texture.",
  6483. description = "Renders to a Texture using a function. The Texture must be created as a framebuffer by passing a width and height to `lovr.graphics.newTexture` instead of a filename.",
  6484. key = "Texture:renderTo",
  6485. module = "lovr.graphics",
  6486. notes = "Make sure you clear the contents of the Texture before rendering to it to clear any previous contents.",
  6487. variants = {
  6488. {
  6489. arguments = {
  6490. {
  6491. name = "callback",
  6492. type = "function",
  6493. description = "A function that calls drawing commands to render to the Texture."
  6494. }
  6495. },
  6496. returns = {}
  6497. }
  6498. }
  6499. },
  6500. {
  6501. name = "setFilter",
  6502. summary = "Set the FilterMode for the Texture.",
  6503. description = "Sets the `FilterMode` used by the texture when upsampling or downsampling. The default mode is `linear`.",
  6504. key = "Texture:setFilter",
  6505. module = "lovr.graphics",
  6506. variants = {
  6507. {
  6508. arguments = {
  6509. {
  6510. name = "min",
  6511. type = "FilterMode",
  6512. description = "The filter mode used for minification."
  6513. },
  6514. {
  6515. name = "mag",
  6516. type = "FilterMode",
  6517. description = "The filter mode used for magnification.",
  6518. default = "min"
  6519. }
  6520. },
  6521. returns = {}
  6522. }
  6523. }
  6524. },
  6525. {
  6526. name = "setWrap",
  6527. summary = "Set the WrapMode for the Texture.",
  6528. description = "Sets the wrap mode of a texture. The wrap mode controls how the texture is sampled when texture coordinates lie outside the usual 0 - 1 range. The default for both directions is `repeat`.",
  6529. key = "Texture:setWrap",
  6530. module = "lovr.graphics",
  6531. variants = {
  6532. {
  6533. arguments = {
  6534. {
  6535. name = "horizontal",
  6536. type = "WrapMode",
  6537. description = "How the texture should wrap horizontally."
  6538. },
  6539. {
  6540. name = "vertical",
  6541. type = "WrapMode",
  6542. description = "How the texture should wrap vertically.",
  6543. default = "horizontal"
  6544. }
  6545. },
  6546. returns = {}
  6547. }
  6548. }
  6549. }
  6550. },
  6551. constructors = {
  6552. "lovr.graphics.newTexture"
  6553. }
  6554. }
  6555. }
  6556. },
  6557. {
  6558. name = "headset",
  6559. tag = "modules",
  6560. summary = "Connects to VR hardware.",
  6561. 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 the center of the play area.",
  6562. key = "lovr.headset",
  6563. sections = {
  6564. {
  6565. name = "Headset",
  6566. tag = "headset",
  6567. description = "Functions that return information about the head mounted display (HMD) currently strapped to the player's face."
  6568. },
  6569. {
  6570. name = "Play area",
  6571. tag = "playArea",
  6572. 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."
  6573. },
  6574. {
  6575. name = "Controllers",
  6576. tag = "controllers",
  6577. description = "Get a list of connected `Controller`s. Also see `lovr.controlleradded` and `lovr.controllerremoved`."
  6578. }
  6579. },
  6580. enums = {
  6581. {
  6582. name = "ControllerAxis",
  6583. description = "Axes on a Controller.",
  6584. key = "ControllerAxis",
  6585. module = "headset",
  6586. values = {
  6587. {
  6588. name = "trigger",
  6589. description = "The trigger."
  6590. },
  6591. {
  6592. name = "touchx",
  6593. description = "The x axis of the touchpad. Positive values are to the right."
  6594. },
  6595. {
  6596. name = "touchy",
  6597. description = "The y axis of the touchpad. Positive values are upwards."
  6598. }
  6599. }
  6600. },
  6601. {
  6602. name = "ControllerButton",
  6603. description = "Buttons on a Controller.",
  6604. key = "ControllerButton",
  6605. module = "headset",
  6606. values = {
  6607. {
  6608. name = "system",
  6609. description = "The system button."
  6610. },
  6611. {
  6612. name = "menu",
  6613. description = "The menu button."
  6614. },
  6615. {
  6616. name = "grip",
  6617. description = "The grip button."
  6618. },
  6619. {
  6620. name = "touchpad",
  6621. description = "The button on the touchpad."
  6622. }
  6623. }
  6624. },
  6625. {
  6626. name = "HeadsetEye",
  6627. summary = "The two different eyes.",
  6628. description = "Represents either the left eye or the right eye.",
  6629. key = "HeadsetEye",
  6630. module = "headset",
  6631. values = {
  6632. {
  6633. name = "left",
  6634. description = "The left eye."
  6635. },
  6636. {
  6637. name = "right",
  6638. description = "The right eye."
  6639. }
  6640. }
  6641. }
  6642. },
  6643. functions = {
  6644. {
  6645. name = "getAngularVelocity",
  6646. tag = "headset",
  6647. summary = "Get the angular velocity of the headset.",
  6648. description = "Returns the current angular velocity of the headset.",
  6649. key = "lovr.headset.getAngularVelocity",
  6650. module = "lovr.headset",
  6651. related = {
  6652. "lovr.headset.getOrientation",
  6653. "lovr.headset.getVelocity",
  6654. "lovr.headset.getPosition"
  6655. },
  6656. variants = {
  6657. {
  6658. arguments = {},
  6659. returns = {
  6660. {
  6661. name = "x",
  6662. type = "number",
  6663. description = "The x component of the angular velocity."
  6664. },
  6665. {
  6666. name = "y",
  6667. type = "number",
  6668. description = "The y component of the angular velocity."
  6669. },
  6670. {
  6671. name = "z",
  6672. type = "number",
  6673. description = "The z component of the angular velocity."
  6674. }
  6675. }
  6676. }
  6677. }
  6678. },
  6679. {
  6680. name = "getBoundsDepth",
  6681. tag = "playArea",
  6682. summary = "Get the depth of the play area.",
  6683. description = "Returns the depth of the play area, in meters.",
  6684. key = "lovr.headset.getBoundsDepth",
  6685. module = "lovr.headset",
  6686. related = {
  6687. "lovr.headset.getBoundsWidth",
  6688. "lovr.headset.getBoundsDimensions"
  6689. },
  6690. variants = {
  6691. {
  6692. arguments = {},
  6693. returns = {
  6694. {
  6695. name = "depth",
  6696. type = "number",
  6697. description = "The depth of the play area, in meters."
  6698. }
  6699. }
  6700. }
  6701. }
  6702. },
  6703. {
  6704. name = "getBoundsDimensions",
  6705. tag = "playArea",
  6706. summary = "Get the size of the play area.",
  6707. description = "Returns the size of the play area, in meters.",
  6708. key = "lovr.headset.getBoundsDimensions",
  6709. module = "lovr.headset",
  6710. related = {
  6711. "lovr.headset.getBoundsWidth",
  6712. "lovr.headset.getBoundsDepth"
  6713. },
  6714. variants = {
  6715. {
  6716. arguments = {},
  6717. returns = {
  6718. {
  6719. name = "width",
  6720. type = "number",
  6721. description = "The width of the play area, in meters."
  6722. },
  6723. {
  6724. name = "depth",
  6725. type = "number",
  6726. description = "The depth of the play area, in meters."
  6727. }
  6728. }
  6729. }
  6730. }
  6731. },
  6732. {
  6733. name = "getBoundsGeometry",
  6734. tag = "playArea",
  6735. summary = "Get a list of points that make up the play area boundary.",
  6736. description = "Returns a list of points representing the boundaries of the play area.",
  6737. key = "lovr.headset.getBoundsGeometry",
  6738. module = "lovr.headset",
  6739. variants = {
  6740. {
  6741. arguments = {},
  6742. returns = {
  6743. {
  6744. name = "points",
  6745. type = "table",
  6746. description = "A list of points representing the play area. Each point is a table consisting of an x, y, and z coordinate."
  6747. }
  6748. }
  6749. }
  6750. }
  6751. },
  6752. {
  6753. name = "getBoundsWidth",
  6754. tag = "playArea",
  6755. summary = "Get the width of the play area.",
  6756. description = "Returns the width of the play area, in meters.",
  6757. key = "lovr.headset.getBoundsWidth",
  6758. module = "lovr.headset",
  6759. related = {
  6760. "lovr.headset.getBoundsDepth",
  6761. "lovr.headset.getBoundsDimensions"
  6762. },
  6763. variants = {
  6764. {
  6765. arguments = {},
  6766. returns = {
  6767. {
  6768. name = "width",
  6769. type = "number",
  6770. description = "The width of the play area, in meters."
  6771. }
  6772. }
  6773. }
  6774. }
  6775. },
  6776. {
  6777. name = "getClipDistance",
  6778. tag = "headset",
  6779. summary = "Get the near and far clipping planes of the headset.",
  6780. 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.",
  6781. key = "lovr.headset.getClipDistance",
  6782. module = "lovr.headset",
  6783. variants = {
  6784. {
  6785. arguments = {},
  6786. returns = {
  6787. {
  6788. name = "near",
  6789. type = "number",
  6790. description = "The distance to the near clipping plane, in meters."
  6791. },
  6792. {
  6793. name = "far",
  6794. type = "number",
  6795. description = "The distance to the far clipping plane, in meters."
  6796. }
  6797. }
  6798. }
  6799. }
  6800. },
  6801. {
  6802. name = "getControllerCount",
  6803. tag = "controllers",
  6804. summary = "Get the number of currently connected controller objects.",
  6805. description = "Returns the number of currently connected controllers.",
  6806. key = "lovr.headset.getControllerCount",
  6807. module = "lovr.headset",
  6808. related = {
  6809. "lovr.headset.getControllers"
  6810. },
  6811. variants = {
  6812. {
  6813. arguments = {},
  6814. returns = {
  6815. {
  6816. name = "count",
  6817. type = "number",
  6818. description = "The number of currently connected controllers."
  6819. }
  6820. }
  6821. }
  6822. }
  6823. },
  6824. {
  6825. name = "getControllers",
  6826. tag = "controllers",
  6827. summary = "Get a list of currently connected controller objects.",
  6828. description = "Returns a list of currently connected controllers.",
  6829. key = "lovr.headset.getControllers",
  6830. module = "lovr.headset",
  6831. related = {
  6832. "lovr.headset.getControllerCount"
  6833. },
  6834. variants = {
  6835. {
  6836. arguments = {},
  6837. returns = {
  6838. {
  6839. name = "controllers",
  6840. type = "table",
  6841. description = "A list of Controller objects."
  6842. }
  6843. }
  6844. }
  6845. }
  6846. },
  6847. {
  6848. name = "getDisplayDimensions",
  6849. tag = "headset",
  6850. summary = "Get the dimensions of the headset display.",
  6851. description = "Returns the dimensions of the display for each lens of the headset, in pixels.",
  6852. key = "lovr.headset.getDisplayDimensions",
  6853. module = "lovr.headset",
  6854. related = {
  6855. "lovr.headset.getDisplayWidth",
  6856. "lovr.headset.getDisplayHeight"
  6857. },
  6858. variants = {
  6859. {
  6860. arguments = {},
  6861. returns = {
  6862. {
  6863. name = "width",
  6864. type = "number",
  6865. description = "The width of each lens."
  6866. },
  6867. {
  6868. name = "height",
  6869. type = "number",
  6870. description = "The height of each lens."
  6871. }
  6872. }
  6873. }
  6874. }
  6875. },
  6876. {
  6877. name = "getDisplayHeight",
  6878. tag = "headset",
  6879. summary = "Get the height of the headset display.",
  6880. description = "Returns the height of the display for each lens of the headset, in pixels.",
  6881. key = "lovr.headset.getDisplayHeight",
  6882. module = "lovr.headset",
  6883. related = {
  6884. "lovr.headset.getDisplayWidth",
  6885. "lovr.headset.getDisplayDimensions"
  6886. },
  6887. variants = {
  6888. {
  6889. arguments = {},
  6890. returns = {
  6891. {
  6892. name = "height",
  6893. type = "number",
  6894. description = "The height of each lens."
  6895. }
  6896. }
  6897. }
  6898. }
  6899. },
  6900. {
  6901. name = "getDisplayWidth",
  6902. tag = "headset",
  6903. summary = "Get the width of the headset display.",
  6904. description = "Returns the width of the display for each lens of the headset, in pixels.",
  6905. key = "lovr.headset.getDisplayWidth",
  6906. module = "lovr.headset",
  6907. related = {
  6908. "lovr.headset.getDisplayHeight",
  6909. "lovr.headset.getDisplayDimensions"
  6910. },
  6911. variants = {
  6912. {
  6913. arguments = {},
  6914. returns = {
  6915. {
  6916. name = "width",
  6917. type = "number",
  6918. description = "The width of each lens."
  6919. }
  6920. }
  6921. }
  6922. }
  6923. },
  6924. {
  6925. name = "getEyePosition",
  6926. tag = "headset",
  6927. summary = "Get the position of an eye.",
  6928. description = "Returns the current position of one of the eyes in 3D space.",
  6929. key = "lovr.headset.getEyePosition",
  6930. module = "lovr.headset",
  6931. related = {
  6932. "lovr.headset.getPosition"
  6933. },
  6934. variants = {
  6935. {
  6936. arguments = {
  6937. {
  6938. name = "eye",
  6939. type = "HeadsetEye",
  6940. description = "The eye to get the position of."
  6941. }
  6942. },
  6943. returns = {
  6944. {
  6945. name = "x",
  6946. type = "number",
  6947. description = "The x position of the eye."
  6948. },
  6949. {
  6950. name = "y",
  6951. type = "number",
  6952. description = "The y position of the eye."
  6953. },
  6954. {
  6955. name = "z",
  6956. type = "number",
  6957. description = "The z position of the eye."
  6958. }
  6959. }
  6960. }
  6961. }
  6962. },
  6963. {
  6964. name = "getOrientation",
  6965. tag = "headset",
  6966. summary = "Get the orientation of the headset.",
  6967. description = "Returns the current orientation of the headset.",
  6968. key = "lovr.headset.getOrientation",
  6969. module = "lovr.headset",
  6970. related = {
  6971. "lovr.headset.getPosition",
  6972. "lovr.headset.getVelocity",
  6973. "lovr.headset.getAngularVelocity"
  6974. },
  6975. variants = {
  6976. {
  6977. arguments = {},
  6978. returns = {
  6979. {
  6980. name = "angle",
  6981. type = "number",
  6982. description = "The number of radians the headset is rotated around its axis of rotation."
  6983. },
  6984. {
  6985. name = "ax",
  6986. type = "number",
  6987. description = "The x component of the axis of rotation."
  6988. },
  6989. {
  6990. name = "ay",
  6991. type = "number",
  6992. description = "The y component of the axis of rotation."
  6993. },
  6994. {
  6995. name = "az",
  6996. type = "number",
  6997. description = "The z component of the axis of rotation."
  6998. }
  6999. }
  7000. }
  7001. }
  7002. },
  7003. {
  7004. name = "getPosition",
  7005. tag = "headset",
  7006. summary = "Get the position of the headset.",
  7007. description = "Returns the current position of the headset.",
  7008. key = "lovr.headset.getPosition",
  7009. module = "lovr.headset",
  7010. related = {
  7011. "lovr.headset.getOrientation",
  7012. "lovr.headset.getVelocity",
  7013. "lovr.headset.getAngularVelocity"
  7014. },
  7015. variants = {
  7016. {
  7017. arguments = {},
  7018. returns = {
  7019. {
  7020. name = "x",
  7021. type = "number",
  7022. description = "The x position of the headset."
  7023. },
  7024. {
  7025. name = "y",
  7026. type = "number",
  7027. description = "The y position of the headset."
  7028. },
  7029. {
  7030. name = "z",
  7031. type = "number",
  7032. description = "The z position of the headset."
  7033. }
  7034. }
  7035. }
  7036. }
  7037. },
  7038. {
  7039. name = "getType",
  7040. tag = "headset",
  7041. summary = "Get the type of connected headset.",
  7042. description = "Get the type of headset. Currently only the HTC Vive is supported, though support for the Oculus Rift and other devices is planned.",
  7043. key = "lovr.headset.getType",
  7044. module = "lovr.headset",
  7045. variants = {
  7046. {
  7047. arguments = {},
  7048. returns = {
  7049. {
  7050. name = "type",
  7051. type = "string",
  7052. description = "The type of the headset as a string, e.g. \"Vive\" for the HTC Vive."
  7053. }
  7054. }
  7055. }
  7056. }
  7057. },
  7058. {
  7059. name = "getVelocity",
  7060. tag = "headset",
  7061. summary = "Get the linear velocity of the headset.",
  7062. description = "Returns the current linear velocity of the headset, in meters per second",
  7063. key = "lovr.headset.getVelocity",
  7064. module = "lovr.headset",
  7065. related = {
  7066. "lovr.headset.getPosition",
  7067. "lovr.headset.getOrientation",
  7068. "lovr.headset.getAngularVelocity"
  7069. },
  7070. variants = {
  7071. {
  7072. arguments = {},
  7073. returns = {
  7074. {
  7075. name = "vx",
  7076. type = "number",
  7077. description = "The x component of the linear velocity."
  7078. },
  7079. {
  7080. name = "vy",
  7081. type = "number",
  7082. description = "The y component of the linear velocity."
  7083. },
  7084. {
  7085. name = "vz",
  7086. type = "number",
  7087. description = "The z component of the linear velocity."
  7088. }
  7089. }
  7090. }
  7091. }
  7092. },
  7093. {
  7094. name = "isMirrored",
  7095. tag = "headset",
  7096. summary = "Check if the headset is mirrored to the desktop.",
  7097. description = "Returns whether or not the headset display is mirrored to the desktop window.",
  7098. key = "lovr.headset.isMirrored",
  7099. module = "lovr.headset",
  7100. variants = {
  7101. {
  7102. arguments = {},
  7103. returns = {
  7104. {
  7105. name = "mirrored",
  7106. type = "boolean",
  7107. description = "Whether or not the headset is mirrored to the desktop."
  7108. }
  7109. }
  7110. }
  7111. }
  7112. },
  7113. {
  7114. name = "isPresent",
  7115. tag = "headset",
  7116. summary = "Get whether or not a headset is connected.",
  7117. description = "Determine if a headset is present and ready to use.",
  7118. key = "lovr.headset.isPresent",
  7119. module = "lovr.headset",
  7120. related = {
  7121. "Controller:isPresent"
  7122. },
  7123. variants = {
  7124. {
  7125. arguments = {},
  7126. returns = {
  7127. {
  7128. name = "isPresent",
  7129. type = "boolean",
  7130. description = "Whether or not a headset is present."
  7131. }
  7132. }
  7133. }
  7134. }
  7135. },
  7136. {
  7137. name = "renderTo",
  7138. tag = "headset",
  7139. summary = "Render to the headset using a function.",
  7140. 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.step` with `lovr.draw` as the callback.",
  7141. key = "lovr.headset.renderTo",
  7142. module = "lovr.headset",
  7143. variants = {
  7144. {
  7145. arguments = {
  7146. {
  7147. name = "callback",
  7148. type = "function",
  7149. description = "The function used to render. It will be passed a string representing the current eye that is being rendered to, either \"left\" or \"right\".",
  7150. arguments = {
  7151. {
  7152. name = "eye",
  7153. type = "HeadsetEye"
  7154. }
  7155. },
  7156. returns = {}
  7157. }
  7158. },
  7159. returns = {}
  7160. }
  7161. }
  7162. },
  7163. {
  7164. name = "setClipDistance",
  7165. tag = "headset",
  7166. summary = "Set the near and far clipping planes of the headset.",
  7167. 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.",
  7168. key = "lovr.headset.setClipDistance",
  7169. module = "lovr.headset",
  7170. variants = {
  7171. {
  7172. arguments = {
  7173. {
  7174. name = "near",
  7175. type = "number",
  7176. description = "The distance to the near clipping plane, in meters."
  7177. },
  7178. {
  7179. name = "far",
  7180. type = "number",
  7181. description = "The distance to the far clipping plane, in meters."
  7182. }
  7183. },
  7184. returns = {}
  7185. }
  7186. }
  7187. },
  7188. {
  7189. name = "setMirrored",
  7190. tag = "headset",
  7191. summary = "Set whether the headset is mirrored to the desktop.",
  7192. description = "Returns whether or not the headset display is mirrored to the desktop window.",
  7193. key = "lovr.headset.setMirrored",
  7194. module = "lovr.headset",
  7195. variants = {
  7196. {
  7197. arguments = {
  7198. {
  7199. name = "mirror",
  7200. type = "boolean",
  7201. description = "Whether or not the headset should be mirrored to the desktop."
  7202. }
  7203. },
  7204. returns = {}
  7205. }
  7206. }
  7207. }
  7208. },
  7209. objects = {
  7210. {
  7211. name = "Controller",
  7212. summary = "An object used to interact with connected VR controllers.",
  7213. description = "Controller objects represent the controllers held in players' hands. To obtain a list of currently connected controllers, use `lovr.headset.getControllers`. To determine when controllers are added and removed, use `lovr.controlleradded` and `lovr.controllerremoved`. Often Controllers won't be considered \"active\" until they are moved around a bit.",
  7214. key = "Controller",
  7215. module = "lovr.headset",
  7216. examples = {
  7217. {
  7218. description = "Draw cubes for the controllers and vibrate them if the trigger is pressed.",
  7219. code = "function lovr.update(dt)\n for i, controller in ipairs(lovr.headset.getControllers()) do\n if controller:getAxis('trigger') > .9 then\n controller:vibrate(.004)\n end\n end\nend\n\nfunction lovr.draw()\n for i, controller in ipairs(lovr.headset.getControllers()) do\n local x, y, z = controller:getPosition()\n local angle, ax, ay, az = controller:getOrientation()\n lovr.graphics.cube('fill', x, y, z, .08, angle, ax, ay, az)\n end\nend"
  7220. }
  7221. },
  7222. methods = {
  7223. {
  7224. name = "getAxis",
  7225. summary = "Get the state of an axis on the Controller.",
  7226. description = "Get the current state of an axis on the Controller. Axis values are from 0 to 1.",
  7227. key = "Controller:getAxis",
  7228. module = "lovr.headset",
  7229. related = {
  7230. "ControllerAxis",
  7231. "Controller:isDown"
  7232. },
  7233. variants = {
  7234. {
  7235. arguments = {
  7236. {
  7237. name = "axis",
  7238. type = "ControllerAxis",
  7239. description = "The axis to query."
  7240. }
  7241. },
  7242. returns = {
  7243. {
  7244. name = "value",
  7245. type = "number",
  7246. description = "The current state of the axis."
  7247. }
  7248. }
  7249. }
  7250. }
  7251. },
  7252. {
  7253. name = "getOrientation",
  7254. summary = "Get the orientation of the Controller.",
  7255. description = "Returns the current orientation of the Controller.",
  7256. key = "Controller:getOrientation",
  7257. module = "lovr.headset",
  7258. related = {
  7259. "lovr.headset.getOrientation",
  7260. "Controller:getPosition"
  7261. },
  7262. variants = {
  7263. {
  7264. arguments = {},
  7265. returns = {
  7266. {
  7267. name = "angle",
  7268. type = "number",
  7269. description = "The number of radians the Controller is rotated around its axis of rotation."
  7270. },
  7271. {
  7272. name = "ax",
  7273. type = "number",
  7274. description = "The x component of the axis of rotation."
  7275. },
  7276. {
  7277. name = "ay",
  7278. type = "number",
  7279. description = "The y component of the axis of rotation."
  7280. },
  7281. {
  7282. name = "az",
  7283. type = "number",
  7284. description = "The z component of the axis of rotation."
  7285. }
  7286. }
  7287. }
  7288. }
  7289. },
  7290. {
  7291. name = "getPosition",
  7292. summary = "Get the position of the Controller.",
  7293. description = "Returns the current position of the Controller.",
  7294. key = "Controller:getPosition",
  7295. module = "lovr.headset",
  7296. related = {
  7297. "lovr.headset.getPosition",
  7298. "Controller:getOrientation"
  7299. },
  7300. variants = {
  7301. {
  7302. arguments = {},
  7303. returns = {
  7304. {
  7305. name = "x",
  7306. type = "number",
  7307. description = "The x position of the Controller."
  7308. },
  7309. {
  7310. name = "y",
  7311. type = "number",
  7312. description = "The y position of the Controller."
  7313. },
  7314. {
  7315. name = "z",
  7316. type = "number",
  7317. description = "The z position of the Controller."
  7318. }
  7319. }
  7320. }
  7321. },
  7322. notes = "Units are in meters."
  7323. },
  7324. {
  7325. name = "isDown",
  7326. summary = "Get the state of a button on the Controller.",
  7327. description = "Check if a button on the Controller is currently pressed.",
  7328. key = "Controller:isDown",
  7329. module = "lovr.headset",
  7330. related = {
  7331. "ControllerButton",
  7332. "Controller:getAxis"
  7333. },
  7334. variants = {
  7335. {
  7336. arguments = {
  7337. {
  7338. name = "button",
  7339. type = "ControllerButton",
  7340. description = "The button to query."
  7341. }
  7342. },
  7343. returns = {
  7344. {
  7345. name = "down",
  7346. type = "boolean",
  7347. description = "The current state of the button."
  7348. }
  7349. }
  7350. }
  7351. }
  7352. },
  7353. {
  7354. name = "isPresent",
  7355. summary = "Determine if the Controller is still connected.",
  7356. description = "Determine if the Controller is still connected.",
  7357. key = "Controller:isPresent",
  7358. module = "lovr.headset",
  7359. related = {
  7360. "lovr.headset.isPresent"
  7361. },
  7362. variants = {
  7363. {
  7364. arguments = {},
  7365. returns = {
  7366. {
  7367. name = "isPresent",
  7368. type = "boolean",
  7369. description = "Whether or not the Controller is connected."
  7370. }
  7371. }
  7372. }
  7373. }
  7374. },
  7375. {
  7376. name = "newModel",
  7377. summary = "Get a Model for the Controller.",
  7378. description = "Returns a new Model for the Controller.",
  7379. key = "Controller:newModel",
  7380. module = "lovr.headset",
  7381. notes = "The Model will have a Texture applied.",
  7382. variants = {
  7383. {
  7384. arguments = {},
  7385. returns = {
  7386. {
  7387. name = "model",
  7388. type = "Model",
  7389. description = "The new Model, or nil if a model could not be loaded."
  7390. }
  7391. }
  7392. }
  7393. },
  7394. examples = {
  7395. {
  7396. code = "local models = {}\n\nfunction lovr.draw()\n for _, controller in ipairs(lovr.headset.getControllers()) do\n local x, y, z = controller:getPosition()\n local angle, ax, ay, az = controller:getOrientation()\n models[controller] = models[controller] or controller:newModel()\n models[controller]:draw(x, y, z, 1, angle, ax, ay, az)\n end\nend"
  7397. }
  7398. }
  7399. },
  7400. {
  7401. name = "vibrate",
  7402. summary = "Make the Controller go BZZZ!",
  7403. description = "Causes the Controller to vibrate for a specified duration.",
  7404. key = "Controller:vibrate",
  7405. module = "lovr.headset",
  7406. notes = "On the 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.",
  7407. variants = {
  7408. {
  7409. arguments = {
  7410. {
  7411. name = "duration",
  7412. type = "number",
  7413. description = "The amount of time to vibrate the Controller, in seconds."
  7414. }
  7415. },
  7416. returns = {}
  7417. }
  7418. }
  7419. }
  7420. }
  7421. }
  7422. }
  7423. },
  7424. {
  7425. name = "math",
  7426. tag = "modules",
  7427. summary = "Contains useful math helpers.",
  7428. description = "The `lovr.math` module provides math helpers commonly used for 3D applications. Currently, only `Transform` objects are exposed.",
  7429. key = "lovr.math",
  7430. functions = {
  7431. {
  7432. name = "newTransform",
  7433. summary = "Create a new Transform.",
  7434. description = "A transform is a 4x4, column major matrix that can be used to represent the 3D transform of an object. Most graphics primitives accept a Transform instead of the usual coordinate arguments. Transforms provide a convenient way to represent translation, rotation, and scale in a single object.",
  7435. key = "lovr.math.newTransform",
  7436. module = "lovr.math",
  7437. variants = {
  7438. {
  7439. arguments = {
  7440. {
  7441. name = "x",
  7442. type = "number",
  7443. description = "The x position of the Transform."
  7444. },
  7445. {
  7446. name = "y",
  7447. type = "number",
  7448. description = "The x position of the Transform."
  7449. },
  7450. {
  7451. name = "z",
  7452. type = "number",
  7453. description = "The x position of the Transform."
  7454. },
  7455. {
  7456. name = "sx",
  7457. type = "number",
  7458. description = "The x scale of the Transform."
  7459. },
  7460. {
  7461. name = "sy",
  7462. type = "number",
  7463. description = "The y scale of the Transform."
  7464. },
  7465. {
  7466. name = "sz",
  7467. type = "number",
  7468. description = "The z scale of the Transform."
  7469. },
  7470. {
  7471. name = "angle",
  7472. type = "number",
  7473. description = "The number of radians the Transform is rotated around its axis of rotation."
  7474. },
  7475. {
  7476. name = "ax",
  7477. type = "number",
  7478. description = "The x component of the axis of rotation."
  7479. },
  7480. {
  7481. name = "ay",
  7482. type = "number",
  7483. description = "The y component of the axis of rotation."
  7484. },
  7485. {
  7486. name = "az",
  7487. type = "number",
  7488. description = "The z component of the axis of rotation."
  7489. }
  7490. },
  7491. returns = {
  7492. {
  7493. name = "transform",
  7494. type = "Transform",
  7495. description = "The new Transform."
  7496. }
  7497. }
  7498. }
  7499. }
  7500. }
  7501. },
  7502. enums = {},
  7503. objects = {
  7504. {
  7505. name = "Transform",
  7506. summary = "A 3D transform.",
  7507. description = "A Transform represents a translation, rotation, and scale in 3D space. They're commonly used to describe how entities are arranged in a scene or how a camera is positioned.",
  7508. key = "Transform",
  7509. module = "lovr.math",
  7510. methods = {
  7511. {
  7512. name = "apply",
  7513. summary = "Combine two Transforms.",
  7514. description = "Applies a Transform onto this Transform.",
  7515. key = "Transform:apply",
  7516. module = "lovr.math",
  7517. variants = {
  7518. {
  7519. arguments = {
  7520. {
  7521. name = "other",
  7522. type = "Transform",
  7523. description = "Combine two Transforms together. Order matters, so applying Transforms in different orders will yield different results."
  7524. }
  7525. },
  7526. returns = {
  7527. {
  7528. name = "transform",
  7529. type = "Transform",
  7530. description = "The original Transform."
  7531. }
  7532. }
  7533. }
  7534. }
  7535. },
  7536. {
  7537. name = "clone",
  7538. summary = "Clone the Transform.",
  7539. description = "Returns a copy of the Transform.",
  7540. key = "Transform:clone",
  7541. module = "lovr.math",
  7542. variants = {
  7543. {
  7544. arguments = {},
  7545. returns = {
  7546. {
  7547. name = "copy",
  7548. type = "Transform",
  7549. description = "The copy of the original."
  7550. }
  7551. }
  7552. }
  7553. }
  7554. },
  7555. {
  7556. name = "inverse",
  7557. summary = "Get the inverse of the Transform.",
  7558. description = "Returns a new Transform representing the inverse of the original. The inverse \"cancels out\" the effects of the original, so applying one onto the other will result in the origin.",
  7559. key = "Transform:inverse",
  7560. module = "lovr.math",
  7561. related = {
  7562. "Transform:inverseTransformPoint"
  7563. },
  7564. variants = {
  7565. {
  7566. arguments = {},
  7567. returns = {
  7568. {
  7569. name = "inverse",
  7570. type = "Transform",
  7571. description = "The inverse transform."
  7572. }
  7573. }
  7574. }
  7575. }
  7576. },
  7577. {
  7578. name = "inverseTransformPoint",
  7579. summary = "Apply the inverse of the Transform to a point.",
  7580. description = "Applies the inverse of the Transform to a point, returning the transformed point.",
  7581. key = "Transform:inverseTransformPoint",
  7582. module = "lovr.math",
  7583. related = {
  7584. "Transform:transformPoint"
  7585. },
  7586. variants = {
  7587. {
  7588. arguments = {
  7589. {
  7590. name = "x",
  7591. type = "number",
  7592. description = "The x coordinate of the point."
  7593. },
  7594. {
  7595. name = "y",
  7596. type = "number",
  7597. description = "The y coordinate of the point."
  7598. },
  7599. {
  7600. name = "z",
  7601. type = "number",
  7602. description = "The z coordinate of the point."
  7603. }
  7604. },
  7605. returns = {
  7606. {
  7607. name = "x2",
  7608. type = "number",
  7609. description = "The x coordinate of the transformed point."
  7610. },
  7611. {
  7612. name = "y2",
  7613. type = "number",
  7614. description = "The y coordinate of the transformed point."
  7615. },
  7616. {
  7617. name = "z2",
  7618. type = "number",
  7619. description = "The z coordinate of the transformed point."
  7620. }
  7621. }
  7622. }
  7623. }
  7624. },
  7625. {
  7626. name = "origin",
  7627. summary = "Reset the Transform.",
  7628. description = "Resets the Transform to the origin.",
  7629. key = "Transform:origin",
  7630. module = "lovr.math",
  7631. variants = {
  7632. {
  7633. arguments = {},
  7634. returns = {
  7635. {
  7636. name = "transform",
  7637. type = "Transform",
  7638. description = "The original Transform."
  7639. }
  7640. }
  7641. }
  7642. },
  7643. examples = {
  7644. {
  7645. code = "transform = lovr.math.newTransform(3, 4, 5)\nprint(transform:transformPoint(1, 2, 2)) -- Prints 4, 6, 7\ntransform:origin()\nprint(transform:transformPoint(1, 2, 3)) -- Prints 1, 2, 3"
  7646. }
  7647. }
  7648. },
  7649. {
  7650. name = "rotate",
  7651. summary = "Rotate the Transform.",
  7652. description = "Rotates the Transform using an angle/axis rotation.",
  7653. key = "Transform:rotate",
  7654. module = "lovr.math",
  7655. variants = {
  7656. {
  7657. arguments = {
  7658. {
  7659. name = "angle",
  7660. type = "number",
  7661. description = "The number of radians to rotate around the axis of rotation."
  7662. },
  7663. {
  7664. name = "ax",
  7665. type = "number",
  7666. description = "The x component of the axis of rotation."
  7667. },
  7668. {
  7669. name = "ay",
  7670. type = "number",
  7671. description = "The y component of the axis of rotation."
  7672. },
  7673. {
  7674. name = "az",
  7675. type = "number",
  7676. description = "The z component of the axis of rotation."
  7677. }
  7678. },
  7679. returns = {
  7680. {
  7681. name = "transform",
  7682. type = "Transform",
  7683. description = "The original Transform."
  7684. }
  7685. }
  7686. }
  7687. }
  7688. },
  7689. {
  7690. name = "scale",
  7691. summary = "Scale the Transform.",
  7692. description = "Scales the Transform.",
  7693. key = "Transform:scale",
  7694. module = "lovr.math",
  7695. variants = {
  7696. {
  7697. arguments = {
  7698. {
  7699. name = "x",
  7700. type = "number",
  7701. description = "The scale factor for the x axis."
  7702. },
  7703. {
  7704. name = "y",
  7705. type = "number",
  7706. description = "The scale factor for the y axis.",
  7707. default = "x"
  7708. },
  7709. {
  7710. name = "z",
  7711. type = "number",
  7712. description = "The scale factor for the z axis.",
  7713. default = "x"
  7714. }
  7715. },
  7716. returns = {
  7717. {
  7718. name = "transform",
  7719. type = "Transform",
  7720. description = "The original Transform."
  7721. }
  7722. }
  7723. }
  7724. }
  7725. },
  7726. {
  7727. name = "setTransformation",
  7728. summary = "Set the position, rotation, and scale of the Transform.",
  7729. description = "Sets the translation, rotation, and scale of the Transform. This will override the current values in the Transform.",
  7730. key = "Transform:setTransformation",
  7731. module = "lovr.math",
  7732. variants = {
  7733. {
  7734. arguments = {
  7735. {
  7736. name = "x",
  7737. type = "number",
  7738. description = "The x position of the Transform."
  7739. },
  7740. {
  7741. name = "y",
  7742. type = "number",
  7743. description = "The x position of the Transform."
  7744. },
  7745. {
  7746. name = "z",
  7747. type = "number",
  7748. description = "The x position of the Transform."
  7749. },
  7750. {
  7751. name = "sx",
  7752. type = "number",
  7753. description = "The x scale of the Transform."
  7754. },
  7755. {
  7756. name = "sy",
  7757. type = "number",
  7758. description = "The y scale of the Transform."
  7759. },
  7760. {
  7761. name = "sz",
  7762. type = "number",
  7763. description = "The z scale of the Transform."
  7764. },
  7765. {
  7766. name = "angle",
  7767. type = "number",
  7768. description = "The number of radians the Transform is rotated around its axis of rotation."
  7769. },
  7770. {
  7771. name = "ax",
  7772. type = "number",
  7773. description = "The x component of the axis of rotation."
  7774. },
  7775. {
  7776. name = "ay",
  7777. type = "number",
  7778. description = "The y component of the axis of rotation."
  7779. },
  7780. {
  7781. name = "az",
  7782. type = "number",
  7783. description = "The z component of the axis of rotation."
  7784. }
  7785. },
  7786. returns = {
  7787. {
  7788. name = "transform",
  7789. type = "Transform",
  7790. description = "The original Transform."
  7791. }
  7792. }
  7793. }
  7794. }
  7795. },
  7796. {
  7797. name = "transformPoint",
  7798. summary = "Apply the Transform to a point.",
  7799. description = "Applies the Transform to a point, returning the new position.",
  7800. key = "Transform:transformPoint",
  7801. module = "lovr.math",
  7802. related = {
  7803. "Transform:inverseTransformPoint"
  7804. },
  7805. variants = {
  7806. {
  7807. arguments = {
  7808. {
  7809. name = "x",
  7810. type = "number",
  7811. description = "The x coordinate of the point."
  7812. },
  7813. {
  7814. name = "y",
  7815. type = "number",
  7816. description = "The y coordinate of the point."
  7817. },
  7818. {
  7819. name = "z",
  7820. type = "number",
  7821. description = "The z coordinate of the point."
  7822. }
  7823. },
  7824. returns = {
  7825. {
  7826. name = "x2",
  7827. type = "number",
  7828. description = "The x coordinate of the transformed point."
  7829. },
  7830. {
  7831. name = "y2",
  7832. type = "number",
  7833. description = "The y coordinate of the transformed point."
  7834. },
  7835. {
  7836. name = "z2",
  7837. type = "number",
  7838. description = "The z coordinate of the transformed point."
  7839. }
  7840. }
  7841. }
  7842. }
  7843. },
  7844. {
  7845. name = "translate",
  7846. summary = "Translate the Transform.",
  7847. description = "Translates the Transform.",
  7848. key = "Transform:translate",
  7849. module = "lovr.math",
  7850. variants = {
  7851. {
  7852. arguments = {
  7853. {
  7854. name = "x",
  7855. type = "number",
  7856. description = "The x component of the translation."
  7857. },
  7858. {
  7859. name = "y",
  7860. type = "number",
  7861. description = "The y component of the translation."
  7862. },
  7863. {
  7864. name = "z",
  7865. type = "number",
  7866. description = "The z component of the translation."
  7867. }
  7868. },
  7869. returns = {
  7870. {
  7871. name = "transform",
  7872. type = "Transform",
  7873. description = "The original Transform."
  7874. }
  7875. }
  7876. }
  7877. }
  7878. }
  7879. },
  7880. constructors = {
  7881. "lovr.math.newTransform"
  7882. }
  7883. }
  7884. }
  7885. },
  7886. {
  7887. name = "physics",
  7888. tag = "modules",
  7889. summary = "Simulates 3D physics.",
  7890. description = "The `lovr.physics` module simulates 3D rigid body physics.",
  7891. key = "lovr.physics",
  7892. sections = {
  7893. {
  7894. name = "Worlds",
  7895. tag = "world",
  7896. 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."
  7897. },
  7898. {
  7899. name = "Colliders",
  7900. tag = "colliders",
  7901. 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."
  7902. },
  7903. {
  7904. name = "Shapes",
  7905. tag = "shapes",
  7906. 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."
  7907. },
  7908. {
  7909. name = "Joints",
  7910. tag = "joints",
  7911. 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."
  7912. }
  7913. },
  7914. enums = {
  7915. {
  7916. name = "JointType",
  7917. summary = "Types of physics joints.",
  7918. description = "Represents the different types of physics Joints available.",
  7919. key = "JointType",
  7920. module = "physics",
  7921. values = {
  7922. {
  7923. name = "ball",
  7924. description = "A BallJoint."
  7925. },
  7926. {
  7927. name = "distance",
  7928. description = "A DistanceJoint."
  7929. },
  7930. {
  7931. name = "hinge",
  7932. description = "A HingeJoint."
  7933. },
  7934. {
  7935. name = "slider",
  7936. description = "A SliderJoint."
  7937. }
  7938. },
  7939. related = {
  7940. "Joint",
  7941. "BallJoint",
  7942. "DistanceJoint",
  7943. "HingeJoint",
  7944. "SliderJoint"
  7945. }
  7946. },
  7947. {
  7948. name = "ShapeType",
  7949. summary = "Types of physics shapes.",
  7950. description = "Represents the different types of physics Shapes available.",
  7951. key = "ShapeType",
  7952. module = "physics",
  7953. values = {
  7954. {
  7955. name = "box",
  7956. description = "A BoxShape."
  7957. },
  7958. {
  7959. name = "capsule",
  7960. description = "A CapsuleShape."
  7961. },
  7962. {
  7963. name = "cylinder",
  7964. description = "A CylinderShape."
  7965. },
  7966. {
  7967. name = "sphere",
  7968. description = "A SphereShape."
  7969. }
  7970. },
  7971. related = {
  7972. "Shape",
  7973. "BoxShape",
  7974. "CapsuleShape",
  7975. "CylinderShape",
  7976. "SphereShape"
  7977. }
  7978. }
  7979. },
  7980. functions = {
  7981. {
  7982. name = "newBallJoint",
  7983. tag = "joints",
  7984. summary = "Create a new BallJoint.",
  7985. description = "Creates a new BallJoint.",
  7986. key = "lovr.physics.newBallJoint",
  7987. module = "lovr.physics",
  7988. variants = {
  7989. {
  7990. arguments = {
  7991. {
  7992. name = "colliderA",
  7993. type = "Collider",
  7994. description = "The first collider to attach the Joint to."
  7995. },
  7996. {
  7997. name = "colliderB",
  7998. type = "Collider",
  7999. description = "The second collider to attach the Joint to."
  8000. },
  8001. {
  8002. name = "x",
  8003. type = "number",
  8004. description = "The x position of the joint anchor point, in world coordinates."
  8005. },
  8006. {
  8007. name = "y",
  8008. type = "number",
  8009. description = "The y position of the joint anchor point, in world coordinates."
  8010. },
  8011. {
  8012. name = "z",
  8013. type = "number",
  8014. description = "The z position of the joint anchor point, in world coordinates."
  8015. }
  8016. },
  8017. returns = {
  8018. {
  8019. name = "ball",
  8020. type = "BallJoint",
  8021. description = "The new BallJoint."
  8022. }
  8023. }
  8024. }
  8025. },
  8026. related = {
  8027. "lovr.physics.newDistanceJoint",
  8028. "lovr.physics.newHingeJoint",
  8029. "lovr.physics.newSliderJoint"
  8030. },
  8031. 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."
  8032. },
  8033. {
  8034. name = "newBoxShape",
  8035. tag = "shapes",
  8036. summary = "Create a new BoxShape.",
  8037. description = "Creates a new BoxShape.",
  8038. key = "lovr.physics.newBoxShape",
  8039. module = "lovr.physics",
  8040. variants = {
  8041. {
  8042. arguments = {
  8043. {
  8044. name = "width",
  8045. type = "number",
  8046. description = "The width of the box, in meters.",
  8047. default = "1"
  8048. },
  8049. {
  8050. name = "height",
  8051. type = "number",
  8052. description = "The height of the box, in meters.",
  8053. default = "width"
  8054. },
  8055. {
  8056. name = "depth",
  8057. type = "number",
  8058. description = "The depth of the box, in meters.",
  8059. default = "width"
  8060. }
  8061. },
  8062. returns = {
  8063. {
  8064. name = "box",
  8065. type = "BoxShape",
  8066. description = "The new BoxShape."
  8067. }
  8068. }
  8069. }
  8070. },
  8071. related = {
  8072. "BoxShape",
  8073. "lovr.physics.newCapsuleShape",
  8074. "lovr.physics.newCylinderShape",
  8075. "lovr.physics.newSphereShape"
  8076. },
  8077. notes = "A Shape can be attached to a Collider using `Collider:addShape`."
  8078. },
  8079. {
  8080. name = "newCapsuleShape",
  8081. tag = "shapes",
  8082. summary = "Create a new CapsuleShape.",
  8083. description = "Creates a new CapsuleShape. Capsules are cylinders with hemispheres on each end.",
  8084. key = "lovr.physics.newCapsuleShape",
  8085. module = "lovr.physics",
  8086. variants = {
  8087. {
  8088. arguments = {
  8089. {
  8090. name = "radius",
  8091. type = "number",
  8092. description = "The radius of the capsule, in meters.",
  8093. default = "1"
  8094. },
  8095. {
  8096. name = "length",
  8097. type = "number",
  8098. description = "The length of the capsule, not including the caps, in meters.",
  8099. default = "1"
  8100. }
  8101. },
  8102. returns = {
  8103. {
  8104. name = "capsule",
  8105. type = "CapsuleShape",
  8106. description = "The new CapsuleShape."
  8107. }
  8108. }
  8109. }
  8110. },
  8111. related = {
  8112. "CapsuleShape",
  8113. "lovr.physics.newBoxShape",
  8114. "lovr.physics.newCylinderShape",
  8115. "lovr.physics.newSphereShape"
  8116. },
  8117. notes = "A Shape can be attached to a Collider using `Collider:addShape`."
  8118. },
  8119. {
  8120. name = "newCylinderShape",
  8121. tag = "shapes",
  8122. summary = "Create a new CylinderShape.",
  8123. description = "Creates a new CylinderShape.",
  8124. key = "lovr.physics.newCylinderShape",
  8125. module = "lovr.physics",
  8126. variants = {
  8127. {
  8128. arguments = {
  8129. {
  8130. name = "radius",
  8131. type = "number",
  8132. description = "The radius of the cylinder, in meters.",
  8133. default = "1"
  8134. },
  8135. {
  8136. name = "length",
  8137. type = "number",
  8138. description = "The length of the cylinder, in meters.",
  8139. default = "1"
  8140. }
  8141. },
  8142. returns = {
  8143. {
  8144. name = "cylinder",
  8145. type = "CylinderShape",
  8146. description = "The new CylinderShape."
  8147. }
  8148. }
  8149. }
  8150. },
  8151. related = {
  8152. "CylinderShape",
  8153. "lovr.physics.newBoxShape",
  8154. "lovr.physics.newCapsuleShape",
  8155. "lovr.physics.newSphereShape"
  8156. },
  8157. notes = "A Shape can be attached to a Collider using `Collider:addShape`."
  8158. },
  8159. {
  8160. name = "newDistanceJoint",
  8161. tag = "joints",
  8162. summary = "Create a new DistanceJoint.",
  8163. description = "Creates a new DistanceJoint.",
  8164. key = "lovr.physics.newDistanceJoint",
  8165. module = "lovr.physics",
  8166. variants = {
  8167. {
  8168. arguments = {
  8169. {
  8170. name = "colliderA",
  8171. type = "Collider",
  8172. description = "The first collider to attach the Joint to."
  8173. },
  8174. {
  8175. name = "colliderB",
  8176. type = "Collider",
  8177. description = "The second collider to attach the Joint to."
  8178. },
  8179. {
  8180. name = "x1",
  8181. type = "number",
  8182. description = "The x position of the first anchor point, in world coordinates."
  8183. },
  8184. {
  8185. name = "y1",
  8186. type = "number",
  8187. description = "The y position of the first anchor point, in world coordinates."
  8188. },
  8189. {
  8190. name = "z1",
  8191. type = "number",
  8192. description = "The z position of the first anchor point, in world coordinates."
  8193. },
  8194. {
  8195. name = "x2",
  8196. type = "number",
  8197. description = "The x position of the second anchor point, in world coordinates."
  8198. },
  8199. {
  8200. name = "y2",
  8201. type = "number",
  8202. description = "The y position of the second anchor point, in world coordinates."
  8203. },
  8204. {
  8205. name = "z2",
  8206. type = "number",
  8207. description = "The z position of the second anchor point, in world coordinates."
  8208. }
  8209. },
  8210. returns = {
  8211. {
  8212. name = "joint",
  8213. type = "DistanceJoint",
  8214. description = "The new DistanceJoint."
  8215. }
  8216. }
  8217. }
  8218. },
  8219. related = {
  8220. "lovr.physics.newBallJoint",
  8221. "lovr.physics.newHingeJoint",
  8222. "lovr.physics.newSliderJoint"
  8223. },
  8224. 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."
  8225. },
  8226. {
  8227. name = "newHingeJoint",
  8228. tag = "joints",
  8229. summary = "Create a new HingeJoint.",
  8230. description = "Creates a new HingeJoint.",
  8231. key = "lovr.physics.newHingeJoint",
  8232. module = "lovr.physics",
  8233. variants = {
  8234. {
  8235. arguments = {
  8236. {
  8237. name = "colliderA",
  8238. type = "Collider",
  8239. description = "The first collider to attach the Joint to."
  8240. },
  8241. {
  8242. name = "colliderB",
  8243. type = "Collider",
  8244. description = "The second collider to attach the Joint to."
  8245. },
  8246. {
  8247. name = "x",
  8248. type = "number",
  8249. description = "The x position of the hinge anchor, in world coordinates."
  8250. },
  8251. {
  8252. name = "y",
  8253. type = "number",
  8254. description = "The y position of the hinge anchor, in world coordinates."
  8255. },
  8256. {
  8257. name = "z",
  8258. type = "number",
  8259. description = "The z position of the hinge anchor, in world coordinates."
  8260. },
  8261. {
  8262. name = "ax",
  8263. type = "number",
  8264. description = "The x component of the hinge axis."
  8265. },
  8266. {
  8267. name = "ay",
  8268. type = "number",
  8269. description = "The y component of the hinge axis."
  8270. },
  8271. {
  8272. name = "az",
  8273. type = "number",
  8274. description = "The z component of the hinge axis."
  8275. }
  8276. },
  8277. returns = {
  8278. {
  8279. name = "hinge",
  8280. type = "HingeJoint",
  8281. description = "The new HingeJoint."
  8282. }
  8283. }
  8284. }
  8285. },
  8286. related = {
  8287. "lovr.physics.newBallJoint",
  8288. "lovr.physics.newDistanceJoint",
  8289. "lovr.physics.newSliderJoint"
  8290. },
  8291. notes = "A hinge joint constrains two colliders to allow rotation only around the hinge's axis."
  8292. },
  8293. {
  8294. name = "newSliderJoint",
  8295. tag = "joints",
  8296. summary = "Create a new SliderJoint.",
  8297. description = "Creates a new SliderJoint.",
  8298. key = "lovr.physics.newSliderJoint",
  8299. module = "lovr.physics",
  8300. variants = {
  8301. {
  8302. arguments = {
  8303. {
  8304. name = "colliderA",
  8305. type = "Collider",
  8306. description = "The first collider to attach the Joint to."
  8307. },
  8308. {
  8309. name = "colliderB",
  8310. type = "Collider",
  8311. description = "The second collider to attach the Joint to."
  8312. },
  8313. {
  8314. name = "ax",
  8315. type = "number",
  8316. description = "The x component of the slider axis."
  8317. },
  8318. {
  8319. name = "ay",
  8320. type = "number",
  8321. description = "The y component of the slider axis."
  8322. },
  8323. {
  8324. name = "az",
  8325. type = "number",
  8326. description = "The z component of the slider axis."
  8327. }
  8328. },
  8329. returns = {
  8330. {
  8331. name = "slider",
  8332. type = "SliderJoint",
  8333. description = "The new SliderJoint."
  8334. }
  8335. }
  8336. }
  8337. },
  8338. related = {
  8339. "lovr.physics.newBallJoint",
  8340. "lovr.physics.newDistanceJoint",
  8341. "lovr.physics.newHingeJoint"
  8342. },
  8343. notes = "A slider joint constrains two colliders to only allow movement along the slider's axis."
  8344. },
  8345. {
  8346. name = "newSphereShape",
  8347. tag = "shapes",
  8348. summary = "Create a new SphereShape.",
  8349. description = "Creates a new SphereShape.",
  8350. key = "lovr.physics.newSphereShape",
  8351. module = "lovr.physics",
  8352. variants = {
  8353. {
  8354. arguments = {
  8355. {
  8356. name = "radius",
  8357. type = "number",
  8358. description = "The radius of the sphere, in meters.",
  8359. default = "1"
  8360. }
  8361. },
  8362. returns = {
  8363. {
  8364. name = "sphere",
  8365. type = "SphereShape",
  8366. description = "The new SphereShape."
  8367. }
  8368. }
  8369. }
  8370. },
  8371. related = {
  8372. "SphereShape",
  8373. "lovr.physics.newBoxShape",
  8374. "lovr.physics.newCapsuleShape",
  8375. "lovr.physics.newCylinderShape"
  8376. },
  8377. notes = "A Shape can be attached to a Collider using `Collider:addShape`."
  8378. },
  8379. {
  8380. name = "newWorld",
  8381. tag = "world",
  8382. summary = "Create a new World.",
  8383. description = "Creates a new physics World, which tracks the overall physics simulation, holds collider objects, and resolves collisions between them.",
  8384. key = "lovr.physics.newWorld",
  8385. module = "lovr.physics",
  8386. notes = "A World must be updated with `World:update` in `lovr.update` for the physics simulation to advance.",
  8387. variants = {
  8388. {
  8389. arguments = {
  8390. {
  8391. name = "xg",
  8392. type = "number",
  8393. description = "The x component of the gravity force.",
  8394. default = "0"
  8395. },
  8396. {
  8397. name = "yg",
  8398. type = "number",
  8399. description = "The y component of the gravity force.",
  8400. default = "-9.81"
  8401. },
  8402. {
  8403. name = "zg",
  8404. type = "number",
  8405. description = "The z component of the gravity force.",
  8406. default = "0"
  8407. },
  8408. {
  8409. name = "allowSleep",
  8410. type = "boolean",
  8411. description = "Whether or not colliders will automatically be put to sleep.",
  8412. default = "true"
  8413. },
  8414. {
  8415. name = "tags",
  8416. type = "table",
  8417. description = "A list of collision tags colliders can be assigned to.",
  8418. default = "{}"
  8419. }
  8420. },
  8421. returns = {
  8422. {
  8423. name = "world",
  8424. type = "World",
  8425. description = "A whole new World."
  8426. }
  8427. }
  8428. }
  8429. },
  8430. examples = {
  8431. {
  8432. description = "Create a new world, add a collider to it, and update it, printing out its position as it falls.",
  8433. 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"
  8434. }
  8435. }
  8436. }
  8437. },
  8438. objects = {
  8439. {
  8440. name = "BallJoint",
  8441. summary = "A ball and socket joint.",
  8442. 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.",
  8443. key = "BallJoint",
  8444. module = "lovr.physics",
  8445. related = {
  8446. "Collider"
  8447. },
  8448. constructors = {
  8449. "lovr.physics.newBallJoint"
  8450. },
  8451. methods = {
  8452. {
  8453. name = "getAnchors",
  8454. summary = "Get the anchor points of the BallJoint.",
  8455. 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.",
  8456. key = "BallJoint:getAnchors",
  8457. module = "lovr.physics",
  8458. variants = {
  8459. {
  8460. arguments = {},
  8461. returns = {
  8462. {
  8463. name = "x1",
  8464. type = "number",
  8465. description = "The x coordinate of the first anchor point, in world coordinates."
  8466. },
  8467. {
  8468. name = "y1",
  8469. type = "number",
  8470. description = "The y coordinate of the first anchor point, in world coordinates."
  8471. },
  8472. {
  8473. name = "z1",
  8474. type = "number",
  8475. description = "The z coordinate of the first anchor point, in world coordinates."
  8476. },
  8477. {
  8478. name = "x2",
  8479. type = "number",
  8480. description = "The x coordinate of the second anchor point, in world coordinates."
  8481. },
  8482. {
  8483. name = "y2",
  8484. type = "number",
  8485. description = "The y coordinate of the second anchor point, in world coordinates."
  8486. },
  8487. {
  8488. name = "z2",
  8489. type = "number",
  8490. description = "The z coordinate of the second anchor point, in world coordinates."
  8491. }
  8492. }
  8493. }
  8494. }
  8495. },
  8496. {
  8497. name = "setAnchor",
  8498. summary = "Set the anchor point of the BallJoint.",
  8499. description = "Sets a new anchor point for the BallJoint.",
  8500. key = "BallJoint:setAnchor",
  8501. module = "lovr.physics",
  8502. variants = {
  8503. {
  8504. arguments = {
  8505. {
  8506. name = "x",
  8507. type = "number",
  8508. description = "The x coordinate of the anchor point, in world coordinates."
  8509. },
  8510. {
  8511. name = "y",
  8512. type = "number",
  8513. description = "The y coordinate of the anchor point, in world coordinates."
  8514. },
  8515. {
  8516. name = "z",
  8517. type = "number",
  8518. description = "The z coordinate of the anchor point, in world coordinates."
  8519. }
  8520. },
  8521. returns = {}
  8522. }
  8523. }
  8524. }
  8525. },
  8526. extends = "Joint"
  8527. },
  8528. {
  8529. name = "BoxShape",
  8530. summary = "A box Shape.",
  8531. description = "A type of `Shape` that can be used for cubes or boxes.",
  8532. key = "BoxShape",
  8533. module = "lovr.physics",
  8534. extends = "Shape",
  8535. constructors = {
  8536. "lovr.physics.newBoxShape",
  8537. "World:newBoxCollider"
  8538. },
  8539. methods = {
  8540. {
  8541. name = "getDimensions",
  8542. summary = "Get the dimensions of the BoxShape.",
  8543. description = "Returns the width, height, and depth of the BoxShape.",
  8544. key = "BoxShape:getDimensions",
  8545. module = "lovr.physics",
  8546. variants = {
  8547. {
  8548. arguments = {},
  8549. returns = {
  8550. {
  8551. name = "width",
  8552. type = "number",
  8553. description = "The width of the box, in meters."
  8554. },
  8555. {
  8556. name = "height",
  8557. type = "number",
  8558. description = "The height of the box, in meters."
  8559. },
  8560. {
  8561. name = "depth",
  8562. type = "number",
  8563. description = "The depth of the box, in meters."
  8564. }
  8565. }
  8566. }
  8567. }
  8568. },
  8569. {
  8570. name = "setDimensions",
  8571. summary = "Set the dimensions of the BoxShape.",
  8572. description = "Sets the width, height, and depth of the BoxShape.",
  8573. key = "BoxShape:setDimensions",
  8574. module = "lovr.physics",
  8575. variants = {
  8576. {
  8577. arguments = {
  8578. {
  8579. name = "width",
  8580. type = "number",
  8581. description = "The width of the box, in meters."
  8582. },
  8583. {
  8584. name = "height",
  8585. type = "number",
  8586. description = "The height of the box, in meters."
  8587. },
  8588. {
  8589. name = "depth",
  8590. type = "number",
  8591. description = "The depth of the box, in meters."
  8592. }
  8593. },
  8594. returns = {}
  8595. }
  8596. }
  8597. }
  8598. }
  8599. },
  8600. {
  8601. name = "CapsuleShape",
  8602. summary = "A capsule Shape.",
  8603. description = "A type of `Shape` that can be used for capsule-shaped things.",
  8604. key = "CapsuleShape",
  8605. module = "lovr.physics",
  8606. extends = "Shape",
  8607. constructors = {
  8608. "lovr.physics.newCapsuleShape",
  8609. "World:newCapsuleCollider"
  8610. },
  8611. methods = {
  8612. {
  8613. name = "getLength",
  8614. summary = "Get the length of the CapsuleShape.",
  8615. description = "Returns the length of the CapsuleShape, not including the caps.",
  8616. key = "CapsuleShape:getLength",
  8617. module = "lovr.physics",
  8618. variants = {
  8619. {
  8620. arguments = {},
  8621. returns = {
  8622. {
  8623. name = "length",
  8624. type = "number",
  8625. description = "The length of the capsule, in meters."
  8626. }
  8627. }
  8628. }
  8629. }
  8630. },
  8631. {
  8632. name = "getRadius",
  8633. summary = "Get the radius of the CapsuleShape.",
  8634. description = "Returns the radius of the CapsuleShape.",
  8635. key = "CapsuleShape:getRadius",
  8636. module = "lovr.physics",
  8637. variants = {
  8638. {
  8639. arguments = {},
  8640. returns = {
  8641. {
  8642. name = "radius",
  8643. type = "number",
  8644. description = "The radius of the capsule, in meters."
  8645. }
  8646. }
  8647. }
  8648. }
  8649. },
  8650. {
  8651. name = "setLength",
  8652. summary = "Set the length of the CapsuleShape.",
  8653. description = "Sets the length of the CapsuleShape.",
  8654. key = "CapsuleShape:setLength",
  8655. module = "lovr.physics",
  8656. variants = {
  8657. {
  8658. arguments = {
  8659. {
  8660. name = "length",
  8661. type = "number",
  8662. description = "The new length, in meters, not including the caps."
  8663. }
  8664. },
  8665. returns = {}
  8666. }
  8667. }
  8668. },
  8669. {
  8670. name = "setRadius",
  8671. summary = "Set the radius of the CapsuleShape.",
  8672. description = "Sets the radius of the CapsuleShape.",
  8673. key = "CapsuleShape:setRadius",
  8674. module = "lovr.physics",
  8675. variants = {
  8676. {
  8677. arguments = {
  8678. {
  8679. name = "radius",
  8680. type = "number",
  8681. description = "The new radius, in meters."
  8682. }
  8683. },
  8684. returns = {}
  8685. }
  8686. }
  8687. }
  8688. }
  8689. },
  8690. {
  8691. name = "Collider",
  8692. summary = "A single entity in a physics simulation.",
  8693. 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.",
  8694. key = "Collider",
  8695. module = "lovr.physics",
  8696. methods = {
  8697. {
  8698. name = "addShape",
  8699. summary = "Add a Shape to the Collider.",
  8700. description = "Attaches a Shape to the collider. Attached shapes will collide with other shapes in the world.",
  8701. key = "Collider:addShape",
  8702. module = "lovr.physics",
  8703. related = {
  8704. "Collider:removeShape",
  8705. "Collider:getShapeList",
  8706. "Shape"
  8707. },
  8708. variants = {
  8709. {
  8710. arguments = {
  8711. {
  8712. name = "shape",
  8713. type = "Shape",
  8714. description = "The Shape to attach."
  8715. }
  8716. },
  8717. returns = {}
  8718. }
  8719. }
  8720. },
  8721. {
  8722. name = "applyForce",
  8723. summary = "Apply a force to the Collider.",
  8724. description = "Applies a force to the Collider.",
  8725. key = "Collider:applyForce",
  8726. module = "lovr.physics",
  8727. related = {
  8728. "Collider:applyTorque"
  8729. },
  8730. variants = {
  8731. {
  8732. arguments = {
  8733. {
  8734. name = "x",
  8735. type = "number",
  8736. description = "The x component of the force to apply."
  8737. },
  8738. {
  8739. name = "y",
  8740. type = "number",
  8741. description = "The y component of the force to apply."
  8742. },
  8743. {
  8744. name = "z",
  8745. type = "number",
  8746. description = "The z component of the force to apply."
  8747. }
  8748. },
  8749. returns = {}
  8750. },
  8751. {
  8752. arguments = {
  8753. {
  8754. name = "x",
  8755. type = "number",
  8756. description = "The x component of the force to apply."
  8757. },
  8758. {
  8759. name = "y",
  8760. type = "number",
  8761. description = "The y component of the force to apply."
  8762. },
  8763. {
  8764. name = "z",
  8765. type = "number",
  8766. description = "The z component of the force to apply."
  8767. },
  8768. {
  8769. name = "px",
  8770. type = "number",
  8771. description = "The x position to apply the force at, in world coordinates."
  8772. },
  8773. {
  8774. name = "py",
  8775. type = "number",
  8776. description = "The y position to apply the force at, in world coordinates."
  8777. },
  8778. {
  8779. name = "pz",
  8780. type = "number",
  8781. description = "The z position to apply the force at, in world coordinates."
  8782. }
  8783. },
  8784. returns = {}
  8785. }
  8786. }
  8787. },
  8788. {
  8789. name = "applyTorque",
  8790. summary = "Apply torque to the Collider.",
  8791. description = "Applies torque to the Collider.",
  8792. key = "Collider:applyTorque",
  8793. module = "lovr.physics",
  8794. related = {
  8795. "Collider:applyForce"
  8796. },
  8797. variants = {
  8798. {
  8799. arguments = {
  8800. {
  8801. name = "x",
  8802. type = "number",
  8803. description = "The x component of the torque."
  8804. },
  8805. {
  8806. name = "y",
  8807. type = "number",
  8808. description = "The y component of the torque."
  8809. },
  8810. {
  8811. name = "z",
  8812. type = "number",
  8813. description = "The z component of the torque."
  8814. }
  8815. },
  8816. returns = {}
  8817. }
  8818. }
  8819. },
  8820. {
  8821. name = "destroy",
  8822. summary = "Destroy the Collider.",
  8823. description = "Destroy the Collider, removing it from the World.",
  8824. key = "Collider:destroy",
  8825. module = "lovr.physics",
  8826. related = {
  8827. "World:destroy",
  8828. "Shape:destroy",
  8829. "Joint:destroy"
  8830. },
  8831. variants = {
  8832. {
  8833. arguments = {},
  8834. returns = {}
  8835. }
  8836. },
  8837. notes = "Calling functions on the collider after destroying it is a bad idea."
  8838. },
  8839. {
  8840. name = "getAABB",
  8841. summary = "Get the Collider's axis aligned bounding box.",
  8842. description = "Returns the bounding box for the Collider, computed from attached shapes.",
  8843. key = "Collider:getAABB",
  8844. module = "lovr.physics",
  8845. related = {
  8846. "Shape:getAABB"
  8847. },
  8848. variants = {
  8849. {
  8850. arguments = {},
  8851. returns = {
  8852. {
  8853. name = "minx",
  8854. type = "number",
  8855. description = "The minimum x coordinate of the box."
  8856. },
  8857. {
  8858. name = "maxx",
  8859. type = "number",
  8860. description = "The maximum x coordinate of the box."
  8861. },
  8862. {
  8863. name = "miny",
  8864. type = "number",
  8865. description = "The minimum y coordinate of the box."
  8866. },
  8867. {
  8868. name = "maxy",
  8869. type = "number",
  8870. description = "The maximum y coordinate of the box."
  8871. },
  8872. {
  8873. name = "minz",
  8874. type = "number",
  8875. description = "The minimum z coordinate of the box."
  8876. },
  8877. {
  8878. name = "maxz",
  8879. type = "number",
  8880. description = "The maximum z coordinate of the box."
  8881. }
  8882. }
  8883. }
  8884. }
  8885. },
  8886. {
  8887. name = "getAngularDamping",
  8888. summary = "Get the angular damping of the Collider.",
  8889. description = "Returns the angular damping of the Collider. Angular damping makes things less \"spinny\", causing them them slow down their angular velocity over time.",
  8890. key = "Collider:getAngularDamping",
  8891. module = "lovr.physics",
  8892. related = {
  8893. "World:getAngularDamping",
  8894. "World:setAngularDamping"
  8895. },
  8896. variants = {
  8897. {
  8898. arguments = {},
  8899. returns = {
  8900. {
  8901. name = "damping",
  8902. type = "number",
  8903. description = "The angular damping."
  8904. }
  8905. }
  8906. }
  8907. },
  8908. notes = "Angular damping can also be set on the World."
  8909. },
  8910. {
  8911. name = "getAngularVelocity",
  8912. summary = "Get the angular velocity of the Collider.",
  8913. description = "Returns the angular velocity of the Collider.",
  8914. key = "Collider:getAngularVelocity",
  8915. module = "lovr.physics",
  8916. related = {
  8917. "Collider:getLinearVelocity",
  8918. "Collider:setLinearVelocity",
  8919. "Collider:applyTorque",
  8920. "Collider:getOrientation",
  8921. "Collider:setOrientation"
  8922. },
  8923. variants = {
  8924. {
  8925. arguments = {},
  8926. returns = {
  8927. {
  8928. name = "vx",
  8929. type = "number",
  8930. description = "The x component of the angular velocity."
  8931. },
  8932. {
  8933. name = "vy",
  8934. type = "number",
  8935. description = "The y component of the angular velocity."
  8936. },
  8937. {
  8938. name = "vz",
  8939. type = "number",
  8940. description = "The z component of the angular velocity."
  8941. }
  8942. }
  8943. }
  8944. }
  8945. },
  8946. {
  8947. name = "getFriction",
  8948. summary = "Get the friction of the Collider.",
  8949. 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.",
  8950. key = "Collider:getFriction",
  8951. module = "lovr.physics",
  8952. related = {
  8953. "Collider:getRestitution",
  8954. "Collider:setRestitution",
  8955. "World:collide"
  8956. },
  8957. variants = {
  8958. {
  8959. arguments = {},
  8960. returns = {
  8961. {
  8962. name = "friction",
  8963. type = "number",
  8964. description = "The friction of the Collider."
  8965. }
  8966. }
  8967. }
  8968. }
  8969. },
  8970. {
  8971. name = "getLinearDamping",
  8972. summary = "Get the linear damping of the Collider.",
  8973. description = "Returns the Collider's linear damping parameter. Linear damping is similar to drag or air resistance, slowing the Collider down over time.",
  8974. key = "Collider:getLinearDamping",
  8975. module = "lovr.physics",
  8976. related = {
  8977. "World:getLinearDamping",
  8978. "World:setLinearDamping"
  8979. },
  8980. variants = {
  8981. {
  8982. arguments = {},
  8983. returns = {
  8984. {
  8985. name = "damping",
  8986. type = "number",
  8987. description = "The linear damping."
  8988. }
  8989. }
  8990. }
  8991. },
  8992. notes = "A linear damping of 0 means the Collider won't slow down over time.\n\nLinear damping can also be set on the World using `World:setLinearDamping`, which will affect all new colliders."
  8993. },
  8994. {
  8995. name = "getLinearVelocity",
  8996. summary = "Get the linear velocity of the Collider.",
  8997. 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.",
  8998. key = "Collider:getLinearVelocity",
  8999. module = "lovr.physics",
  9000. related = {
  9001. "Collider:getLinearVelocityFromLocalPoint",
  9002. "Collider:getLinearVelocityFromWorldPoint",
  9003. "Collider:getAngularVelocity",
  9004. "Collider:setAngularVelocity",
  9005. "Collider:applyForce",
  9006. "Collider:getPosition",
  9007. "Collider:setPosition"
  9008. },
  9009. variants = {
  9010. {
  9011. arguments = {},
  9012. returns = {
  9013. {
  9014. name = "vx",
  9015. type = "number",
  9016. description = "The x velocity of the Collider, in meters per second."
  9017. },
  9018. {
  9019. name = "vy",
  9020. type = "number",
  9021. description = "The y velocity of the Collider, in meters per second."
  9022. },
  9023. {
  9024. name = "vz",
  9025. type = "number",
  9026. description = "The z velocity of the Collider, in meters per second."
  9027. }
  9028. }
  9029. }
  9030. }
  9031. },
  9032. {
  9033. name = "getLinearVelocityFromLocalPoint",
  9034. summary = "Get the linear velocity of the Collider at a point.",
  9035. description = "Returns the linear velocity of a point relative to the Collider.",
  9036. key = "Collider:getLinearVelocityFromLocalPoint",
  9037. module = "lovr.physics",
  9038. related = {
  9039. "Collider:getLinearVelocity",
  9040. "Collider:getLinearVelocityFromWorldPoint"
  9041. },
  9042. variants = {
  9043. {
  9044. arguments = {
  9045. {
  9046. name = "x",
  9047. type = "number",
  9048. description = "The x coordinate."
  9049. },
  9050. {
  9051. name = "y",
  9052. type = "number",
  9053. description = "The y coordinate."
  9054. },
  9055. {
  9056. name = "z",
  9057. type = "number",
  9058. description = "The z coordinate."
  9059. }
  9060. },
  9061. returns = {
  9062. {
  9063. name = "vx",
  9064. type = "number",
  9065. description = "The x component of the velocity of the point."
  9066. },
  9067. {
  9068. name = "vy",
  9069. type = "number",
  9070. description = "The y component of the velocity of the point."
  9071. },
  9072. {
  9073. name = "vz",
  9074. type = "number",
  9075. description = "The z component of the velocity of the point."
  9076. }
  9077. }
  9078. }
  9079. }
  9080. },
  9081. {
  9082. name = "getLinearVelocityFromWorldPoint",
  9083. summary = "Get the linear velocity of the Collider at a world space point.",
  9084. description = "Returns the linear velocity of a point on the Collider specified in world space.",
  9085. key = "Collider:getLinearVelocityFromWorldPoint",
  9086. module = "lovr.physics",
  9087. related = {
  9088. "Collider:getLinearVelocity",
  9089. "Collider:getLinearVelocityFromLocalPoint"
  9090. },
  9091. variants = {
  9092. {
  9093. arguments = {
  9094. {
  9095. name = "x",
  9096. type = "number",
  9097. description = "The x coordinate in world space."
  9098. },
  9099. {
  9100. name = "y",
  9101. type = "number",
  9102. description = "The y coordinate in world space."
  9103. },
  9104. {
  9105. name = "z",
  9106. type = "number",
  9107. description = "The z coordinate in world space."
  9108. }
  9109. },
  9110. returns = {
  9111. {
  9112. name = "vx",
  9113. type = "number",
  9114. description = "The x component of the velocity of the point."
  9115. },
  9116. {
  9117. name = "vy",
  9118. type = "number",
  9119. description = "The y component of the velocity of the point."
  9120. },
  9121. {
  9122. name = "vz",
  9123. type = "number",
  9124. description = "The z component of the velocity of the point."
  9125. }
  9126. }
  9127. }
  9128. }
  9129. },
  9130. {
  9131. name = "getLocalCenter",
  9132. summary = "Get the Collider's center of mass.",
  9133. description = "Returns the Collider's center of mass.",
  9134. key = "Collider:getLocalCenter",
  9135. module = "lovr.physics",
  9136. related = {
  9137. "Collider:getLocalPoint",
  9138. "Collider:getMassData",
  9139. "Collider:setMassData"
  9140. },
  9141. variants = {
  9142. {
  9143. arguments = {},
  9144. returns = {
  9145. {
  9146. name = "cx",
  9147. type = "number",
  9148. description = "The x position of the center of mass."
  9149. },
  9150. {
  9151. name = "cy",
  9152. type = "number",
  9153. description = "The y position of the center of mass."
  9154. },
  9155. {
  9156. name = "cz",
  9157. type = "number",
  9158. description = "The z position of the center of mass."
  9159. }
  9160. }
  9161. }
  9162. }
  9163. },
  9164. {
  9165. name = "getLocalPoint",
  9166. summary = "Convert a point from world space to collider space.",
  9167. description = "Converts a point from world coordinates into local coordinates relative to the Collider.",
  9168. key = "Collider:getLocalPoint",
  9169. module = "lovr.physics",
  9170. related = {
  9171. "Collider:getWorldPoint",
  9172. "Collider:getLocalVector",
  9173. "Collider:getWorldVector"
  9174. },
  9175. variants = {
  9176. {
  9177. arguments = {
  9178. {
  9179. name = "wx",
  9180. type = "number",
  9181. description = "The x coordinate of the world point."
  9182. },
  9183. {
  9184. name = "wy",
  9185. type = "number",
  9186. description = "The y coordinate of the world point."
  9187. },
  9188. {
  9189. name = "wz",
  9190. type = "number",
  9191. description = "The z coordinate of the world point."
  9192. }
  9193. },
  9194. returns = {
  9195. {
  9196. name = "x",
  9197. type = "number",
  9198. description = "The x position of the local-space point."
  9199. },
  9200. {
  9201. name = "y",
  9202. type = "number",
  9203. description = "The y position of the local-space point."
  9204. },
  9205. {
  9206. name = "z",
  9207. type = "number",
  9208. description = "The z position of the local-space point."
  9209. }
  9210. }
  9211. }
  9212. }
  9213. },
  9214. {
  9215. name = "getLocalVector",
  9216. summary = "Convert a vector from world space to local space.",
  9217. description = "Converts a direction vector from world space to local space.",
  9218. key = "Collider:getLocalVector",
  9219. module = "lovr.physics",
  9220. related = {
  9221. "Collider:getWorldVector",
  9222. "Collider:getLocalPoint",
  9223. "Collider:getWorldPoint"
  9224. },
  9225. variants = {
  9226. {
  9227. arguments = {
  9228. {
  9229. name = "wx",
  9230. type = "number",
  9231. description = "The x component of the world vector."
  9232. },
  9233. {
  9234. name = "wy",
  9235. type = "number",
  9236. description = "The y component of the world vector."
  9237. },
  9238. {
  9239. name = "wz",
  9240. type = "number",
  9241. description = "The z component of the world vector."
  9242. }
  9243. },
  9244. returns = {
  9245. {
  9246. name = "x",
  9247. type = "number",
  9248. description = "The x coordinate of the local vector."
  9249. },
  9250. {
  9251. name = "y",
  9252. type = "number",
  9253. description = "The y coordinate of the local vector."
  9254. },
  9255. {
  9256. name = "z",
  9257. type = "number",
  9258. description = "The z coordinate of the local vector."
  9259. }
  9260. }
  9261. }
  9262. }
  9263. },
  9264. {
  9265. name = "getMass",
  9266. summary = "Get the total mass of the Collider.",
  9267. description = "Returns the total mass of the Collider. The mass of a Collider depends on its attached shapes.",
  9268. key = "Collider:getMass",
  9269. module = "lovr.physics",
  9270. related = {
  9271. "Collider:getMassData",
  9272. "Collider:setMassData",
  9273. "Shape:getMass"
  9274. },
  9275. variants = {
  9276. {
  9277. arguments = {},
  9278. returns = {
  9279. {
  9280. name = "mass",
  9281. type = "number",
  9282. description = "The mass of the Collider, in kilograms."
  9283. }
  9284. }
  9285. }
  9286. }
  9287. },
  9288. {
  9289. name = "getMassData",
  9290. summary = "Compute mass properties for the Collider.",
  9291. description = "Computes mass properties for the Collider.",
  9292. key = "Collider:getMassData",
  9293. module = "lovr.physics",
  9294. related = {
  9295. "Collider:getMass",
  9296. "Collider:setMass",
  9297. "Shape:getMass"
  9298. },
  9299. variants = {
  9300. {
  9301. arguments = {},
  9302. returns = {
  9303. {
  9304. name = "cx",
  9305. type = "number",
  9306. description = "The x position of the center of mass."
  9307. },
  9308. {
  9309. name = "cy",
  9310. type = "number",
  9311. description = "The y position of the center of mass."
  9312. },
  9313. {
  9314. name = "cz",
  9315. type = "number",
  9316. description = "The z position of the center of mass."
  9317. },
  9318. {
  9319. name = "mass",
  9320. type = "number",
  9321. description = "The computed mass of the Collider."
  9322. },
  9323. {
  9324. name = "inertia",
  9325. type = "table",
  9326. 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."
  9327. }
  9328. }
  9329. }
  9330. }
  9331. },
  9332. {
  9333. name = "getOrientation",
  9334. summary = "Get the orientation of the Collider.",
  9335. description = "Returns the orientation of the Collider in angle/axis representation.",
  9336. key = "Collider:getOrientation",
  9337. module = "lovr.physics",
  9338. related = {
  9339. "Collider:applyTorque",
  9340. "Collider:getAngularVelocity",
  9341. "Collider:setAngularVelocity",
  9342. "Collider:getPosition",
  9343. "Collider:setPosition"
  9344. },
  9345. variants = {
  9346. {
  9347. arguments = {},
  9348. returns = {
  9349. {
  9350. name = "angle",
  9351. type = "number",
  9352. description = "The number of radians the Collider is rotated around its axis of rotation."
  9353. },
  9354. {
  9355. name = "ax",
  9356. type = "number",
  9357. description = "The x component of the axis of rotation."
  9358. },
  9359. {
  9360. name = "ay",
  9361. type = "number",
  9362. description = "The y component of the axis of rotation."
  9363. },
  9364. {
  9365. name = "az",
  9366. type = "number",
  9367. description = "The z component of the axis of rotation."
  9368. }
  9369. }
  9370. }
  9371. }
  9372. },
  9373. {
  9374. name = "getPosition",
  9375. summary = "Get the position of the Collider.",
  9376. description = "Returns the position of the Collider.",
  9377. key = "Collider:getPosition",
  9378. module = "lovr.physics",
  9379. related = {
  9380. "Collider:applyForce",
  9381. "Collider:getLinearVelocity",
  9382. "Collider:setLinearVelocity",
  9383. "Collider:getOrientation",
  9384. "Collider:setOrientation"
  9385. },
  9386. variants = {
  9387. {
  9388. arguments = {},
  9389. returns = {
  9390. {
  9391. name = "x",
  9392. type = "number",
  9393. description = "The x position of the Collider, in meters."
  9394. },
  9395. {
  9396. name = "y",
  9397. type = "number",
  9398. description = "The y position of the Collider, in meters."
  9399. },
  9400. {
  9401. name = "z",
  9402. type = "number",
  9403. description = "The z position of the Collider, in meters."
  9404. }
  9405. }
  9406. }
  9407. }
  9408. },
  9409. {
  9410. name = "getRestitution",
  9411. summary = "Get the bounciness of the Collider.",
  9412. 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.",
  9413. key = "Collider:getRestitution",
  9414. module = "lovr.physics",
  9415. related = {
  9416. "Collider:getFriction",
  9417. "Collider:setFriction",
  9418. "World:collide"
  9419. },
  9420. variants = {
  9421. {
  9422. arguments = {},
  9423. returns = {
  9424. {
  9425. name = "restitution",
  9426. type = "number",
  9427. description = "The restitution of the Collider."
  9428. }
  9429. }
  9430. }
  9431. }
  9432. },
  9433. {
  9434. name = "getShapeList",
  9435. summary = "Get a list of Shapes attached to the Collider.",
  9436. description = "Returns a list of Shapes attached to the Collider.",
  9437. key = "Collider:getShapeList",
  9438. module = "lovr.physics",
  9439. related = {
  9440. "Collider:addShape",
  9441. "Collider:removeShape",
  9442. "Shape"
  9443. },
  9444. variants = {
  9445. {
  9446. arguments = {},
  9447. returns = {
  9448. {
  9449. name = "shapes",
  9450. type = "table",
  9451. description = "A list of Shapes attached to the Collider."
  9452. }
  9453. }
  9454. }
  9455. }
  9456. },
  9457. {
  9458. name = "getTag",
  9459. summary = "Get the Collider's tag.",
  9460. description = "Returns the Collider's tag.",
  9461. key = "Collider:getTag",
  9462. module = "lovr.physics",
  9463. related = {
  9464. "World:disableCollisionBetween",
  9465. "World:enableCollisionBetween",
  9466. "World:isCollisionEnabledBetween",
  9467. "lovr.physics.newWorld"
  9468. },
  9469. variants = {
  9470. {
  9471. arguments = {},
  9472. returns = {
  9473. {
  9474. name = "tag",
  9475. type = "string",
  9476. description = "The Collider's collision tag."
  9477. }
  9478. }
  9479. }
  9480. },
  9481. notes = "Collision between tags can be enabled and disabled using `World:enableCollisionBetween` and `World:disableCollisionBetween`."
  9482. },
  9483. {
  9484. name = "getUserData",
  9485. summary = "Get the Collider's user data.",
  9486. description = "Returns the user data associated with the Collider.",
  9487. key = "Collider:getUserData",
  9488. module = "lovr.physics",
  9489. notes = "User data can be useful to identify the Collider in callbacks.",
  9490. variants = {
  9491. {
  9492. arguments = {},
  9493. returns = {
  9494. {
  9495. name = "data",
  9496. type = "*",
  9497. description = "The custom value associated with the Collider."
  9498. }
  9499. }
  9500. }
  9501. }
  9502. },
  9503. {
  9504. name = "getWorld",
  9505. summary = "Get the World the Collider is in.",
  9506. description = "Returns the World the Collider is in.",
  9507. key = "Collider:getWorld",
  9508. module = "lovr.physics",
  9509. related = {
  9510. "World"
  9511. },
  9512. variants = {
  9513. {
  9514. arguments = {},
  9515. returns = {
  9516. {
  9517. name = "world",
  9518. type = "World",
  9519. description = "The World the Collider is in."
  9520. }
  9521. }
  9522. }
  9523. },
  9524. notes = "Colliders can only be in one World at a time."
  9525. },
  9526. {
  9527. name = "getWorldPoint",
  9528. summary = "Convert a point from local space to world space.",
  9529. description = "Convert a point relative to the collider to a point in world coordinates.",
  9530. key = "Collider:getWorldPoint",
  9531. module = "lovr.physics",
  9532. related = {
  9533. "Collider:getLocalPoint",
  9534. "Collider:getLocalVector",
  9535. "Collider:getWorldVector"
  9536. },
  9537. variants = {
  9538. {
  9539. arguments = {
  9540. {
  9541. name = "x",
  9542. type = "number",
  9543. description = "The x position of the point."
  9544. },
  9545. {
  9546. name = "y",
  9547. type = "number",
  9548. description = "The y position of the point."
  9549. },
  9550. {
  9551. name = "z",
  9552. type = "number",
  9553. description = "The z position of the point."
  9554. }
  9555. },
  9556. returns = {
  9557. {
  9558. name = "wx",
  9559. type = "number",
  9560. description = "The x coordinate of the world point."
  9561. },
  9562. {
  9563. name = "wy",
  9564. type = "number",
  9565. description = "The y coordinate of the world point."
  9566. },
  9567. {
  9568. name = "wz",
  9569. type = "number",
  9570. description = "The z coordinate of the world point."
  9571. }
  9572. }
  9573. }
  9574. }
  9575. },
  9576. {
  9577. name = "getWorldVector",
  9578. summary = "Convert a vector from local space to world space.",
  9579. description = "Converts a direction vector from local space to world space.",
  9580. key = "Collider:getWorldVector",
  9581. module = "lovr.physics",
  9582. related = {
  9583. "Collider:getLocalVector",
  9584. "Collider:getLocalPoint",
  9585. "Collider:getWorldPoint"
  9586. },
  9587. variants = {
  9588. {
  9589. arguments = {
  9590. {
  9591. name = "x",
  9592. type = "number",
  9593. description = "The x coordinate of the local vector."
  9594. },
  9595. {
  9596. name = "y",
  9597. type = "number",
  9598. description = "The y coordinate of the local vector."
  9599. },
  9600. {
  9601. name = "z",
  9602. type = "number",
  9603. description = "The z coordinate of the local vector."
  9604. }
  9605. },
  9606. returns = {
  9607. {
  9608. name = "wx",
  9609. type = "number",
  9610. description = "The x component of the world vector."
  9611. },
  9612. {
  9613. name = "wy",
  9614. type = "number",
  9615. description = "The y component of the world vector."
  9616. },
  9617. {
  9618. name = "wz",
  9619. type = "number",
  9620. description = "The z component of the world vector."
  9621. }
  9622. }
  9623. }
  9624. }
  9625. },
  9626. {
  9627. name = "isAwake",
  9628. summary = "Check if the Collider is awake.",
  9629. description = "Returns whether the Collider is currently awake.",
  9630. key = "Collider:isAwake",
  9631. module = "lovr.physics",
  9632. related = {
  9633. "World:isSleepingAllowed",
  9634. "World:setSleepingAllowed",
  9635. "Collider:isSleepingAllowed",
  9636. "Collider:setSleepingAllowed"
  9637. },
  9638. variants = {
  9639. {
  9640. arguments = {},
  9641. returns = {
  9642. {
  9643. name = "awake",
  9644. type = "boolean",
  9645. description = "Whether the Collider is awake."
  9646. }
  9647. }
  9648. }
  9649. }
  9650. },
  9651. {
  9652. name = "isGravityIgnored",
  9653. summary = "Check if the Collider ignores gravity.",
  9654. description = "Returns whether the Collider is currently ignoring gravity.",
  9655. key = "Collider:isGravityIgnored",
  9656. module = "lovr.physics",
  9657. variants = {
  9658. {
  9659. arguments = {},
  9660. returns = {
  9661. {
  9662. name = "ignored",
  9663. type = "boolean",
  9664. description = "Whether gravity is ignored for this Collider."
  9665. }
  9666. }
  9667. }
  9668. }
  9669. },
  9670. {
  9671. name = "isKinematic",
  9672. summary = "Check if the Collider is kinematic.",
  9673. description = "Returns whether the Collider is kinematic.",
  9674. key = "Collider:isKinematic",
  9675. module = "lovr.physics",
  9676. 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.",
  9677. variants = {
  9678. {
  9679. arguments = {},
  9680. returns = {
  9681. {
  9682. name = "kinematic",
  9683. type = "boolean",
  9684. description = "Whether the Collider is kinematic."
  9685. }
  9686. }
  9687. }
  9688. }
  9689. },
  9690. {
  9691. name = "isSleepingAllowed",
  9692. summary = "Check if the Collider is allowed to sleep.",
  9693. description = "Returns whether the Collider is allowed to sleep.",
  9694. key = "Collider:isSleepingAllowed",
  9695. module = "lovr.physics",
  9696. related = {
  9697. "World:isSleepingAllowed",
  9698. "World:setSleepingAllowed",
  9699. "Collider:isAwake",
  9700. "Collider:setAwake"
  9701. },
  9702. variants = {
  9703. {
  9704. arguments = {},
  9705. returns = {
  9706. {
  9707. name = "allowed",
  9708. type = "boolean",
  9709. description = "Whether the Collider can go to sleep."
  9710. }
  9711. }
  9712. }
  9713. },
  9714. 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`."
  9715. },
  9716. {
  9717. name = "removeShape",
  9718. summary = "Remove a Shape from the Collider.",
  9719. description = "Removes a Shape from the Collider.",
  9720. key = "Collider:removeShape",
  9721. module = "lovr.physics",
  9722. related = {
  9723. "Collider:addShape",
  9724. "Collider:getShapeList",
  9725. "Shape"
  9726. },
  9727. variants = {
  9728. {
  9729. arguments = {
  9730. {
  9731. name = "shape",
  9732. type = "Shape",
  9733. description = "The Shape to remove."
  9734. }
  9735. },
  9736. returns = {}
  9737. }
  9738. },
  9739. notes = "Colliders without any shapes won't collide with anything."
  9740. },
  9741. {
  9742. name = "setAngularDamping",
  9743. summary = "Set the angular damping of the Collider.",
  9744. description = "Sets the angular damping of the Collider. Angular damping makes things less \"spinny\", causing them them slow down their angular velocity over time.",
  9745. key = "Collider:setAngularDamping",
  9746. module = "lovr.physics",
  9747. related = {
  9748. "World:getAngularDamping",
  9749. "World:setAngularDamping"
  9750. },
  9751. variants = {
  9752. {
  9753. arguments = {
  9754. {
  9755. name = "damping",
  9756. type = "number",
  9757. description = "The angular damping."
  9758. }
  9759. },
  9760. returns = {}
  9761. }
  9762. },
  9763. notes = "Angular damping can also be set on the World."
  9764. },
  9765. {
  9766. name = "setAngularVelocity",
  9767. summary = "Set the angular velocity of the Collider.",
  9768. description = "Sets the angular velocity of the Collider.",
  9769. key = "Collider:setAngularVelocity",
  9770. module = "lovr.physics",
  9771. related = {
  9772. "Collider:getLinearVelocity",
  9773. "Collider:setLinearVelocity",
  9774. "Collider:applyTorque",
  9775. "Collider:getOrientation",
  9776. "Collider:setOrientation"
  9777. },
  9778. variants = {
  9779. {
  9780. arguments = {
  9781. {
  9782. name = "vx",
  9783. type = "number",
  9784. description = "The x component of the angular velocity."
  9785. },
  9786. {
  9787. name = "vy",
  9788. type = "number",
  9789. description = "The y component of the angular velocity."
  9790. },
  9791. {
  9792. name = "vz",
  9793. type = "number",
  9794. description = "The z component of the angular velocity."
  9795. }
  9796. },
  9797. returns = {}
  9798. }
  9799. }
  9800. },
  9801. {
  9802. name = "setAwake",
  9803. summary = "Put the Collider to sleep or wake it up.",
  9804. 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.",
  9805. key = "Collider:setAwake",
  9806. module = "lovr.physics",
  9807. related = {
  9808. "World:isSleepingAllowed",
  9809. "World:setSleepingAllowed",
  9810. "Collider:isSleepingAllowed",
  9811. "Collider:setSleepingAllowed"
  9812. },
  9813. variants = {
  9814. {
  9815. arguments = {
  9816. {
  9817. name = "awake",
  9818. type = "boolean",
  9819. description = "Whether the Collider should be awake."
  9820. }
  9821. },
  9822. returns = {}
  9823. }
  9824. }
  9825. },
  9826. {
  9827. name = "setFriction",
  9828. summary = "Set the friction of the Collider.",
  9829. 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.",
  9830. key = "Collider:setFriction",
  9831. module = "lovr.physics",
  9832. related = {
  9833. "Collider:getRestitution",
  9834. "Collider:setRestitution",
  9835. "World:collide"
  9836. },
  9837. variants = {
  9838. {
  9839. arguments = {
  9840. {
  9841. name = "friction",
  9842. type = "number",
  9843. description = "The new friction."
  9844. }
  9845. },
  9846. returns = {}
  9847. }
  9848. }
  9849. },
  9850. {
  9851. name = "setGravityIgnored",
  9852. summary = "Set whether the Collider ignores gravity.",
  9853. description = "Sets whether the Collider should ignore gravity.",
  9854. key = "Collider:setGravityIgnored",
  9855. module = "lovr.physics",
  9856. variants = {
  9857. {
  9858. arguments = {
  9859. {
  9860. name = "ignored",
  9861. type = "boolean",
  9862. description = "Whether gravity should be ignored."
  9863. }
  9864. },
  9865. returns = {}
  9866. }
  9867. }
  9868. },
  9869. {
  9870. name = "setKinematic",
  9871. summary = "Set whether the Collider is kinematic.",
  9872. description = "Sets whether the Collider is kinematic.",
  9873. key = "Collider:setKinematic",
  9874. module = "lovr.physics",
  9875. 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.",
  9876. variants = {
  9877. {
  9878. arguments = {
  9879. {
  9880. name = "kinematic",
  9881. type = "boolean",
  9882. description = "Whether the Collider is kinematic."
  9883. }
  9884. },
  9885. returns = {}
  9886. }
  9887. }
  9888. },
  9889. {
  9890. name = "setLinearDamping",
  9891. summary = "Set the linear damping of the Collider.",
  9892. description = "Sets the Collider's linear damping parameter. Linear damping is similar to drag or air resistance, slowing the Collider down over time.",
  9893. key = "Collider:setLinearDamping",
  9894. module = "lovr.physics",
  9895. related = {
  9896. "World:getLinearDamping",
  9897. "World:setLinearDamping"
  9898. },
  9899. variants = {
  9900. {
  9901. arguments = {
  9902. {
  9903. name = "damping",
  9904. type = "number",
  9905. description = "The linear damping."
  9906. }
  9907. },
  9908. returns = {}
  9909. }
  9910. },
  9911. notes = "A linear damping of 0 means the Collider won't slow down over time.\n\nLinear damping can also be set on the World using `World:setLinearDamping`, which will affect all new colliders."
  9912. },
  9913. {
  9914. name = "setLinearVelocity",
  9915. summary = "Set the linear velocity of the Collider.",
  9916. 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.",
  9917. key = "Collider:setLinearVelocity",
  9918. module = "lovr.physics",
  9919. related = {
  9920. "Collider:getLinearVelocityFromLocalPoint",
  9921. "Collider:getLinearVelocityFromWorldPoint",
  9922. "Collider:getAngularVelocity",
  9923. "Collider:setAngularVelocity",
  9924. "Collider:applyForce",
  9925. "Collider:getPosition",
  9926. "Collider:setPosition"
  9927. },
  9928. variants = {
  9929. {
  9930. arguments = {
  9931. {
  9932. name = "vx",
  9933. type = "number",
  9934. description = "The x velocity of the Collider, in meters per second."
  9935. },
  9936. {
  9937. name = "vy",
  9938. type = "number",
  9939. description = "The y velocity of the Collider, in meters per second."
  9940. },
  9941. {
  9942. name = "vz",
  9943. type = "number",
  9944. description = "The z velocity of the Collider, in meters per second."
  9945. }
  9946. },
  9947. returns = {}
  9948. }
  9949. }
  9950. },
  9951. {
  9952. name = "setMass",
  9953. summary = "Set the total mass of the Collider.",
  9954. description = "Sets the total mass of the Collider.",
  9955. key = "Collider:setMass",
  9956. module = "lovr.physics",
  9957. related = {
  9958. "Collider:getMassData",
  9959. "Collider:setMassData",
  9960. "Shape:getMass"
  9961. },
  9962. variants = {
  9963. {
  9964. arguments = {
  9965. {
  9966. name = "mass",
  9967. type = "number",
  9968. description = "The new mass for the Collider, in kilograms."
  9969. }
  9970. },
  9971. returns = {}
  9972. }
  9973. }
  9974. },
  9975. {
  9976. name = "setMassData",
  9977. summary = "Set mass properties for the Collider.",
  9978. description = "Sets mass properties for the Collider.",
  9979. key = "Collider:setMassData",
  9980. module = "lovr.physics",
  9981. related = {
  9982. "Collider:getMass",
  9983. "Collider:setMass",
  9984. "Shape:getMass"
  9985. },
  9986. variants = {
  9987. {
  9988. arguments = {
  9989. {
  9990. name = "cx",
  9991. type = "number",
  9992. description = "The x position of the center of mass."
  9993. },
  9994. {
  9995. name = "cy",
  9996. type = "number",
  9997. description = "The y position of the center of mass."
  9998. },
  9999. {
  10000. name = "cz",
  10001. type = "number",
  10002. description = "The z position of the center of mass."
  10003. },
  10004. {
  10005. name = "mass",
  10006. type = "number",
  10007. description = "The computed mass of the Collider."
  10008. },
  10009. {
  10010. name = "inertia",
  10011. type = "table",
  10012. 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."
  10013. }
  10014. },
  10015. returns = {}
  10016. }
  10017. }
  10018. },
  10019. {
  10020. name = "setOrientation",
  10021. summary = "Set the orientation of the Collider.",
  10022. description = "Sets the orientation of the Collider in angle/axis representation.",
  10023. key = "Collider:setOrientation",
  10024. module = "lovr.physics",
  10025. related = {
  10026. "Collider:applyTorque",
  10027. "Collider:getAngularVelocity",
  10028. "Collider:setAngularVelocity",
  10029. "Collider:getPosition",
  10030. "Collider:setPosition"
  10031. },
  10032. variants = {
  10033. {
  10034. arguments = {
  10035. {
  10036. name = "angle",
  10037. type = "number",
  10038. description = "The number of radians the Collider is rotated around its axis of rotation."
  10039. },
  10040. {
  10041. name = "ax",
  10042. type = "number",
  10043. description = "The x component of the axis of rotation."
  10044. },
  10045. {
  10046. name = "ay",
  10047. type = "number",
  10048. description = "The y component of the axis of rotation."
  10049. },
  10050. {
  10051. name = "az",
  10052. type = "number",
  10053. description = "The z component of the axis of rotation."
  10054. }
  10055. },
  10056. returns = {}
  10057. }
  10058. }
  10059. },
  10060. {
  10061. name = "setPosition",
  10062. summary = "Set the position of the Collider.",
  10063. description = "Sets the position of the Collider.",
  10064. key = "Collider:setPosition",
  10065. module = "lovr.physics",
  10066. related = {
  10067. "Collider:applyForce",
  10068. "Collider:getLinearVelocity",
  10069. "Collider:setLinearVelocity",
  10070. "Collider:getOrientation",
  10071. "Collider:setOrientation"
  10072. },
  10073. variants = {
  10074. {
  10075. arguments = {
  10076. {
  10077. name = "x",
  10078. type = "number",
  10079. description = "The x position of the Collider, in meters."
  10080. },
  10081. {
  10082. name = "y",
  10083. type = "number",
  10084. description = "The y position of the Collider, in meters."
  10085. },
  10086. {
  10087. name = "z",
  10088. type = "number",
  10089. description = "The z position of the Collider, in meters."
  10090. }
  10091. },
  10092. returns = {}
  10093. }
  10094. }
  10095. },
  10096. {
  10097. name = "setRestitution",
  10098. summary = "Set the bounciness of the Collider.",
  10099. 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.",
  10100. key = "Collider:setRestitution",
  10101. module = "lovr.physics",
  10102. related = {
  10103. "Collider:getFriction",
  10104. "Collider:setFriction",
  10105. "World:collide"
  10106. },
  10107. variants = {
  10108. {
  10109. arguments = {
  10110. {
  10111. name = "restitution",
  10112. type = "number",
  10113. description = "The new restitution."
  10114. }
  10115. },
  10116. returns = {}
  10117. }
  10118. }
  10119. },
  10120. {
  10121. name = "setSleepingAllowed",
  10122. summary = "Set whether the Collider is allowed to sleep.",
  10123. description = "Sets whether the Collider is allowed to sleep.",
  10124. key = "Collider:setSleepingAllowed",
  10125. module = "lovr.physics",
  10126. related = {
  10127. "World:isSleepingAllowed",
  10128. "World:setSleepingAllowed",
  10129. "Collider:isAwake",
  10130. "Collider:setAwake"
  10131. },
  10132. variants = {
  10133. {
  10134. arguments = {
  10135. {
  10136. name = "allowed",
  10137. type = "boolean",
  10138. description = "Whether the Collider can go to sleep."
  10139. }
  10140. },
  10141. returns = {}
  10142. }
  10143. },
  10144. 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`."
  10145. },
  10146. {
  10147. name = "setTag",
  10148. summary = "Set the Collider's tag.",
  10149. description = "Sets the Collider's tag.",
  10150. key = "Collider:setTag",
  10151. module = "lovr.physics",
  10152. related = {
  10153. "World:disableCollisionBetween",
  10154. "World:enableCollisionBetween",
  10155. "World:isCollisionEnabledBetween",
  10156. "lovr.physics.newWorld"
  10157. },
  10158. variants = {
  10159. {
  10160. arguments = {
  10161. {
  10162. name = "tag",
  10163. type = "string",
  10164. description = "The Collider's collision tag."
  10165. }
  10166. },
  10167. returns = {}
  10168. }
  10169. },
  10170. notes = "Collision between tags can be enabled and disabled using `World:enableCollisionBetween` and `World:disableCollisionBetween`."
  10171. },
  10172. {
  10173. name = "setUserData",
  10174. summary = "Set the Collider's user data.",
  10175. description = "Associates a custom value with the Collider.",
  10176. key = "Collider:setUserData",
  10177. module = "lovr.physics",
  10178. notes = "User data can be useful to identify the Collider in callbacks.",
  10179. variants = {
  10180. {
  10181. arguments = {
  10182. {
  10183. name = "data",
  10184. type = "*",
  10185. description = "The custom value to associate with the Collider."
  10186. }
  10187. },
  10188. returns = {}
  10189. }
  10190. }
  10191. }
  10192. },
  10193. constructors = {
  10194. "World:newCollider",
  10195. "World:newBoxCollider",
  10196. "World:newCapsuleCollider",
  10197. "World:newCylinderCollider",
  10198. "World:newSphereCollider"
  10199. }
  10200. },
  10201. {
  10202. name = "CylinderShape",
  10203. summary = "A cylinder Shape.",
  10204. description = "A type of `Shape` that can be used for cylinder-shaped things.",
  10205. key = "CylinderShape",
  10206. module = "lovr.physics",
  10207. extends = "Shape",
  10208. constructors = {
  10209. "lovr.physics.newCylinderShape",
  10210. "World:newCylinderCollider"
  10211. },
  10212. methods = {
  10213. {
  10214. name = "getLength",
  10215. summary = "Get the length of the CylinderShape.",
  10216. description = "Returns the length of the CylinderShape.",
  10217. key = "CylinderShape:getLength",
  10218. module = "lovr.physics",
  10219. variants = {
  10220. {
  10221. arguments = {},
  10222. returns = {
  10223. {
  10224. name = "length",
  10225. type = "number",
  10226. description = "The length of the cylinder, in meters."
  10227. }
  10228. }
  10229. }
  10230. }
  10231. },
  10232. {
  10233. name = "getRadius",
  10234. summary = "Get the radius of the CylinderShape.",
  10235. description = "Returns the radius of the CylinderShape.",
  10236. key = "CylinderShape:getRadius",
  10237. module = "lovr.physics",
  10238. variants = {
  10239. {
  10240. arguments = {},
  10241. returns = {
  10242. {
  10243. name = "radius",
  10244. type = "number",
  10245. description = "The radius of the cylinder, in meters."
  10246. }
  10247. }
  10248. }
  10249. }
  10250. },
  10251. {
  10252. name = "setLength",
  10253. summary = "Set the length of the CylinderShape.",
  10254. description = "Sets the length of the CylinderShape.",
  10255. key = "CylinderShape:setLength",
  10256. module = "lovr.physics",
  10257. variants = {
  10258. {
  10259. arguments = {
  10260. {
  10261. name = "length",
  10262. type = "number",
  10263. description = "The new length, in meters."
  10264. }
  10265. },
  10266. returns = {}
  10267. }
  10268. }
  10269. },
  10270. {
  10271. name = "setRadius",
  10272. summary = "Set the radius of the CylinderShape.",
  10273. description = "Sets the radius of the CylinderShape.",
  10274. key = "CylinderShape:setRadius",
  10275. module = "lovr.physics",
  10276. variants = {
  10277. {
  10278. arguments = {
  10279. {
  10280. name = "radius",
  10281. type = "number",
  10282. description = "The new radius, in meters."
  10283. }
  10284. },
  10285. returns = {}
  10286. }
  10287. }
  10288. }
  10289. }
  10290. },
  10291. {
  10292. name = "DistanceJoint",
  10293. summary = "A fixed distance joint.",
  10294. 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.",
  10295. key = "DistanceJoint",
  10296. module = "lovr.physics",
  10297. related = {
  10298. "Collider"
  10299. },
  10300. constructors = {
  10301. "lovr.physics.newDistanceJoint"
  10302. },
  10303. methods = {
  10304. {
  10305. name = "getAnchors",
  10306. summary = "Get the anchor points of the DistanceJoint.",
  10307. description = "Returns the anchor points of the DistanceJoint.",
  10308. key = "DistanceJoint:getAnchors",
  10309. module = "lovr.physics",
  10310. variants = {
  10311. {
  10312. arguments = {},
  10313. returns = {
  10314. {
  10315. name = "x1",
  10316. type = "number",
  10317. description = "The x coordinate of the first anchor point, in world coordinates."
  10318. },
  10319. {
  10320. name = "y1",
  10321. type = "number",
  10322. description = "The y coordinate of the first anchor point, in world coordinates."
  10323. },
  10324. {
  10325. name = "z1",
  10326. type = "number",
  10327. description = "The z coordinate of the first anchor point, in world coordinates."
  10328. },
  10329. {
  10330. name = "x2",
  10331. type = "number",
  10332. description = "The x coordinate of the second anchor point, in world coordinates."
  10333. },
  10334. {
  10335. name = "y2",
  10336. type = "number",
  10337. description = "The y coordinate of the second anchor point, in world coordinates."
  10338. },
  10339. {
  10340. name = "z2",
  10341. type = "number",
  10342. description = "The z coordinate of the second anchor point, in world coordinates."
  10343. }
  10344. }
  10345. }
  10346. }
  10347. },
  10348. {
  10349. name = "getDistance",
  10350. summary = "Get the target distance of the DistanceJoint.",
  10351. description = "Returns the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.",
  10352. key = "DistanceJoint:getDistance",
  10353. module = "lovr.physics",
  10354. variants = {
  10355. {
  10356. arguments = {},
  10357. returns = {
  10358. {
  10359. name = "distance",
  10360. type = "number",
  10361. description = "The target distance."
  10362. }
  10363. }
  10364. }
  10365. }
  10366. },
  10367. {
  10368. name = "setAnchors",
  10369. summary = "Set the anchor points of the DistanceJoint.",
  10370. description = "Sets the anchor points of the DistanceJoint.",
  10371. key = "DistanceJoint:setAnchors",
  10372. module = "lovr.physics",
  10373. variants = {
  10374. {
  10375. arguments = {
  10376. {
  10377. name = "x1",
  10378. type = "number",
  10379. description = "The x coordinate of the first anchor point, in world coordinates."
  10380. },
  10381. {
  10382. name = "y1",
  10383. type = "number",
  10384. description = "The y coordinate of the first anchor point, in world coordinates."
  10385. },
  10386. {
  10387. name = "z1",
  10388. type = "number",
  10389. description = "The z coordinate of the first anchor point, in world coordinates."
  10390. },
  10391. {
  10392. name = "x2",
  10393. type = "number",
  10394. description = "The x coordinate of the second anchor point, in world coordinates."
  10395. },
  10396. {
  10397. name = "y2",
  10398. type = "number",
  10399. description = "The y coordinate of the second anchor point, in world coordinates."
  10400. },
  10401. {
  10402. name = "z2",
  10403. type = "number",
  10404. description = "The z coordinate of the second anchor point, in world coordinates."
  10405. }
  10406. },
  10407. returns = {}
  10408. }
  10409. }
  10410. },
  10411. {
  10412. name = "setDistance",
  10413. summary = "Set the target distance of the DistanceJoint.",
  10414. description = "Sets the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.",
  10415. key = "DistanceJoint:setDistance",
  10416. module = "lovr.physics",
  10417. variants = {
  10418. {
  10419. arguments = {
  10420. {
  10421. name = "distance",
  10422. type = "number",
  10423. description = "The new target distance."
  10424. }
  10425. },
  10426. returns = {}
  10427. }
  10428. }
  10429. }
  10430. },
  10431. extends = "Joint"
  10432. },
  10433. {
  10434. name = "HingeJoint",
  10435. summary = "A hinge joint.",
  10436. description = "A HingeJoint is a type of `Joint` that only allows colliders to rotate on a single axis.",
  10437. key = "HingeJoint",
  10438. module = "lovr.physics",
  10439. related = {
  10440. "Collider"
  10441. },
  10442. constructors = {
  10443. "lovr.physics.newHingeJoint"
  10444. },
  10445. methods = {
  10446. {
  10447. name = "getAnchors",
  10448. summary = "Get the anchor points of the HingeJoint.",
  10449. description = "Returns the anchor points of the HingeJoint.",
  10450. key = "HingeJoint:getAnchors",
  10451. module = "lovr.physics",
  10452. variants = {
  10453. {
  10454. arguments = {},
  10455. returns = {
  10456. {
  10457. name = "x1",
  10458. type = "number",
  10459. description = "The x coordinate of the first anchor point, in world coordinates."
  10460. },
  10461. {
  10462. name = "y1",
  10463. type = "number",
  10464. description = "The y coordinate of the first anchor point, in world coordinates."
  10465. },
  10466. {
  10467. name = "z1",
  10468. type = "number",
  10469. description = "The z coordinate of the first anchor point, in world coordinates."
  10470. },
  10471. {
  10472. name = "x2",
  10473. type = "number",
  10474. description = "The x coordinate of the second anchor point, in world coordinates."
  10475. },
  10476. {
  10477. name = "y2",
  10478. type = "number",
  10479. description = "The y coordinate of the second anchor point, in world coordinates."
  10480. },
  10481. {
  10482. name = "z2",
  10483. type = "number",
  10484. description = "The z coordinate of the second anchor point, in world coordinates."
  10485. }
  10486. }
  10487. }
  10488. }
  10489. },
  10490. {
  10491. name = "getAngle",
  10492. summary = "Get the angle of the HingeJoint.",
  10493. 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.",
  10494. key = "HingeJoint:getAngle",
  10495. module = "lovr.physics",
  10496. variants = {
  10497. {
  10498. arguments = {},
  10499. returns = {
  10500. {
  10501. name = "angle",
  10502. type = "number",
  10503. description = "The hinge angle."
  10504. }
  10505. }
  10506. }
  10507. }
  10508. },
  10509. {
  10510. name = "getAxis",
  10511. summary = "Get the HingeJoint's axis.",
  10512. description = "Returns the axis of the hinge.",
  10513. key = "HingeJoint:getAxis",
  10514. module = "lovr.physics",
  10515. variants = {
  10516. {
  10517. arguments = {},
  10518. returns = {
  10519. {
  10520. name = "x",
  10521. type = "number",
  10522. description = "The x component of the axis."
  10523. },
  10524. {
  10525. name = "y",
  10526. type = "number",
  10527. description = "The y component of the axis."
  10528. },
  10529. {
  10530. name = "z",
  10531. type = "number",
  10532. description = "The z component of the axis."
  10533. }
  10534. }
  10535. }
  10536. }
  10537. },
  10538. {
  10539. name = "getLimits",
  10540. summary = "Get the HingeJoint's angle limits.",
  10541. description = "Returns the upper and lower limits of the hinge angle. These will be between -π and π.",
  10542. key = "HingeJoint:getLimits",
  10543. module = "lovr.physics",
  10544. related = {
  10545. "HingeJoint:getAngle",
  10546. "HingeJoint:getLowerLimit",
  10547. "HingeJoint:setLowerLimit",
  10548. "HingeJoint:getUpperLimit",
  10549. "HingeJoint:setUpperLimit"
  10550. },
  10551. variants = {
  10552. {
  10553. arguments = {},
  10554. returns = {
  10555. {
  10556. name = "lower",
  10557. type = "number",
  10558. description = "The lower limit."
  10559. },
  10560. {
  10561. name = "upper",
  10562. type = "number",
  10563. description = "The upper limit."
  10564. }
  10565. }
  10566. }
  10567. }
  10568. },
  10569. {
  10570. name = "getLowerLimit",
  10571. summary = "Get the HingeJoint's lower angle limit.",
  10572. description = "Returns the lower limit of the hinge angle. This will be greater than -π.",
  10573. key = "HingeJoint:getLowerLimit",
  10574. module = "lovr.physics",
  10575. related = {
  10576. "HingeJoint:getAngle",
  10577. "HingeJoint:getUpperLimit",
  10578. "HingeJoint:setUpperLimit",
  10579. "HingeJoint:getLimits",
  10580. "HingeJoint:setLimits"
  10581. },
  10582. variants = {
  10583. {
  10584. arguments = {},
  10585. returns = {
  10586. {
  10587. name = "limit",
  10588. type = "number",
  10589. description = "The lower limit."
  10590. }
  10591. }
  10592. }
  10593. }
  10594. },
  10595. {
  10596. name = "getUpperLimit",
  10597. summary = "Get the HingeJoint's upper angle limit.",
  10598. description = "Returns the upper limit of the hinge angle. This will be less than π.",
  10599. key = "HingeJoint:getUpperLimit",
  10600. module = "lovr.physics",
  10601. related = {
  10602. "HingeJoint:getAngle",
  10603. "HingeJoint:getLowerLimit",
  10604. "HingeJoint:setLowerLimit",
  10605. "HingeJoint:getLimits",
  10606. "HingeJoint:setLimits"
  10607. },
  10608. variants = {
  10609. {
  10610. arguments = {},
  10611. returns = {
  10612. {
  10613. name = "limit",
  10614. type = "number",
  10615. description = "The upper limit."
  10616. }
  10617. }
  10618. }
  10619. }
  10620. },
  10621. {
  10622. name = "setAnchor",
  10623. summary = "Set the anchor point of the HingeJoint.",
  10624. description = "Sets a new anchor point for the HingeJoint.",
  10625. key = "HingeJoint:setAnchor",
  10626. module = "lovr.physics",
  10627. variants = {
  10628. {
  10629. arguments = {
  10630. {
  10631. name = "x",
  10632. type = "number",
  10633. description = "The x coordinate of the anchor point, in world coordinates."
  10634. },
  10635. {
  10636. name = "y",
  10637. type = "number",
  10638. description = "The y coordinate of the anchor point, in world coordinates."
  10639. },
  10640. {
  10641. name = "z",
  10642. type = "number",
  10643. description = "The z coordinate of the anchor point, in world coordinates."
  10644. }
  10645. },
  10646. returns = {}
  10647. }
  10648. }
  10649. },
  10650. {
  10651. name = "setAxis",
  10652. summary = "Set the HingeJoint's axis.",
  10653. description = "Sets the axis of the hinge.",
  10654. key = "HingeJoint:setAxis",
  10655. module = "lovr.physics",
  10656. variants = {
  10657. {
  10658. arguments = {
  10659. {
  10660. name = "x",
  10661. type = "number",
  10662. description = "The x component of the axis."
  10663. },
  10664. {
  10665. name = "y",
  10666. type = "number",
  10667. description = "The y component of the axis."
  10668. },
  10669. {
  10670. name = "z",
  10671. type = "number",
  10672. description = "The z component of the axis."
  10673. }
  10674. },
  10675. returns = {}
  10676. }
  10677. }
  10678. },
  10679. {
  10680. name = "setLimits",
  10681. summary = "Set the HingeJoint's angle limits.",
  10682. description = "Sets the upper and lower limits of the hinge angle. These should be between -π and π.",
  10683. key = "HingeJoint:setLimits",
  10684. module = "lovr.physics",
  10685. related = {
  10686. "HingeJoint:getAngle",
  10687. "HingeJoint:getLowerLimit",
  10688. "HingeJoint:setLowerLimit",
  10689. "HingeJoint:getUpperLimit",
  10690. "HingeJoint:setUpperLimit"
  10691. },
  10692. variants = {
  10693. {
  10694. arguments = {
  10695. {
  10696. name = "lower",
  10697. type = "number",
  10698. description = "The lower limit."
  10699. },
  10700. {
  10701. name = "upper",
  10702. type = "number",
  10703. description = "The upper limit."
  10704. }
  10705. },
  10706. returns = {}
  10707. }
  10708. }
  10709. },
  10710. {
  10711. name = "setLowerLimit",
  10712. summary = "Set the HingeJoint's lower angle limit.",
  10713. description = "Sets the lower limit of the hinge angle. This should be greater than -π.",
  10714. key = "HingeJoint:setLowerLimit",
  10715. module = "lovr.physics",
  10716. related = {
  10717. "HingeJoint:getAngle",
  10718. "HingeJoint:getUpperLimit",
  10719. "HingeJoint:setUpperLimit",
  10720. "HingeJoint:getLimits",
  10721. "HingeJoint:setLimits"
  10722. },
  10723. variants = {
  10724. {
  10725. arguments = {
  10726. {
  10727. name = "limit",
  10728. type = "number",
  10729. description = "The lower limit."
  10730. }
  10731. },
  10732. returns = {}
  10733. }
  10734. }
  10735. },
  10736. {
  10737. name = "setUpperLimit",
  10738. summary = "Set the HingeJoint's upper angle limit.",
  10739. description = "Sets the upper limit of the hinge angle. This should be less than π.",
  10740. key = "HingeJoint:setUpperLimit",
  10741. module = "lovr.physics",
  10742. related = {
  10743. "HingeJoint:getAngle",
  10744. "HingeJoint:getLowerLimit",
  10745. "HingeJoint:setLowerLimit",
  10746. "HingeJoint:getLimits",
  10747. "HingeJoint:setLimits"
  10748. },
  10749. variants = {
  10750. {
  10751. arguments = {
  10752. {
  10753. name = "limit",
  10754. type = "number",
  10755. description = "The upper limit."
  10756. }
  10757. },
  10758. returns = {}
  10759. }
  10760. }
  10761. }
  10762. },
  10763. extends = "Joint"
  10764. },
  10765. {
  10766. name = "Joint",
  10767. summary = "Joins two Colliders together.",
  10768. description = "A Joint is a physics object that constrains the movement of two Colliders.",
  10769. key = "Joint",
  10770. module = "lovr.physics",
  10771. methods = {
  10772. {
  10773. name = "destroy",
  10774. summary = "Destroy the Joint.",
  10775. description = "Destroy the Joint, removing it from Colliders it's attached to.",
  10776. key = "Joint:destroy",
  10777. module = "lovr.physics",
  10778. related = {
  10779. "Collider:destroy",
  10780. "Shape:destroy",
  10781. "World:destroy"
  10782. },
  10783. variants = {
  10784. {
  10785. arguments = {},
  10786. returns = {}
  10787. }
  10788. },
  10789. notes = "Calling functions on the Joint after destroying it is a bad idea."
  10790. },
  10791. {
  10792. name = "getColliders",
  10793. summary = "Get the Colliders the Joint is attached to.",
  10794. description = "Returns the Colliders the Joint is attached to. All Joints are attached to two colliders.",
  10795. key = "Joint:getColliders",
  10796. module = "lovr.physics",
  10797. variants = {
  10798. {
  10799. arguments = {},
  10800. returns = {
  10801. {
  10802. name = "colliderA",
  10803. type = "Collider",
  10804. description = "The first Collider."
  10805. },
  10806. {
  10807. name = "colliderB",
  10808. type = "Collider",
  10809. description = "The second Collider."
  10810. }
  10811. }
  10812. }
  10813. }
  10814. },
  10815. {
  10816. name = "getType",
  10817. summary = "Get the type of the Joint.",
  10818. description = "Returns the type of the Joint.",
  10819. key = "Joint:getType",
  10820. module = "lovr.physics",
  10821. related = {
  10822. "JointType"
  10823. },
  10824. variants = {
  10825. {
  10826. arguments = {},
  10827. returns = {
  10828. {
  10829. name = "type",
  10830. type = "JointType",
  10831. description = "The type of the Joint."
  10832. }
  10833. }
  10834. }
  10835. }
  10836. },
  10837. {
  10838. name = "getUserData",
  10839. summary = "Get the Joint's user data.",
  10840. description = "Returns the user data associated with the Joint.",
  10841. key = "Joint:getUserData",
  10842. module = "lovr.physics",
  10843. variants = {
  10844. {
  10845. arguments = {},
  10846. returns = {
  10847. {
  10848. name = "data",
  10849. type = "*",
  10850. description = "The custom value associated with the Joint."
  10851. }
  10852. }
  10853. }
  10854. }
  10855. },
  10856. {
  10857. name = "setUserData",
  10858. summary = "Set the Joint's user data.",
  10859. description = "Sets the user data associated with the Joint.",
  10860. key = "Joint:setUserData",
  10861. module = "lovr.physics",
  10862. variants = {
  10863. {
  10864. arguments = {
  10865. {
  10866. name = "data",
  10867. type = "*",
  10868. description = "The custom value associated with the Joint."
  10869. }
  10870. },
  10871. returns = {}
  10872. }
  10873. }
  10874. }
  10875. },
  10876. constructors = {
  10877. "lovr.physics.newBallJoint",
  10878. "lovr.physics.newDistanceJoint",
  10879. "lovr.physics.newHingeJoint",
  10880. "lovr.physics.newSliderJoint"
  10881. },
  10882. related = {
  10883. "Collider"
  10884. }
  10885. },
  10886. {
  10887. name = "Shape",
  10888. summary = "Defines the shape of Colliders.",
  10889. description = "A Shape is a physics object that can be attached to colliders to define their shape.",
  10890. key = "Shape",
  10891. module = "lovr.physics",
  10892. methods = {
  10893. {
  10894. name = "destroy",
  10895. summary = "Destroy the Shape.",
  10896. description = "Destroy the Shape, removing it from Colliders it's attached to.",
  10897. key = "Shape:destroy",
  10898. module = "lovr.physics",
  10899. related = {
  10900. "Collider:destroy",
  10901. "Joint:destroy",
  10902. "World:destroy"
  10903. },
  10904. variants = {
  10905. {
  10906. arguments = {},
  10907. returns = {}
  10908. }
  10909. },
  10910. notes = "Calling functions on the Shape after destroying it is a bad idea."
  10911. },
  10912. {
  10913. name = "getAABB",
  10914. summary = "Get the Shape's axis aligned bounding box.",
  10915. description = "Returns the bounding box for the Shape.",
  10916. key = "Shape:getAABB",
  10917. module = "lovr.physics",
  10918. related = {
  10919. "Collider:getAABB"
  10920. },
  10921. variants = {
  10922. {
  10923. arguments = {},
  10924. returns = {
  10925. {
  10926. name = "minx",
  10927. type = "number",
  10928. description = "The minimum x coordinate of the box."
  10929. },
  10930. {
  10931. name = "maxx",
  10932. type = "number",
  10933. description = "The maximum x coordinate of the box."
  10934. },
  10935. {
  10936. name = "miny",
  10937. type = "number",
  10938. description = "The minimum y coordinate of the box."
  10939. },
  10940. {
  10941. name = "maxy",
  10942. type = "number",
  10943. description = "The maximum y coordinate of the box."
  10944. },
  10945. {
  10946. name = "minz",
  10947. type = "number",
  10948. description = "The minimum z coordinate of the box."
  10949. },
  10950. {
  10951. name = "maxz",
  10952. type = "number",
  10953. description = "The maximum z coordinate of the box."
  10954. }
  10955. }
  10956. }
  10957. }
  10958. },
  10959. {
  10960. name = "getCollider",
  10961. summary = "Get the Collider the Shape is attached to.",
  10962. description = "Returns the Collider the Shape is attached to.",
  10963. key = "Shape:getCollider",
  10964. module = "lovr.physics",
  10965. related = {
  10966. "Collider",
  10967. "Collider:addShape",
  10968. "Collider:removeShape"
  10969. },
  10970. variants = {
  10971. {
  10972. arguments = {},
  10973. returns = {
  10974. {
  10975. name = "collider",
  10976. type = "Collider",
  10977. description = "The Collider the Shape is attached to."
  10978. }
  10979. }
  10980. }
  10981. },
  10982. notes = "A Shape can only be attached to one Collider at a time."
  10983. },
  10984. {
  10985. name = "getMass",
  10986. summary = "Compute mass properties of the Shape.",
  10987. description = "Computes mass properties of the Shape.",
  10988. key = "Shape:getMass",
  10989. module = "lovr.physics",
  10990. related = {
  10991. "Collider:getMass",
  10992. "Collider:setMass",
  10993. "Collider:getMassData",
  10994. "Collider:setMassData"
  10995. },
  10996. variants = {
  10997. {
  10998. arguments = {
  10999. {
  11000. name = "density",
  11001. type = "number",
  11002. description = "The density to use, in kilograms per cubic meter."
  11003. }
  11004. },
  11005. returns = {
  11006. {
  11007. name = "cx",
  11008. type = "number",
  11009. description = "The x position of the center of mass."
  11010. },
  11011. {
  11012. name = "cy",
  11013. type = "number",
  11014. description = "The y position of the center of mass."
  11015. },
  11016. {
  11017. name = "cz",
  11018. type = "number",
  11019. description = "The z position of the center of mass."
  11020. },
  11021. {
  11022. name = "mass",
  11023. type = "number",
  11024. description = "The mass of the Shape."
  11025. },
  11026. {
  11027. name = "inertia",
  11028. type = "table",
  11029. 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."
  11030. }
  11031. }
  11032. }
  11033. }
  11034. },
  11035. {
  11036. name = "getOrientation",
  11037. summary = "Get the Shape's orientation.",
  11038. description = "Get the orientation of the Shape relative to its Collider.",
  11039. key = "Shape:getOrientation",
  11040. module = "lovr.physics",
  11041. related = {
  11042. "Shape:getPosition",
  11043. "Shape:setPosition"
  11044. },
  11045. variants = {
  11046. {
  11047. arguments = {},
  11048. returns = {
  11049. {
  11050. name = "angle",
  11051. type = "number",
  11052. description = "The number of radians the Shape is rotated."
  11053. },
  11054. {
  11055. name = "ax",
  11056. type = "number",
  11057. description = "The x component of the rotation axis."
  11058. },
  11059. {
  11060. name = "ay",
  11061. type = "number",
  11062. description = "The y component of the rotation axis."
  11063. },
  11064. {
  11065. name = "az",
  11066. type = "number",
  11067. description = "The z component of the rotation axis."
  11068. }
  11069. }
  11070. }
  11071. }
  11072. },
  11073. {
  11074. name = "getPosition",
  11075. summary = "Get the Shape's position.",
  11076. description = "Get the position of the Shape relative to its Collider.",
  11077. key = "Shape:getPosition",
  11078. module = "lovr.physics",
  11079. related = {
  11080. "Shape:getOrientation",
  11081. "Shape:setOrientation"
  11082. },
  11083. variants = {
  11084. {
  11085. arguments = {},
  11086. returns = {
  11087. {
  11088. name = "x",
  11089. type = "number",
  11090. description = "The x offset."
  11091. },
  11092. {
  11093. name = "y",
  11094. type = "number",
  11095. description = "The y offset."
  11096. },
  11097. {
  11098. name = "z",
  11099. type = "number",
  11100. description = "The z offset."
  11101. }
  11102. }
  11103. }
  11104. }
  11105. },
  11106. {
  11107. name = "getType",
  11108. summary = "Get the type of the Shape.",
  11109. description = "Returns the type of the Shape.",
  11110. key = "Shape:getType",
  11111. module = "lovr.physics",
  11112. related = {
  11113. "ShapeType"
  11114. },
  11115. variants = {
  11116. {
  11117. arguments = {},
  11118. returns = {
  11119. {
  11120. name = "type",
  11121. type = "ShapeType",
  11122. description = "The type of the Shape."
  11123. }
  11124. }
  11125. }
  11126. }
  11127. },
  11128. {
  11129. name = "getUserData",
  11130. summary = "Get the Shape's user data.",
  11131. description = "Returns the user data associated with the Shape.",
  11132. key = "Shape:getUserData",
  11133. module = "lovr.physics",
  11134. notes = "User data can be useful to identify the Shape in callbacks.",
  11135. variants = {
  11136. {
  11137. arguments = {},
  11138. returns = {
  11139. {
  11140. name = "data",
  11141. type = "*",
  11142. description = "The custom value associated with the Shape."
  11143. }
  11144. }
  11145. }
  11146. }
  11147. },
  11148. {
  11149. name = "isEnabled",
  11150. summary = "Check if the Shape is enabled.",
  11151. description = "Returns whether the Shape is enabled.",
  11152. key = "Shape:isEnabled",
  11153. module = "lovr.physics",
  11154. notes = "Disabled shapes won't collide with anything.",
  11155. variants = {
  11156. {
  11157. arguments = {},
  11158. returns = {
  11159. {
  11160. name = "enabled",
  11161. type = "boolean",
  11162. description = "Whether the Shape is enabled."
  11163. }
  11164. }
  11165. }
  11166. }
  11167. },
  11168. {
  11169. name = "setEnabled",
  11170. summary = "Enable or disable the Shape.",
  11171. description = "Enable or disable the Shape.",
  11172. key = "Shape:setEnabled",
  11173. module = "lovr.physics",
  11174. notes = "Disabled shapes won't collide with anything.",
  11175. variants = {
  11176. {
  11177. arguments = {
  11178. {
  11179. name = "enabled",
  11180. type = "boolean",
  11181. description = "Whether the Shape should be enabled."
  11182. }
  11183. },
  11184. returns = {}
  11185. }
  11186. }
  11187. },
  11188. {
  11189. name = "setOrientation",
  11190. summary = "Set the Shape's orientation.",
  11191. description = "Set the orientation of the Shape relative to its Collider.",
  11192. key = "Shape:setOrientation",
  11193. module = "lovr.physics",
  11194. related = {
  11195. "Shape:getPosition",
  11196. "Shape:setPosition"
  11197. },
  11198. variants = {
  11199. {
  11200. arguments = {
  11201. {
  11202. name = "angle",
  11203. type = "number",
  11204. description = "The number of radians the Shape is rotated."
  11205. },
  11206. {
  11207. name = "ax",
  11208. type = "number",
  11209. description = "The x component of the rotation axis."
  11210. },
  11211. {
  11212. name = "ay",
  11213. type = "number",
  11214. description = "The y component of the rotation axis."
  11215. },
  11216. {
  11217. name = "az",
  11218. type = "number",
  11219. description = "The z component of the rotation axis."
  11220. }
  11221. },
  11222. returns = {}
  11223. }
  11224. }
  11225. },
  11226. {
  11227. name = "setPosition",
  11228. summary = "Set the Shape's position.",
  11229. description = "Set the position of the Shape relative to its Collider.",
  11230. key = "Shape:setPosition",
  11231. module = "lovr.physics",
  11232. related = {
  11233. "Shape:getOrientation",
  11234. "Shape:setOrientation"
  11235. },
  11236. variants = {
  11237. {
  11238. arguments = {
  11239. {
  11240. name = "x",
  11241. type = "number",
  11242. description = "The x offset."
  11243. },
  11244. {
  11245. name = "y",
  11246. type = "number",
  11247. description = "The y offset."
  11248. },
  11249. {
  11250. name = "z",
  11251. type = "number",
  11252. description = "The z offset."
  11253. }
  11254. },
  11255. returns = {}
  11256. }
  11257. }
  11258. },
  11259. {
  11260. name = "setUserData",
  11261. summary = "Set the Shape's user data.",
  11262. description = "Sets the user data associated with the Shape.",
  11263. key = "Shape:setUserData",
  11264. module = "lovr.physics",
  11265. notes = "User data can be useful to identify the Shape in callbacks.",
  11266. variants = {
  11267. {
  11268. arguments = {
  11269. {
  11270. name = "data",
  11271. type = "*",
  11272. description = "The custom value associated with the Shape."
  11273. }
  11274. },
  11275. returns = {}
  11276. }
  11277. }
  11278. }
  11279. },
  11280. constructors = {
  11281. "lovr.physics.newBoxShape",
  11282. "lovr.physics.newCapsuleShape",
  11283. "lovr.physics.newCylinderShape",
  11284. "lovr.physics.newSphereShape",
  11285. "World:newBoxCollider",
  11286. "World:newCapsuleCollider",
  11287. "World:newCylinderCollider",
  11288. "World:newSphereCollider"
  11289. }
  11290. },
  11291. {
  11292. name = "SliderJoint",
  11293. summary = "A slider joint.",
  11294. description = "A SliderJoint is a type of `Joint` that only allows colliders to move on a single axis.",
  11295. key = "SliderJoint",
  11296. module = "lovr.physics",
  11297. related = {
  11298. "Collider"
  11299. },
  11300. constructors = {
  11301. "lovr.physics.newSliderJoint"
  11302. },
  11303. methods = {
  11304. {
  11305. name = "getAxis",
  11306. summary = "Get the SliderJoint's axis.",
  11307. description = "Returns the axis of the slider.",
  11308. key = "SliderJoint:getAxis",
  11309. module = "lovr.physics",
  11310. variants = {
  11311. {
  11312. arguments = {},
  11313. returns = {
  11314. {
  11315. name = "x",
  11316. type = "number",
  11317. description = "The x component of the axis."
  11318. },
  11319. {
  11320. name = "y",
  11321. type = "number",
  11322. description = "The y component of the axis."
  11323. },
  11324. {
  11325. name = "z",
  11326. type = "number",
  11327. description = "The z component of the axis."
  11328. }
  11329. }
  11330. }
  11331. }
  11332. },
  11333. {
  11334. name = "getLimits",
  11335. summary = "Get the SliderJoint's limits.",
  11336. description = "Returns the upper and lower limits of the slider position.",
  11337. key = "SliderJoint:getLimits",
  11338. module = "lovr.physics",
  11339. related = {
  11340. "SliderJoint:getPosition",
  11341. "SliderJoint:getLowerLimit",
  11342. "SliderJoint:setLowerLimit",
  11343. "SliderJoint:getUpperLimit",
  11344. "SliderJoint:setUpperLimit"
  11345. },
  11346. variants = {
  11347. {
  11348. arguments = {},
  11349. returns = {
  11350. {
  11351. name = "lower",
  11352. type = "number",
  11353. description = "The lower limit."
  11354. },
  11355. {
  11356. name = "upper",
  11357. type = "number",
  11358. description = "The upper limit."
  11359. }
  11360. }
  11361. }
  11362. }
  11363. },
  11364. {
  11365. name = "getLowerLimit",
  11366. summary = "Get the SliderJoint's lower limit.",
  11367. description = "Returns the lower limit of the slider position.",
  11368. key = "SliderJoint:getLowerLimit",
  11369. module = "lovr.physics",
  11370. related = {
  11371. "SliderJoint:getPosition",
  11372. "SliderJoint:getUpperLimit",
  11373. "SliderJoint:setUpperLimit",
  11374. "SliderJoint:getLimits",
  11375. "SliderJoint:setLimits"
  11376. },
  11377. variants = {
  11378. {
  11379. arguments = {},
  11380. returns = {
  11381. {
  11382. name = "limit",
  11383. type = "number",
  11384. description = "The lower limit."
  11385. }
  11386. }
  11387. }
  11388. }
  11389. },
  11390. {
  11391. name = "getUpperLimit",
  11392. summary = "Get the SliderJoint's upper limit.",
  11393. description = "Returns the upper limit of the slider position.",
  11394. key = "SliderJoint:getUpperLimit",
  11395. module = "lovr.physics",
  11396. related = {
  11397. "SliderJoint:getPosition",
  11398. "SliderJoint:getLowerLimit",
  11399. "SliderJoint:setLowerLimit",
  11400. "SliderJoint:getLimits",
  11401. "SliderJoint:setLimits"
  11402. },
  11403. variants = {
  11404. {
  11405. arguments = {},
  11406. returns = {
  11407. {
  11408. name = "limit",
  11409. type = "number",
  11410. description = "The upper limit."
  11411. }
  11412. }
  11413. }
  11414. }
  11415. },
  11416. {
  11417. name = "setAxis",
  11418. summary = "Set the SliderJoint's axis.",
  11419. description = "Sets the axis of the slider.",
  11420. key = "SliderJoint:setAxis",
  11421. module = "lovr.physics",
  11422. variants = {
  11423. {
  11424. arguments = {
  11425. {
  11426. name = "x",
  11427. type = "number",
  11428. description = "The x component of the axis."
  11429. },
  11430. {
  11431. name = "y",
  11432. type = "number",
  11433. description = "The y component of the axis."
  11434. },
  11435. {
  11436. name = "z",
  11437. type = "number",
  11438. description = "The z component of the axis."
  11439. }
  11440. },
  11441. returns = {}
  11442. }
  11443. }
  11444. },
  11445. {
  11446. name = "setLimits",
  11447. summary = "Set the SliderJoint's limits.",
  11448. description = "Sets the upper and lower limits of the slider position.",
  11449. key = "SliderJoint:setLimits",
  11450. module = "lovr.physics",
  11451. related = {
  11452. "SliderJoint:getPosition",
  11453. "SliderJoint:getLowerLimit",
  11454. "SliderJoint:setLowerLimit",
  11455. "SliderJoint:getUpperLimit",
  11456. "SliderJoint:setUpperLimit"
  11457. },
  11458. variants = {
  11459. {
  11460. arguments = {
  11461. {
  11462. name = "lower",
  11463. type = "number",
  11464. description = "The lower limit."
  11465. },
  11466. {
  11467. name = "upper",
  11468. type = "number",
  11469. description = "The upper limit."
  11470. }
  11471. },
  11472. returns = {}
  11473. }
  11474. }
  11475. },
  11476. {
  11477. name = "setLowerLimit",
  11478. summary = "Set the SliderJoint's lower limit.",
  11479. description = "Sets the lower limit of the slider position.",
  11480. key = "SliderJoint:setLowerLimit",
  11481. module = "lovr.physics",
  11482. related = {
  11483. "SliderJoint:getPosition",
  11484. "SliderJoint:getUpperLimit",
  11485. "SliderJoint:setUpperLimit",
  11486. "SliderJoint:getLimits",
  11487. "SliderJoint:setLimits"
  11488. },
  11489. variants = {
  11490. {
  11491. arguments = {
  11492. {
  11493. name = "limit",
  11494. type = "number",
  11495. description = "The lower limit."
  11496. }
  11497. },
  11498. returns = {}
  11499. }
  11500. }
  11501. },
  11502. {
  11503. name = "setUpperLimit",
  11504. summary = "Set the SliderJoint's upper limit.",
  11505. description = "Sets the upper limit of the slider position.",
  11506. key = "SliderJoint:setUpperLimit",
  11507. module = "lovr.physics",
  11508. related = {
  11509. "SliderJoint:getPosition",
  11510. "SliderJoint:getLowerLimit",
  11511. "SliderJoint:setLowerLimit",
  11512. "SliderJoint:getLimits",
  11513. "SliderJoint:setLimits"
  11514. },
  11515. variants = {
  11516. {
  11517. arguments = {
  11518. {
  11519. name = "limit",
  11520. type = "number",
  11521. description = "The upper limit."
  11522. }
  11523. },
  11524. returns = {}
  11525. }
  11526. }
  11527. }
  11528. },
  11529. extends = "Joint"
  11530. },
  11531. {
  11532. name = "SphereShape",
  11533. summary = "A sphere Shape.",
  11534. description = "A type of `Shape` that can be used for spheres.",
  11535. key = "SphereShape",
  11536. module = "lovr.physics",
  11537. extends = "Shape",
  11538. constructors = {
  11539. "lovr.physics.newSphereShape",
  11540. "World:newSphereCollider"
  11541. },
  11542. methods = {
  11543. {
  11544. name = "getDimensions",
  11545. summary = "Get the radius of the SphereShape.",
  11546. description = "Returns the radius of the SphereShape.",
  11547. key = "SphereShape:getDimensions",
  11548. module = "lovr.physics",
  11549. variants = {
  11550. {
  11551. arguments = {},
  11552. returns = {
  11553. {
  11554. name = "radius",
  11555. type = "number",
  11556. description = "The radius of the sphere, in meters."
  11557. }
  11558. }
  11559. }
  11560. }
  11561. },
  11562. {
  11563. name = "setDimensions",
  11564. summary = "Set the radius of the SphereShape.",
  11565. description = "Sets the radius of the SphereShape.",
  11566. key = "SphereShape:setDimensions",
  11567. module = "lovr.physics",
  11568. variants = {
  11569. {
  11570. arguments = {
  11571. {
  11572. name = "radius",
  11573. type = "number",
  11574. description = "The radius of the sphere, in meters."
  11575. }
  11576. },
  11577. returns = {}
  11578. }
  11579. }
  11580. }
  11581. }
  11582. },
  11583. {
  11584. name = "World",
  11585. summary = "An independent physics simulation.",
  11586. description = "A World is an object that holds the colliders, joints, and shapes in a physics simulation.",
  11587. key = "World",
  11588. module = "lovr.physics",
  11589. methods = {
  11590. {
  11591. name = "collide",
  11592. tag = "worldCollision",
  11593. summary = "Attempt to collide two shapes.",
  11594. 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`.",
  11595. key = "World:collide",
  11596. module = "lovr.physics",
  11597. variants = {
  11598. {
  11599. arguments = {
  11600. {
  11601. name = "shapeA",
  11602. type = "Shape",
  11603. description = "The first shape."
  11604. },
  11605. {
  11606. name = "shapeB",
  11607. type = "Shape",
  11608. description = "The second shape."
  11609. },
  11610. {
  11611. name = "friction",
  11612. type = "number",
  11613. description = "The friction parameter for the collision.",
  11614. default = "nil"
  11615. },
  11616. {
  11617. name = "restitution",
  11618. type = "number",
  11619. description = "The restitution (bounciness) parameter for the collision.",
  11620. default = "nil"
  11621. }
  11622. },
  11623. returns = {
  11624. {
  11625. name = "collided",
  11626. type = "boolean",
  11627. description = "Whether the shapes collided."
  11628. }
  11629. }
  11630. }
  11631. },
  11632. related = {
  11633. "World:computeOverlaps",
  11634. "World:overlaps",
  11635. "World:disableCollisionBetween",
  11636. "World:enableCollisionBetween",
  11637. "World:isCollisionEnabledBetween"
  11638. },
  11639. 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."
  11640. },
  11641. {
  11642. name = "computeOverlaps",
  11643. tag = "worldCollision",
  11644. summary = "Compute pairs of shapes that are close to each other.",
  11645. 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`.",
  11646. key = "World:computeOverlaps",
  11647. module = "lovr.physics",
  11648. variants = {
  11649. {
  11650. arguments = {},
  11651. returns = {}
  11652. }
  11653. },
  11654. examples = {
  11655. {
  11656. code = "world:computeOverlaps()\nfor shapeA, shapeB in world:overlaps() do\n local areColliding = world:collide(shapeA, shapeB)\n print(shapeA, shapeB, areColliding)\nend"
  11657. }
  11658. },
  11659. related = {
  11660. "World:overlaps",
  11661. "World:collide",
  11662. "World:update"
  11663. }
  11664. },
  11665. {
  11666. name = "destroy",
  11667. tag = "worldBasics",
  11668. summary = "Destroy the World!! Muahaha!",
  11669. description = "Destroy the World!",
  11670. key = "World:destroy",
  11671. module = "lovr.physics",
  11672. variants = {
  11673. {
  11674. arguments = {},
  11675. returns = {}
  11676. }
  11677. },
  11678. notes = "Bad things will happen if you destroy the world and then try to access it or anything that was in it."
  11679. },
  11680. {
  11681. name = "disableCollisionBetween",
  11682. tag = "worldCollision",
  11683. summary = "Disable collision between two tags.",
  11684. description = "Disables collision between two collison tags.",
  11685. key = "World:disableCollisionBetween",
  11686. module = "lovr.physics",
  11687. variants = {
  11688. {
  11689. arguments = {
  11690. {
  11691. name = "tag1",
  11692. type = "string",
  11693. description = "The first tag."
  11694. },
  11695. {
  11696. name = "tag2",
  11697. type = "string",
  11698. description = "The second tag."
  11699. }
  11700. },
  11701. returns = {}
  11702. }
  11703. },
  11704. related = {
  11705. "lovr.physics.newWorld",
  11706. "World:enableCollisionBetween",
  11707. "World:isCollisionEnabledBetween"
  11708. },
  11709. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags."
  11710. },
  11711. {
  11712. name = "enableCollisionBetween",
  11713. tag = "worldCollision",
  11714. summary = "Enable collision between two tags.",
  11715. description = "Enables collision between two collison tags.",
  11716. key = "World:enableCollisionBetween",
  11717. module = "lovr.physics",
  11718. variants = {
  11719. {
  11720. arguments = {
  11721. {
  11722. name = "tag1",
  11723. type = "string",
  11724. description = "The first tag."
  11725. },
  11726. {
  11727. name = "tag2",
  11728. type = "string",
  11729. description = "The second tag."
  11730. }
  11731. },
  11732. returns = {}
  11733. }
  11734. },
  11735. related = {
  11736. "lovr.physics.newWorld",
  11737. "World:disableCollisionBetween",
  11738. "World:isCollisionEnabledBetween"
  11739. },
  11740. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags."
  11741. },
  11742. {
  11743. name = "getAngularDamping",
  11744. tag = "worldProperties",
  11745. summary = "Get the angular damping of the World.",
  11746. description = "Returns the angular damping of the World. Angular damping makes things less \"spinny\", making them slow down their angular velocity over time.",
  11747. key = "World:getAngularDamping",
  11748. module = "lovr.physics",
  11749. variants = {
  11750. {
  11751. arguments = {},
  11752. returns = {
  11753. {
  11754. name = "damping",
  11755. type = "number",
  11756. description = "The angular damping."
  11757. }
  11758. }
  11759. }
  11760. },
  11761. related = {
  11762. "Collider:getAngularDamping",
  11763. "Collider:setAngularDamping"
  11764. },
  11765. notes = "Angular damping can also be set on individual colliders."
  11766. },
  11767. {
  11768. name = "getGravity",
  11769. tag = "worldProperties",
  11770. summary = "Get the gravity of the World.",
  11771. description = "Returns the gravity of the World.",
  11772. key = "World:getGravity",
  11773. module = "lovr.physics",
  11774. variants = {
  11775. {
  11776. arguments = {},
  11777. returns = {
  11778. {
  11779. name = "xg",
  11780. type = "number",
  11781. description = "The x component of the gravity force."
  11782. },
  11783. {
  11784. name = "yg",
  11785. type = "number",
  11786. description = "The y component of the gravity force."
  11787. },
  11788. {
  11789. name = "zg",
  11790. type = "number",
  11791. description = "The z component of the gravity force."
  11792. }
  11793. }
  11794. }
  11795. }
  11796. },
  11797. {
  11798. name = "getLinearDamping",
  11799. tag = "worldProperties",
  11800. summary = "Get the linear damping of the World.",
  11801. description = "Returns the linear damping of the World. Linear damping is similar to drag or air resistance, slowing down colliders over time as they move.",
  11802. key = "World:getLinearDamping",
  11803. module = "lovr.physics",
  11804. variants = {
  11805. {
  11806. arguments = {},
  11807. returns = {
  11808. {
  11809. name = "damping",
  11810. type = "number",
  11811. description = "The linear damping."
  11812. }
  11813. }
  11814. }
  11815. },
  11816. related = {
  11817. "Collider:getLinearDamping",
  11818. "Collider:setLinearDamping"
  11819. },
  11820. notes = "A linear damping of 0 means colliders won't slow down over time.\n\nLinear damping can also be set on individual colliders."
  11821. },
  11822. {
  11823. name = "isCollisionEnabledBetween",
  11824. tag = "worldCollision",
  11825. summary = "Check if two tags can collide.",
  11826. description = "Returns whether collisions are currently enabled between two tags.",
  11827. key = "World:isCollisionEnabledBetween",
  11828. module = "lovr.physics",
  11829. variants = {
  11830. {
  11831. arguments = {
  11832. {
  11833. name = "tag1",
  11834. type = "string",
  11835. description = "The first tag."
  11836. },
  11837. {
  11838. name = "tag2",
  11839. type = "string",
  11840. description = "The second tag."
  11841. }
  11842. },
  11843. returns = {
  11844. {
  11845. name = "enabled",
  11846. type = "boolean",
  11847. description = "Whether or not two colliders with the specified tags will collide."
  11848. }
  11849. }
  11850. }
  11851. },
  11852. related = {
  11853. "lovr.physics.newWorld",
  11854. "World:disableCollisionBetween",
  11855. "World:enableCollisionBetween"
  11856. },
  11857. notes = "Tags must be set up when creating the World, see `lovr.physics.newWorld`.\n\nBy default, collision is enabled between all tags."
  11858. },
  11859. {
  11860. name = "isSleepingAllowed",
  11861. tag = "worldProperties",
  11862. summary = "Check if colliders can go to sleep.",
  11863. description = "Returns whether colliders can go to sleep in the World.",
  11864. key = "World:isSleepingAllowed",
  11865. module = "lovr.physics",
  11866. variants = {
  11867. {
  11868. arguments = {},
  11869. returns = {
  11870. {
  11871. name = "allowed",
  11872. type = "boolean",
  11873. description = "Whether colliders can sleep."
  11874. }
  11875. }
  11876. }
  11877. },
  11878. related = {
  11879. "Collider:isSleepingAllowed",
  11880. "Collider:setSleepingAllowed",
  11881. "Collider:isAwake",
  11882. "Collider:setAwake"
  11883. },
  11884. 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`."
  11885. },
  11886. {
  11887. name = "newBoxCollider",
  11888. tag = "colliders",
  11889. summary = "Add a Collider with a BoxShape to the World.",
  11890. description = "Adds a new Collider to the World with a BoxShape already attached.",
  11891. key = "World:newBoxCollider",
  11892. module = "lovr.physics",
  11893. related = {
  11894. "BoxShape",
  11895. "Collider",
  11896. "World:newCollider",
  11897. "World:newCapsuleCollider",
  11898. "World:newCylinderCollider",
  11899. "World:newSphereCollider"
  11900. },
  11901. variants = {
  11902. {
  11903. arguments = {
  11904. {
  11905. name = "x",
  11906. type = "number",
  11907. description = "The x coordinate of the center of the box.",
  11908. default = "0"
  11909. },
  11910. {
  11911. name = "y",
  11912. type = "number",
  11913. description = "The y coordinate of the center of the box.",
  11914. default = "0"
  11915. },
  11916. {
  11917. name = "z",
  11918. type = "number",
  11919. description = "The z coordinate of the center of the box.",
  11920. default = "0"
  11921. },
  11922. {
  11923. name = "width",
  11924. type = "number",
  11925. description = "The total width of the box, in meters.",
  11926. default = "1"
  11927. },
  11928. {
  11929. name = "height",
  11930. type = "number",
  11931. description = "The total height of the box, in meters.",
  11932. default = "width"
  11933. },
  11934. {
  11935. name = "depth",
  11936. type = "number",
  11937. description = "The total depth of the box, in meters.",
  11938. default = "width"
  11939. }
  11940. },
  11941. returns = {
  11942. {
  11943. name = "collider",
  11944. type = "Collider",
  11945. description = "The new Collider."
  11946. }
  11947. }
  11948. }
  11949. }
  11950. },
  11951. {
  11952. name = "newCapsuleCollider",
  11953. tag = "colliders",
  11954. summary = "Add a Collider with a CapsuleShape to the World.",
  11955. description = "Adds a new Collider to the World with a CapsuleShape already attached.",
  11956. key = "World:newCapsuleCollider",
  11957. module = "lovr.physics",
  11958. related = {
  11959. "CapsuleShape",
  11960. "Collider",
  11961. "World:newCollider",
  11962. "World:newBoxCollider",
  11963. "World:newCylinderCollider",
  11964. "World:newSphereCollider"
  11965. },
  11966. variants = {
  11967. {
  11968. arguments = {
  11969. {
  11970. name = "x",
  11971. type = "number",
  11972. description = "The x coordinate of the center of the capsule.",
  11973. default = "0"
  11974. },
  11975. {
  11976. name = "y",
  11977. type = "number",
  11978. description = "The y coordinate of the center of the capsule.",
  11979. default = "0"
  11980. },
  11981. {
  11982. name = "z",
  11983. type = "number",
  11984. description = "The z coordinate of the center of the capsule.",
  11985. default = "0"
  11986. },
  11987. {
  11988. name = "radius",
  11989. type = "number",
  11990. description = "The radius of the capsule, in meters.",
  11991. default = "1"
  11992. },
  11993. {
  11994. name = "length",
  11995. type = "number",
  11996. description = "The length of the capsule, not including the caps, in meters.",
  11997. default = "1"
  11998. }
  11999. },
  12000. returns = {
  12001. {
  12002. name = "collider",
  12003. type = "Collider",
  12004. description = "The new Collider."
  12005. }
  12006. }
  12007. }
  12008. }
  12009. },
  12010. {
  12011. name = "newCollider",
  12012. tag = "colliders",
  12013. summary = "Add a Collider to the World.",
  12014. description = "Adds a new Collider to the World.",
  12015. key = "World:newCollider",
  12016. module = "lovr.physics",
  12017. variants = {
  12018. {
  12019. arguments = {
  12020. {
  12021. name = "x",
  12022. type = "number",
  12023. description = "The x position of the Collider.",
  12024. default = "0"
  12025. },
  12026. {
  12027. name = "y",
  12028. type = "number",
  12029. description = "The y position of the Collider.",
  12030. default = "0"
  12031. },
  12032. {
  12033. name = "z",
  12034. type = "number",
  12035. description = "The z position of the Collider.",
  12036. default = "0"
  12037. }
  12038. },
  12039. returns = {
  12040. {
  12041. name = "collider",
  12042. type = "Collider",
  12043. description = "The new Collider."
  12044. }
  12045. }
  12046. }
  12047. },
  12048. related = {
  12049. "World:newBoxCollider",
  12050. "World:newCapsuleCollider",
  12051. "World:newCylinderCollider",
  12052. "World:newSphereCollider",
  12053. "Collider",
  12054. "Shape"
  12055. },
  12056. examples = {
  12057. {
  12058. description = "Create a new world, add a collider to it, and update it, printing out the collider's position as it falls.",
  12059. 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"
  12060. }
  12061. },
  12062. 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`"
  12063. },
  12064. {
  12065. name = "newCylinderCollider",
  12066. tag = "colliders",
  12067. summary = "Add a Collider with a CylinderShape to the World.",
  12068. description = "Adds a new Collider to the World with a CylinderShape already attached.",
  12069. key = "World:newCylinderCollider",
  12070. module = "lovr.physics",
  12071. related = {
  12072. "CylinderShape",
  12073. "Collider",
  12074. "World:newCollider",
  12075. "World:newBoxCollider",
  12076. "World:newCapsuleCollider",
  12077. "World:newSphereCollider"
  12078. },
  12079. variants = {
  12080. {
  12081. arguments = {
  12082. {
  12083. name = "x",
  12084. type = "number",
  12085. description = "The x coordinate of the center of the cylinder.",
  12086. default = "0"
  12087. },
  12088. {
  12089. name = "y",
  12090. type = "number",
  12091. description = "The y coordinate of the center of the cylinder.",
  12092. default = "0"
  12093. },
  12094. {
  12095. name = "z",
  12096. type = "number",
  12097. description = "The z coordinate of the center of the cylinder.",
  12098. default = "0"
  12099. },
  12100. {
  12101. name = "radius",
  12102. type = "number",
  12103. description = "The radius of the cylinder, in meters.",
  12104. default = "1"
  12105. },
  12106. {
  12107. name = "length",
  12108. type = "number",
  12109. description = "The length of the cylinder, in meters.",
  12110. default = "1"
  12111. }
  12112. },
  12113. returns = {
  12114. {
  12115. name = "collider",
  12116. type = "Collider",
  12117. description = "The new Collider."
  12118. }
  12119. }
  12120. }
  12121. }
  12122. },
  12123. {
  12124. name = "newSphereCollider",
  12125. tag = "colliders",
  12126. summary = "Add a Collider with a SphereShape to the World.",
  12127. description = "Adds a new Collider to the World with a SphereShape already attached.",
  12128. key = "World:newSphereCollider",
  12129. module = "lovr.physics",
  12130. related = {
  12131. "SphereShape",
  12132. "Collider",
  12133. "World:newCollider",
  12134. "World:newBoxCollider",
  12135. "World:newCapsuleCollider",
  12136. "World:newCylinderCollider"
  12137. },
  12138. variants = {
  12139. {
  12140. arguments = {
  12141. {
  12142. name = "x",
  12143. type = "number",
  12144. description = "The x coordinate of the center of the sphere.",
  12145. default = "0"
  12146. },
  12147. {
  12148. name = "y",
  12149. type = "number",
  12150. description = "The y coordinate of the center of the sphere.",
  12151. default = "0"
  12152. },
  12153. {
  12154. name = "z",
  12155. type = "number",
  12156. description = "The z coordinate of the center of the sphere.",
  12157. default = "0"
  12158. },
  12159. {
  12160. name = "radius",
  12161. type = "number",
  12162. description = "The radius of the sphere, in meters.",
  12163. default = "1"
  12164. }
  12165. },
  12166. returns = {
  12167. {
  12168. name = "collider",
  12169. type = "Collider",
  12170. description = "The new Collider."
  12171. }
  12172. }
  12173. }
  12174. }
  12175. },
  12176. {
  12177. name = "overlaps",
  12178. tag = "worldCollision",
  12179. summary = "Iterate over pairs of nearby shapes.",
  12180. 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:detectOverlaps` to compute the list of overlaps. Usually this is called automatically by `World:update`.",
  12181. key = "World:overlaps",
  12182. module = "lovr.physics",
  12183. variants = {
  12184. {
  12185. arguments = {},
  12186. returns = {
  12187. {
  12188. name = "iterator",
  12189. type = "function",
  12190. description = "A Lua iterator, usable in a for loop.",
  12191. arguments = {},
  12192. returns = {}
  12193. }
  12194. }
  12195. }
  12196. },
  12197. examples = {
  12198. {
  12199. code = "world:computeOverlaps()\nfor shapeA, shapeB in world:overlaps() do\n local areColliding = world:collide(shapeA, shapeB)\n print(shapeA, shapeB, areColliding)\nend"
  12200. }
  12201. },
  12202. related = {
  12203. "World:computeOverlaps",
  12204. "World:collide",
  12205. "World:update"
  12206. }
  12207. },
  12208. {
  12209. name = "raycast",
  12210. tag = "worldBasics",
  12211. summary = "Cast a ray through the World.",
  12212. description = "Casts a ray through the World, calling a function every time the ray intersects with a Shape.",
  12213. key = "World:raycast",
  12214. module = "lovr.physics",
  12215. notes = "The callback is passed the shape that was hit, the hit position, and the normal vector of the hit.",
  12216. variants = {
  12217. {
  12218. arguments = {
  12219. {
  12220. name = "x1",
  12221. type = "number",
  12222. description = "The x coordinate of the starting position of the ray."
  12223. },
  12224. {
  12225. name = "y1",
  12226. type = "number",
  12227. description = "The y coordinate of the starting position of the ray."
  12228. },
  12229. {
  12230. name = "z1",
  12231. type = "number",
  12232. description = "The z coordinate of the starting position of the ray."
  12233. },
  12234. {
  12235. name = "x2",
  12236. type = "number",
  12237. description = "The x coordinate of the ending position of the ray."
  12238. },
  12239. {
  12240. name = "y2",
  12241. type = "number",
  12242. description = "The y coordinate of the ending position of the ray."
  12243. },
  12244. {
  12245. name = "z2",
  12246. type = "number",
  12247. description = "The z coordinate of the ending position of the ray."
  12248. },
  12249. {
  12250. name = "callback",
  12251. type = "function",
  12252. description = "The function to call when an intersection is detected.",
  12253. arguments = {
  12254. {
  12255. name = "shape",
  12256. type = "Shape"
  12257. },
  12258. {
  12259. name = "x",
  12260. type = "number"
  12261. },
  12262. {
  12263. name = "y",
  12264. type = "number"
  12265. },
  12266. {
  12267. name = "z",
  12268. type = "number"
  12269. },
  12270. {
  12271. name = "nx",
  12272. type = "number"
  12273. },
  12274. {
  12275. name = "ny",
  12276. type = "number"
  12277. },
  12278. {
  12279. name = "nz",
  12280. type = "number"
  12281. }
  12282. },
  12283. returns = {}
  12284. }
  12285. },
  12286. returns = {}
  12287. }
  12288. },
  12289. examples = {
  12290. {
  12291. 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"
  12292. }
  12293. }
  12294. },
  12295. {
  12296. name = "setAngularDamping",
  12297. tag = "worldProperties",
  12298. summary = "Set the angular damping of the World.",
  12299. description = "Sets the angular damping of the World. Angular damping makes things less \"spinny\", making them slow down their angular velocity over time.",
  12300. key = "World:setAngularDamping",
  12301. module = "lovr.physics",
  12302. variants = {
  12303. {
  12304. arguments = {
  12305. {
  12306. name = "damping",
  12307. type = "number",
  12308. description = "The angular damping."
  12309. }
  12310. },
  12311. returns = {}
  12312. }
  12313. },
  12314. related = {
  12315. "Collider:getAngularDamping",
  12316. "Collider:setAngularDamping"
  12317. },
  12318. notes = "Angular damping can also be set on individual colliders."
  12319. },
  12320. {
  12321. name = "setGravity",
  12322. tag = "worldProperties",
  12323. summary = "Set the gravity of the World.",
  12324. description = "Sets the gravity of the World.",
  12325. key = "World:setGravity",
  12326. module = "lovr.physics",
  12327. variants = {
  12328. {
  12329. arguments = {
  12330. {
  12331. name = "xg",
  12332. type = "number",
  12333. description = "The x component of the gravity force."
  12334. },
  12335. {
  12336. name = "yg",
  12337. type = "number",
  12338. description = "The y component of the gravity force."
  12339. },
  12340. {
  12341. name = "zg",
  12342. type = "number",
  12343. description = "The z component of the gravity force."
  12344. }
  12345. },
  12346. returns = {}
  12347. }
  12348. }
  12349. },
  12350. {
  12351. name = "setLinearDamping",
  12352. tag = "worldProperties",
  12353. summary = "Set the linear damping of the World.",
  12354. 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.",
  12355. key = "World:setLinearDamping",
  12356. module = "lovr.physics",
  12357. variants = {
  12358. {
  12359. arguments = {
  12360. {
  12361. name = "damping",
  12362. type = "number",
  12363. description = "The linear damping."
  12364. }
  12365. },
  12366. returns = {}
  12367. }
  12368. },
  12369. related = {
  12370. "Collider:getLinearDamping",
  12371. "Collider:setLinearDamping"
  12372. },
  12373. notes = "A linear damping of 0 means colliders won't slow down over time.\n\nLinear damping can also be set on individual colliders."
  12374. },
  12375. {
  12376. name = "setSleepingAllowed",
  12377. tag = "worldProperties",
  12378. summary = "Set whether colliders can go to sleep.",
  12379. description = "Sets whether colliders can go to sleep in the World.",
  12380. key = "World:setSleepingAllowed",
  12381. module = "lovr.physics",
  12382. variants = {
  12383. {
  12384. arguments = {
  12385. {
  12386. name = "allowed",
  12387. type = "boolean",
  12388. description = "Whether colliders can sleep."
  12389. }
  12390. },
  12391. returns = {}
  12392. }
  12393. },
  12394. related = {
  12395. "Collider:isSleepingAllowed",
  12396. "Collider:setSleepingAllowed",
  12397. "Collider:isAwake",
  12398. "Collider:setAwake"
  12399. },
  12400. 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`."
  12401. },
  12402. {
  12403. name = "update",
  12404. tag = "worldBasics",
  12405. summary = "Update the World.",
  12406. description = "Updates the World, advancing the physics simulation forward in time and resolving collisions between colliders in the World.",
  12407. key = "World:update",
  12408. module = "lovr.physics",
  12409. variants = {
  12410. {
  12411. arguments = {
  12412. {
  12413. name = "dt",
  12414. type = "number",
  12415. description = "The amount of time to advance the simultion forward."
  12416. },
  12417. {
  12418. name = "resolver",
  12419. type = "function",
  12420. 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.",
  12421. arguments = {
  12422. {
  12423. name = "world",
  12424. type = "World"
  12425. }
  12426. },
  12427. returns = {},
  12428. default = "nil"
  12429. }
  12430. },
  12431. returns = {}
  12432. }
  12433. },
  12434. related = {
  12435. "World:computeOverlaps",
  12436. "World:overlaps",
  12437. "World:collide"
  12438. },
  12439. 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/)."
  12440. }
  12441. },
  12442. sections = {
  12443. {
  12444. name = "Basics",
  12445. tag = "worldBasics"
  12446. },
  12447. {
  12448. name = "Colliders",
  12449. tag = "colliders",
  12450. 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."
  12451. },
  12452. {
  12453. name = "Properties",
  12454. tag = "worldProperties",
  12455. description = "The following functions are global properties of the simulation that apply to all new Colliders."
  12456. },
  12457. {
  12458. name = "Collision",
  12459. tag = "worldCollision",
  12460. 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."
  12461. }
  12462. },
  12463. notes = "Be sure to update the World in `lovr.update` using `World:update`, otherwise everything will stand still.",
  12464. constructors = {
  12465. "lovr.physics.newWorld"
  12466. }
  12467. }
  12468. }
  12469. },
  12470. {
  12471. name = "timer",
  12472. tag = "modules",
  12473. summary = "Exposes a high resolution timer.",
  12474. description = "The `lovr.timer` module provides a few functions that deal with time. All times are measured in seconds.",
  12475. key = "lovr.timer",
  12476. functions = {
  12477. {
  12478. name = "getAverageDelta",
  12479. summary = "Get the average delta over the last second.",
  12480. description = "Returns the average delta over the last second.",
  12481. key = "lovr.timer.getAverageDelta",
  12482. module = "lovr.timer",
  12483. related = {
  12484. "lovr.timer.getDelta",
  12485. "lovr.update"
  12486. },
  12487. variants = {
  12488. {
  12489. arguments = {},
  12490. returns = {
  12491. {
  12492. name = "delta",
  12493. type = "number",
  12494. description = "The average delta, in seconds."
  12495. }
  12496. }
  12497. }
  12498. }
  12499. },
  12500. {
  12501. name = "getDelta",
  12502. summary = "Get the time elapsed since the last update.",
  12503. description = "Returns the time between the last two frames. This is the same value as the `dt` argument provided to `lovr.update`.",
  12504. key = "lovr.timer.getDelta",
  12505. module = "lovr.timer",
  12506. related = {
  12507. "lovr.timer.getTime",
  12508. "lovr.update"
  12509. },
  12510. variants = {
  12511. {
  12512. arguments = {},
  12513. returns = {
  12514. {
  12515. name = "dt",
  12516. type = "number",
  12517. description = "The delta time, in seconds."
  12518. }
  12519. }
  12520. }
  12521. },
  12522. 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."
  12523. },
  12524. {
  12525. name = "getFPS",
  12526. summary = "Get the current frames per second.",
  12527. description = "Returns the current frames per second, averaged over the last 60 frames.",
  12528. key = "lovr.timer.getFPS",
  12529. module = "lovr.timer",
  12530. variants = {
  12531. {
  12532. arguments = {},
  12533. returns = {
  12534. {
  12535. name = "fps",
  12536. type = "number",
  12537. description = "The current FPS."
  12538. }
  12539. }
  12540. }
  12541. }
  12542. },
  12543. {
  12544. name = "getTime",
  12545. summary = "Get the current time.",
  12546. description = "Returns the time since some time in the past. This can be used to measure the difference between two points in time.",
  12547. key = "lovr.timer.getTime",
  12548. module = "lovr.timer",
  12549. variants = {
  12550. {
  12551. arguments = {},
  12552. returns = {
  12553. {
  12554. name = "time",
  12555. type = "number",
  12556. description = "The current time, in seconds."
  12557. }
  12558. }
  12559. }
  12560. }
  12561. },
  12562. {
  12563. name = "sleep",
  12564. summary = "Go to sleep.",
  12565. 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.",
  12566. key = "lovr.timer.sleep",
  12567. module = "lovr.timer",
  12568. variants = {
  12569. {
  12570. arguments = {
  12571. {
  12572. name = "duration",
  12573. type = "number",
  12574. description = "The number of seconds to sleep for."
  12575. }
  12576. },
  12577. returns = {}
  12578. }
  12579. }
  12580. },
  12581. {
  12582. name = "step",
  12583. summary = "Steps the internal clock.",
  12584. description = "Steps the timer, returning the new delta time. This is called automatically in `lovr.step` and it's used to calculate the new `dt` to pass to `lovr.update`.",
  12585. key = "lovr.timer.step",
  12586. module = "lovr.timer",
  12587. variants = {
  12588. {
  12589. arguments = {},
  12590. returns = {
  12591. {
  12592. name = "delta",
  12593. type = "number",
  12594. description = "The amount of time since the last call to this function, in seconds."
  12595. }
  12596. }
  12597. }
  12598. }
  12599. }
  12600. },
  12601. enums = {},
  12602. objects = {}
  12603. }
  12604. }
  12605. }