Math.cpp 88 KB

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