Math.cpp 88 KB

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