Math.cpp 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633
  1. // Copyright (C) 2009-present, 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 = {7646200881744055672, "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::length.
  659. static inline int pwrapVec2length(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->length();
  676. // Push return value
  677. lua_pushnumber(l, lua_Number(ret));
  678. return 1;
  679. }
  680. /// Wrap method Vec2::length.
  681. static int wrapVec2length(lua_State* l)
  682. {
  683. int res = pwrapVec2length(l);
  684. if(res >= 0)
  685. {
  686. return res;
  687. }
  688. lua_error(l);
  689. return 0;
  690. }
  691. /// Pre-wrap method Vec2::normalize.
  692. static inline int pwrapVec2normalize(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->normalize();
  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::normalize.
  720. static int wrapVec2normalize(lua_State* l)
  721. {
  722. int res = pwrapVec2normalize(l);
  723. if(res >= 0)
  724. {
  725. return res;
  726. }
  727. lua_error(l);
  728. return 0;
  729. }
  730. /// Pre-wrap method Vec2::dot.
  731. static inline int pwrapVec2dot(lua_State* l)
  732. {
  733. [[maybe_unused]] LuaUserData* ud;
  734. [[maybe_unused]] void* voidp;
  735. [[maybe_unused]] PtrSize size;
  736. if(LuaBinder::checkArgsCount(l, 2)) [[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. // Pop arguments
  747. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec2;
  748. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec2, ud)) [[unlikely]]
  749. {
  750. return -1;
  751. }
  752. Vec2* iarg0 = ud->getData<Vec2>();
  753. const Vec2& arg0(*iarg0);
  754. // Call the method
  755. F32 ret = self->dot(arg0);
  756. // Push return value
  757. lua_pushnumber(l, lua_Number(ret));
  758. return 1;
  759. }
  760. /// Wrap method Vec2::dot.
  761. static int wrapVec2dot(lua_State* l)
  762. {
  763. int res = pwrapVec2dot(l);
  764. if(res >= 0)
  765. {
  766. return res;
  767. }
  768. lua_error(l);
  769. return 0;
  770. }
  771. /// Wrap class Vec2.
  772. static inline void wrapVec2(lua_State* l)
  773. {
  774. LuaBinder::createClass(l, &luaUserDataTypeInfoVec2);
  775. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec2.m_typeName, "new", wrapVec2Ctor);
  776. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec2Dtor);
  777. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec2getX);
  778. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec2getY);
  779. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec2setX);
  780. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec2setY);
  781. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec2setAll);
  782. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec2getAt);
  783. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec2setAt);
  784. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec2copy);
  785. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec2__add);
  786. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec2__sub);
  787. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec2__mul);
  788. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec2__div);
  789. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec2__eq);
  790. LuaBinder::pushLuaCFuncMethod(l, "length", wrapVec2length);
  791. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec2normalize);
  792. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec2dot);
  793. lua_settop(l, 0);
  794. }
  795. /// Serialize Vec3
  796. static void serializeVec3(LuaUserData& self, void* data, PtrSize& size)
  797. {
  798. Vec3* obj = self.getData<Vec3>();
  799. obj->serialize(data, size);
  800. }
  801. /// De-serialize Vec3
  802. static void deserializeVec3(const void* data, LuaUserData& self)
  803. {
  804. ANKI_ASSERT(data);
  805. Vec3* obj = self.getData<Vec3>();
  806. ::new(obj) Vec3();
  807. obj->deserialize(data);
  808. }
  809. LuaUserDataTypeInfo luaUserDataTypeInfoVec3 = {7123097970105283442, "Vec3", LuaUserData::computeSizeForGarbageCollected<Vec3>(), serializeVec3,
  810. deserializeVec3};
  811. template<>
  812. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Vec3>()
  813. {
  814. return luaUserDataTypeInfoVec3;
  815. }
  816. /// Pre-wrap constructor for Vec3.
  817. static inline int pwrapVec3Ctor0(lua_State* l)
  818. {
  819. [[maybe_unused]] LuaUserData* ud;
  820. [[maybe_unused]] void* voidp;
  821. [[maybe_unused]] PtrSize size;
  822. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  823. {
  824. return -1;
  825. }
  826. // Create user data
  827. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  828. voidp = lua_newuserdata(l, size);
  829. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  830. ud = static_cast<LuaUserData*>(voidp);
  831. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  832. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  833. ::new(ud->getData<Vec3>()) Vec3();
  834. return 1;
  835. }
  836. /// Pre-wrap constructor for Vec3.
  837. static inline int pwrapVec3Ctor1(lua_State* l)
  838. {
  839. [[maybe_unused]] LuaUserData* ud;
  840. [[maybe_unused]] void* voidp;
  841. [[maybe_unused]] PtrSize size;
  842. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  843. {
  844. return -1;
  845. }
  846. // Pop arguments
  847. F32 arg0;
  848. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  849. {
  850. return -1;
  851. }
  852. // Create user data
  853. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  854. voidp = lua_newuserdata(l, size);
  855. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  856. ud = static_cast<LuaUserData*>(voidp);
  857. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  858. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  859. ::new(ud->getData<Vec3>()) Vec3(arg0);
  860. return 1;
  861. }
  862. /// Pre-wrap constructor for Vec3.
  863. static inline int pwrapVec3Ctor2(lua_State* l)
  864. {
  865. [[maybe_unused]] LuaUserData* ud;
  866. [[maybe_unused]] void* voidp;
  867. [[maybe_unused]] PtrSize size;
  868. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  869. {
  870. return -1;
  871. }
  872. // Pop arguments
  873. F32 arg0;
  874. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  875. {
  876. return -1;
  877. }
  878. F32 arg1;
  879. if(LuaBinder::checkNumber(l, 2, arg1)) [[unlikely]]
  880. {
  881. return -1;
  882. }
  883. F32 arg2;
  884. if(LuaBinder::checkNumber(l, 3, arg2)) [[unlikely]]
  885. {
  886. return -1;
  887. }
  888. // Create user data
  889. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  890. voidp = lua_newuserdata(l, size);
  891. luaL_setmetatable(l, luaUserDataTypeInfoVec3.m_typeName);
  892. ud = static_cast<LuaUserData*>(voidp);
  893. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  894. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  895. ::new(ud->getData<Vec3>()) Vec3(arg0, arg1, arg2);
  896. return 1;
  897. }
  898. /// Wrap constructors for Vec3.
  899. static int wrapVec3Ctor(lua_State* l)
  900. {
  901. // Chose the right overload
  902. const int argCount = lua_gettop(l);
  903. int res = 0;
  904. switch(argCount)
  905. {
  906. case 0:
  907. res = pwrapVec3Ctor0(l);
  908. break;
  909. case 1:
  910. res = pwrapVec3Ctor1(l);
  911. break;
  912. case 3:
  913. res = pwrapVec3Ctor2(l);
  914. break;
  915. default:
  916. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  917. res = -1;
  918. }
  919. if(res >= 0)
  920. {
  921. return res;
  922. }
  923. lua_error(l);
  924. return 0;
  925. }
  926. /// Wrap destructor for Vec3.
  927. static int wrapVec3Dtor(lua_State* l)
  928. {
  929. [[maybe_unused]] LuaUserData* ud;
  930. [[maybe_unused]] void* voidp;
  931. [[maybe_unused]] PtrSize size;
  932. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  933. {
  934. return -1;
  935. }
  936. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  937. {
  938. return -1;
  939. }
  940. if(ud->isGarbageCollected())
  941. {
  942. Vec3* inst = ud->getData<Vec3>();
  943. inst->~Vec3();
  944. }
  945. return 0;
  946. }
  947. /// Pre-wrap method Vec3::getX.
  948. static inline int pwrapVec3getX(lua_State* l)
  949. {
  950. [[maybe_unused]] LuaUserData* ud;
  951. [[maybe_unused]] void* voidp;
  952. [[maybe_unused]] PtrSize size;
  953. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  954. {
  955. return -1;
  956. }
  957. // Get "this" as "self"
  958. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  959. {
  960. return -1;
  961. }
  962. Vec3* self = ud->getData<Vec3>();
  963. // Call the method
  964. F32 ret = (*self).x();
  965. // Push return value
  966. lua_pushnumber(l, lua_Number(ret));
  967. return 1;
  968. }
  969. /// Wrap method Vec3::getX.
  970. static int wrapVec3getX(lua_State* l)
  971. {
  972. int res = pwrapVec3getX(l);
  973. if(res >= 0)
  974. {
  975. return res;
  976. }
  977. lua_error(l);
  978. return 0;
  979. }
  980. /// Pre-wrap method Vec3::getY.
  981. static inline int pwrapVec3getY(lua_State* l)
  982. {
  983. [[maybe_unused]] LuaUserData* ud;
  984. [[maybe_unused]] void* voidp;
  985. [[maybe_unused]] PtrSize size;
  986. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  987. {
  988. return -1;
  989. }
  990. // Get "this" as "self"
  991. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  992. {
  993. return -1;
  994. }
  995. Vec3* self = ud->getData<Vec3>();
  996. // Call the method
  997. F32 ret = (*self).y();
  998. // Push return value
  999. lua_pushnumber(l, lua_Number(ret));
  1000. return 1;
  1001. }
  1002. /// Wrap method Vec3::getY.
  1003. static int wrapVec3getY(lua_State* l)
  1004. {
  1005. int res = pwrapVec3getY(l);
  1006. if(res >= 0)
  1007. {
  1008. return res;
  1009. }
  1010. lua_error(l);
  1011. return 0;
  1012. }
  1013. /// Pre-wrap method Vec3::getZ.
  1014. static inline int pwrapVec3getZ(lua_State* l)
  1015. {
  1016. [[maybe_unused]] LuaUserData* ud;
  1017. [[maybe_unused]] void* voidp;
  1018. [[maybe_unused]] PtrSize size;
  1019. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1020. {
  1021. return -1;
  1022. }
  1023. // Get "this" as "self"
  1024. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1025. {
  1026. return -1;
  1027. }
  1028. Vec3* self = ud->getData<Vec3>();
  1029. // Call the method
  1030. F32 ret = (*self).z();
  1031. // Push return value
  1032. lua_pushnumber(l, lua_Number(ret));
  1033. return 1;
  1034. }
  1035. /// Wrap method Vec3::getZ.
  1036. static int wrapVec3getZ(lua_State* l)
  1037. {
  1038. int res = pwrapVec3getZ(l);
  1039. if(res >= 0)
  1040. {
  1041. return res;
  1042. }
  1043. lua_error(l);
  1044. return 0;
  1045. }
  1046. /// Pre-wrap method Vec3::setX.
  1047. static inline int pwrapVec3setX(lua_State* l)
  1048. {
  1049. [[maybe_unused]] LuaUserData* ud;
  1050. [[maybe_unused]] void* voidp;
  1051. [[maybe_unused]] PtrSize size;
  1052. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1053. {
  1054. return -1;
  1055. }
  1056. // Get "this" as "self"
  1057. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1058. {
  1059. return -1;
  1060. }
  1061. Vec3* self = ud->getData<Vec3>();
  1062. // Pop arguments
  1063. F32 arg0;
  1064. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1065. {
  1066. return -1;
  1067. }
  1068. // Call the method
  1069. (*self).x() = arg0;
  1070. return 0;
  1071. }
  1072. /// Wrap method Vec3::setX.
  1073. static int wrapVec3setX(lua_State* l)
  1074. {
  1075. int res = pwrapVec3setX(l);
  1076. if(res >= 0)
  1077. {
  1078. return res;
  1079. }
  1080. lua_error(l);
  1081. return 0;
  1082. }
  1083. /// Pre-wrap method Vec3::setY.
  1084. static inline int pwrapVec3setY(lua_State* l)
  1085. {
  1086. [[maybe_unused]] LuaUserData* ud;
  1087. [[maybe_unused]] void* voidp;
  1088. [[maybe_unused]] PtrSize size;
  1089. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1090. {
  1091. return -1;
  1092. }
  1093. // Get "this" as "self"
  1094. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1095. {
  1096. return -1;
  1097. }
  1098. Vec3* self = ud->getData<Vec3>();
  1099. // Pop arguments
  1100. F32 arg0;
  1101. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1102. {
  1103. return -1;
  1104. }
  1105. // Call the method
  1106. (*self).y() = arg0;
  1107. return 0;
  1108. }
  1109. /// Wrap method Vec3::setY.
  1110. static int wrapVec3setY(lua_State* l)
  1111. {
  1112. int res = pwrapVec3setY(l);
  1113. if(res >= 0)
  1114. {
  1115. return res;
  1116. }
  1117. lua_error(l);
  1118. return 0;
  1119. }
  1120. /// Pre-wrap method Vec3::setZ.
  1121. static inline int pwrapVec3setZ(lua_State* l)
  1122. {
  1123. [[maybe_unused]] LuaUserData* ud;
  1124. [[maybe_unused]] void* voidp;
  1125. [[maybe_unused]] PtrSize size;
  1126. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1127. {
  1128. return -1;
  1129. }
  1130. // Get "this" as "self"
  1131. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1132. {
  1133. return -1;
  1134. }
  1135. Vec3* self = ud->getData<Vec3>();
  1136. // Pop arguments
  1137. F32 arg0;
  1138. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1139. {
  1140. return -1;
  1141. }
  1142. // Call the method
  1143. (*self).z() = arg0;
  1144. return 0;
  1145. }
  1146. /// Wrap method Vec3::setZ.
  1147. static int wrapVec3setZ(lua_State* l)
  1148. {
  1149. int res = pwrapVec3setZ(l);
  1150. if(res >= 0)
  1151. {
  1152. return res;
  1153. }
  1154. lua_error(l);
  1155. return 0;
  1156. }
  1157. /// Pre-wrap method Vec3::setAll.
  1158. static inline int pwrapVec3setAll(lua_State* l)
  1159. {
  1160. [[maybe_unused]] LuaUserData* ud;
  1161. [[maybe_unused]] void* voidp;
  1162. [[maybe_unused]] PtrSize size;
  1163. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  1164. {
  1165. return -1;
  1166. }
  1167. // Get "this" as "self"
  1168. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1169. {
  1170. return -1;
  1171. }
  1172. Vec3* self = ud->getData<Vec3>();
  1173. // Pop arguments
  1174. F32 arg0;
  1175. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1176. {
  1177. return -1;
  1178. }
  1179. F32 arg1;
  1180. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  1181. {
  1182. return -1;
  1183. }
  1184. F32 arg2;
  1185. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  1186. {
  1187. return -1;
  1188. }
  1189. // Call the method
  1190. (*self) = Vec3(arg0, arg1, arg2);
  1191. return 0;
  1192. }
  1193. /// Wrap method Vec3::setAll.
  1194. static int wrapVec3setAll(lua_State* l)
  1195. {
  1196. int res = pwrapVec3setAll(l);
  1197. if(res >= 0)
  1198. {
  1199. return res;
  1200. }
  1201. lua_error(l);
  1202. return 0;
  1203. }
  1204. /// Pre-wrap method Vec3::getAt.
  1205. static inline int pwrapVec3getAt(lua_State* l)
  1206. {
  1207. [[maybe_unused]] LuaUserData* ud;
  1208. [[maybe_unused]] void* voidp;
  1209. [[maybe_unused]] PtrSize size;
  1210. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1211. {
  1212. return -1;
  1213. }
  1214. // Get "this" as "self"
  1215. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1216. {
  1217. return -1;
  1218. }
  1219. Vec3* self = ud->getData<Vec3>();
  1220. // Pop arguments
  1221. U arg0;
  1222. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1223. {
  1224. return -1;
  1225. }
  1226. // Call the method
  1227. F32 ret = (*self)[arg0];
  1228. // Push return value
  1229. lua_pushnumber(l, lua_Number(ret));
  1230. return 1;
  1231. }
  1232. /// Wrap method Vec3::getAt.
  1233. static int wrapVec3getAt(lua_State* l)
  1234. {
  1235. int res = pwrapVec3getAt(l);
  1236. if(res >= 0)
  1237. {
  1238. return res;
  1239. }
  1240. lua_error(l);
  1241. return 0;
  1242. }
  1243. /// Pre-wrap method Vec3::setAt.
  1244. static inline int pwrapVec3setAt(lua_State* l)
  1245. {
  1246. [[maybe_unused]] LuaUserData* ud;
  1247. [[maybe_unused]] void* voidp;
  1248. [[maybe_unused]] PtrSize size;
  1249. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  1250. {
  1251. return -1;
  1252. }
  1253. // Get "this" as "self"
  1254. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1255. {
  1256. return -1;
  1257. }
  1258. Vec3* self = ud->getData<Vec3>();
  1259. // Pop arguments
  1260. U arg0;
  1261. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  1262. {
  1263. return -1;
  1264. }
  1265. F32 arg1;
  1266. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  1267. {
  1268. return -1;
  1269. }
  1270. // Call the method
  1271. (*self)[arg0] = arg1;
  1272. return 0;
  1273. }
  1274. /// Wrap method Vec3::setAt.
  1275. static int wrapVec3setAt(lua_State* l)
  1276. {
  1277. int res = pwrapVec3setAt(l);
  1278. if(res >= 0)
  1279. {
  1280. return res;
  1281. }
  1282. lua_error(l);
  1283. return 0;
  1284. }
  1285. /// Pre-wrap method Vec3::operator=.
  1286. static inline int pwrapVec3copy(lua_State* l)
  1287. {
  1288. [[maybe_unused]] LuaUserData* ud;
  1289. [[maybe_unused]] void* voidp;
  1290. [[maybe_unused]] PtrSize size;
  1291. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1292. {
  1293. return -1;
  1294. }
  1295. // Get "this" as "self"
  1296. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1297. {
  1298. return -1;
  1299. }
  1300. Vec3* self = ud->getData<Vec3>();
  1301. // Pop arguments
  1302. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1303. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1304. {
  1305. return -1;
  1306. }
  1307. Vec3* iarg0 = ud->getData<Vec3>();
  1308. const Vec3& arg0(*iarg0);
  1309. // Call the method
  1310. self->operator=(arg0);
  1311. return 0;
  1312. }
  1313. /// Wrap method Vec3::operator=.
  1314. static int wrapVec3copy(lua_State* l)
  1315. {
  1316. int res = pwrapVec3copy(l);
  1317. if(res >= 0)
  1318. {
  1319. return res;
  1320. }
  1321. lua_error(l);
  1322. return 0;
  1323. }
  1324. /// Pre-wrap method Vec3::operator+.
  1325. static inline int pwrapVec3__add(lua_State* l)
  1326. {
  1327. [[maybe_unused]] LuaUserData* ud;
  1328. [[maybe_unused]] void* voidp;
  1329. [[maybe_unused]] PtrSize size;
  1330. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1331. {
  1332. return -1;
  1333. }
  1334. // Get "this" as "self"
  1335. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1336. {
  1337. return -1;
  1338. }
  1339. Vec3* self = ud->getData<Vec3>();
  1340. // Pop arguments
  1341. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1342. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1343. {
  1344. return -1;
  1345. }
  1346. Vec3* iarg0 = ud->getData<Vec3>();
  1347. const Vec3& arg0(*iarg0);
  1348. // Call the method
  1349. Vec3 ret = self->operator+(arg0);
  1350. // Push return value
  1351. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1352. voidp = lua_newuserdata(l, size);
  1353. luaL_setmetatable(l, "Vec3");
  1354. ud = static_cast<LuaUserData*>(voidp);
  1355. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1356. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1357. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1358. return 1;
  1359. }
  1360. /// Wrap method Vec3::operator+.
  1361. static int wrapVec3__add(lua_State* l)
  1362. {
  1363. int res = pwrapVec3__add(l);
  1364. if(res >= 0)
  1365. {
  1366. return res;
  1367. }
  1368. lua_error(l);
  1369. return 0;
  1370. }
  1371. /// Pre-wrap method Vec3::operator-.
  1372. static inline int pwrapVec3__sub(lua_State* l)
  1373. {
  1374. [[maybe_unused]] LuaUserData* ud;
  1375. [[maybe_unused]] void* voidp;
  1376. [[maybe_unused]] PtrSize size;
  1377. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1378. {
  1379. return -1;
  1380. }
  1381. // Get "this" as "self"
  1382. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1383. {
  1384. return -1;
  1385. }
  1386. Vec3* self = ud->getData<Vec3>();
  1387. // Pop arguments
  1388. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1389. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1390. {
  1391. return -1;
  1392. }
  1393. Vec3* iarg0 = ud->getData<Vec3>();
  1394. const Vec3& arg0(*iarg0);
  1395. // Call the method
  1396. Vec3 ret = self->operator-(arg0);
  1397. // Push return value
  1398. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1399. voidp = lua_newuserdata(l, size);
  1400. luaL_setmetatable(l, "Vec3");
  1401. ud = static_cast<LuaUserData*>(voidp);
  1402. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1403. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1404. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1405. return 1;
  1406. }
  1407. /// Wrap method Vec3::operator-.
  1408. static int wrapVec3__sub(lua_State* l)
  1409. {
  1410. int res = pwrapVec3__sub(l);
  1411. if(res >= 0)
  1412. {
  1413. return res;
  1414. }
  1415. lua_error(l);
  1416. return 0;
  1417. }
  1418. /// Pre-wrap method Vec3::operator*.
  1419. static inline int pwrapVec3__mul(lua_State* l)
  1420. {
  1421. [[maybe_unused]] LuaUserData* ud;
  1422. [[maybe_unused]] void* voidp;
  1423. [[maybe_unused]] PtrSize size;
  1424. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1425. {
  1426. return -1;
  1427. }
  1428. // Get "this" as "self"
  1429. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1430. {
  1431. return -1;
  1432. }
  1433. Vec3* self = ud->getData<Vec3>();
  1434. // Pop arguments
  1435. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1436. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1437. {
  1438. return -1;
  1439. }
  1440. Vec3* iarg0 = ud->getData<Vec3>();
  1441. const Vec3& arg0(*iarg0);
  1442. // Call the method
  1443. Vec3 ret = self->operator*(arg0);
  1444. // Push return value
  1445. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1446. voidp = lua_newuserdata(l, size);
  1447. luaL_setmetatable(l, "Vec3");
  1448. ud = static_cast<LuaUserData*>(voidp);
  1449. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1450. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1451. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1452. return 1;
  1453. }
  1454. /// Wrap method Vec3::operator*.
  1455. static int wrapVec3__mul(lua_State* l)
  1456. {
  1457. int res = pwrapVec3__mul(l);
  1458. if(res >= 0)
  1459. {
  1460. return res;
  1461. }
  1462. lua_error(l);
  1463. return 0;
  1464. }
  1465. /// Pre-wrap method Vec3::operator/.
  1466. static inline int pwrapVec3__div(lua_State* l)
  1467. {
  1468. [[maybe_unused]] LuaUserData* ud;
  1469. [[maybe_unused]] void* voidp;
  1470. [[maybe_unused]] PtrSize size;
  1471. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1472. {
  1473. return -1;
  1474. }
  1475. // Get "this" as "self"
  1476. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1477. {
  1478. return -1;
  1479. }
  1480. Vec3* self = ud->getData<Vec3>();
  1481. // Pop arguments
  1482. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1483. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1484. {
  1485. return -1;
  1486. }
  1487. Vec3* iarg0 = ud->getData<Vec3>();
  1488. const Vec3& arg0(*iarg0);
  1489. // Call the method
  1490. Vec3 ret = self->operator/(arg0);
  1491. // Push return value
  1492. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1493. voidp = lua_newuserdata(l, size);
  1494. luaL_setmetatable(l, "Vec3");
  1495. ud = static_cast<LuaUserData*>(voidp);
  1496. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1497. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1498. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1499. return 1;
  1500. }
  1501. /// Wrap method Vec3::operator/.
  1502. static int wrapVec3__div(lua_State* l)
  1503. {
  1504. int res = pwrapVec3__div(l);
  1505. if(res >= 0)
  1506. {
  1507. return res;
  1508. }
  1509. lua_error(l);
  1510. return 0;
  1511. }
  1512. /// Pre-wrap method Vec3::operator==.
  1513. static inline int pwrapVec3__eq(lua_State* l)
  1514. {
  1515. [[maybe_unused]] LuaUserData* ud;
  1516. [[maybe_unused]] void* voidp;
  1517. [[maybe_unused]] PtrSize size;
  1518. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1519. {
  1520. return -1;
  1521. }
  1522. // Get "this" as "self"
  1523. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1524. {
  1525. return -1;
  1526. }
  1527. Vec3* self = ud->getData<Vec3>();
  1528. // Pop arguments
  1529. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1530. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1531. {
  1532. return -1;
  1533. }
  1534. Vec3* iarg0 = ud->getData<Vec3>();
  1535. const Vec3& arg0(*iarg0);
  1536. // Call the method
  1537. Bool ret = self->operator==(arg0);
  1538. // Push return value
  1539. lua_pushboolean(l, ret);
  1540. return 1;
  1541. }
  1542. /// Wrap method Vec3::operator==.
  1543. static int wrapVec3__eq(lua_State* l)
  1544. {
  1545. int res = pwrapVec3__eq(l);
  1546. if(res >= 0)
  1547. {
  1548. return res;
  1549. }
  1550. lua_error(l);
  1551. return 0;
  1552. }
  1553. /// Pre-wrap method Vec3::length.
  1554. static inline int pwrapVec3length(lua_State* l)
  1555. {
  1556. [[maybe_unused]] LuaUserData* ud;
  1557. [[maybe_unused]] void* voidp;
  1558. [[maybe_unused]] PtrSize size;
  1559. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1560. {
  1561. return -1;
  1562. }
  1563. // Get "this" as "self"
  1564. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1565. {
  1566. return -1;
  1567. }
  1568. Vec3* self = ud->getData<Vec3>();
  1569. // Call the method
  1570. F32 ret = self->length();
  1571. // Push return value
  1572. lua_pushnumber(l, lua_Number(ret));
  1573. return 1;
  1574. }
  1575. /// Wrap method Vec3::length.
  1576. static int wrapVec3length(lua_State* l)
  1577. {
  1578. int res = pwrapVec3length(l);
  1579. if(res >= 0)
  1580. {
  1581. return res;
  1582. }
  1583. lua_error(l);
  1584. return 0;
  1585. }
  1586. /// Pre-wrap method Vec3::normalize.
  1587. static inline int pwrapVec3normalize(lua_State* l)
  1588. {
  1589. [[maybe_unused]] LuaUserData* ud;
  1590. [[maybe_unused]] void* voidp;
  1591. [[maybe_unused]] PtrSize size;
  1592. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1593. {
  1594. return -1;
  1595. }
  1596. // Get "this" as "self"
  1597. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1598. {
  1599. return -1;
  1600. }
  1601. Vec3* self = ud->getData<Vec3>();
  1602. // Call the method
  1603. Vec3 ret = self->normalize();
  1604. // Push return value
  1605. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  1606. voidp = lua_newuserdata(l, size);
  1607. luaL_setmetatable(l, "Vec3");
  1608. ud = static_cast<LuaUserData*>(voidp);
  1609. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1610. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  1611. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  1612. return 1;
  1613. }
  1614. /// Wrap method Vec3::normalize.
  1615. static int wrapVec3normalize(lua_State* l)
  1616. {
  1617. int res = pwrapVec3normalize(l);
  1618. if(res >= 0)
  1619. {
  1620. return res;
  1621. }
  1622. lua_error(l);
  1623. return 0;
  1624. }
  1625. /// Pre-wrap method Vec3::dot.
  1626. static inline int pwrapVec3dot(lua_State* l)
  1627. {
  1628. [[maybe_unused]] LuaUserData* ud;
  1629. [[maybe_unused]] void* voidp;
  1630. [[maybe_unused]] PtrSize size;
  1631. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1632. {
  1633. return -1;
  1634. }
  1635. // Get "this" as "self"
  1636. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud))
  1637. {
  1638. return -1;
  1639. }
  1640. Vec3* self = ud->getData<Vec3>();
  1641. // Pop arguments
  1642. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  1643. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  1644. {
  1645. return -1;
  1646. }
  1647. Vec3* iarg0 = ud->getData<Vec3>();
  1648. const Vec3& arg0(*iarg0);
  1649. // Call the method
  1650. F32 ret = self->dot(arg0);
  1651. // Push return value
  1652. lua_pushnumber(l, lua_Number(ret));
  1653. return 1;
  1654. }
  1655. /// Wrap method Vec3::dot.
  1656. static int wrapVec3dot(lua_State* l)
  1657. {
  1658. int res = pwrapVec3dot(l);
  1659. if(res >= 0)
  1660. {
  1661. return res;
  1662. }
  1663. lua_error(l);
  1664. return 0;
  1665. }
  1666. /// Wrap class Vec3.
  1667. static inline void wrapVec3(lua_State* l)
  1668. {
  1669. LuaBinder::createClass(l, &luaUserDataTypeInfoVec3);
  1670. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec3.m_typeName, "new", wrapVec3Ctor);
  1671. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec3Dtor);
  1672. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec3getX);
  1673. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec3getY);
  1674. LuaBinder::pushLuaCFuncMethod(l, "getZ", wrapVec3getZ);
  1675. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec3setX);
  1676. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec3setY);
  1677. LuaBinder::pushLuaCFuncMethod(l, "setZ", wrapVec3setZ);
  1678. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec3setAll);
  1679. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec3getAt);
  1680. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec3setAt);
  1681. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec3copy);
  1682. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec3__add);
  1683. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec3__sub);
  1684. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec3__mul);
  1685. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec3__div);
  1686. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec3__eq);
  1687. LuaBinder::pushLuaCFuncMethod(l, "length", wrapVec3length);
  1688. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec3normalize);
  1689. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec3dot);
  1690. lua_settop(l, 0);
  1691. }
  1692. /// Serialize Vec4
  1693. static void serializeVec4(LuaUserData& self, void* data, PtrSize& size)
  1694. {
  1695. Vec4* obj = self.getData<Vec4>();
  1696. obj->serialize(data, size);
  1697. }
  1698. /// De-serialize Vec4
  1699. static void deserializeVec4(const void* data, LuaUserData& self)
  1700. {
  1701. ANKI_ASSERT(data);
  1702. Vec4* obj = self.getData<Vec4>();
  1703. ::new(obj) Vec4();
  1704. obj->deserialize(data);
  1705. }
  1706. LuaUserDataTypeInfo luaUserDataTypeInfoVec4 = {-5145388461665443836, "Vec4", LuaUserData::computeSizeForGarbageCollected<Vec4>(), serializeVec4,
  1707. deserializeVec4};
  1708. template<>
  1709. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Vec4>()
  1710. {
  1711. return luaUserDataTypeInfoVec4;
  1712. }
  1713. /// Pre-wrap constructor for Vec4.
  1714. static inline int pwrapVec4Ctor0(lua_State* l)
  1715. {
  1716. [[maybe_unused]] LuaUserData* ud;
  1717. [[maybe_unused]] void* voidp;
  1718. [[maybe_unused]] PtrSize size;
  1719. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  1720. {
  1721. return -1;
  1722. }
  1723. // Create user data
  1724. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1725. voidp = lua_newuserdata(l, size);
  1726. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1727. ud = static_cast<LuaUserData*>(voidp);
  1728. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1729. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1730. ::new(ud->getData<Vec4>()) Vec4();
  1731. return 1;
  1732. }
  1733. /// Pre-wrap constructor for Vec4.
  1734. static inline int pwrapVec4Ctor1(lua_State* l)
  1735. {
  1736. [[maybe_unused]] LuaUserData* ud;
  1737. [[maybe_unused]] void* voidp;
  1738. [[maybe_unused]] PtrSize size;
  1739. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1740. {
  1741. return -1;
  1742. }
  1743. // Pop arguments
  1744. F32 arg0;
  1745. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  1746. {
  1747. return -1;
  1748. }
  1749. // Create user data
  1750. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1751. voidp = lua_newuserdata(l, size);
  1752. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1753. ud = static_cast<LuaUserData*>(voidp);
  1754. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1755. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1756. ::new(ud->getData<Vec4>()) Vec4(arg0);
  1757. return 1;
  1758. }
  1759. /// Pre-wrap constructor for Vec4.
  1760. static inline int pwrapVec4Ctor2(lua_State* l)
  1761. {
  1762. [[maybe_unused]] LuaUserData* ud;
  1763. [[maybe_unused]] void* voidp;
  1764. [[maybe_unused]] PtrSize size;
  1765. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  1766. {
  1767. return -1;
  1768. }
  1769. // Pop arguments
  1770. F32 arg0;
  1771. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  1772. {
  1773. return -1;
  1774. }
  1775. F32 arg1;
  1776. if(LuaBinder::checkNumber(l, 2, arg1)) [[unlikely]]
  1777. {
  1778. return -1;
  1779. }
  1780. F32 arg2;
  1781. if(LuaBinder::checkNumber(l, 3, arg2)) [[unlikely]]
  1782. {
  1783. return -1;
  1784. }
  1785. F32 arg3;
  1786. if(LuaBinder::checkNumber(l, 4, arg3)) [[unlikely]]
  1787. {
  1788. return -1;
  1789. }
  1790. // Create user data
  1791. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  1792. voidp = lua_newuserdata(l, size);
  1793. luaL_setmetatable(l, luaUserDataTypeInfoVec4.m_typeName);
  1794. ud = static_cast<LuaUserData*>(voidp);
  1795. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  1796. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  1797. ::new(ud->getData<Vec4>()) Vec4(arg0, arg1, arg2, arg3);
  1798. return 1;
  1799. }
  1800. /// Wrap constructors for Vec4.
  1801. static int wrapVec4Ctor(lua_State* l)
  1802. {
  1803. // Chose the right overload
  1804. const int argCount = lua_gettop(l);
  1805. int res = 0;
  1806. switch(argCount)
  1807. {
  1808. case 0:
  1809. res = pwrapVec4Ctor0(l);
  1810. break;
  1811. case 1:
  1812. res = pwrapVec4Ctor1(l);
  1813. break;
  1814. case 4:
  1815. res = pwrapVec4Ctor2(l);
  1816. break;
  1817. default:
  1818. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  1819. res = -1;
  1820. }
  1821. if(res >= 0)
  1822. {
  1823. return res;
  1824. }
  1825. lua_error(l);
  1826. return 0;
  1827. }
  1828. /// Wrap destructor for Vec4.
  1829. static int wrapVec4Dtor(lua_State* l)
  1830. {
  1831. [[maybe_unused]] LuaUserData* ud;
  1832. [[maybe_unused]] void* voidp;
  1833. [[maybe_unused]] PtrSize size;
  1834. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1835. {
  1836. return -1;
  1837. }
  1838. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  1839. {
  1840. return -1;
  1841. }
  1842. if(ud->isGarbageCollected())
  1843. {
  1844. Vec4* inst = ud->getData<Vec4>();
  1845. inst->~Vec4();
  1846. }
  1847. return 0;
  1848. }
  1849. /// Pre-wrap method Vec4::getX.
  1850. static inline int pwrapVec4getX(lua_State* l)
  1851. {
  1852. [[maybe_unused]] LuaUserData* ud;
  1853. [[maybe_unused]] void* voidp;
  1854. [[maybe_unused]] PtrSize size;
  1855. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1856. {
  1857. return -1;
  1858. }
  1859. // Get "this" as "self"
  1860. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1861. {
  1862. return -1;
  1863. }
  1864. Vec4* self = ud->getData<Vec4>();
  1865. // Call the method
  1866. F32 ret = (*self).x();
  1867. // Push return value
  1868. lua_pushnumber(l, lua_Number(ret));
  1869. return 1;
  1870. }
  1871. /// Wrap method Vec4::getX.
  1872. static int wrapVec4getX(lua_State* l)
  1873. {
  1874. int res = pwrapVec4getX(l);
  1875. if(res >= 0)
  1876. {
  1877. return res;
  1878. }
  1879. lua_error(l);
  1880. return 0;
  1881. }
  1882. /// Pre-wrap method Vec4::getY.
  1883. static inline int pwrapVec4getY(lua_State* l)
  1884. {
  1885. [[maybe_unused]] LuaUserData* ud;
  1886. [[maybe_unused]] void* voidp;
  1887. [[maybe_unused]] PtrSize size;
  1888. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1889. {
  1890. return -1;
  1891. }
  1892. // Get "this" as "self"
  1893. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1894. {
  1895. return -1;
  1896. }
  1897. Vec4* self = ud->getData<Vec4>();
  1898. // Call the method
  1899. F32 ret = (*self).y();
  1900. // Push return value
  1901. lua_pushnumber(l, lua_Number(ret));
  1902. return 1;
  1903. }
  1904. /// Wrap method Vec4::getY.
  1905. static int wrapVec4getY(lua_State* l)
  1906. {
  1907. int res = pwrapVec4getY(l);
  1908. if(res >= 0)
  1909. {
  1910. return res;
  1911. }
  1912. lua_error(l);
  1913. return 0;
  1914. }
  1915. /// Pre-wrap method Vec4::getZ.
  1916. static inline int pwrapVec4getZ(lua_State* l)
  1917. {
  1918. [[maybe_unused]] LuaUserData* ud;
  1919. [[maybe_unused]] void* voidp;
  1920. [[maybe_unused]] PtrSize size;
  1921. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1922. {
  1923. return -1;
  1924. }
  1925. // Get "this" as "self"
  1926. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1927. {
  1928. return -1;
  1929. }
  1930. Vec4* self = ud->getData<Vec4>();
  1931. // Call the method
  1932. F32 ret = (*self).z();
  1933. // Push return value
  1934. lua_pushnumber(l, lua_Number(ret));
  1935. return 1;
  1936. }
  1937. /// Wrap method Vec4::getZ.
  1938. static int wrapVec4getZ(lua_State* l)
  1939. {
  1940. int res = pwrapVec4getZ(l);
  1941. if(res >= 0)
  1942. {
  1943. return res;
  1944. }
  1945. lua_error(l);
  1946. return 0;
  1947. }
  1948. /// Pre-wrap method Vec4::getW.
  1949. static inline int pwrapVec4getW(lua_State* l)
  1950. {
  1951. [[maybe_unused]] LuaUserData* ud;
  1952. [[maybe_unused]] void* voidp;
  1953. [[maybe_unused]] PtrSize size;
  1954. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  1955. {
  1956. return -1;
  1957. }
  1958. // Get "this" as "self"
  1959. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1960. {
  1961. return -1;
  1962. }
  1963. Vec4* self = ud->getData<Vec4>();
  1964. // Call the method
  1965. F32 ret = (*self).w();
  1966. // Push return value
  1967. lua_pushnumber(l, lua_Number(ret));
  1968. return 1;
  1969. }
  1970. /// Wrap method Vec4::getW.
  1971. static int wrapVec4getW(lua_State* l)
  1972. {
  1973. int res = pwrapVec4getW(l);
  1974. if(res >= 0)
  1975. {
  1976. return res;
  1977. }
  1978. lua_error(l);
  1979. return 0;
  1980. }
  1981. /// Pre-wrap method Vec4::setX.
  1982. static inline int pwrapVec4setX(lua_State* l)
  1983. {
  1984. [[maybe_unused]] LuaUserData* ud;
  1985. [[maybe_unused]] void* voidp;
  1986. [[maybe_unused]] PtrSize size;
  1987. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  1988. {
  1989. return -1;
  1990. }
  1991. // Get "this" as "self"
  1992. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  1993. {
  1994. return -1;
  1995. }
  1996. Vec4* self = ud->getData<Vec4>();
  1997. // Pop arguments
  1998. F32 arg0;
  1999. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2000. {
  2001. return -1;
  2002. }
  2003. // Call the method
  2004. (*self).x() = arg0;
  2005. return 0;
  2006. }
  2007. /// Wrap method Vec4::setX.
  2008. static int wrapVec4setX(lua_State* l)
  2009. {
  2010. int res = pwrapVec4setX(l);
  2011. if(res >= 0)
  2012. {
  2013. return res;
  2014. }
  2015. lua_error(l);
  2016. return 0;
  2017. }
  2018. /// Pre-wrap method Vec4::setY.
  2019. static inline int pwrapVec4setY(lua_State* l)
  2020. {
  2021. [[maybe_unused]] LuaUserData* ud;
  2022. [[maybe_unused]] void* voidp;
  2023. [[maybe_unused]] PtrSize size;
  2024. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2025. {
  2026. return -1;
  2027. }
  2028. // Get "this" as "self"
  2029. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2030. {
  2031. return -1;
  2032. }
  2033. Vec4* self = ud->getData<Vec4>();
  2034. // Pop arguments
  2035. F32 arg0;
  2036. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2037. {
  2038. return -1;
  2039. }
  2040. // Call the method
  2041. (*self).y() = arg0;
  2042. return 0;
  2043. }
  2044. /// Wrap method Vec4::setY.
  2045. static int wrapVec4setY(lua_State* l)
  2046. {
  2047. int res = pwrapVec4setY(l);
  2048. if(res >= 0)
  2049. {
  2050. return res;
  2051. }
  2052. lua_error(l);
  2053. return 0;
  2054. }
  2055. /// Pre-wrap method Vec4::setZ.
  2056. static inline int pwrapVec4setZ(lua_State* l)
  2057. {
  2058. [[maybe_unused]] LuaUserData* ud;
  2059. [[maybe_unused]] void* voidp;
  2060. [[maybe_unused]] PtrSize size;
  2061. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2062. {
  2063. return -1;
  2064. }
  2065. // Get "this" as "self"
  2066. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2067. {
  2068. return -1;
  2069. }
  2070. Vec4* self = ud->getData<Vec4>();
  2071. // Pop arguments
  2072. F32 arg0;
  2073. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2074. {
  2075. return -1;
  2076. }
  2077. // Call the method
  2078. (*self).z() = arg0;
  2079. return 0;
  2080. }
  2081. /// Wrap method Vec4::setZ.
  2082. static int wrapVec4setZ(lua_State* l)
  2083. {
  2084. int res = pwrapVec4setZ(l);
  2085. if(res >= 0)
  2086. {
  2087. return res;
  2088. }
  2089. lua_error(l);
  2090. return 0;
  2091. }
  2092. /// Pre-wrap method Vec4::setW.
  2093. static inline int pwrapVec4setW(lua_State* l)
  2094. {
  2095. [[maybe_unused]] LuaUserData* ud;
  2096. [[maybe_unused]] void* voidp;
  2097. [[maybe_unused]] PtrSize size;
  2098. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2099. {
  2100. return -1;
  2101. }
  2102. // Get "this" as "self"
  2103. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2104. {
  2105. return -1;
  2106. }
  2107. Vec4* self = ud->getData<Vec4>();
  2108. // Pop arguments
  2109. F32 arg0;
  2110. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2111. {
  2112. return -1;
  2113. }
  2114. // Call the method
  2115. (*self).w() = arg0;
  2116. return 0;
  2117. }
  2118. /// Wrap method Vec4::setW.
  2119. static int wrapVec4setW(lua_State* l)
  2120. {
  2121. int res = pwrapVec4setW(l);
  2122. if(res >= 0)
  2123. {
  2124. return res;
  2125. }
  2126. lua_error(l);
  2127. return 0;
  2128. }
  2129. /// Pre-wrap method Vec4::setAll.
  2130. static inline int pwrapVec4setAll(lua_State* l)
  2131. {
  2132. [[maybe_unused]] LuaUserData* ud;
  2133. [[maybe_unused]] void* voidp;
  2134. [[maybe_unused]] PtrSize size;
  2135. if(LuaBinder::checkArgsCount(l, 5)) [[unlikely]]
  2136. {
  2137. return -1;
  2138. }
  2139. // Get "this" as "self"
  2140. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2141. {
  2142. return -1;
  2143. }
  2144. Vec4* self = ud->getData<Vec4>();
  2145. // Pop arguments
  2146. F32 arg0;
  2147. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2148. {
  2149. return -1;
  2150. }
  2151. F32 arg1;
  2152. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2153. {
  2154. return -1;
  2155. }
  2156. F32 arg2;
  2157. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  2158. {
  2159. return -1;
  2160. }
  2161. F32 arg3;
  2162. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  2163. {
  2164. return -1;
  2165. }
  2166. // Call the method
  2167. (*self) = Vec4(arg0, arg1, arg2, arg3);
  2168. return 0;
  2169. }
  2170. /// Wrap method Vec4::setAll.
  2171. static int wrapVec4setAll(lua_State* l)
  2172. {
  2173. int res = pwrapVec4setAll(l);
  2174. if(res >= 0)
  2175. {
  2176. return res;
  2177. }
  2178. lua_error(l);
  2179. return 0;
  2180. }
  2181. /// Pre-wrap method Vec4::getAt.
  2182. static inline int pwrapVec4getAt(lua_State* l)
  2183. {
  2184. [[maybe_unused]] LuaUserData* ud;
  2185. [[maybe_unused]] void* voidp;
  2186. [[maybe_unused]] PtrSize size;
  2187. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2188. {
  2189. return -1;
  2190. }
  2191. // Get "this" as "self"
  2192. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2193. {
  2194. return -1;
  2195. }
  2196. Vec4* self = ud->getData<Vec4>();
  2197. // Pop arguments
  2198. U arg0;
  2199. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2200. {
  2201. return -1;
  2202. }
  2203. // Call the method
  2204. F32 ret = (*self)[arg0];
  2205. // Push return value
  2206. lua_pushnumber(l, lua_Number(ret));
  2207. return 1;
  2208. }
  2209. /// Wrap method Vec4::getAt.
  2210. static int wrapVec4getAt(lua_State* l)
  2211. {
  2212. int res = pwrapVec4getAt(l);
  2213. if(res >= 0)
  2214. {
  2215. return res;
  2216. }
  2217. lua_error(l);
  2218. return 0;
  2219. }
  2220. /// Pre-wrap method Vec4::setAt.
  2221. static inline int pwrapVec4setAt(lua_State* l)
  2222. {
  2223. [[maybe_unused]] LuaUserData* ud;
  2224. [[maybe_unused]] void* voidp;
  2225. [[maybe_unused]] PtrSize size;
  2226. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  2227. {
  2228. return -1;
  2229. }
  2230. // Get "this" as "self"
  2231. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2232. {
  2233. return -1;
  2234. }
  2235. Vec4* self = ud->getData<Vec4>();
  2236. // Pop arguments
  2237. U arg0;
  2238. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2239. {
  2240. return -1;
  2241. }
  2242. F32 arg1;
  2243. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2244. {
  2245. return -1;
  2246. }
  2247. // Call the method
  2248. (*self)[arg0] = arg1;
  2249. return 0;
  2250. }
  2251. /// Wrap method Vec4::setAt.
  2252. static int wrapVec4setAt(lua_State* l)
  2253. {
  2254. int res = pwrapVec4setAt(l);
  2255. if(res >= 0)
  2256. {
  2257. return res;
  2258. }
  2259. lua_error(l);
  2260. return 0;
  2261. }
  2262. /// Pre-wrap method Vec4::operator=.
  2263. static inline int pwrapVec4copy(lua_State* l)
  2264. {
  2265. [[maybe_unused]] LuaUserData* ud;
  2266. [[maybe_unused]] void* voidp;
  2267. [[maybe_unused]] PtrSize size;
  2268. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2269. {
  2270. return -1;
  2271. }
  2272. // Get "this" as "self"
  2273. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2274. {
  2275. return -1;
  2276. }
  2277. Vec4* self = ud->getData<Vec4>();
  2278. // Pop arguments
  2279. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2280. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2281. {
  2282. return -1;
  2283. }
  2284. Vec4* iarg0 = ud->getData<Vec4>();
  2285. const Vec4& arg0(*iarg0);
  2286. // Call the method
  2287. self->operator=(arg0);
  2288. return 0;
  2289. }
  2290. /// Wrap method Vec4::operator=.
  2291. static int wrapVec4copy(lua_State* l)
  2292. {
  2293. int res = pwrapVec4copy(l);
  2294. if(res >= 0)
  2295. {
  2296. return res;
  2297. }
  2298. lua_error(l);
  2299. return 0;
  2300. }
  2301. /// Pre-wrap method Vec4::operator+.
  2302. static inline int pwrapVec4__add(lua_State* l)
  2303. {
  2304. [[maybe_unused]] LuaUserData* ud;
  2305. [[maybe_unused]] void* voidp;
  2306. [[maybe_unused]] PtrSize size;
  2307. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2308. {
  2309. return -1;
  2310. }
  2311. // Get "this" as "self"
  2312. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2313. {
  2314. return -1;
  2315. }
  2316. Vec4* self = ud->getData<Vec4>();
  2317. // Pop arguments
  2318. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2319. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2320. {
  2321. return -1;
  2322. }
  2323. Vec4* iarg0 = ud->getData<Vec4>();
  2324. const Vec4& arg0(*iarg0);
  2325. // Call the method
  2326. Vec4 ret = self->operator+(arg0);
  2327. // Push return value
  2328. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2329. voidp = lua_newuserdata(l, size);
  2330. luaL_setmetatable(l, "Vec4");
  2331. ud = static_cast<LuaUserData*>(voidp);
  2332. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2333. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2334. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2335. return 1;
  2336. }
  2337. /// Wrap method Vec4::operator+.
  2338. static int wrapVec4__add(lua_State* l)
  2339. {
  2340. int res = pwrapVec4__add(l);
  2341. if(res >= 0)
  2342. {
  2343. return res;
  2344. }
  2345. lua_error(l);
  2346. return 0;
  2347. }
  2348. /// Pre-wrap method Vec4::operator-.
  2349. static inline int pwrapVec4__sub(lua_State* l)
  2350. {
  2351. [[maybe_unused]] LuaUserData* ud;
  2352. [[maybe_unused]] void* voidp;
  2353. [[maybe_unused]] PtrSize size;
  2354. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2355. {
  2356. return -1;
  2357. }
  2358. // Get "this" as "self"
  2359. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2360. {
  2361. return -1;
  2362. }
  2363. Vec4* self = ud->getData<Vec4>();
  2364. // Pop arguments
  2365. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2366. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2367. {
  2368. return -1;
  2369. }
  2370. Vec4* iarg0 = ud->getData<Vec4>();
  2371. const Vec4& arg0(*iarg0);
  2372. // Call the method
  2373. Vec4 ret = self->operator-(arg0);
  2374. // Push return value
  2375. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2376. voidp = lua_newuserdata(l, size);
  2377. luaL_setmetatable(l, "Vec4");
  2378. ud = static_cast<LuaUserData*>(voidp);
  2379. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2380. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2381. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2382. return 1;
  2383. }
  2384. /// Wrap method Vec4::operator-.
  2385. static int wrapVec4__sub(lua_State* l)
  2386. {
  2387. int res = pwrapVec4__sub(l);
  2388. if(res >= 0)
  2389. {
  2390. return res;
  2391. }
  2392. lua_error(l);
  2393. return 0;
  2394. }
  2395. /// Pre-wrap method Vec4::operator*.
  2396. static inline int pwrapVec4__mul(lua_State* l)
  2397. {
  2398. [[maybe_unused]] LuaUserData* ud;
  2399. [[maybe_unused]] void* voidp;
  2400. [[maybe_unused]] PtrSize size;
  2401. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2402. {
  2403. return -1;
  2404. }
  2405. // Get "this" as "self"
  2406. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2407. {
  2408. return -1;
  2409. }
  2410. Vec4* self = ud->getData<Vec4>();
  2411. // Pop arguments
  2412. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2413. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2414. {
  2415. return -1;
  2416. }
  2417. Vec4* iarg0 = ud->getData<Vec4>();
  2418. const Vec4& arg0(*iarg0);
  2419. // Call the method
  2420. Vec4 ret = self->operator*(arg0);
  2421. // Push return value
  2422. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2423. voidp = lua_newuserdata(l, size);
  2424. luaL_setmetatable(l, "Vec4");
  2425. ud = static_cast<LuaUserData*>(voidp);
  2426. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2427. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2428. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2429. return 1;
  2430. }
  2431. /// Wrap method Vec4::operator*.
  2432. static int wrapVec4__mul(lua_State* l)
  2433. {
  2434. int res = pwrapVec4__mul(l);
  2435. if(res >= 0)
  2436. {
  2437. return res;
  2438. }
  2439. lua_error(l);
  2440. return 0;
  2441. }
  2442. /// Pre-wrap method Vec4::operator/.
  2443. static inline int pwrapVec4__div(lua_State* l)
  2444. {
  2445. [[maybe_unused]] LuaUserData* ud;
  2446. [[maybe_unused]] void* voidp;
  2447. [[maybe_unused]] PtrSize size;
  2448. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2449. {
  2450. return -1;
  2451. }
  2452. // Get "this" as "self"
  2453. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2454. {
  2455. return -1;
  2456. }
  2457. Vec4* self = ud->getData<Vec4>();
  2458. // Pop arguments
  2459. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2460. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2461. {
  2462. return -1;
  2463. }
  2464. Vec4* iarg0 = ud->getData<Vec4>();
  2465. const Vec4& arg0(*iarg0);
  2466. // Call the method
  2467. Vec4 ret = self->operator/(arg0);
  2468. // Push return value
  2469. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2470. voidp = lua_newuserdata(l, size);
  2471. luaL_setmetatable(l, "Vec4");
  2472. ud = static_cast<LuaUserData*>(voidp);
  2473. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2474. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2475. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2476. return 1;
  2477. }
  2478. /// Wrap method Vec4::operator/.
  2479. static int wrapVec4__div(lua_State* l)
  2480. {
  2481. int res = pwrapVec4__div(l);
  2482. if(res >= 0)
  2483. {
  2484. return res;
  2485. }
  2486. lua_error(l);
  2487. return 0;
  2488. }
  2489. /// Pre-wrap method Vec4::operator==.
  2490. static inline int pwrapVec4__eq(lua_State* l)
  2491. {
  2492. [[maybe_unused]] LuaUserData* ud;
  2493. [[maybe_unused]] void* voidp;
  2494. [[maybe_unused]] PtrSize size;
  2495. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2496. {
  2497. return -1;
  2498. }
  2499. // Get "this" as "self"
  2500. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2501. {
  2502. return -1;
  2503. }
  2504. Vec4* self = ud->getData<Vec4>();
  2505. // Pop arguments
  2506. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2507. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2508. {
  2509. return -1;
  2510. }
  2511. Vec4* iarg0 = ud->getData<Vec4>();
  2512. const Vec4& arg0(*iarg0);
  2513. // Call the method
  2514. Bool ret = self->operator==(arg0);
  2515. // Push return value
  2516. lua_pushboolean(l, ret);
  2517. return 1;
  2518. }
  2519. /// Wrap method Vec4::operator==.
  2520. static int wrapVec4__eq(lua_State* l)
  2521. {
  2522. int res = pwrapVec4__eq(l);
  2523. if(res >= 0)
  2524. {
  2525. return res;
  2526. }
  2527. lua_error(l);
  2528. return 0;
  2529. }
  2530. /// Pre-wrap method Vec4::length.
  2531. static inline int pwrapVec4length(lua_State* l)
  2532. {
  2533. [[maybe_unused]] LuaUserData* ud;
  2534. [[maybe_unused]] void* voidp;
  2535. [[maybe_unused]] PtrSize size;
  2536. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2537. {
  2538. return -1;
  2539. }
  2540. // Get "this" as "self"
  2541. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2542. {
  2543. return -1;
  2544. }
  2545. Vec4* self = ud->getData<Vec4>();
  2546. // Call the method
  2547. F32 ret = self->length();
  2548. // Push return value
  2549. lua_pushnumber(l, lua_Number(ret));
  2550. return 1;
  2551. }
  2552. /// Wrap method Vec4::length.
  2553. static int wrapVec4length(lua_State* l)
  2554. {
  2555. int res = pwrapVec4length(l);
  2556. if(res >= 0)
  2557. {
  2558. return res;
  2559. }
  2560. lua_error(l);
  2561. return 0;
  2562. }
  2563. /// Pre-wrap method Vec4::normalize.
  2564. static inline int pwrapVec4normalize(lua_State* l)
  2565. {
  2566. [[maybe_unused]] LuaUserData* ud;
  2567. [[maybe_unused]] void* voidp;
  2568. [[maybe_unused]] PtrSize size;
  2569. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2570. {
  2571. return -1;
  2572. }
  2573. // Get "this" as "self"
  2574. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2575. {
  2576. return -1;
  2577. }
  2578. Vec4* self = ud->getData<Vec4>();
  2579. // Call the method
  2580. Vec4 ret = self->normalize();
  2581. // Push return value
  2582. size = LuaUserData::computeSizeForGarbageCollected<Vec4>();
  2583. voidp = lua_newuserdata(l, size);
  2584. luaL_setmetatable(l, "Vec4");
  2585. ud = static_cast<LuaUserData*>(voidp);
  2586. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2587. ud->initGarbageCollected(&luaUserDataTypeInfoVec4);
  2588. ::new(ud->getData<Vec4>()) Vec4(std::move(ret));
  2589. return 1;
  2590. }
  2591. /// Wrap method Vec4::normalize.
  2592. static int wrapVec4normalize(lua_State* l)
  2593. {
  2594. int res = pwrapVec4normalize(l);
  2595. if(res >= 0)
  2596. {
  2597. return res;
  2598. }
  2599. lua_error(l);
  2600. return 0;
  2601. }
  2602. /// Pre-wrap method Vec4::dot.
  2603. static inline int pwrapVec4dot(lua_State* l)
  2604. {
  2605. [[maybe_unused]] LuaUserData* ud;
  2606. [[maybe_unused]] void* voidp;
  2607. [[maybe_unused]] PtrSize size;
  2608. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2609. {
  2610. return -1;
  2611. }
  2612. // Get "this" as "self"
  2613. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec4, ud))
  2614. {
  2615. return -1;
  2616. }
  2617. Vec4* self = ud->getData<Vec4>();
  2618. // Pop arguments
  2619. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec4;
  2620. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec4, ud)) [[unlikely]]
  2621. {
  2622. return -1;
  2623. }
  2624. Vec4* iarg0 = ud->getData<Vec4>();
  2625. const Vec4& arg0(*iarg0);
  2626. // Call the method
  2627. F32 ret = self->dot(arg0);
  2628. // Push return value
  2629. lua_pushnumber(l, lua_Number(ret));
  2630. return 1;
  2631. }
  2632. /// Wrap method Vec4::dot.
  2633. static int wrapVec4dot(lua_State* l)
  2634. {
  2635. int res = pwrapVec4dot(l);
  2636. if(res >= 0)
  2637. {
  2638. return res;
  2639. }
  2640. lua_error(l);
  2641. return 0;
  2642. }
  2643. /// Wrap class Vec4.
  2644. static inline void wrapVec4(lua_State* l)
  2645. {
  2646. LuaBinder::createClass(l, &luaUserDataTypeInfoVec4);
  2647. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoVec4.m_typeName, "new", wrapVec4Ctor);
  2648. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapVec4Dtor);
  2649. LuaBinder::pushLuaCFuncMethod(l, "getX", wrapVec4getX);
  2650. LuaBinder::pushLuaCFuncMethod(l, "getY", wrapVec4getY);
  2651. LuaBinder::pushLuaCFuncMethod(l, "getZ", wrapVec4getZ);
  2652. LuaBinder::pushLuaCFuncMethod(l, "getW", wrapVec4getW);
  2653. LuaBinder::pushLuaCFuncMethod(l, "setX", wrapVec4setX);
  2654. LuaBinder::pushLuaCFuncMethod(l, "setY", wrapVec4setY);
  2655. LuaBinder::pushLuaCFuncMethod(l, "setZ", wrapVec4setZ);
  2656. LuaBinder::pushLuaCFuncMethod(l, "setW", wrapVec4setW);
  2657. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapVec4setAll);
  2658. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapVec4getAt);
  2659. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapVec4setAt);
  2660. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapVec4copy);
  2661. LuaBinder::pushLuaCFuncMethod(l, "__add", wrapVec4__add);
  2662. LuaBinder::pushLuaCFuncMethod(l, "__sub", wrapVec4__sub);
  2663. LuaBinder::pushLuaCFuncMethod(l, "__mul", wrapVec4__mul);
  2664. LuaBinder::pushLuaCFuncMethod(l, "__div", wrapVec4__div);
  2665. LuaBinder::pushLuaCFuncMethod(l, "__eq", wrapVec4__eq);
  2666. LuaBinder::pushLuaCFuncMethod(l, "length", wrapVec4length);
  2667. LuaBinder::pushLuaCFuncMethod(l, "normalize", wrapVec4normalize);
  2668. LuaBinder::pushLuaCFuncMethod(l, "dot", wrapVec4dot);
  2669. lua_settop(l, 0);
  2670. }
  2671. LuaUserDataTypeInfo luaUserDataTypeInfoMat3 = {288806843489649530, "Mat3", LuaUserData::computeSizeForGarbageCollected<Mat3>(), nullptr, nullptr};
  2672. template<>
  2673. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Mat3>()
  2674. {
  2675. return luaUserDataTypeInfoMat3;
  2676. }
  2677. /// Pre-wrap constructor for Mat3.
  2678. static inline int pwrapMat3Ctor0(lua_State* l)
  2679. {
  2680. [[maybe_unused]] LuaUserData* ud;
  2681. [[maybe_unused]] void* voidp;
  2682. [[maybe_unused]] PtrSize size;
  2683. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  2684. {
  2685. return -1;
  2686. }
  2687. // Create user data
  2688. size = LuaUserData::computeSizeForGarbageCollected<Mat3>();
  2689. voidp = lua_newuserdata(l, size);
  2690. luaL_setmetatable(l, luaUserDataTypeInfoMat3.m_typeName);
  2691. ud = static_cast<LuaUserData*>(voidp);
  2692. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2693. ud->initGarbageCollected(&luaUserDataTypeInfoMat3);
  2694. ::new(ud->getData<Mat3>()) Mat3();
  2695. return 1;
  2696. }
  2697. /// Pre-wrap constructor for Mat3.
  2698. static inline int pwrapMat3Ctor1(lua_State* l)
  2699. {
  2700. [[maybe_unused]] LuaUserData* ud;
  2701. [[maybe_unused]] void* voidp;
  2702. [[maybe_unused]] PtrSize size;
  2703. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2704. {
  2705. return -1;
  2706. }
  2707. // Pop arguments
  2708. F32 arg0;
  2709. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  2710. {
  2711. return -1;
  2712. }
  2713. // Create user data
  2714. size = LuaUserData::computeSizeForGarbageCollected<Mat3>();
  2715. voidp = lua_newuserdata(l, size);
  2716. luaL_setmetatable(l, luaUserDataTypeInfoMat3.m_typeName);
  2717. ud = static_cast<LuaUserData*>(voidp);
  2718. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2719. ud->initGarbageCollected(&luaUserDataTypeInfoMat3);
  2720. ::new(ud->getData<Mat3>()) Mat3(arg0);
  2721. return 1;
  2722. }
  2723. /// Wrap constructors for Mat3.
  2724. static int wrapMat3Ctor(lua_State* l)
  2725. {
  2726. // Chose the right overload
  2727. const int argCount = lua_gettop(l);
  2728. int res = 0;
  2729. switch(argCount)
  2730. {
  2731. case 0:
  2732. res = pwrapMat3Ctor0(l);
  2733. break;
  2734. case 1:
  2735. res = pwrapMat3Ctor1(l);
  2736. break;
  2737. default:
  2738. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  2739. res = -1;
  2740. }
  2741. if(res >= 0)
  2742. {
  2743. return res;
  2744. }
  2745. lua_error(l);
  2746. return 0;
  2747. }
  2748. /// Wrap destructor for Mat3.
  2749. static int wrapMat3Dtor(lua_State* l)
  2750. {
  2751. [[maybe_unused]] LuaUserData* ud;
  2752. [[maybe_unused]] void* voidp;
  2753. [[maybe_unused]] PtrSize size;
  2754. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  2755. {
  2756. return -1;
  2757. }
  2758. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  2759. {
  2760. return -1;
  2761. }
  2762. if(ud->isGarbageCollected())
  2763. {
  2764. Mat3* inst = ud->getData<Mat3>();
  2765. inst->~Mat3();
  2766. }
  2767. return 0;
  2768. }
  2769. /// Pre-wrap method Mat3::operator=.
  2770. static inline int pwrapMat3copy(lua_State* l)
  2771. {
  2772. [[maybe_unused]] LuaUserData* ud;
  2773. [[maybe_unused]] void* voidp;
  2774. [[maybe_unused]] PtrSize size;
  2775. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  2776. {
  2777. return -1;
  2778. }
  2779. // Get "this" as "self"
  2780. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2781. {
  2782. return -1;
  2783. }
  2784. Mat3* self = ud->getData<Mat3>();
  2785. // Pop arguments
  2786. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  2787. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  2788. {
  2789. return -1;
  2790. }
  2791. Mat3* iarg0 = ud->getData<Mat3>();
  2792. const Mat3& arg0(*iarg0);
  2793. // Call the method
  2794. self->operator=(arg0);
  2795. return 0;
  2796. }
  2797. /// Wrap method Mat3::operator=.
  2798. static int wrapMat3copy(lua_State* l)
  2799. {
  2800. int res = pwrapMat3copy(l);
  2801. if(res >= 0)
  2802. {
  2803. return res;
  2804. }
  2805. lua_error(l);
  2806. return 0;
  2807. }
  2808. /// Pre-wrap method Mat3::getAt.
  2809. static inline int pwrapMat3getAt(lua_State* l)
  2810. {
  2811. [[maybe_unused]] LuaUserData* ud;
  2812. [[maybe_unused]] void* voidp;
  2813. [[maybe_unused]] PtrSize size;
  2814. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  2815. {
  2816. return -1;
  2817. }
  2818. // Get "this" as "self"
  2819. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2820. {
  2821. return -1;
  2822. }
  2823. Mat3* self = ud->getData<Mat3>();
  2824. // Pop arguments
  2825. U arg0;
  2826. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2827. {
  2828. return -1;
  2829. }
  2830. U arg1;
  2831. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2832. {
  2833. return -1;
  2834. }
  2835. // Call the method
  2836. F32 ret = (*self)(arg0, arg1);
  2837. // Push return value
  2838. lua_pushnumber(l, lua_Number(ret));
  2839. return 1;
  2840. }
  2841. /// Wrap method Mat3::getAt.
  2842. static int wrapMat3getAt(lua_State* l)
  2843. {
  2844. int res = pwrapMat3getAt(l);
  2845. if(res >= 0)
  2846. {
  2847. return res;
  2848. }
  2849. lua_error(l);
  2850. return 0;
  2851. }
  2852. /// Pre-wrap method Mat3::setAt.
  2853. static inline int pwrapMat3setAt(lua_State* l)
  2854. {
  2855. [[maybe_unused]] LuaUserData* ud;
  2856. [[maybe_unused]] void* voidp;
  2857. [[maybe_unused]] PtrSize size;
  2858. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  2859. {
  2860. return -1;
  2861. }
  2862. // Get "this" as "self"
  2863. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2864. {
  2865. return -1;
  2866. }
  2867. Mat3* self = ud->getData<Mat3>();
  2868. // Pop arguments
  2869. U arg0;
  2870. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2871. {
  2872. return -1;
  2873. }
  2874. U arg1;
  2875. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2876. {
  2877. return -1;
  2878. }
  2879. F32 arg2;
  2880. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  2881. {
  2882. return -1;
  2883. }
  2884. // Call the method
  2885. (*self)(arg0, arg1) = arg2;
  2886. return 0;
  2887. }
  2888. /// Wrap method Mat3::setAt.
  2889. static int wrapMat3setAt(lua_State* l)
  2890. {
  2891. int res = pwrapMat3setAt(l);
  2892. if(res >= 0)
  2893. {
  2894. return res;
  2895. }
  2896. lua_error(l);
  2897. return 0;
  2898. }
  2899. /// Pre-wrap method Mat3::setAll.
  2900. static inline int pwrapMat3setAll(lua_State* l)
  2901. {
  2902. [[maybe_unused]] LuaUserData* ud;
  2903. [[maybe_unused]] void* voidp;
  2904. [[maybe_unused]] PtrSize size;
  2905. if(LuaBinder::checkArgsCount(l, 10)) [[unlikely]]
  2906. {
  2907. return -1;
  2908. }
  2909. // Get "this" as "self"
  2910. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3, ud))
  2911. {
  2912. return -1;
  2913. }
  2914. Mat3* self = ud->getData<Mat3>();
  2915. // Pop arguments
  2916. F32 arg0;
  2917. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  2918. {
  2919. return -1;
  2920. }
  2921. F32 arg1;
  2922. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  2923. {
  2924. return -1;
  2925. }
  2926. F32 arg2;
  2927. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  2928. {
  2929. return -1;
  2930. }
  2931. F32 arg3;
  2932. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  2933. {
  2934. return -1;
  2935. }
  2936. F32 arg4;
  2937. if(LuaBinder::checkNumber(l, 6, arg4)) [[unlikely]]
  2938. {
  2939. return -1;
  2940. }
  2941. F32 arg5;
  2942. if(LuaBinder::checkNumber(l, 7, arg5)) [[unlikely]]
  2943. {
  2944. return -1;
  2945. }
  2946. F32 arg6;
  2947. if(LuaBinder::checkNumber(l, 8, arg6)) [[unlikely]]
  2948. {
  2949. return -1;
  2950. }
  2951. F32 arg7;
  2952. if(LuaBinder::checkNumber(l, 9, arg7)) [[unlikely]]
  2953. {
  2954. return -1;
  2955. }
  2956. F32 arg8;
  2957. if(LuaBinder::checkNumber(l, 10, arg8)) [[unlikely]]
  2958. {
  2959. return -1;
  2960. }
  2961. // Call the method
  2962. (*self) = Mat3(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
  2963. return 0;
  2964. }
  2965. /// Wrap method Mat3::setAll.
  2966. static int wrapMat3setAll(lua_State* l)
  2967. {
  2968. int res = pwrapMat3setAll(l);
  2969. if(res >= 0)
  2970. {
  2971. return res;
  2972. }
  2973. lua_error(l);
  2974. return 0;
  2975. }
  2976. /// Wrap class Mat3.
  2977. static inline void wrapMat3(lua_State* l)
  2978. {
  2979. LuaBinder::createClass(l, &luaUserDataTypeInfoMat3);
  2980. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoMat3.m_typeName, "new", wrapMat3Ctor);
  2981. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapMat3Dtor);
  2982. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapMat3copy);
  2983. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapMat3getAt);
  2984. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapMat3setAt);
  2985. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapMat3setAll);
  2986. lua_settop(l, 0);
  2987. }
  2988. LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4 = {-5331181224552445128, "Mat3x4", LuaUserData::computeSizeForGarbageCollected<Mat3x4>(), nullptr,
  2989. nullptr};
  2990. template<>
  2991. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Mat3x4>()
  2992. {
  2993. return luaUserDataTypeInfoMat3x4;
  2994. }
  2995. /// Pre-wrap constructor for Mat3x4.
  2996. static inline int pwrapMat3x4Ctor0(lua_State* l)
  2997. {
  2998. [[maybe_unused]] LuaUserData* ud;
  2999. [[maybe_unused]] void* voidp;
  3000. [[maybe_unused]] PtrSize size;
  3001. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  3002. {
  3003. return -1;
  3004. }
  3005. // Create user data
  3006. size = LuaUserData::computeSizeForGarbageCollected<Mat3x4>();
  3007. voidp = lua_newuserdata(l, size);
  3008. luaL_setmetatable(l, luaUserDataTypeInfoMat3x4.m_typeName);
  3009. ud = static_cast<LuaUserData*>(voidp);
  3010. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3011. ud->initGarbageCollected(&luaUserDataTypeInfoMat3x4);
  3012. ::new(ud->getData<Mat3x4>()) Mat3x4();
  3013. return 1;
  3014. }
  3015. /// Pre-wrap constructor for Mat3x4.
  3016. static inline int pwrapMat3x4Ctor1(lua_State* l)
  3017. {
  3018. [[maybe_unused]] LuaUserData* ud;
  3019. [[maybe_unused]] void* voidp;
  3020. [[maybe_unused]] PtrSize size;
  3021. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3022. {
  3023. return -1;
  3024. }
  3025. // Pop arguments
  3026. F32 arg0;
  3027. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  3028. {
  3029. return -1;
  3030. }
  3031. // Create user data
  3032. size = LuaUserData::computeSizeForGarbageCollected<Mat3x4>();
  3033. voidp = lua_newuserdata(l, size);
  3034. luaL_setmetatable(l, luaUserDataTypeInfoMat3x4.m_typeName);
  3035. ud = static_cast<LuaUserData*>(voidp);
  3036. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3037. ud->initGarbageCollected(&luaUserDataTypeInfoMat3x4);
  3038. ::new(ud->getData<Mat3x4>()) Mat3x4(arg0);
  3039. return 1;
  3040. }
  3041. /// Wrap constructors for Mat3x4.
  3042. static int wrapMat3x4Ctor(lua_State* l)
  3043. {
  3044. // Chose the right overload
  3045. const int argCount = lua_gettop(l);
  3046. int res = 0;
  3047. switch(argCount)
  3048. {
  3049. case 0:
  3050. res = pwrapMat3x4Ctor0(l);
  3051. break;
  3052. case 1:
  3053. res = pwrapMat3x4Ctor1(l);
  3054. break;
  3055. default:
  3056. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  3057. res = -1;
  3058. }
  3059. if(res >= 0)
  3060. {
  3061. return res;
  3062. }
  3063. lua_error(l);
  3064. return 0;
  3065. }
  3066. /// Wrap destructor for Mat3x4.
  3067. static int wrapMat3x4Dtor(lua_State* l)
  3068. {
  3069. [[maybe_unused]] LuaUserData* ud;
  3070. [[maybe_unused]] void* voidp;
  3071. [[maybe_unused]] PtrSize size;
  3072. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3073. {
  3074. return -1;
  3075. }
  3076. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3077. {
  3078. return -1;
  3079. }
  3080. if(ud->isGarbageCollected())
  3081. {
  3082. Mat3x4* inst = ud->getData<Mat3x4>();
  3083. inst->~Mat3x4();
  3084. }
  3085. return 0;
  3086. }
  3087. /// Pre-wrap method Mat3x4::operator=.
  3088. static inline int pwrapMat3x4copy(lua_State* l)
  3089. {
  3090. [[maybe_unused]] LuaUserData* ud;
  3091. [[maybe_unused]] void* voidp;
  3092. [[maybe_unused]] PtrSize size;
  3093. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3094. {
  3095. return -1;
  3096. }
  3097. // Get "this" as "self"
  3098. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3099. {
  3100. return -1;
  3101. }
  3102. Mat3x4* self = ud->getData<Mat3x4>();
  3103. // Pop arguments
  3104. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3x4;
  3105. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3x4, ud)) [[unlikely]]
  3106. {
  3107. return -1;
  3108. }
  3109. Mat3x4* iarg0 = ud->getData<Mat3x4>();
  3110. const Mat3x4& arg0(*iarg0);
  3111. // Call the method
  3112. self->operator=(arg0);
  3113. return 0;
  3114. }
  3115. /// Wrap method Mat3x4::operator=.
  3116. static int wrapMat3x4copy(lua_State* l)
  3117. {
  3118. int res = pwrapMat3x4copy(l);
  3119. if(res >= 0)
  3120. {
  3121. return res;
  3122. }
  3123. lua_error(l);
  3124. return 0;
  3125. }
  3126. /// Pre-wrap method Mat3x4::getAt.
  3127. static inline int pwrapMat3x4getAt(lua_State* l)
  3128. {
  3129. [[maybe_unused]] LuaUserData* ud;
  3130. [[maybe_unused]] void* voidp;
  3131. [[maybe_unused]] PtrSize size;
  3132. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  3133. {
  3134. return -1;
  3135. }
  3136. // Get "this" as "self"
  3137. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3138. {
  3139. return -1;
  3140. }
  3141. Mat3x4* self = ud->getData<Mat3x4>();
  3142. // Pop arguments
  3143. U arg0;
  3144. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3145. {
  3146. return -1;
  3147. }
  3148. U arg1;
  3149. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3150. {
  3151. return -1;
  3152. }
  3153. // Call the method
  3154. F32 ret = (*self)(arg0, arg1);
  3155. // Push return value
  3156. lua_pushnumber(l, lua_Number(ret));
  3157. return 1;
  3158. }
  3159. /// Wrap method Mat3x4::getAt.
  3160. static int wrapMat3x4getAt(lua_State* l)
  3161. {
  3162. int res = pwrapMat3x4getAt(l);
  3163. if(res >= 0)
  3164. {
  3165. return res;
  3166. }
  3167. lua_error(l);
  3168. return 0;
  3169. }
  3170. /// Pre-wrap method Mat3x4::setAt.
  3171. static inline int pwrapMat3x4setAt(lua_State* l)
  3172. {
  3173. [[maybe_unused]] LuaUserData* ud;
  3174. [[maybe_unused]] void* voidp;
  3175. [[maybe_unused]] PtrSize size;
  3176. if(LuaBinder::checkArgsCount(l, 4)) [[unlikely]]
  3177. {
  3178. return -1;
  3179. }
  3180. // Get "this" as "self"
  3181. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3182. {
  3183. return -1;
  3184. }
  3185. Mat3x4* self = ud->getData<Mat3x4>();
  3186. // Pop arguments
  3187. U arg0;
  3188. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3189. {
  3190. return -1;
  3191. }
  3192. U arg1;
  3193. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3194. {
  3195. return -1;
  3196. }
  3197. F32 arg2;
  3198. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  3199. {
  3200. return -1;
  3201. }
  3202. // Call the method
  3203. (*self)(arg0, arg1) = arg2;
  3204. return 0;
  3205. }
  3206. /// Wrap method Mat3x4::setAt.
  3207. static int wrapMat3x4setAt(lua_State* l)
  3208. {
  3209. int res = pwrapMat3x4setAt(l);
  3210. if(res >= 0)
  3211. {
  3212. return res;
  3213. }
  3214. lua_error(l);
  3215. return 0;
  3216. }
  3217. /// Pre-wrap method Mat3x4::setAll.
  3218. static inline int pwrapMat3x4setAll(lua_State* l)
  3219. {
  3220. [[maybe_unused]] LuaUserData* ud;
  3221. [[maybe_unused]] void* voidp;
  3222. [[maybe_unused]] PtrSize size;
  3223. if(LuaBinder::checkArgsCount(l, 13)) [[unlikely]]
  3224. {
  3225. return -1;
  3226. }
  3227. // Get "this" as "self"
  3228. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMat3x4, ud))
  3229. {
  3230. return -1;
  3231. }
  3232. Mat3x4* self = ud->getData<Mat3x4>();
  3233. // Pop arguments
  3234. F32 arg0;
  3235. if(LuaBinder::checkNumber(l, 2, arg0)) [[unlikely]]
  3236. {
  3237. return -1;
  3238. }
  3239. F32 arg1;
  3240. if(LuaBinder::checkNumber(l, 3, arg1)) [[unlikely]]
  3241. {
  3242. return -1;
  3243. }
  3244. F32 arg2;
  3245. if(LuaBinder::checkNumber(l, 4, arg2)) [[unlikely]]
  3246. {
  3247. return -1;
  3248. }
  3249. F32 arg3;
  3250. if(LuaBinder::checkNumber(l, 5, arg3)) [[unlikely]]
  3251. {
  3252. return -1;
  3253. }
  3254. F32 arg4;
  3255. if(LuaBinder::checkNumber(l, 6, arg4)) [[unlikely]]
  3256. {
  3257. return -1;
  3258. }
  3259. F32 arg5;
  3260. if(LuaBinder::checkNumber(l, 7, arg5)) [[unlikely]]
  3261. {
  3262. return -1;
  3263. }
  3264. F32 arg6;
  3265. if(LuaBinder::checkNumber(l, 8, arg6)) [[unlikely]]
  3266. {
  3267. return -1;
  3268. }
  3269. F32 arg7;
  3270. if(LuaBinder::checkNumber(l, 9, arg7)) [[unlikely]]
  3271. {
  3272. return -1;
  3273. }
  3274. F32 arg8;
  3275. if(LuaBinder::checkNumber(l, 10, arg8)) [[unlikely]]
  3276. {
  3277. return -1;
  3278. }
  3279. F32 arg9;
  3280. if(LuaBinder::checkNumber(l, 11, arg9)) [[unlikely]]
  3281. {
  3282. return -1;
  3283. }
  3284. F32 arg10;
  3285. if(LuaBinder::checkNumber(l, 12, arg10)) [[unlikely]]
  3286. {
  3287. return -1;
  3288. }
  3289. F32 arg11;
  3290. if(LuaBinder::checkNumber(l, 13, arg11)) [[unlikely]]
  3291. {
  3292. return -1;
  3293. }
  3294. // Call the method
  3295. (*self) = Mat3x4(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
  3296. return 0;
  3297. }
  3298. /// Wrap method Mat3x4::setAll.
  3299. static int wrapMat3x4setAll(lua_State* l)
  3300. {
  3301. int res = pwrapMat3x4setAll(l);
  3302. if(res >= 0)
  3303. {
  3304. return res;
  3305. }
  3306. lua_error(l);
  3307. return 0;
  3308. }
  3309. /// Wrap class Mat3x4.
  3310. static inline void wrapMat3x4(lua_State* l)
  3311. {
  3312. LuaBinder::createClass(l, &luaUserDataTypeInfoMat3x4);
  3313. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoMat3x4.m_typeName, "new", wrapMat3x4Ctor);
  3314. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapMat3x4Dtor);
  3315. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapMat3x4copy);
  3316. LuaBinder::pushLuaCFuncMethod(l, "getAt", wrapMat3x4getAt);
  3317. LuaBinder::pushLuaCFuncMethod(l, "setAt", wrapMat3x4setAt);
  3318. LuaBinder::pushLuaCFuncMethod(l, "setAll", wrapMat3x4setAll);
  3319. lua_settop(l, 0);
  3320. }
  3321. LuaUserDataTypeInfo luaUserDataTypeInfoTransform = {432149697915855870, "Transform", LuaUserData::computeSizeForGarbageCollected<Transform>(),
  3322. nullptr, nullptr};
  3323. template<>
  3324. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Transform>()
  3325. {
  3326. return luaUserDataTypeInfoTransform;
  3327. }
  3328. /// Pre-wrap constructor for Transform.
  3329. static inline int pwrapTransformCtor0(lua_State* l)
  3330. {
  3331. [[maybe_unused]] LuaUserData* ud;
  3332. [[maybe_unused]] void* voidp;
  3333. [[maybe_unused]] PtrSize size;
  3334. if(LuaBinder::checkArgsCount(l, 0)) [[unlikely]]
  3335. {
  3336. return -1;
  3337. }
  3338. // Create user data
  3339. size = LuaUserData::computeSizeForGarbageCollected<Transform>();
  3340. voidp = lua_newuserdata(l, size);
  3341. luaL_setmetatable(l, luaUserDataTypeInfoTransform.m_typeName);
  3342. ud = static_cast<LuaUserData*>(voidp);
  3343. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3344. ud->initGarbageCollected(&luaUserDataTypeInfoTransform);
  3345. ::new(ud->getData<Transform>()) Transform();
  3346. return 1;
  3347. }
  3348. /// Pre-wrap constructor for Transform.
  3349. static inline int pwrapTransformCtor1(lua_State* l)
  3350. {
  3351. [[maybe_unused]] LuaUserData* ud;
  3352. [[maybe_unused]] void* voidp;
  3353. [[maybe_unused]] PtrSize size;
  3354. if(LuaBinder::checkArgsCount(l, 3)) [[unlikely]]
  3355. {
  3356. return -1;
  3357. }
  3358. // Pop arguments
  3359. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3360. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  3361. {
  3362. return -1;
  3363. }
  3364. Vec3* iarg0 = ud->getData<Vec3>();
  3365. Vec3 arg0(*iarg0);
  3366. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  3367. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  3368. {
  3369. return -1;
  3370. }
  3371. Mat3* iarg1 = ud->getData<Mat3>();
  3372. Mat3 arg1(*iarg1);
  3373. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3374. if(LuaBinder::checkUserData(l, 3, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  3375. {
  3376. return -1;
  3377. }
  3378. Vec3* iarg2 = ud->getData<Vec3>();
  3379. Vec3 arg2(*iarg2);
  3380. // Create user data
  3381. size = LuaUserData::computeSizeForGarbageCollected<Transform>();
  3382. voidp = lua_newuserdata(l, size);
  3383. luaL_setmetatable(l, luaUserDataTypeInfoTransform.m_typeName);
  3384. ud = static_cast<LuaUserData*>(voidp);
  3385. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3386. ud->initGarbageCollected(&luaUserDataTypeInfoTransform);
  3387. ::new(ud->getData<Transform>()) Transform(arg0, arg1, arg2);
  3388. return 1;
  3389. }
  3390. /// Wrap constructors for Transform.
  3391. static int wrapTransformCtor(lua_State* l)
  3392. {
  3393. // Chose the right overload
  3394. const int argCount = lua_gettop(l);
  3395. int res = 0;
  3396. switch(argCount)
  3397. {
  3398. case 0:
  3399. res = pwrapTransformCtor0(l);
  3400. break;
  3401. case 3:
  3402. res = pwrapTransformCtor1(l);
  3403. break;
  3404. default:
  3405. lua_pushfstring(l, "Wrong overloaded new. Wrong number of arguments: %d", argCount);
  3406. res = -1;
  3407. }
  3408. if(res >= 0)
  3409. {
  3410. return res;
  3411. }
  3412. lua_error(l);
  3413. return 0;
  3414. }
  3415. /// Wrap destructor for Transform.
  3416. static int wrapTransformDtor(lua_State* l)
  3417. {
  3418. [[maybe_unused]] LuaUserData* ud;
  3419. [[maybe_unused]] void* voidp;
  3420. [[maybe_unused]] PtrSize size;
  3421. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3422. {
  3423. return -1;
  3424. }
  3425. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud)) [[unlikely]]
  3426. {
  3427. return -1;
  3428. }
  3429. if(ud->isGarbageCollected())
  3430. {
  3431. Transform* inst = ud->getData<Transform>();
  3432. inst->~Transform();
  3433. }
  3434. return 0;
  3435. }
  3436. /// Pre-wrap method Transform::operator=.
  3437. static inline int pwrapTransformcopy(lua_State* l)
  3438. {
  3439. [[maybe_unused]] LuaUserData* ud;
  3440. [[maybe_unused]] void* voidp;
  3441. [[maybe_unused]] PtrSize size;
  3442. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3443. {
  3444. return -1;
  3445. }
  3446. // Get "this" as "self"
  3447. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3448. {
  3449. return -1;
  3450. }
  3451. Transform* self = ud->getData<Transform>();
  3452. // Pop arguments
  3453. extern LuaUserDataTypeInfo luaUserDataTypeInfoTransform;
  3454. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoTransform, ud)) [[unlikely]]
  3455. {
  3456. return -1;
  3457. }
  3458. Transform* iarg0 = ud->getData<Transform>();
  3459. const Transform& arg0(*iarg0);
  3460. // Call the method
  3461. self->operator=(arg0);
  3462. return 0;
  3463. }
  3464. /// Wrap method Transform::operator=.
  3465. static int wrapTransformcopy(lua_State* l)
  3466. {
  3467. int res = pwrapTransformcopy(l);
  3468. if(res >= 0)
  3469. {
  3470. return res;
  3471. }
  3472. lua_error(l);
  3473. return 0;
  3474. }
  3475. /// Pre-wrap method Transform::getOrigin.
  3476. static inline int pwrapTransformgetOrigin(lua_State* l)
  3477. {
  3478. [[maybe_unused]] LuaUserData* ud;
  3479. [[maybe_unused]] void* voidp;
  3480. [[maybe_unused]] PtrSize size;
  3481. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3482. {
  3483. return -1;
  3484. }
  3485. // Get "this" as "self"
  3486. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3487. {
  3488. return -1;
  3489. }
  3490. Transform* self = ud->getData<Transform>();
  3491. // Call the method
  3492. Vec3 ret = self->getOrigin().xyz();
  3493. // Push return value
  3494. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  3495. voidp = lua_newuserdata(l, size);
  3496. luaL_setmetatable(l, "Vec3");
  3497. ud = static_cast<LuaUserData*>(voidp);
  3498. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3499. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  3500. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  3501. return 1;
  3502. }
  3503. /// Wrap method Transform::getOrigin.
  3504. static int wrapTransformgetOrigin(lua_State* l)
  3505. {
  3506. int res = pwrapTransformgetOrigin(l);
  3507. if(res >= 0)
  3508. {
  3509. return res;
  3510. }
  3511. lua_error(l);
  3512. return 0;
  3513. }
  3514. /// Pre-wrap method Transform::setOrigin.
  3515. static inline int pwrapTransformsetOrigin(lua_State* l)
  3516. {
  3517. [[maybe_unused]] LuaUserData* ud;
  3518. [[maybe_unused]] void* voidp;
  3519. [[maybe_unused]] PtrSize size;
  3520. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3521. {
  3522. return -1;
  3523. }
  3524. // Get "this" as "self"
  3525. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3526. {
  3527. return -1;
  3528. }
  3529. Transform* self = ud->getData<Transform>();
  3530. // Pop arguments
  3531. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3532. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  3533. {
  3534. return -1;
  3535. }
  3536. Vec3* iarg0 = ud->getData<Vec3>();
  3537. const Vec3& arg0(*iarg0);
  3538. // Call the method
  3539. self->setOrigin(arg0);
  3540. return 0;
  3541. }
  3542. /// Wrap method Transform::setOrigin.
  3543. static int wrapTransformsetOrigin(lua_State* l)
  3544. {
  3545. int res = pwrapTransformsetOrigin(l);
  3546. if(res >= 0)
  3547. {
  3548. return res;
  3549. }
  3550. lua_error(l);
  3551. return 0;
  3552. }
  3553. /// Pre-wrap method Transform::getRotation.
  3554. static inline int pwrapTransformgetRotation(lua_State* l)
  3555. {
  3556. [[maybe_unused]] LuaUserData* ud;
  3557. [[maybe_unused]] void* voidp;
  3558. [[maybe_unused]] PtrSize size;
  3559. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3560. {
  3561. return -1;
  3562. }
  3563. // Get "this" as "self"
  3564. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3565. {
  3566. return -1;
  3567. }
  3568. Transform* self = ud->getData<Transform>();
  3569. // Call the method
  3570. Mat3 ret = self->getRotation().getRotationPart();
  3571. // Push return value
  3572. size = LuaUserData::computeSizeForGarbageCollected<Mat3>();
  3573. voidp = lua_newuserdata(l, size);
  3574. luaL_setmetatable(l, "Mat3");
  3575. ud = static_cast<LuaUserData*>(voidp);
  3576. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  3577. ud->initGarbageCollected(&luaUserDataTypeInfoMat3);
  3578. ::new(ud->getData<Mat3>()) Mat3(std::move(ret));
  3579. return 1;
  3580. }
  3581. /// Wrap method Transform::getRotation.
  3582. static int wrapTransformgetRotation(lua_State* l)
  3583. {
  3584. int res = pwrapTransformgetRotation(l);
  3585. if(res >= 0)
  3586. {
  3587. return res;
  3588. }
  3589. lua_error(l);
  3590. return 0;
  3591. }
  3592. /// Pre-wrap method Transform::setRotation.
  3593. static inline int pwrapTransformsetRotation(lua_State* l)
  3594. {
  3595. [[maybe_unused]] LuaUserData* ud;
  3596. [[maybe_unused]] void* voidp;
  3597. [[maybe_unused]] PtrSize size;
  3598. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3599. {
  3600. return -1;
  3601. }
  3602. // Get "this" as "self"
  3603. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3604. {
  3605. return -1;
  3606. }
  3607. Transform* self = ud->getData<Transform>();
  3608. // Pop arguments
  3609. extern LuaUserDataTypeInfo luaUserDataTypeInfoMat3;
  3610. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoMat3, ud)) [[unlikely]]
  3611. {
  3612. return -1;
  3613. }
  3614. Mat3* iarg0 = ud->getData<Mat3>();
  3615. const Mat3& arg0(*iarg0);
  3616. // Call the method
  3617. self->setRotation(arg0);
  3618. return 0;
  3619. }
  3620. /// Wrap method Transform::setRotation.
  3621. static int wrapTransformsetRotation(lua_State* l)
  3622. {
  3623. int res = pwrapTransformsetRotation(l);
  3624. if(res >= 0)
  3625. {
  3626. return res;
  3627. }
  3628. lua_error(l);
  3629. return 0;
  3630. }
  3631. /// Pre-wrap method Transform::getScale.
  3632. static inline int pwrapTransformgetScale(lua_State* l)
  3633. {
  3634. [[maybe_unused]] LuaUserData* ud;
  3635. [[maybe_unused]] void* voidp;
  3636. [[maybe_unused]] PtrSize size;
  3637. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3638. {
  3639. return -1;
  3640. }
  3641. // Get "this" as "self"
  3642. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3643. {
  3644. return -1;
  3645. }
  3646. Transform* self = ud->getData<Transform>();
  3647. // Call the method
  3648. Vec3 ret = self->getScale().xyz();
  3649. // Push return value
  3650. size = LuaUserData::computeSizeForGarbageCollected<Vec3>();
  3651. voidp = lua_newuserdata(l, size);
  3652. luaL_setmetatable(l, "Vec3");
  3653. ud = static_cast<LuaUserData*>(voidp);
  3654. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3655. ud->initGarbageCollected(&luaUserDataTypeInfoVec3);
  3656. ::new(ud->getData<Vec3>()) Vec3(std::move(ret));
  3657. return 1;
  3658. }
  3659. /// Wrap method Transform::getScale.
  3660. static int wrapTransformgetScale(lua_State* l)
  3661. {
  3662. int res = pwrapTransformgetScale(l);
  3663. if(res >= 0)
  3664. {
  3665. return res;
  3666. }
  3667. lua_error(l);
  3668. return 0;
  3669. }
  3670. /// Pre-wrap method Transform::setScale.
  3671. static inline int pwrapTransformsetScale(lua_State* l)
  3672. {
  3673. [[maybe_unused]] LuaUserData* ud;
  3674. [[maybe_unused]] void* voidp;
  3675. [[maybe_unused]] PtrSize size;
  3676. if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
  3677. {
  3678. return -1;
  3679. }
  3680. // Get "this" as "self"
  3681. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoTransform, ud))
  3682. {
  3683. return -1;
  3684. }
  3685. Transform* self = ud->getData<Transform>();
  3686. // Pop arguments
  3687. extern LuaUserDataTypeInfo luaUserDataTypeInfoVec3;
  3688. if(LuaBinder::checkUserData(l, 2, luaUserDataTypeInfoVec3, ud)) [[unlikely]]
  3689. {
  3690. return -1;
  3691. }
  3692. Vec3* iarg0 = ud->getData<Vec3>();
  3693. const Vec3& arg0(*iarg0);
  3694. // Call the method
  3695. self->setScale(arg0);
  3696. return 0;
  3697. }
  3698. /// Wrap method Transform::setScale.
  3699. static int wrapTransformsetScale(lua_State* l)
  3700. {
  3701. int res = pwrapTransformsetScale(l);
  3702. if(res >= 0)
  3703. {
  3704. return res;
  3705. }
  3706. lua_error(l);
  3707. return 0;
  3708. }
  3709. /// Wrap class Transform.
  3710. static inline void wrapTransform(lua_State* l)
  3711. {
  3712. LuaBinder::createClass(l, &luaUserDataTypeInfoTransform);
  3713. LuaBinder::pushLuaCFuncStaticMethod(l, luaUserDataTypeInfoTransform.m_typeName, "new", wrapTransformCtor);
  3714. LuaBinder::pushLuaCFuncMethod(l, "__gc", wrapTransformDtor);
  3715. LuaBinder::pushLuaCFuncMethod(l, "copy", wrapTransformcopy);
  3716. LuaBinder::pushLuaCFuncMethod(l, "getOrigin", wrapTransformgetOrigin);
  3717. LuaBinder::pushLuaCFuncMethod(l, "setOrigin", wrapTransformsetOrigin);
  3718. LuaBinder::pushLuaCFuncMethod(l, "getRotation", wrapTransformgetRotation);
  3719. LuaBinder::pushLuaCFuncMethod(l, "setRotation", wrapTransformsetRotation);
  3720. LuaBinder::pushLuaCFuncMethod(l, "getScale", wrapTransformgetScale);
  3721. LuaBinder::pushLuaCFuncMethod(l, "setScale", wrapTransformsetScale);
  3722. lua_settop(l, 0);
  3723. }
  3724. /// Pre-wrap function toRad.
  3725. static inline int pwraptoRad(lua_State* l)
  3726. {
  3727. [[maybe_unused]] LuaUserData* ud;
  3728. [[maybe_unused]] void* voidp;
  3729. [[maybe_unused]] PtrSize size;
  3730. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  3731. {
  3732. return -1;
  3733. }
  3734. // Pop arguments
  3735. F32 arg0;
  3736. if(LuaBinder::checkNumber(l, 1, arg0)) [[unlikely]]
  3737. {
  3738. return -1;
  3739. }
  3740. // Call the function
  3741. F32 ret = toRad(arg0);
  3742. // Push return value
  3743. lua_pushnumber(l, lua_Number(ret));
  3744. return 1;
  3745. }
  3746. /// Wrap function toRad.
  3747. static int wraptoRad(lua_State* l)
  3748. {
  3749. int res = pwraptoRad(l);
  3750. if(res >= 0)
  3751. {
  3752. return res;
  3753. }
  3754. lua_error(l);
  3755. return 0;
  3756. }
  3757. /// Wrap the module.
  3758. void wrapModuleMath(lua_State* l)
  3759. {
  3760. wrapVec2(l);
  3761. wrapVec3(l);
  3762. wrapVec4(l);
  3763. wrapMat3(l);
  3764. wrapMat3x4(l);
  3765. wrapTransform(l);
  3766. LuaBinder::pushLuaCFunc(l, "toRad", wraptoRad);
  3767. }
  3768. } // end namespace anki