Math.cpp 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753
  1. // Copyright (C) 2009-2023, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // WARNING: This file is auto generated.
  6. #include <AnKi/Script/LuaBinder.h>
  7. #include <AnKi/Math.h>
  8. namespace anki {
  9. /// Serialize Vec2
  10. static void serializeVec2(LuaUserData& self, void* data, PtrSize& size)
  11. {
  12. Vec2* obj = self.getData<Vec2>();
  13. obj->serialize(data, size);
  14. }
  15. /// De-serialize Vec2
  16. static void deserializeVec2(const void* data, LuaUserData& self)
  17. {
  18. ANKI_ASSERT(data);
  19. Vec2* obj = self.getData<Vec2>();
  20. ::new(obj) Vec2();
  21. obj->deserialize(data);
  22. }
  23. LuaUserDataTypeInfo luaUserDataTypeInfoVec2 = {594303304060146034, "Vec2", LuaUserData::computeSizeForGarbageCollected<Vec2>(), serializeVec2,
  24. deserializeVec2};
  25. template<>
  26. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Vec2>()
  27. {
  28. return luaUserDataTypeInfoVec2;
  29. }
  30. /// Pre-wrap constructor for Vec2.
  31. static inline int pwrapVec2Ctor0(lua_State* l)
  32. {
  33. [[maybe_unused]] LuaUserData* ud;
  34. [[maybe_unused]] void* voidp;
  35. [[maybe_unused]] PtrSize size;
  36. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  37. {
  38. return -1;
  39. }
  40. // Create user data
  41. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  42. voidp = lua_newuserdata(l, size);
  43. luaL_setmetatable(l, luaUserDataTypeInfoVec2.m_typeName);
  44. ud = static_cast<LuaUserData*>(voidp);
  45. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  46. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  47. ::new(ud->getData<Vec2>()) Vec2();
  48. return 1;
  49. }
  50. /// Pre-wrap constructor for Vec2.
  51. static inline int pwrapVec2Ctor1(lua_State* l)
  52. {
  53. [[maybe_unused]] LuaUserData* ud;
  54. [[maybe_unused]] void* voidp;
  55. [[maybe_unused]] PtrSize size;
  56. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  57. {
  58. return -1;
  59. }
  60. // Pop arguments
  61. F32 arg0;
  62. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  63. {
  64. return -1;
  65. }
  66. F32 arg1;
  67. if(LuaBinder::checkNumber(l, 2, arg1)) [[unlikely]]
  68. {
  69. return -1;
  70. }
  71. // Create user data
  72. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  73. voidp = lua_newuserdata(l, size);
  74. luaL_setmetatable(l, luaUserDataTypeInfoVec2.m_typeName);
  75. ud = static_cast<LuaUserData*>(voidp);
  76. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  77. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  78. ::new(ud->getData<Vec2>()) Vec2(arg0, arg1);
  79. return 1;
  80. }
  81. /// Wrap constructors for Vec2.
  82. static int wrapVec2Ctor(lua_State* l)
  83. {
  84. // Chose the right overload
  85. const int argCount = lua_gettop(l);
  86. int res = 0;
  87. switch(argCount)
  88. {
  89. case 0:
  90. res = pwrapVec2Ctor0(l);
  91. break;
  92. case 2:
  93. res = pwrapVec2Ctor1(l);
  94. break;
  95. default:
  96. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  97. res = -1;
  98. }
  99. if(res >= 0)
  100. {
  101. return res;
  102. }
  103. lua_error(l);
  104. return 0;
  105. }
  106. /// Wrap destructor for Vec2.
  107. static int wrapVec2Dtor(lua_State* l)
  108. {
  109. [[maybe_unused]] LuaUserData* ud;
  110. [[maybe_unused]] void* voidp;
  111. [[maybe_unused]] PtrSize size;
  112. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  113. {
  114. return -1;
  115. }
  116. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  117. {
  118. return -1;
  119. }
  120. if(ud->isGarbageCollected())
  121. {
  122. Vec2* inst = ud->getData<Vec2>();
  123. inst->~Vec2();
  124. }
  125. return 0;
  126. }
  127. /// Pre-wrap method Vec2::getX.
  128. static inline int pwrapVec2getX(lua_State* l)
  129. {
  130. [[maybe_unused]] LuaUserData* ud;
  131. [[maybe_unused]] void* voidp;
  132. [[maybe_unused]] PtrSize size;
  133. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  134. {
  135. return -1;
  136. }
  137. // Get "this" as "self"
  138. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  139. {
  140. return -1;
  141. }
  142. Vec2* self = ud->getData<Vec2>();
  143. // Call the method
  144. F32 ret = (*self).x();
  145. // Push return value
  146. lua_pushnumber(l, lua_Number(ret));
  147. return 1;
  148. }
  149. /// Wrap method Vec2::getX.
  150. static int wrapVec2getX(lua_State* l)
  151. {
  152. int res = pwrapVec2getX(l);
  153. if(res >= 0)
  154. {
  155. return res;
  156. }
  157. lua_error(l);
  158. return 0;
  159. }
  160. /// Pre-wrap method Vec2::getY.
  161. static inline int pwrapVec2getY(lua_State* l)
  162. {
  163. [[maybe_unused]] LuaUserData* ud;
  164. [[maybe_unused]] void* voidp;
  165. [[maybe_unused]] PtrSize size;
  166. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  167. {
  168. return -1;
  169. }
  170. // Get "this" as "self"
  171. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  172. {
  173. return -1;
  174. }
  175. Vec2* self = ud->getData<Vec2>();
  176. // Call the method
  177. F32 ret = (*self).y();
  178. // Push return value
  179. lua_pushnumber(l, lua_Number(ret));
  180. return 1;
  181. }
  182. /// Wrap method Vec2::getY.
  183. static int wrapVec2getY(lua_State* l)
  184. {
  185. int res = pwrapVec2getY(l);
  186. if(res >= 0)
  187. {
  188. return res;
  189. }
  190. lua_error(l);
  191. return 0;
  192. }
  193. /// Pre-wrap method Vec2::setX.
  194. static inline int pwrapVec2setX(lua_State* l)
  195. {
  196. [[maybe_unused]] LuaUserData* ud;
  197. [[maybe_unused]] void* voidp;
  198. [[maybe_unused]] PtrSize size;
  199. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  200. {
  201. return -1;
  202. }
  203. // Get "this" as "self"
  204. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  205. {
  206. return -1;
  207. }
  208. Vec2* self = ud->getData<Vec2>();
  209. // Pop arguments
  210. F32 arg0;
  211. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  212. {
  213. return -1;
  214. }
  215. // Call the method
  216. (*self).x() = arg0;
  217. return 0;
  218. }
  219. /// Wrap method Vec2::setX.
  220. static int wrapVec2setX(lua_State* l)
  221. {
  222. int res = pwrapVec2setX(l);
  223. if(res >= 0)
  224. {
  225. return res;
  226. }
  227. lua_error(l);
  228. return 0;
  229. }
  230. /// Pre-wrap method Vec2::setY.
  231. static inline int pwrapVec2setY(lua_State* l)
  232. {
  233. [[maybe_unused]] LuaUserData* ud;
  234. [[maybe_unused]] void* voidp;
  235. [[maybe_unused]] PtrSize size;
  236. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  237. {
  238. return -1;
  239. }
  240. // Get "this" as "self"
  241. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  242. {
  243. return -1;
  244. }
  245. Vec2* self = ud->getData<Vec2>();
  246. // Pop arguments
  247. F32 arg0;
  248. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  249. {
  250. return -1;
  251. }
  252. // Call the method
  253. (*self).y() = arg0;
  254. return 0;
  255. }
  256. /// Wrap method Vec2::setY.
  257. static int wrapVec2setY(lua_State* l)
  258. {
  259. int res = pwrapVec2setY(l);
  260. if(res >= 0)
  261. {
  262. return res;
  263. }
  264. lua_error(l);
  265. return 0;
  266. }
  267. /// Pre-wrap method Vec2::setAll.
  268. static inline int pwrapVec2setAll(lua_State* l)
  269. {
  270. [[maybe_unused]] LuaUserData* ud;
  271. [[maybe_unused]] void* voidp;
  272. [[maybe_unused]] PtrSize size;
  273. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  274. {
  275. return -1;
  276. }
  277. // Get "this" as "self"
  278. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  279. {
  280. return -1;
  281. }
  282. Vec2* self = ud->getData<Vec2>();
  283. // Pop arguments
  284. F32 arg0;
  285. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  286. {
  287. return -1;
  288. }
  289. F32 arg1;
  290. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  291. {
  292. return -1;
  293. }
  294. // Call the method
  295. (*self) = Vec2(arg0, arg1);
  296. return 0;
  297. }
  298. /// Wrap method Vec2::setAll.
  299. static int wrapVec2setAll(lua_State* l)
  300. {
  301. int res = pwrapVec2setAll(l);
  302. if(res >= 0)
  303. {
  304. return res;
  305. }
  306. lua_error(l);
  307. return 0;
  308. }
  309. /// Pre-wrap method Vec2::getAt.
  310. static inline int pwrapVec2getAt(lua_State* l)
  311. {
  312. [[maybe_unused]] LuaUserData* ud;
  313. [[maybe_unused]] void* voidp;
  314. [[maybe_unused]] PtrSize size;
  315. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  316. {
  317. return -1;
  318. }
  319. // Get "this" as "self"
  320. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  321. {
  322. return -1;
  323. }
  324. Vec2* self = ud->getData<Vec2>();
  325. // Pop arguments
  326. U arg0;
  327. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  328. {
  329. return -1;
  330. }
  331. // Call the method
  332. F32 ret = (*self)[arg0];
  333. // Push return value
  334. lua_pushnumber(l, lua_Number(ret));
  335. return 1;
  336. }
  337. /// Wrap method Vec2::getAt.
  338. static int wrapVec2getAt(lua_State* l)
  339. {
  340. int res = pwrapVec2getAt(l);
  341. if(res >= 0)
  342. {
  343. return res;
  344. }
  345. lua_error(l);
  346. return 0;
  347. }
  348. /// Pre-wrap method Vec2::setAt.
  349. static inline int pwrapVec2setAt(lua_State* l)
  350. {
  351. [[maybe_unused]] LuaUserData* ud;
  352. [[maybe_unused]] void* voidp;
  353. [[maybe_unused]] PtrSize size;
  354. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  355. {
  356. return -1;
  357. }
  358. // Get "this" as "self"
  359. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  360. {
  361. return -1;
  362. }
  363. Vec2* self = ud->getData<Vec2>();
  364. // Pop arguments
  365. U arg0;
  366. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  367. {
  368. return -1;
  369. }
  370. F32 arg1;
  371. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  372. {
  373. return -1;
  374. }
  375. // Call the method
  376. (*self)[arg0] = arg1;
  377. return 0;
  378. }
  379. /// Wrap method Vec2::setAt.
  380. static int wrapVec2setAt(lua_State* l)
  381. {
  382. int res = pwrapVec2setAt(l);
  383. if(res >= 0)
  384. {
  385. return res;
  386. }
  387. lua_error(l);
  388. return 0;
  389. }
  390. /// Pre-wrap method Vec2::operator=.
  391. static inline int pwrapVec2copy(lua_State* l)
  392. {
  393. [[maybe_unused]] LuaUserData* ud;
  394. [[maybe_unused]] void* voidp;
  395. [[maybe_unused]] PtrSize size;
  396. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  397. {
  398. return -1;
  399. }
  400. // Get "this" as "self"
  401. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  402. {
  403. return -1;
  404. }
  405. Vec2* self = ud->getData<Vec2>();
  406. // Pop arguments
  407. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  408. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  409. {
  410. return -1;
  411. }
  412. Vec2* iarg0 = ud->getData<Vec2>();
  413. const Vec2& arg0(*iarg0);
  414. // Call the method
  415. self->operator=(arg0);
  416. return 0;
  417. }
  418. /// Wrap method Vec2::operator=.
  419. static int wrapVec2copy(lua_State* l)
  420. {
  421. int res = pwrapVec2copy(l);
  422. if(res >= 0)
  423. {
  424. return res;
  425. }
  426. lua_error(l);
  427. return 0;
  428. }
  429. /// Pre-wrap method Vec2::operator+.
  430. static inline int pwrapVec2__add(lua_State* l)
  431. {
  432. [[maybe_unused]] LuaUserData* ud;
  433. [[maybe_unused]] void* voidp;
  434. [[maybe_unused]] PtrSize size;
  435. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  436. {
  437. return -1;
  438. }
  439. // Get "this" as "self"
  440. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  441. {
  442. return -1;
  443. }
  444. Vec2* self = ud->getData<Vec2>();
  445. // Pop arguments
  446. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  447. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  448. {
  449. return -1;
  450. }
  451. Vec2* iarg0 = ud->getData<Vec2>();
  452. const Vec2& arg0(*iarg0);
  453. // Call the method
  454. Vec2 ret = self->operator+(arg0);
  455. // Push return value
  456. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  457. voidp = lua_newuserdata(l, size);
  458. luaL_setmetatable(l, "Vec2");
  459. ud = static_cast<LuaUserData*>(voidp);
  460. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  461. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  462. ::new(ud->getData<Vec2>()) Vec2(std::move(ret));
  463. return 1;
  464. }
  465. /// Wrap method Vec2::operator+.
  466. static int wrapVec2__add(lua_State* l)
  467. {
  468. int res = pwrapVec2__add(l);
  469. if(res >= 0)
  470. {
  471. return res;
  472. }
  473. lua_error(l);
  474. return 0;
  475. }
  476. /// Pre-wrap method Vec2::operator-.
  477. static inline int pwrapVec2__sub(lua_State* l)
  478. {
  479. [[maybe_unused]] LuaUserData* ud;
  480. [[maybe_unused]] void* voidp;
  481. [[maybe_unused]] PtrSize size;
  482. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  483. {
  484. return -1;
  485. }
  486. // Get "this" as "self"
  487. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  488. {
  489. return -1;
  490. }
  491. Vec2* self = ud->getData<Vec2>();
  492. // Pop arguments
  493. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  494. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  495. {
  496. return -1;
  497. }
  498. Vec2* iarg0 = ud->getData<Vec2>();
  499. const Vec2& arg0(*iarg0);
  500. // Call the method
  501. Vec2 ret = self->operator-(arg0);
  502. // Push return value
  503. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  504. voidp = lua_newuserdata(l, size);
  505. luaL_setmetatable(l, "Vec2");
  506. ud = static_cast<LuaUserData*>(voidp);
  507. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  508. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  509. ::new(ud->getData<Vec2>()) Vec2(std::move(ret));
  510. return 1;
  511. }
  512. /// Wrap method Vec2::operator-.
  513. static int wrapVec2__sub(lua_State* l)
  514. {
  515. int res = pwrapVec2__sub(l);
  516. if(res >= 0)
  517. {
  518. return res;
  519. }
  520. lua_error(l);
  521. return 0;
  522. }
  523. /// Pre-wrap method Vec2::operator*.
  524. static inline int pwrapVec2__mul(lua_State* l)
  525. {
  526. [[maybe_unused]] LuaUserData* ud;
  527. [[maybe_unused]] void* voidp;
  528. [[maybe_unused]] PtrSize size;
  529. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  530. {
  531. return -1;
  532. }
  533. // Get "this" as "self"
  534. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  535. {
  536. return -1;
  537. }
  538. Vec2* self = ud->getData<Vec2>();
  539. // Pop arguments
  540. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  541. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  542. {
  543. return -1;
  544. }
  545. Vec2* iarg0 = ud->getData<Vec2>();
  546. const Vec2& arg0(*iarg0);
  547. // Call the method
  548. Vec2 ret = self->operator*(arg0);
  549. // Push return value
  550. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  551. voidp = lua_newuserdata(l, size);
  552. luaL_setmetatable(l, "Vec2");
  553. ud = static_cast<LuaUserData*>(voidp);
  554. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  555. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  556. ::new(ud->getData<Vec2>()) Vec2(std::move(ret));
  557. return 1;
  558. }
  559. /// Wrap method Vec2::operator*.
  560. static int wrapVec2__mul(lua_State* l)
  561. {
  562. int res = pwrapVec2__mul(l);
  563. if(res >= 0)
  564. {
  565. return res;
  566. }
  567. lua_error(l);
  568. return 0;
  569. }
  570. /// Pre-wrap method Vec2::operator/.
  571. static inline int pwrapVec2__div(lua_State* l)
  572. {
  573. [[maybe_unused]] LuaUserData* ud;
  574. [[maybe_unused]] void* voidp;
  575. [[maybe_unused]] PtrSize size;
  576. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  577. {
  578. return -1;
  579. }
  580. // Get "this" as "self"
  581. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  582. {
  583. return -1;
  584. }
  585. Vec2* self = ud->getData<Vec2>();
  586. // Pop arguments
  587. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  588. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  589. {
  590. return -1;
  591. }
  592. Vec2* iarg0 = ud->getData<Vec2>();
  593. const Vec2& arg0(*iarg0);
  594. // Call the method
  595. Vec2 ret = self->operator/(arg0);
  596. // Push return value
  597. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  598. voidp = lua_newuserdata(l, size);
  599. luaL_setmetatable(l, "Vec2");
  600. ud = static_cast<LuaUserData*>(voidp);
  601. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  602. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  603. ::new(ud->getData<Vec2>()) Vec2(std::move(ret));
  604. return 1;
  605. }
  606. /// Wrap method Vec2::operator/.
  607. static int wrapVec2__div(lua_State* l)
  608. {
  609. int res = pwrapVec2__div(l);
  610. if(res >= 0)
  611. {
  612. return res;
  613. }
  614. lua_error(l);
  615. return 0;
  616. }
  617. /// Pre-wrap method Vec2::operator==.
  618. static inline int pwrapVec2__eq(lua_State* l)
  619. {
  620. [[maybe_unused]] LuaUserData* ud;
  621. [[maybe_unused]] void* voidp;
  622. [[maybe_unused]] PtrSize size;
  623. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  624. {
  625. return -1;
  626. }
  627. // Get "this" as "self"
  628. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  629. {
  630. return -1;
  631. }
  632. Vec2* self = ud->getData<Vec2>();
  633. // Pop arguments
  634. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  635. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  636. {
  637. return -1;
  638. }
  639. Vec2* iarg0 = ud->getData<Vec2>();
  640. const Vec2& arg0(*iarg0);
  641. // Call the method
  642. Bool ret = self->operator==(arg0);
  643. // Push return value
  644. lua_pushboolean(l, ret);
  645. return 1;
  646. }
  647. /// Wrap method Vec2::operator==.
  648. static int wrapVec2__eq(lua_State* l)
  649. {
  650. int res = pwrapVec2__eq(l);
  651. if(res >= 0)
  652. {
  653. return res;
  654. }
  655. lua_error(l);
  656. return 0;
  657. }
  658. /// Pre-wrap method Vec2::getLength.
  659. static inline int pwrapVec2getLength(lua_State* l)
  660. {
  661. [[maybe_unused]] LuaUserData* ud;
  662. [[maybe_unused]] void* voidp;
  663. [[maybe_unused]] PtrSize size;
  664. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  665. {
  666. return -1;
  667. }
  668. // Get "this" as "self"
  669. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  670. {
  671. return -1;
  672. }
  673. Vec2* self = ud->getData<Vec2>();
  674. // Call the method
  675. F32 ret = self->getLength();
  676. // Push return value
  677. lua_pushnumber(l, lua_Number(ret));
  678. return 1;
  679. }
  680. /// Wrap method Vec2::getLength.
  681. static int wrapVec2getLength(lua_State* l)
  682. {
  683. int res = pwrapVec2getLength(l);
  684. if(res >= 0)
  685. {
  686. return res;
  687. }
  688. lua_error(l);
  689. return 0;
  690. }
  691. /// Pre-wrap method Vec2::getNormalized.
  692. static inline int pwrapVec2getNormalized(lua_State* l)
  693. {
  694. [[maybe_unused]] LuaUserData* ud;
  695. [[maybe_unused]] void* voidp;
  696. [[maybe_unused]] PtrSize size;
  697. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  698. {
  699. return -1;
  700. }
  701. // Get "this" as "self"
  702. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  703. {
  704. return -1;
  705. }
  706. Vec2* self = ud->getData<Vec2>();
  707. // Call the method
  708. Vec2 ret = self->getNormalized();
  709. // Push return value
  710. size = LuaUserData::computeSizeForGarbageCollected<Vec2>();
  711. voidp = lua_newuserdata(l, size);
  712. luaL_setmetatable(l, "Vec2");
  713. ud = static_cast<LuaUserData*>(voidp);
  714. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  715. ud->initGarbageCollected(&luaUserDataTypeInfoVec2);
  716. ::new(ud->getData<Vec2>()) Vec2(std::move(ret));
  717. return 1;
  718. }
  719. /// Wrap method Vec2::getNormalized.
  720. static int wrapVec2getNormalized(lua_State* l)
  721. {
  722. int res = pwrapVec2getNormalized(l);
  723. if(res >= 0)
  724. {
  725. return res;
  726. }
  727. lua_error(l);
  728. return 0;
  729. }
  730. /// Pre-wrap method Vec2::normalize.
  731. static inline int pwrapVec2normalize(lua_State* l)
  732. {
  733. [[maybe_unused]] LuaUserData* ud;
  734. [[maybe_unused]] void* voidp;
  735. [[maybe_unused]] PtrSize size;
  736. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  737. {
  738. return -1;
  739. }
  740. // Get "this" as "self"
  741. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  742. {
  743. return -1;
  744. }
  745. Vec2* self = ud->getData<Vec2>();
  746. // Call the method
  747. self->normalize();
  748. return 0;
  749. }
  750. /// Wrap method Vec2::normalize.
  751. static int wrapVec2normalize(lua_State* l)
  752. {
  753. int res = pwrapVec2normalize(l);
  754. if(res >= 0)
  755. {
  756. return res;
  757. }
  758. lua_error(l);
  759. return 0;
  760. }
  761. /// Pre-wrap method Vec2::dot.
  762. static inline int pwrapVec2dot(lua_State* l)
  763. {
  764. [[maybe_unused]] LuaUserData* ud;
  765. [[maybe_unused]] void* voidp;
  766. [[maybe_unused]] PtrSize size;
  767. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  768. {
  769. return -1;
  770. }
  771. // Get "this" as "self"
  772. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec2, ud))
  773. {
  774. return -1;
  775. }
  776. Vec2* self = ud->getData<Vec2>();
  777. // Pop arguments
  778. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  779. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  780. {
  781. return -1;
  782. }
  783. Vec2* iarg0 = ud->getData<Vec2>();
  784. const Vec2& arg0(*iarg0);
  785. // Call the method
  786. F32 ret = self->dot(arg0);
  787. // Push return value
  788. lua_pushnumber(l, lua_Number(ret));
  789. return 1;
  790. }
  791. /// Wrap method Vec2::dot.
  792. static int wrapVec2dot(lua_State* l)
  793. {
  794. int res = pwrapVec2dot(l);
  795. if(res >= 0)
  796. {
  797. return res;
  798. }
  799. lua_error(l);
  800. return 0;
  801. }
  802. /// Wrap class Vec2.
  803. static inline void wrapVec2(lua_State* l)
  804. {
  805. LuaBinder::createClass(l, &luaUserDataTypeInfoVec2);
  806. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec2.m_typeName, "new", wrapVec2Ctor);
  807. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec2Dtor);
  808. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec2getX);
  809. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec2getY);
  810. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec2setX);
  811. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec2setY);
  812. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec2setAll);
  813. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec2getAt);
  814. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec2setAt);
  815. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec2copy);
  816. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec2__add);
  817. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec2__sub);
  818. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec2__mul);
  819. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec2__div);
  820. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec2__eq);
  821. LuaBinder::pushLuaCFuncMethod(l, "getLength", wrapVec2getLength);
  822. LuaBinder::pushLuaCFuncMethod(l, "getNormalized", wrapVec2getNormalized);
  823. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec2normalize);
  824. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec2dot);
  825. lua_settop(l, 0);
  826. }
  827. /// Serialize Vec3
  828. static void serializeVec3(LuaUserData& self, void* data, PtrSize& size)
  829. {
  830. Vec3* obj = self.getData<Vec3>();
  831. obj->serialize(data, size);
  832. }
  833. /// De-serialize Vec3
  834. static void deserializeVec3(const void* data, LuaUserData& self)
  835. {
  836. ANKI_ASSERT(data);
  837. Vec3* obj = self.getData<Vec3>();
  838. ::new(obj) Vec3();
  839. obj->deserialize(data);
  840. }
  841. LuaUserDataTypeInfo luaUserDataTypeInfoVec3 = {5669632566763941038, "Vec3", LuaUserData::computeSizeForGarbageCollected<Vec3>(), serializeVec3,
  842. deserializeVec3};
  843. template<>
  844. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Vec3>()
  845. {
  846. return luaUserDataTypeInfoVec3;
  847. }
  848. /// Pre-wrap constructor for Vec3.
  849. static inline int pwrapVec3Ctor0(lua_State* l)
  850. {
  851. [[maybe_unused]] LuaUserData* ud;
  852. [[maybe_unused]] void* voidp;
  853. [[maybe_unused]] PtrSize size;
  854. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  855. {
  856. return -1;
  857. }
  858. // Create user data
  859. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  860. voidp = lua_newuserdata(l, size);
  861. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  862. ud = static_cast<LuaUserData*>(voidp);
  863. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  864. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  865. ::new(ud->getData<Vec3>()) Vec3();
  866. return 1;
  867. }
  868. /// Pre-wrap constructor for Vec3.
  869. static inline int pwrapVec3Ctor1(lua_State* l)
  870. {
  871. [[maybe_unused]] LuaUserData* ud;
  872. [[maybe_unused]] void* voidp;
  873. [[maybe_unused]] PtrSize size;
  874. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  875. {
  876. return -1;
  877. }
  878. // Pop arguments
  879. F32 arg0;
  880. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  881. {
  882. return -1;
  883. }
  884. // Create user data
  885. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  886. voidp = lua_newuserdata(l, size);
  887. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  888. ud = static_cast<LuaUserData*>(voidp);
  889. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  890. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  891. ::new(ud->getData<Vec3>()) Vec3(arg0);
  892. return 1;
  893. }
  894. /// Pre-wrap constructor for Vec3.
  895. static inline int pwrapVec3Ctor2(lua_State* l)
  896. {
  897. [[maybe_unused]] LuaUserData* ud;
  898. [[maybe_unused]] void* voidp;
  899. [[maybe_unused]] PtrSize size;
  900. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  901. {
  902. return -1;
  903. }
  904. // Pop arguments
  905. F32 arg0;
  906. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  907. {
  908. return -1;
  909. }
  910. F32 arg1;
  911. if(LuaBinder::checkNumber(l, 2, arg1)) [[unlikely]]
  912. {
  913. return -1;
  914. }
  915. F32 arg2;
  916. if(LuaBinder::checkNumber(l, 3, arg2)) [[unlikely]]
  917. {
  918. return -1;
  919. }
  920. // Create user data
  921. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  922. voidp = lua_newuserdata(l, size);
  923. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  924. ud = static_cast<LuaUserData*>(voidp);
  925. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  926. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  927. ::new(ud->getData<Vec3>()) Vec3(arg0, arg1, arg2);
  928. return 1;
  929. }
  930. /// Wrap constructors for Vec3.
  931. static int wrapVec3Ctor(lua_State* l)
  932. {
  933. // Chose the right overload
  934. const int argCount = lua_gettop(l);
  935. int res = 0;
  936. switch(argCount)
  937. {
  938. case 0:
  939. res = pwrapVec3Ctor0(l);
  940. break;
  941. case 1:
  942. res = pwrapVec3Ctor1(l);
  943. break;
  944. case 3:
  945. res = pwrapVec3Ctor2(l);
  946. break;
  947. default:
  948. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  949. res = -1;
  950. }
  951. if(res >= 0)
  952. {
  953. return res;
  954. }
  955. lua_error(l);
  956. return 0;
  957. }
  958. /// Wrap destructor for Vec3.
  959. static int wrapVec3Dtor(lua_State* l)
  960. {
  961. [[maybe_unused]] LuaUserData* ud;
  962. [[maybe_unused]] void* voidp;
  963. [[maybe_unused]] PtrSize size;
  964. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  965. {
  966. return -1;
  967. }
  968. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  969. {
  970. return -1;
  971. }
  972. if(ud->isGarbageCollected())
  973. {
  974. Vec3* inst = ud->getData<Vec3>();
  975. inst->~Vec3();
  976. }
  977. return 0;
  978. }
  979. /// Pre-wrap method Vec3::getX.
  980. static inline int pwrapVec3getX(lua_State* l)
  981. {
  982. [[maybe_unused]] LuaUserData* ud;
  983. [[maybe_unused]] void* voidp;
  984. [[maybe_unused]] PtrSize size;
  985. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  986. {
  987. return -1;
  988. }
  989. // Get "this" as "self"
  990. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  991. {
  992. return -1;
  993. }
  994. Vec3* self = ud->getData<Vec3>();
  995. // Call the method
  996. F32 ret = (*self).x();
  997. // Push return value
  998. lua_pushnumber(l, lua_Number(ret));
  999. return 1;
  1000. }
  1001. /// Wrap method Vec3::getX.
  1002. static int wrapVec3getX(lua_State* l)
  1003. {
  1004. int res = pwrapVec3getX(l);
  1005. if(res >= 0)
  1006. {
  1007. return res;
  1008. }
  1009. lua_error(l);
  1010. return 0;
  1011. }
  1012. /// Pre-wrap method Vec3::getY.
  1013. static inline int pwrapVec3getY(lua_State* l)
  1014. {
  1015. [[maybe_unused]] LuaUserData* ud;
  1016. [[maybe_unused]] void* voidp;
  1017. [[maybe_unused]] PtrSize size;
  1018. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1019. {
  1020. return -1;
  1021. }
  1022. // Get "this" as "self"
  1023. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1024. {
  1025. return -1;
  1026. }
  1027. Vec3* self = ud->getData<Vec3>();
  1028. // Call the method
  1029. F32 ret = (*self).y();
  1030. // Push return value
  1031. lua_pushnumber(l, lua_Number(ret));
  1032. return 1;
  1033. }
  1034. /// Wrap method Vec3::getY.
  1035. static int wrapVec3getY(lua_State* l)
  1036. {
  1037. int res = pwrapVec3getY(l);
  1038. if(res >= 0)
  1039. {
  1040. return res;
  1041. }
  1042. lua_error(l);
  1043. return 0;
  1044. }
  1045. /// Pre-wrap method Vec3::getZ.
  1046. static inline int pwrapVec3getZ(lua_State* l)
  1047. {
  1048. [[maybe_unused]] LuaUserData* ud;
  1049. [[maybe_unused]] void* voidp;
  1050. [[maybe_unused]] PtrSize size;
  1051. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1052. {
  1053. return -1;
  1054. }
  1055. // Get "this" as "self"
  1056. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1057. {
  1058. return -1;
  1059. }
  1060. Vec3* self = ud->getData<Vec3>();
  1061. // Call the method
  1062. F32 ret = (*self).z();
  1063. // Push return value
  1064. lua_pushnumber(l, lua_Number(ret));
  1065. return 1;
  1066. }
  1067. /// Wrap method Vec3::getZ.
  1068. static int wrapVec3getZ(lua_State* l)
  1069. {
  1070. int res = pwrapVec3getZ(l);
  1071. if(res >= 0)
  1072. {
  1073. return res;
  1074. }
  1075. lua_error(l);
  1076. return 0;
  1077. }
  1078. /// Pre-wrap method Vec3::setX.
  1079. static inline int pwrapVec3setX(lua_State* l)
  1080. {
  1081. [[maybe_unused]] LuaUserData* ud;
  1082. [[maybe_unused]] void* voidp;
  1083. [[maybe_unused]] PtrSize size;
  1084. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1085. {
  1086. return -1;
  1087. }
  1088. // Get "this" as "self"
  1089. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1090. {
  1091. return -1;
  1092. }
  1093. Vec3* self = ud->getData<Vec3>();
  1094. // Pop arguments
  1095. F32 arg0;
  1096. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1097. {
  1098. return -1;
  1099. }
  1100. // Call the method
  1101. (*self).x() = arg0;
  1102. return 0;
  1103. }
  1104. /// Wrap method Vec3::setX.
  1105. static int wrapVec3setX(lua_State* l)
  1106. {
  1107. int res = pwrapVec3setX(l);
  1108. if(res >= 0)
  1109. {
  1110. return res;
  1111. }
  1112. lua_error(l);
  1113. return 0;
  1114. }
  1115. /// Pre-wrap method Vec3::setY.
  1116. static inline int pwrapVec3setY(lua_State* l)
  1117. {
  1118. [[maybe_unused]] LuaUserData* ud;
  1119. [[maybe_unused]] void* voidp;
  1120. [[maybe_unused]] PtrSize size;
  1121. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1122. {
  1123. return -1;
  1124. }
  1125. // Get "this" as "self"
  1126. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1127. {
  1128. return -1;
  1129. }
  1130. Vec3* self = ud->getData<Vec3>();
  1131. // Pop arguments
  1132. F32 arg0;
  1133. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1134. {
  1135. return -1;
  1136. }
  1137. // Call the method
  1138. (*self).y() = arg0;
  1139. return 0;
  1140. }
  1141. /// Wrap method Vec3::setY.
  1142. static int wrapVec3setY(lua_State* l)
  1143. {
  1144. int res = pwrapVec3setY(l);
  1145. if(res >= 0)
  1146. {
  1147. return res;
  1148. }
  1149. lua_error(l);
  1150. return 0;
  1151. }
  1152. /// Pre-wrap method Vec3::setZ.
  1153. static inline int pwrapVec3setZ(lua_State* l)
  1154. {
  1155. [[maybe_unused]] LuaUserData* ud;
  1156. [[maybe_unused]] void* voidp;
  1157. [[maybe_unused]] PtrSize size;
  1158. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1159. {
  1160. return -1;
  1161. }
  1162. // Get "this" as "self"
  1163. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1164. {
  1165. return -1;
  1166. }
  1167. Vec3* self = ud->getData<Vec3>();
  1168. // Pop arguments
  1169. F32 arg0;
  1170. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1171. {
  1172. return -1;
  1173. }
  1174. // Call the method
  1175. (*self).z() = arg0;
  1176. return 0;
  1177. }
  1178. /// Wrap method Vec3::setZ.
  1179. static int wrapVec3setZ(lua_State* l)
  1180. {
  1181. int res = pwrapVec3setZ(l);
  1182. if(res >= 0)
  1183. {
  1184. return res;
  1185. }
  1186. lua_error(l);
  1187. return 0;
  1188. }
  1189. /// Pre-wrap method Vec3::setAll.
  1190. static inline int pwrapVec3setAll(lua_State* l)
  1191. {
  1192. [[maybe_unused]] LuaUserData* ud;
  1193. [[maybe_unused]] void* voidp;
  1194. [[maybe_unused]] PtrSize size;
  1195. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  1196. {
  1197. return -1;
  1198. }
  1199. // Get "this" as "self"
  1200. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1201. {
  1202. return -1;
  1203. }
  1204. Vec3* self = ud->getData<Vec3>();
  1205. // Pop arguments
  1206. F32 arg0;
  1207. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1208. {
  1209. return -1;
  1210. }
  1211. F32 arg1;
  1212. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  1213. {
  1214. return -1;
  1215. }
  1216. F32 arg2;
  1217. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  1218. {
  1219. return -1;
  1220. }
  1221. // Call the method
  1222. (*self) = Vec3(arg0, arg1, arg2);
  1223. return 0;
  1224. }
  1225. /// Wrap method Vec3::setAll.
  1226. static int wrapVec3setAll(lua_State* l)
  1227. {
  1228. int res = pwrapVec3setAll(l);
  1229. if(res >= 0)
  1230. {
  1231. return res;
  1232. }
  1233. lua_error(l);
  1234. return 0;
  1235. }
  1236. /// Pre-wrap method Vec3::getAt.
  1237. static inline int pwrapVec3getAt(lua_State* l)
  1238. {
  1239. [[maybe_unused]] LuaUserData* ud;
  1240. [[maybe_unused]] void* voidp;
  1241. [[maybe_unused]] PtrSize size;
  1242. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1243. {
  1244. return -1;
  1245. }
  1246. // Get "this" as "self"
  1247. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1248. {
  1249. return -1;
  1250. }
  1251. Vec3* self = ud->getData<Vec3>();
  1252. // Pop arguments
  1253. U arg0;
  1254. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1255. {
  1256. return -1;
  1257. }
  1258. // Call the method
  1259. F32 ret = (*self)[arg0];
  1260. // Push return value
  1261. lua_pushnumber(l, lua_Number(ret));
  1262. return 1;
  1263. }
  1264. /// Wrap method Vec3::getAt.
  1265. static int wrapVec3getAt(lua_State* l)
  1266. {
  1267. int res = pwrapVec3getAt(l);
  1268. if(res >= 0)
  1269. {
  1270. return res;
  1271. }
  1272. lua_error(l);
  1273. return 0;
  1274. }
  1275. /// Pre-wrap method Vec3::setAt.
  1276. static inline int pwrapVec3setAt(lua_State* l)
  1277. {
  1278. [[maybe_unused]] LuaUserData* ud;
  1279. [[maybe_unused]] void* voidp;
  1280. [[maybe_unused]] PtrSize size;
  1281. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  1282. {
  1283. return -1;
  1284. }
  1285. // Get "this" as "self"
  1286. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1287. {
  1288. return -1;
  1289. }
  1290. Vec3* self = ud->getData<Vec3>();
  1291. // Pop arguments
  1292. U arg0;
  1293. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1294. {
  1295. return -1;
  1296. }
  1297. F32 arg1;
  1298. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  1299. {
  1300. return -1;
  1301. }
  1302. // Call the method
  1303. (*self)[arg0] = arg1;
  1304. return 0;
  1305. }
  1306. /// Wrap method Vec3::setAt.
  1307. static int wrapVec3setAt(lua_State* l)
  1308. {
  1309. int res = pwrapVec3setAt(l);
  1310. if(res >= 0)
  1311. {
  1312. return res;
  1313. }
  1314. lua_error(l);
  1315. return 0;
  1316. }
  1317. /// Pre-wrap method Vec3::operator=.
  1318. static inline int pwrapVec3copy(lua_State* l)
  1319. {
  1320. [[maybe_unused]] LuaUserData* ud;
  1321. [[maybe_unused]] void* voidp;
  1322. [[maybe_unused]] PtrSize size;
  1323. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1324. {
  1325. return -1;
  1326. }
  1327. // Get "this" as "self"
  1328. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1329. {
  1330. return -1;
  1331. }
  1332. Vec3* self = ud->getData<Vec3>();
  1333. // Pop arguments
  1334. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1335. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1336. {
  1337. return -1;
  1338. }
  1339. Vec3* iarg0 = ud->getData<Vec3>();
  1340. const Vec3& arg0(*iarg0);
  1341. // Call the method
  1342. self->operator=(arg0);
  1343. return 0;
  1344. }
  1345. /// Wrap method Vec3::operator=.
  1346. static int wrapVec3copy(lua_State* l)
  1347. {
  1348. int res = pwrapVec3copy(l);
  1349. if(res >= 0)
  1350. {
  1351. return res;
  1352. }
  1353. lua_error(l);
  1354. return 0;
  1355. }
  1356. /// Pre-wrap method Vec3::operator+.
  1357. static inline int pwrapVec3__add(lua_State* l)
  1358. {
  1359. [[maybe_unused]] LuaUserData* ud;
  1360. [[maybe_unused]] void* voidp;
  1361. [[maybe_unused]] PtrSize size;
  1362. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1363. {
  1364. return -1;
  1365. }
  1366. // Get "this" as "self"
  1367. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1368. {
  1369. return -1;
  1370. }
  1371. Vec3* self = ud->getData<Vec3>();
  1372. // Pop arguments
  1373. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1374. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1375. {
  1376. return -1;
  1377. }
  1378. Vec3* iarg0 = ud->getData<Vec3>();
  1379. const Vec3& arg0(*iarg0);
  1380. // Call the method
  1381. Vec3 ret = self->operator+(arg0);
  1382. // Push return value
  1383. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1384. voidp = lua_newuserdata(l, size);
  1385. luaL_setmetatable(l, "Vec3");
  1386. ud = static_cast<LuaUserData*>(voidp);
  1387. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1388. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1389. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1390. return 1;
  1391. }
  1392. /// Wrap method Vec3::operator+.
  1393. static int wrapVec3__add(lua_State* l)
  1394. {
  1395. int res = pwrapVec3__add(l);
  1396. if(res >= 0)
  1397. {
  1398. return res;
  1399. }
  1400. lua_error(l);
  1401. return 0;
  1402. }
  1403. /// Pre-wrap method Vec3::operator-.
  1404. static inline int pwrapVec3__sub(lua_State* l)
  1405. {
  1406. [[maybe_unused]] LuaUserData* ud;
  1407. [[maybe_unused]] void* voidp;
  1408. [[maybe_unused]] PtrSize size;
  1409. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1410. {
  1411. return -1;
  1412. }
  1413. // Get "this" as "self"
  1414. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1415. {
  1416. return -1;
  1417. }
  1418. Vec3* self = ud->getData<Vec3>();
  1419. // Pop arguments
  1420. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1421. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1422. {
  1423. return -1;
  1424. }
  1425. Vec3* iarg0 = ud->getData<Vec3>();
  1426. const Vec3& arg0(*iarg0);
  1427. // Call the method
  1428. Vec3 ret = self->operator-(arg0);
  1429. // Push return value
  1430. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1431. voidp = lua_newuserdata(l, size);
  1432. luaL_setmetatable(l, "Vec3");
  1433. ud = static_cast<LuaUserData*>(voidp);
  1434. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1435. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1436. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1437. return 1;
  1438. }
  1439. /// Wrap method Vec3::operator-.
  1440. static int wrapVec3__sub(lua_State* l)
  1441. {
  1442. int res = pwrapVec3__sub(l);
  1443. if(res >= 0)
  1444. {
  1445. return res;
  1446. }
  1447. lua_error(l);
  1448. return 0;
  1449. }
  1450. /// Pre-wrap method Vec3::operator*.
  1451. static inline int pwrapVec3__mul(lua_State* l)
  1452. {
  1453. [[maybe_unused]] LuaUserData* ud;
  1454. [[maybe_unused]] void* voidp;
  1455. [[maybe_unused]] PtrSize size;
  1456. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1457. {
  1458. return -1;
  1459. }
  1460. // Get "this" as "self"
  1461. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1462. {
  1463. return -1;
  1464. }
  1465. Vec3* self = ud->getData<Vec3>();
  1466. // Pop arguments
  1467. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1468. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1469. {
  1470. return -1;
  1471. }
  1472. Vec3* iarg0 = ud->getData<Vec3>();
  1473. const Vec3& arg0(*iarg0);
  1474. // Call the method
  1475. Vec3 ret = self->operator*(arg0);
  1476. // Push return value
  1477. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1478. voidp = lua_newuserdata(l, size);
  1479. luaL_setmetatable(l, "Vec3");
  1480. ud = static_cast<LuaUserData*>(voidp);
  1481. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1482. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1483. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1484. return 1;
  1485. }
  1486. /// Wrap method Vec3::operator*.
  1487. static int wrapVec3__mul(lua_State* l)
  1488. {
  1489. int res = pwrapVec3__mul(l);
  1490. if(res >= 0)
  1491. {
  1492. return res;
  1493. }
  1494. lua_error(l);
  1495. return 0;
  1496. }
  1497. /// Pre-wrap method Vec3::operator/.
  1498. static inline int pwrapVec3__div(lua_State* l)
  1499. {
  1500. [[maybe_unused]] LuaUserData* ud;
  1501. [[maybe_unused]] void* voidp;
  1502. [[maybe_unused]] PtrSize size;
  1503. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1504. {
  1505. return -1;
  1506. }
  1507. // Get "this" as "self"
  1508. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1509. {
  1510. return -1;
  1511. }
  1512. Vec3* self = ud->getData<Vec3>();
  1513. // Pop arguments
  1514. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1515. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1516. {
  1517. return -1;
  1518. }
  1519. Vec3* iarg0 = ud->getData<Vec3>();
  1520. const Vec3& arg0(*iarg0);
  1521. // Call the method
  1522. Vec3 ret = self->operator/(arg0);
  1523. // Push return value
  1524. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1525. voidp = lua_newuserdata(l, size);
  1526. luaL_setmetatable(l, "Vec3");
  1527. ud = static_cast<LuaUserData*>(voidp);
  1528. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1529. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1530. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1531. return 1;
  1532. }
  1533. /// Wrap method Vec3::operator/.
  1534. static int wrapVec3__div(lua_State* l)
  1535. {
  1536. int res = pwrapVec3__div(l);
  1537. if(res >= 0)
  1538. {
  1539. return res;
  1540. }
  1541. lua_error(l);
  1542. return 0;
  1543. }
  1544. /// Pre-wrap method Vec3::operator==.
  1545. static inline int pwrapVec3__eq(lua_State* l)
  1546. {
  1547. [[maybe_unused]] LuaUserData* ud;
  1548. [[maybe_unused]] void* voidp;
  1549. [[maybe_unused]] PtrSize size;
  1550. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1551. {
  1552. return -1;
  1553. }
  1554. // Get "this" as "self"
  1555. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1556. {
  1557. return -1;
  1558. }
  1559. Vec3* self = ud->getData<Vec3>();
  1560. // Pop arguments
  1561. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1562. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1563. {
  1564. return -1;
  1565. }
  1566. Vec3* iarg0 = ud->getData<Vec3>();
  1567. const Vec3& arg0(*iarg0);
  1568. // Call the method
  1569. Bool ret = self->operator==(arg0);
  1570. // Push return value
  1571. lua_pushboolean(l, ret);
  1572. return 1;
  1573. }
  1574. /// Wrap method Vec3::operator==.
  1575. static int wrapVec3__eq(lua_State* l)
  1576. {
  1577. int res = pwrapVec3__eq(l);
  1578. if(res >= 0)
  1579. {
  1580. return res;
  1581. }
  1582. lua_error(l);
  1583. return 0;
  1584. }
  1585. /// Pre-wrap method Vec3::getLength.
  1586. static inline int pwrapVec3getLength(lua_State* l)
  1587. {
  1588. [[maybe_unused]] LuaUserData* ud;
  1589. [[maybe_unused]] void* voidp;
  1590. [[maybe_unused]] PtrSize size;
  1591. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1592. {
  1593. return -1;
  1594. }
  1595. // Get "this" as "self"
  1596. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1597. {
  1598. return -1;
  1599. }
  1600. Vec3* self = ud->getData<Vec3>();
  1601. // Call the method
  1602. F32 ret = self->getLength();
  1603. // Push return value
  1604. lua_pushnumber(l, lua_Number(ret));
  1605. return 1;
  1606. }
  1607. /// Wrap method Vec3::getLength.
  1608. static int wrapVec3getLength(lua_State* l)
  1609. {
  1610. int res = pwrapVec3getLength(l);
  1611. if(res >= 0)
  1612. {
  1613. return res;
  1614. }
  1615. lua_error(l);
  1616. return 0;
  1617. }
  1618. /// Pre-wrap method Vec3::getNormalized.
  1619. static inline int pwrapVec3getNormalized(lua_State* l)
  1620. {
  1621. [[maybe_unused]] LuaUserData* ud;
  1622. [[maybe_unused]] void* voidp;
  1623. [[maybe_unused]] PtrSize size;
  1624. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1625. {
  1626. return -1;
  1627. }
  1628. // Get "this" as "self"
  1629. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1630. {
  1631. return -1;
  1632. }
  1633. Vec3* self = ud->getData<Vec3>();
  1634. // Call the method
  1635. Vec3 ret = self->getNormalized();
  1636. // Push return value
  1637. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1638. voidp = lua_newuserdata(l, size);
  1639. luaL_setmetatable(l, "Vec3");
  1640. ud = static_cast<LuaUserData*>(voidp);
  1641. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1642. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1643. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1644. return 1;
  1645. }
  1646. /// Wrap method Vec3::getNormalized.
  1647. static int wrapVec3getNormalized(lua_State* l)
  1648. {
  1649. int res = pwrapVec3getNormalized(l);
  1650. if(res >= 0)
  1651. {
  1652. return res;
  1653. }
  1654. lua_error(l);
  1655. return 0;
  1656. }
  1657. /// Pre-wrap method Vec3::normalize.
  1658. static inline int pwrapVec3normalize(lua_State* l)
  1659. {
  1660. [[maybe_unused]] LuaUserData* ud;
  1661. [[maybe_unused]] void* voidp;
  1662. [[maybe_unused]] PtrSize size;
  1663. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1664. {
  1665. return -1;
  1666. }
  1667. // Get "this" as "self"
  1668. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1669. {
  1670. return -1;
  1671. }
  1672. Vec3* self = ud->getData<Vec3>();
  1673. // Call the method
  1674. self->normalize();
  1675. return 0;
  1676. }
  1677. /// Wrap method Vec3::normalize.
  1678. static int wrapVec3normalize(lua_State* l)
  1679. {
  1680. int res = pwrapVec3normalize(l);
  1681. if(res >= 0)
  1682. {
  1683. return res;
  1684. }
  1685. lua_error(l);
  1686. return 0;
  1687. }
  1688. /// Pre-wrap method Vec3::dot.
  1689. static inline int pwrapVec3dot(lua_State* l)
  1690. {
  1691. [[maybe_unused]] LuaUserData* ud;
  1692. [[maybe_unused]] void* voidp;
  1693. [[maybe_unused]] PtrSize size;
  1694. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1695. {
  1696. return -1;
  1697. }
  1698. // Get "this" as "self"
  1699. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1700. {
  1701. return -1;
  1702. }
  1703. Vec3* self = ud->getData<Vec3>();
  1704. // Pop arguments
  1705. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1706. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1707. {
  1708. return -1;
  1709. }
  1710. Vec3* iarg0 = ud->getData<Vec3>();
  1711. const Vec3& arg0(*iarg0);
  1712. // Call the method
  1713. F32 ret = self->dot(arg0);
  1714. // Push return value
  1715. lua_pushnumber(l, lua_Number(ret));
  1716. return 1;
  1717. }
  1718. /// Wrap method Vec3::dot.
  1719. static int wrapVec3dot(lua_State* l)
  1720. {
  1721. int res = pwrapVec3dot(l);
  1722. if(res >= 0)
  1723. {
  1724. return res;
  1725. }
  1726. lua_error(l);
  1727. return 0;
  1728. }
  1729. /// Wrap class Vec3.
  1730. static inline void wrapVec3(lua_State* l)
  1731. {
  1732. LuaBinder::createClass(l, &luaUserDataTypeInfoVec3);
  1733. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec3.m_typeName, "new", wrapVec3Ctor);
  1734. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec3Dtor);
  1735. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec3getX);
  1736. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec3getY);
  1737. LuaBinder::pushLuaCFuncMethod(l, "getZ", wrapVec3getZ);
  1738. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec3setX);
  1739. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec3setY);
  1740. LuaBinder::pushLuaCFuncMethod(l, "setZ", wrapVec3setZ);
  1741. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec3setAll);
  1742. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec3getAt);
  1743. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec3setAt);
  1744. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec3copy);
  1745. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec3__add);
  1746. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec3__sub);
  1747. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec3__mul);
  1748. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec3__div);
  1749. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec3__eq);
  1750. LuaBinder::pushLuaCFuncMethod(l, "getLength", wrapVec3getLength);
  1751. LuaBinder::pushLuaCFuncMethod(l, "getNormalized", wrapVec3getNormalized);
  1752. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec3normalize);
  1753. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec3dot);
  1754. lua_settop(l, 0);
  1755. }
  1756. /// Serialize Vec4
  1757. static void serializeVec4(LuaUserData& self, void* data, PtrSize& size)
  1758. {
  1759. Vec4* obj = self.getData<Vec4>();
  1760. obj->serialize(data, size);
  1761. }
  1762. /// De-serialize Vec4
  1763. static void deserializeVec4(const void* data, LuaUserData& self)
  1764. {
  1765. ANKI_ASSERT(data);
  1766. Vec4* obj = self.getData<Vec4>();
  1767. ::new(obj) Vec4();
  1768. obj->deserialize(data);
  1769. }
  1770. LuaUserDataTypeInfo luaUserDataTypeInfoVec4 = {-7510298399639860788, "Vec4", LuaUserData::computeSizeForGarbageCollected<Vec4>(), serializeVec4,
  1771. deserializeVec4};
  1772. template<>
  1773. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Vec4>()
  1774. {
  1775. return luaUserDataTypeInfoVec4;
  1776. }
  1777. /// Pre-wrap constructor for Vec4.
  1778. static inline int pwrapVec4Ctor0(lua_State* l)
  1779. {
  1780. [[maybe_unused]] LuaUserData* ud;
  1781. [[maybe_unused]] void* voidp;
  1782. [[maybe_unused]] PtrSize size;
  1783. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  1784. {
  1785. return -1;
  1786. }
  1787. // Create user data
  1788. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1789. voidp = lua_newuserdata(l, size);
  1790. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1791. ud = static_cast<LuaUserData*>(voidp);
  1792. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1793. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1794. ::new(ud->getData<Vec4>()) Vec4();
  1795. return 1;
  1796. }
  1797. /// Pre-wrap constructor for Vec4.
  1798. static inline int pwrapVec4Ctor1(lua_State* l)
  1799. {
  1800. [[maybe_unused]] LuaUserData* ud;
  1801. [[maybe_unused]] void* voidp;
  1802. [[maybe_unused]] PtrSize size;
  1803. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1804. {
  1805. return -1;
  1806. }
  1807. // Pop arguments
  1808. F32 arg0;
  1809. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  1810. {
  1811. return -1;
  1812. }
  1813. // Create user data
  1814. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1815. voidp = lua_newuserdata(l, size);
  1816. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1817. ud = static_cast<LuaUserData*>(voidp);
  1818. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1819. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1820. ::new(ud->getData<Vec4>()) Vec4(arg0);
  1821. return 1;
  1822. }
  1823. /// Pre-wrap constructor for Vec4.
  1824. static inline int pwrapVec4Ctor2(lua_State* l)
  1825. {
  1826. [[maybe_unused]] LuaUserData* ud;
  1827. [[maybe_unused]] void* voidp;
  1828. [[maybe_unused]] PtrSize size;
  1829. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  1830. {
  1831. return -1;
  1832. }
  1833. // Pop arguments
  1834. F32 arg0;
  1835. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  1836. {
  1837. return -1;
  1838. }
  1839. F32 arg1;
  1840. if(LuaBinder::checkNumber(l, 2, arg1)) [[unlikely]]
  1841. {
  1842. return -1;
  1843. }
  1844. F32 arg2;
  1845. if(LuaBinder::checkNumber(l, 3, arg2)) [[unlikely]]
  1846. {
  1847. return -1;
  1848. }
  1849. F32 arg3;
  1850. if(LuaBinder::checkNumber(l, 4, arg3)) [[unlikely]]
  1851. {
  1852. return -1;
  1853. }
  1854. // Create user data
  1855. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1856. voidp = lua_newuserdata(l, size);
  1857. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1858. ud = static_cast<LuaUserData*>(voidp);
  1859. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1860. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1861. ::new(ud->getData<Vec4>()) Vec4(arg0, arg1, arg2, arg3);
  1862. return 1;
  1863. }
  1864. /// Wrap constructors for Vec4.
  1865. static int wrapVec4Ctor(lua_State* l)
  1866. {
  1867. // Chose the right overload
  1868. const int argCount = lua_gettop(l);
  1869. int res = 0;
  1870. switch(argCount)
  1871. {
  1872. case 0:
  1873. res = pwrapVec4Ctor0(l);
  1874. break;
  1875. case 1:
  1876. res = pwrapVec4Ctor1(l);
  1877. break;
  1878. case 4:
  1879. res = pwrapVec4Ctor2(l);
  1880. break;
  1881. default:
  1882. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  1883. res = -1;
  1884. }
  1885. if(res >= 0)
  1886. {
  1887. return res;
  1888. }
  1889. lua_error(l);
  1890. return 0;
  1891. }
  1892. /// Wrap destructor for Vec4.
  1893. static int wrapVec4Dtor(lua_State* l)
  1894. {
  1895. [[maybe_unused]] LuaUserData* ud;
  1896. [[maybe_unused]] void* voidp;
  1897. [[maybe_unused]] PtrSize size;
  1898. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1899. {
  1900. return -1;
  1901. }
  1902. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  1903. {
  1904. return -1;
  1905. }
  1906. if(ud->isGarbageCollected())
  1907. {
  1908. Vec4* inst = ud->getData<Vec4>();
  1909. inst->~Vec4();
  1910. }
  1911. return 0;
  1912. }
  1913. /// Pre-wrap method Vec4::getX.
  1914. static inline int pwrapVec4getX(lua_State* l)
  1915. {
  1916. [[maybe_unused]] LuaUserData* ud;
  1917. [[maybe_unused]] void* voidp;
  1918. [[maybe_unused]] PtrSize size;
  1919. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1920. {
  1921. return -1;
  1922. }
  1923. // Get "this" as "self"
  1924. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1925. {
  1926. return -1;
  1927. }
  1928. Vec4* self = ud->getData<Vec4>();
  1929. // Call the method
  1930. F32 ret = (*self).x();
  1931. // Push return value
  1932. lua_pushnumber(l, lua_Number(ret));
  1933. return 1;
  1934. }
  1935. /// Wrap method Vec4::getX.
  1936. static int wrapVec4getX(lua_State* l)
  1937. {
  1938. int res = pwrapVec4getX(l);
  1939. if(res >= 0)
  1940. {
  1941. return res;
  1942. }
  1943. lua_error(l);
  1944. return 0;
  1945. }
  1946. /// Pre-wrap method Vec4::getY.
  1947. static inline int pwrapVec4getY(lua_State* l)
  1948. {
  1949. [[maybe_unused]] LuaUserData* ud;
  1950. [[maybe_unused]] void* voidp;
  1951. [[maybe_unused]] PtrSize size;
  1952. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1953. {
  1954. return -1;
  1955. }
  1956. // Get "this" as "self"
  1957. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1958. {
  1959. return -1;
  1960. }
  1961. Vec4* self = ud->getData<Vec4>();
  1962. // Call the method
  1963. F32 ret = (*self).y();
  1964. // Push return value
  1965. lua_pushnumber(l, lua_Number(ret));
  1966. return 1;
  1967. }
  1968. /// Wrap method Vec4::getY.
  1969. static int wrapVec4getY(lua_State* l)
  1970. {
  1971. int res = pwrapVec4getY(l);
  1972. if(res >= 0)
  1973. {
  1974. return res;
  1975. }
  1976. lua_error(l);
  1977. return 0;
  1978. }
  1979. /// Pre-wrap method Vec4::getZ.
  1980. static inline int pwrapVec4getZ(lua_State* l)
  1981. {
  1982. [[maybe_unused]] LuaUserData* ud;
  1983. [[maybe_unused]] void* voidp;
  1984. [[maybe_unused]] PtrSize size;
  1985. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1986. {
  1987. return -1;
  1988. }
  1989. // Get "this" as "self"
  1990. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1991. {
  1992. return -1;
  1993. }
  1994. Vec4* self = ud->getData<Vec4>();
  1995. // Call the method
  1996. F32 ret = (*self).z();
  1997. // Push return value
  1998. lua_pushnumber(l, lua_Number(ret));
  1999. return 1;
  2000. }
  2001. /// Wrap method Vec4::getZ.
  2002. static int wrapVec4getZ(lua_State* l)
  2003. {
  2004. int res = pwrapVec4getZ(l);
  2005. if(res >= 0)
  2006. {
  2007. return res;
  2008. }
  2009. lua_error(l);
  2010. return 0;
  2011. }
  2012. /// Pre-wrap method Vec4::getW.
  2013. static inline int pwrapVec4getW(lua_State* l)
  2014. {
  2015. [[maybe_unused]] LuaUserData* ud;
  2016. [[maybe_unused]] void* voidp;
  2017. [[maybe_unused]] PtrSize size;
  2018. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2019. {
  2020. return -1;
  2021. }
  2022. // Get "this" as "self"
  2023. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2024. {
  2025. return -1;
  2026. }
  2027. Vec4* self = ud->getData<Vec4>();
  2028. // Call the method
  2029. F32 ret = (*self).w();
  2030. // Push return value
  2031. lua_pushnumber(l, lua_Number(ret));
  2032. return 1;
  2033. }
  2034. /// Wrap method Vec4::getW.
  2035. static int wrapVec4getW(lua_State* l)
  2036. {
  2037. int res = pwrapVec4getW(l);
  2038. if(res >= 0)
  2039. {
  2040. return res;
  2041. }
  2042. lua_error(l);
  2043. return 0;
  2044. }
  2045. /// Pre-wrap method Vec4::setX.
  2046. static inline int pwrapVec4setX(lua_State* l)
  2047. {
  2048. [[maybe_unused]] LuaUserData* ud;
  2049. [[maybe_unused]] void* voidp;
  2050. [[maybe_unused]] PtrSize size;
  2051. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2052. {
  2053. return -1;
  2054. }
  2055. // Get "this" as "self"
  2056. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2057. {
  2058. return -1;
  2059. }
  2060. Vec4* self = ud->getData<Vec4>();
  2061. // Pop arguments
  2062. F32 arg0;
  2063. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2064. {
  2065. return -1;
  2066. }
  2067. // Call the method
  2068. (*self).x() = arg0;
  2069. return 0;
  2070. }
  2071. /// Wrap method Vec4::setX.
  2072. static int wrapVec4setX(lua_State* l)
  2073. {
  2074. int res = pwrapVec4setX(l);
  2075. if(res >= 0)
  2076. {
  2077. return res;
  2078. }
  2079. lua_error(l);
  2080. return 0;
  2081. }
  2082. /// Pre-wrap method Vec4::setY.
  2083. static inline int pwrapVec4setY(lua_State* l)
  2084. {
  2085. [[maybe_unused]] LuaUserData* ud;
  2086. [[maybe_unused]] void* voidp;
  2087. [[maybe_unused]] PtrSize size;
  2088. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2089. {
  2090. return -1;
  2091. }
  2092. // Get "this" as "self"
  2093. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2094. {
  2095. return -1;
  2096. }
  2097. Vec4* self = ud->getData<Vec4>();
  2098. // Pop arguments
  2099. F32 arg0;
  2100. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2101. {
  2102. return -1;
  2103. }
  2104. // Call the method
  2105. (*self).y() = arg0;
  2106. return 0;
  2107. }
  2108. /// Wrap method Vec4::setY.
  2109. static int wrapVec4setY(lua_State* l)
  2110. {
  2111. int res = pwrapVec4setY(l);
  2112. if(res >= 0)
  2113. {
  2114. return res;
  2115. }
  2116. lua_error(l);
  2117. return 0;
  2118. }
  2119. /// Pre-wrap method Vec4::setZ.
  2120. static inline int pwrapVec4setZ(lua_State* l)
  2121. {
  2122. [[maybe_unused]] LuaUserData* ud;
  2123. [[maybe_unused]] void* voidp;
  2124. [[maybe_unused]] PtrSize size;
  2125. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2126. {
  2127. return -1;
  2128. }
  2129. // Get "this" as "self"
  2130. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2131. {
  2132. return -1;
  2133. }
  2134. Vec4* self = ud->getData<Vec4>();
  2135. // Pop arguments
  2136. F32 arg0;
  2137. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2138. {
  2139. return -1;
  2140. }
  2141. // Call the method
  2142. (*self).z() = arg0;
  2143. return 0;
  2144. }
  2145. /// Wrap method Vec4::setZ.
  2146. static int wrapVec4setZ(lua_State* l)
  2147. {
  2148. int res = pwrapVec4setZ(l);
  2149. if(res >= 0)
  2150. {
  2151. return res;
  2152. }
  2153. lua_error(l);
  2154. return 0;
  2155. }
  2156. /// Pre-wrap method Vec4::setW.
  2157. static inline int pwrapVec4setW(lua_State* l)
  2158. {
  2159. [[maybe_unused]] LuaUserData* ud;
  2160. [[maybe_unused]] void* voidp;
  2161. [[maybe_unused]] PtrSize size;
  2162. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2163. {
  2164. return -1;
  2165. }
  2166. // Get "this" as "self"
  2167. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2168. {
  2169. return -1;
  2170. }
  2171. Vec4* self = ud->getData<Vec4>();
  2172. // Pop arguments
  2173. F32 arg0;
  2174. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2175. {
  2176. return -1;
  2177. }
  2178. // Call the method
  2179. (*self).w() = arg0;
  2180. return 0;
  2181. }
  2182. /// Wrap method Vec4::setW.
  2183. static int wrapVec4setW(lua_State* l)
  2184. {
  2185. int res = pwrapVec4setW(l);
  2186. if(res >= 0)
  2187. {
  2188. return res;
  2189. }
  2190. lua_error(l);
  2191. return 0;
  2192. }
  2193. /// Pre-wrap method Vec4::setAll.
  2194. static inline int pwrapVec4setAll(lua_State* l)
  2195. {
  2196. [[maybe_unused]] LuaUserData* ud;
  2197. [[maybe_unused]] void* voidp;
  2198. [[maybe_unused]] PtrSize size;
  2199. if(LuaBinder::checkArgsCount(l, 5)) [[unlikely]]
  2200. {
  2201. return -1;
  2202. }
  2203. // Get "this" as "self"
  2204. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2205. {
  2206. return -1;
  2207. }
  2208. Vec4* self = ud->getData<Vec4>();
  2209. // Pop arguments
  2210. F32 arg0;
  2211. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2212. {
  2213. return -1;
  2214. }
  2215. F32 arg1;
  2216. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2217. {
  2218. return -1;
  2219. }
  2220. F32 arg2;
  2221. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  2222. {
  2223. return -1;
  2224. }
  2225. F32 arg3;
  2226. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  2227. {
  2228. return -1;
  2229. }
  2230. // Call the method
  2231. (*self) = Vec4(arg0, arg1, arg2, arg3);
  2232. return 0;
  2233. }
  2234. /// Wrap method Vec4::setAll.
  2235. static int wrapVec4setAll(lua_State* l)
  2236. {
  2237. int res = pwrapVec4setAll(l);
  2238. if(res >= 0)
  2239. {
  2240. return res;
  2241. }
  2242. lua_error(l);
  2243. return 0;
  2244. }
  2245. /// Pre-wrap method Vec4::getAt.
  2246. static inline int pwrapVec4getAt(lua_State* l)
  2247. {
  2248. [[maybe_unused]] LuaUserData* ud;
  2249. [[maybe_unused]] void* voidp;
  2250. [[maybe_unused]] PtrSize size;
  2251. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2252. {
  2253. return -1;
  2254. }
  2255. // Get "this" as "self"
  2256. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2257. {
  2258. return -1;
  2259. }
  2260. Vec4* self = ud->getData<Vec4>();
  2261. // Pop arguments
  2262. U arg0;
  2263. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2264. {
  2265. return -1;
  2266. }
  2267. // Call the method
  2268. F32 ret = (*self)[arg0];
  2269. // Push return value
  2270. lua_pushnumber(l, lua_Number(ret));
  2271. return 1;
  2272. }
  2273. /// Wrap method Vec4::getAt.
  2274. static int wrapVec4getAt(lua_State* l)
  2275. {
  2276. int res = pwrapVec4getAt(l);
  2277. if(res >= 0)
  2278. {
  2279. return res;
  2280. }
  2281. lua_error(l);
  2282. return 0;
  2283. }
  2284. /// Pre-wrap method Vec4::setAt.
  2285. static inline int pwrapVec4setAt(lua_State* l)
  2286. {
  2287. [[maybe_unused]] LuaUserData* ud;
  2288. [[maybe_unused]] void* voidp;
  2289. [[maybe_unused]] PtrSize size;
  2290. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  2291. {
  2292. return -1;
  2293. }
  2294. // Get "this" as "self"
  2295. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2296. {
  2297. return -1;
  2298. }
  2299. Vec4* self = ud->getData<Vec4>();
  2300. // Pop arguments
  2301. U arg0;
  2302. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2303. {
  2304. return -1;
  2305. }
  2306. F32 arg1;
  2307. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2308. {
  2309. return -1;
  2310. }
  2311. // Call the method
  2312. (*self)[arg0] = arg1;
  2313. return 0;
  2314. }
  2315. /// Wrap method Vec4::setAt.
  2316. static int wrapVec4setAt(lua_State* l)
  2317. {
  2318. int res = pwrapVec4setAt(l);
  2319. if(res >= 0)
  2320. {
  2321. return res;
  2322. }
  2323. lua_error(l);
  2324. return 0;
  2325. }
  2326. /// Pre-wrap method Vec4::operator=.
  2327. static inline int pwrapVec4copy(lua_State* l)
  2328. {
  2329. [[maybe_unused]] LuaUserData* ud;
  2330. [[maybe_unused]] void* voidp;
  2331. [[maybe_unused]] PtrSize size;
  2332. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2333. {
  2334. return -1;
  2335. }
  2336. // Get "this" as "self"
  2337. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2338. {
  2339. return -1;
  2340. }
  2341. Vec4* self = ud->getData<Vec4>();
  2342. // Pop arguments
  2343. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2344. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2345. {
  2346. return -1;
  2347. }
  2348. Vec4* iarg0 = ud->getData<Vec4>();
  2349. const Vec4& arg0(*iarg0);
  2350. // Call the method
  2351. self->operator=(arg0);
  2352. return 0;
  2353. }
  2354. /// Wrap method Vec4::operator=.
  2355. static int wrapVec4copy(lua_State* l)
  2356. {
  2357. int res = pwrapVec4copy(l);
  2358. if(res >= 0)
  2359. {
  2360. return res;
  2361. }
  2362. lua_error(l);
  2363. return 0;
  2364. }
  2365. /// Pre-wrap method Vec4::operator+.
  2366. static inline int pwrapVec4__add(lua_State* l)
  2367. {
  2368. [[maybe_unused]] LuaUserData* ud;
  2369. [[maybe_unused]] void* voidp;
  2370. [[maybe_unused]] PtrSize size;
  2371. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2372. {
  2373. return -1;
  2374. }
  2375. // Get "this" as "self"
  2376. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2377. {
  2378. return -1;
  2379. }
  2380. Vec4* self = ud->getData<Vec4>();
  2381. // Pop arguments
  2382. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2383. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2384. {
  2385. return -1;
  2386. }
  2387. Vec4* iarg0 = ud->getData<Vec4>();
  2388. const Vec4& arg0(*iarg0);
  2389. // Call the method
  2390. Vec4 ret = self->operator+(arg0);
  2391. // Push return value
  2392. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2393. voidp = lua_newuserdata(l, size);
  2394. luaL_setmetatable(l, "Vec4");
  2395. ud = static_cast<LuaUserData*>(voidp);
  2396. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2397. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2398. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2399. return 1;
  2400. }
  2401. /// Wrap method Vec4::operator+.
  2402. static int wrapVec4__add(lua_State* l)
  2403. {
  2404. int res = pwrapVec4__add(l);
  2405. if(res >= 0)
  2406. {
  2407. return res;
  2408. }
  2409. lua_error(l);
  2410. return 0;
  2411. }
  2412. /// Pre-wrap method Vec4::operator-.
  2413. static inline int pwrapVec4__sub(lua_State* l)
  2414. {
  2415. [[maybe_unused]] LuaUserData* ud;
  2416. [[maybe_unused]] void* voidp;
  2417. [[maybe_unused]] PtrSize size;
  2418. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2419. {
  2420. return -1;
  2421. }
  2422. // Get "this" as "self"
  2423. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2424. {
  2425. return -1;
  2426. }
  2427. Vec4* self = ud->getData<Vec4>();
  2428. // Pop arguments
  2429. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2430. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2431. {
  2432. return -1;
  2433. }
  2434. Vec4* iarg0 = ud->getData<Vec4>();
  2435. const Vec4& arg0(*iarg0);
  2436. // Call the method
  2437. Vec4 ret = self->operator-(arg0);
  2438. // Push return value
  2439. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2440. voidp = lua_newuserdata(l, size);
  2441. luaL_setmetatable(l, "Vec4");
  2442. ud = static_cast<LuaUserData*>(voidp);
  2443. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2444. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2445. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2446. return 1;
  2447. }
  2448. /// Wrap method Vec4::operator-.
  2449. static int wrapVec4__sub(lua_State* l)
  2450. {
  2451. int res = pwrapVec4__sub(l);
  2452. if(res >= 0)
  2453. {
  2454. return res;
  2455. }
  2456. lua_error(l);
  2457. return 0;
  2458. }
  2459. /// Pre-wrap method Vec4::operator*.
  2460. static inline int pwrapVec4__mul(lua_State* l)
  2461. {
  2462. [[maybe_unused]] LuaUserData* ud;
  2463. [[maybe_unused]] void* voidp;
  2464. [[maybe_unused]] PtrSize size;
  2465. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2466. {
  2467. return -1;
  2468. }
  2469. // Get "this" as "self"
  2470. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2471. {
  2472. return -1;
  2473. }
  2474. Vec4* self = ud->getData<Vec4>();
  2475. // Pop arguments
  2476. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2477. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2478. {
  2479. return -1;
  2480. }
  2481. Vec4* iarg0 = ud->getData<Vec4>();
  2482. const Vec4& arg0(*iarg0);
  2483. // Call the method
  2484. Vec4 ret = self->operator*(arg0);
  2485. // Push return value
  2486. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2487. voidp = lua_newuserdata(l, size);
  2488. luaL_setmetatable(l, "Vec4");
  2489. ud = static_cast<LuaUserData*>(voidp);
  2490. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2491. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2492. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2493. return 1;
  2494. }
  2495. /// Wrap method Vec4::operator*.
  2496. static int wrapVec4__mul(lua_State* l)
  2497. {
  2498. int res = pwrapVec4__mul(l);
  2499. if(res >= 0)
  2500. {
  2501. return res;
  2502. }
  2503. lua_error(l);
  2504. return 0;
  2505. }
  2506. /// Pre-wrap method Vec4::operator/.
  2507. static inline int pwrapVec4__div(lua_State* l)
  2508. {
  2509. [[maybe_unused]] LuaUserData* ud;
  2510. [[maybe_unused]] void* voidp;
  2511. [[maybe_unused]] PtrSize size;
  2512. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2513. {
  2514. return -1;
  2515. }
  2516. // Get "this" as "self"
  2517. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2518. {
  2519. return -1;
  2520. }
  2521. Vec4* self = ud->getData<Vec4>();
  2522. // Pop arguments
  2523. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2524. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2525. {
  2526. return -1;
  2527. }
  2528. Vec4* iarg0 = ud->getData<Vec4>();
  2529. const Vec4& arg0(*iarg0);
  2530. // Call the method
  2531. Vec4 ret = self->operator/(arg0);
  2532. // Push return value
  2533. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2534. voidp = lua_newuserdata(l, size);
  2535. luaL_setmetatable(l, "Vec4");
  2536. ud = static_cast<LuaUserData*>(voidp);
  2537. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2538. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2539. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2540. return 1;
  2541. }
  2542. /// Wrap method Vec4::operator/.
  2543. static int wrapVec4__div(lua_State* l)
  2544. {
  2545. int res = pwrapVec4__div(l);
  2546. if(res >= 0)
  2547. {
  2548. return res;
  2549. }
  2550. lua_error(l);
  2551. return 0;
  2552. }
  2553. /// Pre-wrap method Vec4::operator==.
  2554. static inline int pwrapVec4__eq(lua_State* l)
  2555. {
  2556. [[maybe_unused]] LuaUserData* ud;
  2557. [[maybe_unused]] void* voidp;
  2558. [[maybe_unused]] PtrSize size;
  2559. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2560. {
  2561. return -1;
  2562. }
  2563. // Get "this" as "self"
  2564. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2565. {
  2566. return -1;
  2567. }
  2568. Vec4* self = ud->getData<Vec4>();
  2569. // Pop arguments
  2570. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2571. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2572. {
  2573. return -1;
  2574. }
  2575. Vec4* iarg0 = ud->getData<Vec4>();
  2576. const Vec4& arg0(*iarg0);
  2577. // Call the method
  2578. Bool ret = self->operator==(arg0);
  2579. // Push return value
  2580. lua_pushboolean(l, ret);
  2581. return 1;
  2582. }
  2583. /// Wrap method Vec4::operator==.
  2584. static int wrapVec4__eq(lua_State* l)
  2585. {
  2586. int res = pwrapVec4__eq(l);
  2587. if(res >= 0)
  2588. {
  2589. return res;
  2590. }
  2591. lua_error(l);
  2592. return 0;
  2593. }
  2594. /// Pre-wrap method Vec4::getLength.
  2595. static inline int pwrapVec4getLength(lua_State* l)
  2596. {
  2597. [[maybe_unused]] LuaUserData* ud;
  2598. [[maybe_unused]] void* voidp;
  2599. [[maybe_unused]] PtrSize size;
  2600. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2601. {
  2602. return -1;
  2603. }
  2604. // Get "this" as "self"
  2605. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2606. {
  2607. return -1;
  2608. }
  2609. Vec4* self = ud->getData<Vec4>();
  2610. // Call the method
  2611. F32 ret = self->getLength();
  2612. // Push return value
  2613. lua_pushnumber(l, lua_Number(ret));
  2614. return 1;
  2615. }
  2616. /// Wrap method Vec4::getLength.
  2617. static int wrapVec4getLength(lua_State* l)
  2618. {
  2619. int res = pwrapVec4getLength(l);
  2620. if(res >= 0)
  2621. {
  2622. return res;
  2623. }
  2624. lua_error(l);
  2625. return 0;
  2626. }
  2627. /// Pre-wrap method Vec4::getNormalized.
  2628. static inline int pwrapVec4getNormalized(lua_State* l)
  2629. {
  2630. [[maybe_unused]] LuaUserData* ud;
  2631. [[maybe_unused]] void* voidp;
  2632. [[maybe_unused]] PtrSize size;
  2633. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2634. {
  2635. return -1;
  2636. }
  2637. // Get "this" as "self"
  2638. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2639. {
  2640. return -1;
  2641. }
  2642. Vec4* self = ud->getData<Vec4>();
  2643. // Call the method
  2644. Vec4 ret = self->getNormalized();
  2645. // Push return value
  2646. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2647. voidp = lua_newuserdata(l, size);
  2648. luaL_setmetatable(l, "Vec4");
  2649. ud = static_cast<LuaUserData*>(voidp);
  2650. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2651. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2652. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2653. return 1;
  2654. }
  2655. /// Wrap method Vec4::getNormalized.
  2656. static int wrapVec4getNormalized(lua_State* l)
  2657. {
  2658. int res = pwrapVec4getNormalized(l);
  2659. if(res >= 0)
  2660. {
  2661. return res;
  2662. }
  2663. lua_error(l);
  2664. return 0;
  2665. }
  2666. /// Pre-wrap method Vec4::normalize.
  2667. static inline int pwrapVec4normalize(lua_State* l)
  2668. {
  2669. [[maybe_unused]] LuaUserData* ud;
  2670. [[maybe_unused]] void* voidp;
  2671. [[maybe_unused]] PtrSize size;
  2672. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2673. {
  2674. return -1;
  2675. }
  2676. // Get "this" as "self"
  2677. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2678. {
  2679. return -1;
  2680. }
  2681. Vec4* self = ud->getData<Vec4>();
  2682. // Call the method
  2683. self->normalize();
  2684. return 0;
  2685. }
  2686. /// Wrap method Vec4::normalize.
  2687. static int wrapVec4normalize(lua_State* l)
  2688. {
  2689. int res = pwrapVec4normalize(l);
  2690. if(res >= 0)
  2691. {
  2692. return res;
  2693. }
  2694. lua_error(l);
  2695. return 0;
  2696. }
  2697. /// Pre-wrap method Vec4::dot.
  2698. static inline int pwrapVec4dot(lua_State* l)
  2699. {
  2700. [[maybe_unused]] LuaUserData* ud;
  2701. [[maybe_unused]] void* voidp;
  2702. [[maybe_unused]] PtrSize size;
  2703. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2704. {
  2705. return -1;
  2706. }
  2707. // Get "this" as "self"
  2708. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2709. {
  2710. return -1;
  2711. }
  2712. Vec4* self = ud->getData<Vec4>();
  2713. // Pop arguments
  2714. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2715. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2716. {
  2717. return -1;
  2718. }
  2719. Vec4* iarg0 = ud->getData<Vec4>();
  2720. const Vec4& arg0(*iarg0);
  2721. // Call the method
  2722. F32 ret = self->dot(arg0);
  2723. // Push return value
  2724. lua_pushnumber(l, lua_Number(ret));
  2725. return 1;
  2726. }
  2727. /// Wrap method Vec4::dot.
  2728. static int wrapVec4dot(lua_State* l)
  2729. {
  2730. int res = pwrapVec4dot(l);
  2731. if(res >= 0)
  2732. {
  2733. return res;
  2734. }
  2735. lua_error(l);
  2736. return 0;
  2737. }
  2738. /// Wrap class Vec4.
  2739. static inline void wrapVec4(lua_State* l)
  2740. {
  2741. LuaBinder::createClass(l, &luaUserDataTypeInfoVec4);
  2742. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec4.m_typeName, "new", wrapVec4Ctor);
  2743. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec4Dtor);
  2744. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec4getX);
  2745. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec4getY);
  2746. LuaBinder::pushLuaCFuncMethod(l, "getZ", wrapVec4getZ);
  2747. LuaBinder::pushLuaCFuncMethod(l, "getW", wrapVec4getW);
  2748. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec4setX);
  2749. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec4setY);
  2750. LuaBinder::pushLuaCFuncMethod(l, "setZ", wrapVec4setZ);
  2751. LuaBinder::pushLuaCFuncMethod(l, "setW", wrapVec4setW);
  2752. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec4setAll);
  2753. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec4getAt);
  2754. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec4setAt);
  2755. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec4copy);
  2756. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec4__add);
  2757. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec4__sub);
  2758. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec4__mul);
  2759. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec4__div);
  2760. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec4__eq);
  2761. LuaBinder::pushLuaCFuncMethod(l, "getLength", wrapVec4getLength);
  2762. LuaBinder::pushLuaCFuncMethod(l, "getNormalized", wrapVec4getNormalized);
  2763. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec4normalize);
  2764. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec4dot);
  2765. lua_settop(l, 0);
  2766. }
  2767. LuaUserDataTypeInfo luaUserDataTypeInfoMat3 = {-8522796721639548452, "Mat3", LuaUserData::computeSizeForGarbageCollected<Mat3>(), nullptr, nullptr};
  2768. template<>
  2769. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Mat3>()
  2770. {
  2771. return luaUserDataTypeInfoMat3;
  2772. }
  2773. /// Pre-wrap constructor for Mat3.
  2774. static inline int pwrapMat3Ctor0(lua_State* l)
  2775. {
  2776. [[maybe_unused]] LuaUserData* ud;
  2777. [[maybe_unused]] void* voidp;
  2778. [[maybe_unused]] PtrSize size;
  2779. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  2780. {
  2781. return -1;
  2782. }
  2783. // Create user data
  2784. size = LuaUserData::computeSizeForGarbageCollected<Mat3>();
  2785. voidp = lua_newuserdata(l, size);
  2786. luaL_setmetatable(l, luaUserDataTypeInfoMat3.m_typeName);
  2787. ud = static_cast<LuaUserData*>(voidp);
  2788. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2789. ud->initGarbageCollected(&luaUserDataTypeInfoMat3);
  2790. ::new(ud->getData<Mat3>()) Mat3();
  2791. return 1;
  2792. }
  2793. /// Pre-wrap constructor for Mat3.
  2794. static inline int pwrapMat3Ctor1(lua_State* l)
  2795. {
  2796. [[maybe_unused]] LuaUserData* ud;
  2797. [[maybe_unused]] void* voidp;
  2798. [[maybe_unused]] PtrSize size;
  2799. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2800. {
  2801. return -1;
  2802. }
  2803. // Pop arguments
  2804. F32 arg0;
  2805. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  2806. {
  2807. return -1;
  2808. }
  2809. // Create user data
  2810. size = LuaUserData::computeSizeForGarbageCollected<Mat3>();
  2811. voidp = lua_newuserdata(l, size);
  2812. luaL_setmetatable(l, luaUserDataTypeInfoMat3.m_typeName);
  2813. ud = static_cast<LuaUserData*>(voidp);
  2814. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2815. ud->initGarbageCollected(&luaUserDataTypeInfoMat3);
  2816. ::new(ud->getData<Mat3>()) Mat3(arg0);
  2817. return 1;
  2818. }
  2819. /// Wrap constructors for Mat3.
  2820. static int wrapMat3Ctor(lua_State* l)
  2821. {
  2822. // Chose the right overload
  2823. const int argCount = lua_gettop(l);
  2824. int res = 0;
  2825. switch(argCount)
  2826. {
  2827. case 0:
  2828. res = pwrapMat3Ctor0(l);
  2829. break;
  2830. case 1:
  2831. res = pwrapMat3Ctor1(l);
  2832. break;
  2833. default:
  2834. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  2835. res = -1;
  2836. }
  2837. if(res >= 0)
  2838. {
  2839. return res;
  2840. }
  2841. lua_error(l);
  2842. return 0;
  2843. }
  2844. /// Wrap destructor for Mat3.
  2845. static int wrapMat3Dtor(lua_State* l)
  2846. {
  2847. [[maybe_unused]] LuaUserData* ud;
  2848. [[maybe_unused]] void* voidp;
  2849. [[maybe_unused]] PtrSize size;
  2850. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2851. {
  2852. return -1;
  2853. }
  2854. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  2855. {
  2856. return -1;
  2857. }
  2858. if(ud->isGarbageCollected())
  2859. {
  2860. Mat3* inst = ud->getData<Mat3>();
  2861. inst->~Mat3();
  2862. }
  2863. return 0;
  2864. }
  2865. /// Pre-wrap method Mat3::operator=.
  2866. static inline int pwrapMat3copy(lua_State* l)
  2867. {
  2868. [[maybe_unused]] LuaUserData* ud;
  2869. [[maybe_unused]] void* voidp;
  2870. [[maybe_unused]] PtrSize size;
  2871. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2872. {
  2873. return -1;
  2874. }
  2875. // Get "this" as "self"
  2876. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2877. {
  2878. return -1;
  2879. }
  2880. Mat3* self = ud->getData<Mat3>();
  2881. // Pop arguments
  2882. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2883. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  2884. {
  2885. return -1;
  2886. }
  2887. Mat3* iarg0 = ud->getData<Mat3>();
  2888. const Mat3& arg0(*iarg0);
  2889. // Call the method
  2890. self->operator=(arg0);
  2891. return 0;
  2892. }
  2893. /// Wrap method Mat3::operator=.
  2894. static int wrapMat3copy(lua_State* l)
  2895. {
  2896. int res = pwrapMat3copy(l);
  2897. if(res >= 0)
  2898. {
  2899. return res;
  2900. }
  2901. lua_error(l);
  2902. return 0;
  2903. }
  2904. /// Pre-wrap method Mat3::getAt.
  2905. static inline int pwrapMat3getAt(lua_State* l)
  2906. {
  2907. [[maybe_unused]] LuaUserData* ud;
  2908. [[maybe_unused]] void* voidp;
  2909. [[maybe_unused]] PtrSize size;
  2910. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  2911. {
  2912. return -1;
  2913. }
  2914. // Get "this" as "self"
  2915. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2916. {
  2917. return -1;
  2918. }
  2919. Mat3* self = ud->getData<Mat3>();
  2920. // Pop arguments
  2921. U arg0;
  2922. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2923. {
  2924. return -1;
  2925. }
  2926. U arg1;
  2927. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2928. {
  2929. return -1;
  2930. }
  2931. // Call the method
  2932. F32 ret = (*self)(arg0, arg1);
  2933. // Push return value
  2934. lua_pushnumber(l, lua_Number(ret));
  2935. return 1;
  2936. }
  2937. /// Wrap method Mat3::getAt.
  2938. static int wrapMat3getAt(lua_State* l)
  2939. {
  2940. int res = pwrapMat3getAt(l);
  2941. if(res >= 0)
  2942. {
  2943. return res;
  2944. }
  2945. lua_error(l);
  2946. return 0;
  2947. }
  2948. /// Pre-wrap method Mat3::setAt.
  2949. static inline int pwrapMat3setAt(lua_State* l)
  2950. {
  2951. [[maybe_unused]] LuaUserData* ud;
  2952. [[maybe_unused]] void* voidp;
  2953. [[maybe_unused]] PtrSize size;
  2954. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  2955. {
  2956. return -1;
  2957. }
  2958. // Get "this" as "self"
  2959. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2960. {
  2961. return -1;
  2962. }
  2963. Mat3* self = ud->getData<Mat3>();
  2964. // Pop arguments
  2965. U arg0;
  2966. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2967. {
  2968. return -1;
  2969. }
  2970. U arg1;
  2971. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2972. {
  2973. return -1;
  2974. }
  2975. F32 arg2;
  2976. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  2977. {
  2978. return -1;
  2979. }
  2980. // Call the method
  2981. (*self)(arg0, arg1) = arg2;
  2982. return 0;
  2983. }
  2984. /// Wrap method Mat3::setAt.
  2985. static int wrapMat3setAt(lua_State* l)
  2986. {
  2987. int res = pwrapMat3setAt(l);
  2988. if(res >= 0)
  2989. {
  2990. return res;
  2991. }
  2992. lua_error(l);
  2993. return 0;
  2994. }
  2995. /// Pre-wrap method Mat3::setAll.
  2996. static inline int pwrapMat3setAll(lua_State* l)
  2997. {
  2998. [[maybe_unused]] LuaUserData* ud;
  2999. [[maybe_unused]] void* voidp;
  3000. [[maybe_unused]] PtrSize size;
  3001. if(LuaBinder::checkArgsCount(l, 10)) [[unlikely]]
  3002. {
  3003. return -1;
  3004. }
  3005. // Get "this" as "self"
  3006. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  3007. {
  3008. return -1;
  3009. }
  3010. Mat3* self = ud->getData<Mat3>();
  3011. // Pop arguments
  3012. F32 arg0;
  3013. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3014. {
  3015. return -1;
  3016. }
  3017. F32 arg1;
  3018. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3019. {
  3020. return -1;
  3021. }
  3022. F32 arg2;
  3023. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  3024. {
  3025. return -1;
  3026. }
  3027. F32 arg3;
  3028. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  3029. {
  3030. return -1;
  3031. }
  3032. F32 arg4;
  3033. if(LuaBinder::checkNumber(l, 6, arg4)) [[unlikely]]
  3034. {
  3035. return -1;
  3036. }
  3037. F32 arg5;
  3038. if(LuaBinder::checkNumber(l, 7, arg5)) [[unlikely]]
  3039. {
  3040. return -1;
  3041. }
  3042. F32 arg6;
  3043. if(LuaBinder::checkNumber(l, 8, arg6)) [[unlikely]]
  3044. {
  3045. return -1;
  3046. }
  3047. F32 arg7;
  3048. if(LuaBinder::checkNumber(l, 9, arg7)) [[unlikely]]
  3049. {
  3050. return -1;
  3051. }
  3052. F32 arg8;
  3053. if(LuaBinder::checkNumber(l, 10, arg8)) [[unlikely]]
  3054. {
  3055. return -1;
  3056. }
  3057. // Call the method
  3058. (*self) = Mat3(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
  3059. return 0;
  3060. }
  3061. /// Wrap method Mat3::setAll.
  3062. static int wrapMat3setAll(lua_State* l)
  3063. {
  3064. int res = pwrapMat3setAll(l);
  3065. if(res >= 0)
  3066. {
  3067. return res;
  3068. }
  3069. lua_error(l);
  3070. return 0;
  3071. }
  3072. /// Wrap class Mat3.
  3073. static inline void wrapMat3(lua_State* l)
  3074. {
  3075. LuaBinder::createClass(l, &luaUserDataTypeInfoMat3);
  3076. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoMat3.m_typeName, "new", wrapMat3Ctor);
  3077. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapMat3Dtor);
  3078. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapMat3copy);
  3079. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapMat3getAt);
  3080. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapMat3setAt);
  3081. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapMat3setAll);
  3082. lua_settop(l, 0);
  3083. }
  3084. LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4 = {6107000574328002637, "Mat3x4", LuaUserData::computeSizeForGarbageCollected<Mat3x4>(), nullptr,
  3085. nullptr};
  3086. template<>
  3087. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Mat3x4>()
  3088. {
  3089. return luaUserDataTypeInfoMat3x4;
  3090. }
  3091. /// Pre-wrap constructor for Mat3x4.
  3092. static inline int pwrapMat3x4Ctor0(lua_State* l)
  3093. {
  3094. [[maybe_unused]] LuaUserData* ud;
  3095. [[maybe_unused]] void* voidp;
  3096. [[maybe_unused]] PtrSize size;
  3097. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  3098. {
  3099. return -1;
  3100. }
  3101. // Create user data
  3102. size = LuaUserData::computeSizeForGarbageCollected<Mat3x4>();
  3103. voidp = lua_newuserdata(l, size);
  3104. luaL_setmetatable(l, luaUserDataTypeInfoMat3x4.m_typeName);
  3105. ud = static_cast<LuaUserData*>(voidp);
  3106. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3107. ud->initGarbageCollected(&luaUserDataTypeInfoMat3x4);
  3108. ::new(ud->getData<Mat3x4>()) Mat3x4();
  3109. return 1;
  3110. }
  3111. /// Pre-wrap constructor for Mat3x4.
  3112. static inline int pwrapMat3x4Ctor1(lua_State* l)
  3113. {
  3114. [[maybe_unused]] LuaUserData* ud;
  3115. [[maybe_unused]] void* voidp;
  3116. [[maybe_unused]] PtrSize size;
  3117. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3118. {
  3119. return -1;
  3120. }
  3121. // Pop arguments
  3122. F32 arg0;
  3123. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  3124. {
  3125. return -1;
  3126. }
  3127. // Create user data
  3128. size = LuaUserData::computeSizeForGarbageCollected<Mat3x4>();
  3129. voidp = lua_newuserdata(l, size);
  3130. luaL_setmetatable(l, luaUserDataTypeInfoMat3x4.m_typeName);
  3131. ud = static_cast<LuaUserData*>(voidp);
  3132. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3133. ud->initGarbageCollected(&luaUserDataTypeInfoMat3x4);
  3134. ::new(ud->getData<Mat3x4>()) Mat3x4(arg0);
  3135. return 1;
  3136. }
  3137. /// Wrap constructors for Mat3x4.
  3138. static int wrapMat3x4Ctor(lua_State* l)
  3139. {
  3140. // Chose the right overload
  3141. const int argCount = lua_gettop(l);
  3142. int res = 0;
  3143. switch(argCount)
  3144. {
  3145. case 0:
  3146. res = pwrapMat3x4Ctor0(l);
  3147. break;
  3148. case 1:
  3149. res = pwrapMat3x4Ctor1(l);
  3150. break;
  3151. default:
  3152. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  3153. res = -1;
  3154. }
  3155. if(res >= 0)
  3156. {
  3157. return res;
  3158. }
  3159. lua_error(l);
  3160. return 0;
  3161. }
  3162. /// Wrap destructor for Mat3x4.
  3163. static int wrapMat3x4Dtor(lua_State* l)
  3164. {
  3165. [[maybe_unused]] LuaUserData* ud;
  3166. [[maybe_unused]] void* voidp;
  3167. [[maybe_unused]] PtrSize size;
  3168. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3169. {
  3170. return -1;
  3171. }
  3172. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3173. {
  3174. return -1;
  3175. }
  3176. if(ud->isGarbageCollected())
  3177. {
  3178. Mat3x4* inst = ud->getData<Mat3x4>();
  3179. inst->~Mat3x4();
  3180. }
  3181. return 0;
  3182. }
  3183. /// Pre-wrap method Mat3x4::operator=.
  3184. static inline int pwrapMat3x4copy(lua_State* l)
  3185. {
  3186. [[maybe_unused]] LuaUserData* ud;
  3187. [[maybe_unused]] void* voidp;
  3188. [[maybe_unused]] PtrSize size;
  3189. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3190. {
  3191. return -1;
  3192. }
  3193. // Get "this" as "self"
  3194. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3195. {
  3196. return -1;
  3197. }
  3198. Mat3x4* self = ud->getData<Mat3x4>();
  3199. // Pop arguments
  3200. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3201. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3202. {
  3203. return -1;
  3204. }
  3205. Mat3x4* iarg0 = ud->getData<Mat3x4>();
  3206. const Mat3x4& arg0(*iarg0);
  3207. // Call the method
  3208. self->operator=(arg0);
  3209. return 0;
  3210. }
  3211. /// Wrap method Mat3x4::operator=.
  3212. static int wrapMat3x4copy(lua_State* l)
  3213. {
  3214. int res = pwrapMat3x4copy(l);
  3215. if(res >= 0)
  3216. {
  3217. return res;
  3218. }
  3219. lua_error(l);
  3220. return 0;
  3221. }
  3222. /// Pre-wrap method Mat3x4::getAt.
  3223. static inline int pwrapMat3x4getAt(lua_State* l)
  3224. {
  3225. [[maybe_unused]] LuaUserData* ud;
  3226. [[maybe_unused]] void* voidp;
  3227. [[maybe_unused]] PtrSize size;
  3228. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  3229. {
  3230. return -1;
  3231. }
  3232. // Get "this" as "self"
  3233. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3234. {
  3235. return -1;
  3236. }
  3237. Mat3x4* self = ud->getData<Mat3x4>();
  3238. // Pop arguments
  3239. U arg0;
  3240. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3241. {
  3242. return -1;
  3243. }
  3244. U arg1;
  3245. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3246. {
  3247. return -1;
  3248. }
  3249. // Call the method
  3250. F32 ret = (*self)(arg0, arg1);
  3251. // Push return value
  3252. lua_pushnumber(l, lua_Number(ret));
  3253. return 1;
  3254. }
  3255. /// Wrap method Mat3x4::getAt.
  3256. static int wrapMat3x4getAt(lua_State* l)
  3257. {
  3258. int res = pwrapMat3x4getAt(l);
  3259. if(res >= 0)
  3260. {
  3261. return res;
  3262. }
  3263. lua_error(l);
  3264. return 0;
  3265. }
  3266. /// Pre-wrap method Mat3x4::setAt.
  3267. static inline int pwrapMat3x4setAt(lua_State* l)
  3268. {
  3269. [[maybe_unused]] LuaUserData* ud;
  3270. [[maybe_unused]] void* voidp;
  3271. [[maybe_unused]] PtrSize size;
  3272. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  3273. {
  3274. return -1;
  3275. }
  3276. // Get "this" as "self"
  3277. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3278. {
  3279. return -1;
  3280. }
  3281. Mat3x4* self = ud->getData<Mat3x4>();
  3282. // Pop arguments
  3283. U arg0;
  3284. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3285. {
  3286. return -1;
  3287. }
  3288. U arg1;
  3289. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3290. {
  3291. return -1;
  3292. }
  3293. F32 arg2;
  3294. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  3295. {
  3296. return -1;
  3297. }
  3298. // Call the method
  3299. (*self)(arg0, arg1) = arg2;
  3300. return 0;
  3301. }
  3302. /// Wrap method Mat3x4::setAt.
  3303. static int wrapMat3x4setAt(lua_State* l)
  3304. {
  3305. int res = pwrapMat3x4setAt(l);
  3306. if(res >= 0)
  3307. {
  3308. return res;
  3309. }
  3310. lua_error(l);
  3311. return 0;
  3312. }
  3313. /// Pre-wrap method Mat3x4::setAll.
  3314. static inline int pwrapMat3x4setAll(lua_State* l)
  3315. {
  3316. [[maybe_unused]] LuaUserData* ud;
  3317. [[maybe_unused]] void* voidp;
  3318. [[maybe_unused]] PtrSize size;
  3319. if(LuaBinder::checkArgsCount(l, 13)) [[unlikely]]
  3320. {
  3321. return -1;
  3322. }
  3323. // Get "this" as "self"
  3324. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3325. {
  3326. return -1;
  3327. }
  3328. Mat3x4* self = ud->getData<Mat3x4>();
  3329. // Pop arguments
  3330. F32 arg0;
  3331. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3332. {
  3333. return -1;
  3334. }
  3335. F32 arg1;
  3336. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3337. {
  3338. return -1;
  3339. }
  3340. F32 arg2;
  3341. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  3342. {
  3343. return -1;
  3344. }
  3345. F32 arg3;
  3346. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  3347. {
  3348. return -1;
  3349. }
  3350. F32 arg4;
  3351. if(LuaBinder::checkNumber(l, 6, arg4)) [[unlikely]]
  3352. {
  3353. return -1;
  3354. }
  3355. F32 arg5;
  3356. if(LuaBinder::checkNumber(l, 7, arg5)) [[unlikely]]
  3357. {
  3358. return -1;
  3359. }
  3360. F32 arg6;
  3361. if(LuaBinder::checkNumber(l, 8, arg6)) [[unlikely]]
  3362. {
  3363. return -1;
  3364. }
  3365. F32 arg7;
  3366. if(LuaBinder::checkNumber(l, 9, arg7)) [[unlikely]]
  3367. {
  3368. return -1;
  3369. }
  3370. F32 arg8;
  3371. if(LuaBinder::checkNumber(l, 10, arg8)) [[unlikely]]
  3372. {
  3373. return -1;
  3374. }
  3375. F32 arg9;
  3376. if(LuaBinder::checkNumber(l, 11, arg9)) [[unlikely]]
  3377. {
  3378. return -1;
  3379. }
  3380. F32 arg10;
  3381. if(LuaBinder::checkNumber(l, 12, arg10)) [[unlikely]]
  3382. {
  3383. return -1;
  3384. }
  3385. F32 arg11;
  3386. if(LuaBinder::checkNumber(l, 13, arg11)) [[unlikely]]
  3387. {
  3388. return -1;
  3389. }
  3390. // Call the method
  3391. (*self) = Mat3x4(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
  3392. return 0;
  3393. }
  3394. /// Wrap method Mat3x4::setAll.
  3395. static int wrapMat3x4setAll(lua_State* l)
  3396. {
  3397. int res = pwrapMat3x4setAll(l);
  3398. if(res >= 0)
  3399. {
  3400. return res;
  3401. }
  3402. lua_error(l);
  3403. return 0;
  3404. }
  3405. /// Wrap class Mat3x4.
  3406. static inline void wrapMat3x4(lua_State* l)
  3407. {
  3408. LuaBinder::createClass(l, &luaUserDataTypeInfoMat3x4);
  3409. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoMat3x4.m_typeName, "new", wrapMat3x4Ctor);
  3410. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapMat3x4Dtor);
  3411. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapMat3x4copy);
  3412. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapMat3x4getAt);
  3413. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapMat3x4setAt);
  3414. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapMat3x4setAll);
  3415. lua_settop(l, 0);
  3416. }
  3417. LuaUserDataTypeInfo luaUserDataTypeInfoTransform = {-1440284075251026678, "Transform", LuaUserData::computeSizeForGarbageCollected<Transform>(),
  3418. nullptr, nullptr};
  3419. template<>
  3420. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Transform>()
  3421. {
  3422. return luaUserDataTypeInfoTransform;
  3423. }
  3424. /// Pre-wrap constructor for Transform.
  3425. static inline int pwrapTransformCtor0(lua_State* l)
  3426. {
  3427. [[maybe_unused]] LuaUserData* ud;
  3428. [[maybe_unused]] void* voidp;
  3429. [[maybe_unused]] PtrSize size;
  3430. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  3431. {
  3432. return -1;
  3433. }
  3434. // Create user data
  3435. size = LuaUserData::computeSizeForGarbageCollected<Transform>();
  3436. voidp = lua_newuserdata(l, size);
  3437. luaL_setmetatable(l, luaUserDataTypeInfoTransform.m_typeName);
  3438. ud = static_cast<LuaUserData*>(voidp);
  3439. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3440. ud->initGarbageCollected(&luaUserDataTypeInfoTransform);
  3441. ::new(ud->getData<Transform>()) Transform();
  3442. return 1;
  3443. }
  3444. /// Pre-wrap constructor for Transform.
  3445. static inline int pwrapTransformCtor1(lua_State* l)
  3446. {
  3447. [[maybe_unused]] LuaUserData* ud;
  3448. [[maybe_unused]] void* voidp;
  3449. [[maybe_unused]] PtrSize size;
  3450. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  3451. {
  3452. return -1;
  3453. }
  3454. // Pop arguments
  3455. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3456. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  3457. {
  3458. return -1;
  3459. }
  3460. Vec4* iarg0 = ud->getData<Vec4>();
  3461. Vec4 arg0(*iarg0);
  3462. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3463. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3464. {
  3465. return -1;
  3466. }
  3467. Mat3x4* iarg1 = ud->getData<Mat3x4>();
  3468. Mat3x4 arg1(*iarg1);
  3469. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3470. if(LuaBinder::checkUserData(l, 3, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  3471. {
  3472. return -1;
  3473. }
  3474. Vec4* iarg2 = ud->getData<Vec4>();
  3475. Vec4 arg2(*iarg2);
  3476. // Create user data
  3477. size = LuaUserData::computeSizeForGarbageCollected<Transform>();
  3478. voidp = lua_newuserdata(l, size);
  3479. luaL_setmetatable(l, luaUserDataTypeInfoTransform.m_typeName);
  3480. ud = static_cast<LuaUserData*>(voidp);
  3481. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3482. ud->initGarbageCollected(&luaUserDataTypeInfoTransform);
  3483. ::new(ud->getData<Transform>()) Transform(arg0, arg1, arg2);
  3484. return 1;
  3485. }
  3486. /// Wrap constructors for Transform.
  3487. static int wrapTransformCtor(lua_State* l)
  3488. {
  3489. // Chose the right overload
  3490. const int argCount = lua_gettop(l);
  3491. int res = 0;
  3492. switch(argCount)
  3493. {
  3494. case 0:
  3495. res = pwrapTransformCtor0(l);
  3496. break;
  3497. case 3:
  3498. res = pwrapTransformCtor1(l);
  3499. break;
  3500. default:
  3501. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  3502. res = -1;
  3503. }
  3504. if(res >= 0)
  3505. {
  3506. return res;
  3507. }
  3508. lua_error(l);
  3509. return 0;
  3510. }
  3511. /// Wrap destructor for Transform.
  3512. static int wrapTransformDtor(lua_State* l)
  3513. {
  3514. [[maybe_unused]] LuaUserData* ud;
  3515. [[maybe_unused]] void* voidp;
  3516. [[maybe_unused]] PtrSize size;
  3517. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3518. {
  3519. return -1;
  3520. }
  3521. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud)) [[unlikely]]
  3522. {
  3523. return -1;
  3524. }
  3525. if(ud->isGarbageCollected())
  3526. {
  3527. Transform* inst = ud->getData<Transform>();
  3528. inst->~Transform();
  3529. }
  3530. return 0;
  3531. }
  3532. /// Pre-wrap method Transform::operator=.
  3533. static inline int pwrapTransformcopy(lua_State* l)
  3534. {
  3535. [[maybe_unused]] LuaUserData* ud;
  3536. [[maybe_unused]] void* voidp;
  3537. [[maybe_unused]] PtrSize size;
  3538. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3539. {
  3540. return -1;
  3541. }
  3542. // Get "this" as "self"
  3543. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3544. {
  3545. return -1;
  3546. }
  3547. Transform* self = ud->getData<Transform>();
  3548. // Pop arguments
  3549. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3550. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoTransform, ud)) [[unlikely]]
  3551. {
  3552. return -1;
  3553. }
  3554. Transform* iarg0 = ud->getData<Transform>();
  3555. const Transform& arg0(*iarg0);
  3556. // Call the method
  3557. self->operator=(arg0);
  3558. return 0;
  3559. }
  3560. /// Wrap method Transform::operator=.
  3561. static int wrapTransformcopy(lua_State* l)
  3562. {
  3563. int res = pwrapTransformcopy(l);
  3564. if(res >= 0)
  3565. {
  3566. return res;
  3567. }
  3568. lua_error(l);
  3569. return 0;
  3570. }
  3571. /// Pre-wrap method Transform::getOrigin.
  3572. static inline int pwrapTransformgetOrigin(lua_State* l)
  3573. {
  3574. [[maybe_unused]] LuaUserData* ud;
  3575. [[maybe_unused]] void* voidp;
  3576. [[maybe_unused]] PtrSize size;
  3577. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3578. {
  3579. return -1;
  3580. }
  3581. // Get "this" as "self"
  3582. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3583. {
  3584. return -1;
  3585. }
  3586. Transform* self = ud->getData<Transform>();
  3587. // Call the method
  3588. Vec4 ret = self->getOrigin();
  3589. // Push return value
  3590. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  3591. voidp = lua_newuserdata(l, size);
  3592. luaL_setmetatable(l, "Vec4");
  3593. ud = static_cast<LuaUserData*>(voidp);
  3594. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3595. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  3596. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  3597. return 1;
  3598. }
  3599. /// Wrap method Transform::getOrigin.
  3600. static int wrapTransformgetOrigin(lua_State* l)
  3601. {
  3602. int res = pwrapTransformgetOrigin(l);
  3603. if(res >= 0)
  3604. {
  3605. return res;
  3606. }
  3607. lua_error(l);
  3608. return 0;
  3609. }
  3610. /// Pre-wrap method Transform::setOrigin.
  3611. static inline int pwrapTransformsetOrigin(lua_State* l)
  3612. {
  3613. [[maybe_unused]] LuaUserData* ud;
  3614. [[maybe_unused]] void* voidp;
  3615. [[maybe_unused]] PtrSize size;
  3616. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3617. {
  3618. return -1;
  3619. }
  3620. // Get "this" as "self"
  3621. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3622. {
  3623. return -1;
  3624. }
  3625. Transform* self = ud->getData<Transform>();
  3626. // Pop arguments
  3627. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3628. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  3629. {
  3630. return -1;
  3631. }
  3632. Vec4* iarg0 = ud->getData<Vec4>();
  3633. const Vec4& arg0(*iarg0);
  3634. // Call the method
  3635. self->setOrigin(arg0);
  3636. return 0;
  3637. }
  3638. /// Wrap method Transform::setOrigin.
  3639. static int wrapTransformsetOrigin(lua_State* l)
  3640. {
  3641. int res = pwrapTransformsetOrigin(l);
  3642. if(res >= 0)
  3643. {
  3644. return res;
  3645. }
  3646. lua_error(l);
  3647. return 0;
  3648. }
  3649. /// Pre-wrap method Transform::getRotation.
  3650. static inline int pwrapTransformgetRotation(lua_State* l)
  3651. {
  3652. [[maybe_unused]] LuaUserData* ud;
  3653. [[maybe_unused]] void* voidp;
  3654. [[maybe_unused]] PtrSize size;
  3655. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3656. {
  3657. return -1;
  3658. }
  3659. // Get "this" as "self"
  3660. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3661. {
  3662. return -1;
  3663. }
  3664. Transform* self = ud->getData<Transform>();
  3665. // Call the method
  3666. Mat3x4 ret = self->getRotation();
  3667. // Push return value
  3668. size = LuaUserData::computeSizeForGarbageCollected<Mat3x4>();
  3669. voidp = lua_newuserdata(l, size);
  3670. luaL_setmetatable(l, "Mat3x4");
  3671. ud = static_cast<LuaUserData*>(voidp);
  3672. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3673. ud->initGarbageCollected(&luaUserDataTypeInfoMat3x4);
  3674. ::new(ud->getData<Mat3x4>()) Mat3x4(std::move(ret));
  3675. return 1;
  3676. }
  3677. /// Wrap method Transform::getRotation.
  3678. static int wrapTransformgetRotation(lua_State* l)
  3679. {
  3680. int res = pwrapTransformgetRotation(l);
  3681. if(res >= 0)
  3682. {
  3683. return res;
  3684. }
  3685. lua_error(l);
  3686. return 0;
  3687. }
  3688. /// Pre-wrap method Transform::setRotation.
  3689. static inline int pwrapTransformsetRotation(lua_State* l)
  3690. {
  3691. [[maybe_unused]] LuaUserData* ud;
  3692. [[maybe_unused]] void* voidp;
  3693. [[maybe_unused]] PtrSize size;
  3694. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3695. {
  3696. return -1;
  3697. }
  3698. // Get "this" as "self"
  3699. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3700. {
  3701. return -1;
  3702. }
  3703. Transform* self = ud->getData<Transform>();
  3704. // Pop arguments
  3705. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3706. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3707. {
  3708. return -1;
  3709. }
  3710. Mat3x4* iarg0 = ud->getData<Mat3x4>();
  3711. const Mat3x4& arg0(*iarg0);
  3712. // Call the method
  3713. self->setRotation(arg0);
  3714. return 0;
  3715. }
  3716. /// Wrap method Transform::setRotation.
  3717. static int wrapTransformsetRotation(lua_State* l)
  3718. {
  3719. int res = pwrapTransformsetRotation(l);
  3720. if(res >= 0)
  3721. {
  3722. return res;
  3723. }
  3724. lua_error(l);
  3725. return 0;
  3726. }
  3727. /// Pre-wrap method Transform::getScale.
  3728. static inline int pwrapTransformgetScale(lua_State* l)
  3729. {
  3730. [[maybe_unused]] LuaUserData* ud;
  3731. [[maybe_unused]] void* voidp;
  3732. [[maybe_unused]] PtrSize size;
  3733. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3734. {
  3735. return -1;
  3736. }
  3737. // Get "this" as "self"
  3738. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3739. {
  3740. return -1;
  3741. }
  3742. Transform* self = ud->getData<Transform>();
  3743. // Call the method
  3744. Vec4 ret = self->getScale();
  3745. // Push return value
  3746. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  3747. voidp = lua_newuserdata(l, size);
  3748. luaL_setmetatable(l, "Vec4");
  3749. ud = static_cast<LuaUserData*>(voidp);
  3750. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3751. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  3752. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  3753. return 1;
  3754. }
  3755. /// Wrap method Transform::getScale.
  3756. static int wrapTransformgetScale(lua_State* l)
  3757. {
  3758. int res = pwrapTransformgetScale(l);
  3759. if(res >= 0)
  3760. {
  3761. return res;
  3762. }
  3763. lua_error(l);
  3764. return 0;
  3765. }
  3766. /// Pre-wrap method Transform::setScale.
  3767. static inline int pwrapTransformsetScale(lua_State* l)
  3768. {
  3769. [[maybe_unused]] LuaUserData* ud;
  3770. [[maybe_unused]] void* voidp;
  3771. [[maybe_unused]] PtrSize size;
  3772. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3773. {
  3774. return -1;
  3775. }
  3776. // Get "this" as "self"
  3777. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3778. {
  3779. return -1;
  3780. }
  3781. Transform* self = ud->getData<Transform>();
  3782. // Pop arguments
  3783. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  3784. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  3785. {
  3786. return -1;
  3787. }
  3788. Vec4* iarg0 = ud->getData<Vec4>();
  3789. const Vec4& arg0(*iarg0);
  3790. // Call the method
  3791. self->setScale(arg0);
  3792. return 0;
  3793. }
  3794. /// Wrap method Transform::setScale.
  3795. static int wrapTransformsetScale(lua_State* l)
  3796. {
  3797. int res = pwrapTransformsetScale(l);
  3798. if(res >= 0)
  3799. {
  3800. return res;
  3801. }
  3802. lua_error(l);
  3803. return 0;
  3804. }
  3805. /// Wrap class Transform.
  3806. static inline void wrapTransform(lua_State* l)
  3807. {
  3808. LuaBinder::createClass(l, &luaUserDataTypeInfoTransform);
  3809. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoTransform.m_typeName, "new", wrapTransformCtor);
  3810. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapTransformDtor);
  3811. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapTransformcopy);
  3812. LuaBinder::pushLuaCFuncMethod(l, "getOrigin", wrapTransformgetOrigin);
  3813. LuaBinder::pushLuaCFuncMethod(l, "setOrigin", wrapTransformsetOrigin);
  3814. LuaBinder::pushLuaCFuncMethod(l, "getRotation", wrapTransformgetRotation);
  3815. LuaBinder::pushLuaCFuncMethod(l, "setRotation", wrapTransformsetRotation);
  3816. LuaBinder::pushLuaCFuncMethod(l, "getScale", wrapTransformgetScale);
  3817. LuaBinder::pushLuaCFuncMethod(l, "setScale", wrapTransformsetScale);
  3818. lua_settop(l, 0);
  3819. }
  3820. /// Pre-wrap function toRad.
  3821. static inline int pwraptoRad(lua_State* l)
  3822. {
  3823. [[maybe_unused]] LuaUserData* ud;
  3824. [[maybe_unused]] void* voidp;
  3825. [[maybe_unused]] PtrSize size;
  3826. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3827. {
  3828. return -1;
  3829. }
  3830. // Pop arguments
  3831. F32 arg0;
  3832. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  3833. {
  3834. return -1;
  3835. }
  3836. // Call the function
  3837. F32 ret = toRad(arg0);
  3838. // Push return value
  3839. lua_pushnumber(l, lua_Number(ret));
  3840. return 1;
  3841. }
  3842. /// Wrap function toRad.
  3843. static int wraptoRad(lua_State* l)
  3844. {
  3845. int res = pwraptoRad(l);
  3846. if(res >= 0)
  3847. {
  3848. return res;
  3849. }
  3850. lua_error(l);
  3851. return 0;
  3852. }
  3853. /// Wrap the module.
  3854. void wrapModuleMath(lua_State* l)
  3855. {
  3856. wrapVec2(l);
  3857. wrapVec3(l);
  3858. wrapVec4(l);
  3859. wrapMat3(l);
  3860. wrapMat3x4(l);
  3861. wrapTransform(l);
  3862. LuaBinder::pushLuaCFunc(l, "toRad", wraptoRad);
  3863. }
  3864. } // end namespace anki