lua_Matrix.cpp 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_Matrix.h"
  4. #include "Base.h"
  5. #include "MathUtil.h"
  6. #include "Matrix.h"
  7. #include "Quaternion.h"
  8. namespace gameplay
  9. {
  10. void luaRegister_Matrix()
  11. {
  12. const luaL_Reg lua_members[] =
  13. {
  14. {"add", lua_Matrix_add},
  15. {"decompose", lua_Matrix_decompose},
  16. {"determinant", lua_Matrix_determinant},
  17. {"getBackVector", lua_Matrix_getBackVector},
  18. {"getDownVector", lua_Matrix_getDownVector},
  19. {"getForwardVector", lua_Matrix_getForwardVector},
  20. {"getLeftVector", lua_Matrix_getLeftVector},
  21. {"getRightVector", lua_Matrix_getRightVector},
  22. {"getRotation", lua_Matrix_getRotation},
  23. {"getScale", lua_Matrix_getScale},
  24. {"getTranslation", lua_Matrix_getTranslation},
  25. {"getUpVector", lua_Matrix_getUpVector},
  26. {"invert", lua_Matrix_invert},
  27. {"isIdentity", lua_Matrix_isIdentity},
  28. {"m", lua_Matrix_m},
  29. {"multiply", lua_Matrix_multiply},
  30. {"negate", lua_Matrix_negate},
  31. {"rotate", lua_Matrix_rotate},
  32. {"rotateX", lua_Matrix_rotateX},
  33. {"rotateY", lua_Matrix_rotateY},
  34. {"rotateZ", lua_Matrix_rotateZ},
  35. {"scale", lua_Matrix_scale},
  36. {"set", lua_Matrix_set},
  37. {"setIdentity", lua_Matrix_setIdentity},
  38. {"setZero", lua_Matrix_setZero},
  39. {"subtract", lua_Matrix_subtract},
  40. {"transformPoint", lua_Matrix_transformPoint},
  41. {"transformVector", lua_Matrix_transformVector},
  42. {"translate", lua_Matrix_translate},
  43. {"transpose", lua_Matrix_transpose},
  44. {NULL, NULL}
  45. };
  46. const luaL_Reg lua_statics[] =
  47. {
  48. {"add", lua_Matrix_static_add},
  49. {"createLookAt", lua_Matrix_static_createLookAt},
  50. {"createOrthographic", lua_Matrix_static_createOrthographic},
  51. {"createOrthographicOffCenter", lua_Matrix_static_createOrthographicOffCenter},
  52. {"createPerspective", lua_Matrix_static_createPerspective},
  53. {"createRotation", lua_Matrix_static_createRotation},
  54. {"createRotationX", lua_Matrix_static_createRotationX},
  55. {"createRotationY", lua_Matrix_static_createRotationY},
  56. {"createRotationZ", lua_Matrix_static_createRotationZ},
  57. {"createScale", lua_Matrix_static_createScale},
  58. {"createTranslation", lua_Matrix_static_createTranslation},
  59. {"identity", lua_Matrix_static_identity},
  60. {"multiply", lua_Matrix_static_multiply},
  61. {"subtract", lua_Matrix_static_subtract},
  62. {"zero", lua_Matrix_static_zero},
  63. {NULL, NULL}
  64. };
  65. std::vector<std::string> scopePath;
  66. ScriptUtil::registerClass("Matrix", lua_members, lua_Matrix__init, lua_Matrix__gc, lua_statics, scopePath);
  67. }
  68. static Matrix* getInstance(lua_State* state)
  69. {
  70. void* userdata = luaL_checkudata(state, 1, "Matrix");
  71. luaL_argcheck(state, userdata != NULL, 1, "'Matrix' expected.");
  72. return (Matrix*)((ScriptUtil::LuaObject*)userdata)->instance;
  73. }
  74. int lua_Matrix__gc(lua_State* state)
  75. {
  76. // Get the number of parameters.
  77. int paramCount = lua_gettop(state);
  78. // Attempt to match the parameters to a valid binding.
  79. switch (paramCount)
  80. {
  81. case 1:
  82. {
  83. if ((lua_type(state, 1) == LUA_TUSERDATA))
  84. {
  85. void* userdata = luaL_checkudata(state, 1, "Matrix");
  86. luaL_argcheck(state, userdata != NULL, 1, "'Matrix' expected.");
  87. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
  88. if (object->owns)
  89. {
  90. Matrix* instance = (Matrix*)object->instance;
  91. SAFE_DELETE(instance);
  92. }
  93. return 0;
  94. }
  95. else
  96. {
  97. lua_pushstring(state, "lua_Matrix__gc - Failed to match the given parameters to a valid function signature.");
  98. lua_error(state);
  99. }
  100. break;
  101. }
  102. default:
  103. {
  104. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  105. lua_error(state);
  106. break;
  107. }
  108. }
  109. return 0;
  110. }
  111. int lua_Matrix__init(lua_State* state)
  112. {
  113. // Get the number of parameters.
  114. int paramCount = lua_gettop(state);
  115. // Attempt to match the parameters to a valid binding.
  116. switch (paramCount)
  117. {
  118. case 0:
  119. {
  120. void* returnPtr = (void*)new Matrix();
  121. if (returnPtr)
  122. {
  123. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  124. object->instance = returnPtr;
  125. object->owns = true;
  126. luaL_getmetatable(state, "Matrix");
  127. lua_setmetatable(state, -2);
  128. }
  129. else
  130. {
  131. lua_pushnil(state);
  132. }
  133. return 1;
  134. break;
  135. }
  136. case 1:
  137. {
  138. if ((lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TLIGHTUSERDATA))
  139. {
  140. // Get parameter 1 off the stack.
  141. ScriptUtil::LuaArray<float> param1 = ScriptUtil::getFloatPointer(1);
  142. void* returnPtr = (void*)new Matrix(param1);
  143. if (returnPtr)
  144. {
  145. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  146. object->instance = returnPtr;
  147. object->owns = true;
  148. luaL_getmetatable(state, "Matrix");
  149. lua_setmetatable(state, -2);
  150. }
  151. else
  152. {
  153. lua_pushnil(state);
  154. }
  155. return 1;
  156. }
  157. else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
  158. {
  159. // Get parameter 1 off the stack.
  160. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
  161. void* returnPtr = (void*)new Matrix(*param1);
  162. if (returnPtr)
  163. {
  164. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  165. object->instance = returnPtr;
  166. object->owns = true;
  167. luaL_getmetatable(state, "Matrix");
  168. lua_setmetatable(state, -2);
  169. }
  170. else
  171. {
  172. lua_pushnil(state);
  173. }
  174. return 1;
  175. }
  176. else
  177. {
  178. lua_pushstring(state, "lua_Matrix__init - Failed to match the given parameters to a valid function signature.");
  179. lua_error(state);
  180. }
  181. break;
  182. }
  183. case 16:
  184. {
  185. if (lua_type(state, 1) == LUA_TNUMBER &&
  186. lua_type(state, 2) == LUA_TNUMBER &&
  187. lua_type(state, 3) == LUA_TNUMBER &&
  188. lua_type(state, 4) == LUA_TNUMBER &&
  189. lua_type(state, 5) == LUA_TNUMBER &&
  190. lua_type(state, 6) == LUA_TNUMBER &&
  191. lua_type(state, 7) == LUA_TNUMBER &&
  192. lua_type(state, 8) == LUA_TNUMBER &&
  193. lua_type(state, 9) == LUA_TNUMBER &&
  194. lua_type(state, 10) == LUA_TNUMBER &&
  195. lua_type(state, 11) == LUA_TNUMBER &&
  196. lua_type(state, 12) == LUA_TNUMBER &&
  197. lua_type(state, 13) == LUA_TNUMBER &&
  198. lua_type(state, 14) == LUA_TNUMBER &&
  199. lua_type(state, 15) == LUA_TNUMBER &&
  200. lua_type(state, 16) == LUA_TNUMBER)
  201. {
  202. // Get parameter 1 off the stack.
  203. float param1 = (float)luaL_checknumber(state, 1);
  204. // Get parameter 2 off the stack.
  205. float param2 = (float)luaL_checknumber(state, 2);
  206. // Get parameter 3 off the stack.
  207. float param3 = (float)luaL_checknumber(state, 3);
  208. // Get parameter 4 off the stack.
  209. float param4 = (float)luaL_checknumber(state, 4);
  210. // Get parameter 5 off the stack.
  211. float param5 = (float)luaL_checknumber(state, 5);
  212. // Get parameter 6 off the stack.
  213. float param6 = (float)luaL_checknumber(state, 6);
  214. // Get parameter 7 off the stack.
  215. float param7 = (float)luaL_checknumber(state, 7);
  216. // Get parameter 8 off the stack.
  217. float param8 = (float)luaL_checknumber(state, 8);
  218. // Get parameter 9 off the stack.
  219. float param9 = (float)luaL_checknumber(state, 9);
  220. // Get parameter 10 off the stack.
  221. float param10 = (float)luaL_checknumber(state, 10);
  222. // Get parameter 11 off the stack.
  223. float param11 = (float)luaL_checknumber(state, 11);
  224. // Get parameter 12 off the stack.
  225. float param12 = (float)luaL_checknumber(state, 12);
  226. // Get parameter 13 off the stack.
  227. float param13 = (float)luaL_checknumber(state, 13);
  228. // Get parameter 14 off the stack.
  229. float param14 = (float)luaL_checknumber(state, 14);
  230. // Get parameter 15 off the stack.
  231. float param15 = (float)luaL_checknumber(state, 15);
  232. // Get parameter 16 off the stack.
  233. float param16 = (float)luaL_checknumber(state, 16);
  234. void* returnPtr = (void*)new Matrix(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16);
  235. if (returnPtr)
  236. {
  237. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  238. object->instance = returnPtr;
  239. object->owns = true;
  240. luaL_getmetatable(state, "Matrix");
  241. lua_setmetatable(state, -2);
  242. }
  243. else
  244. {
  245. lua_pushnil(state);
  246. }
  247. return 1;
  248. }
  249. else
  250. {
  251. lua_pushstring(state, "lua_Matrix__init - Failed to match the given parameters to a valid function signature.");
  252. lua_error(state);
  253. }
  254. break;
  255. }
  256. default:
  257. {
  258. lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 16).");
  259. lua_error(state);
  260. break;
  261. }
  262. }
  263. return 0;
  264. }
  265. int lua_Matrix_add(lua_State* state)
  266. {
  267. // Get the number of parameters.
  268. int paramCount = lua_gettop(state);
  269. // Attempt to match the parameters to a valid binding.
  270. switch (paramCount)
  271. {
  272. case 2:
  273. {
  274. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  275. lua_type(state, 2) == LUA_TNUMBER)
  276. {
  277. // Get parameter 1 off the stack.
  278. float param1 = (float)luaL_checknumber(state, 2);
  279. Matrix* instance = getInstance(state);
  280. instance->add(param1);
  281. return 0;
  282. }
  283. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  284. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  285. {
  286. // Get parameter 1 off the stack.
  287. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  288. Matrix* instance = getInstance(state);
  289. instance->add(*param1);
  290. return 0;
  291. }
  292. else
  293. {
  294. lua_pushstring(state, "lua_Matrix_add - Failed to match the given parameters to a valid function signature.");
  295. lua_error(state);
  296. }
  297. break;
  298. }
  299. case 3:
  300. {
  301. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  302. lua_type(state, 2) == LUA_TNUMBER &&
  303. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  304. {
  305. // Get parameter 1 off the stack.
  306. float param1 = (float)luaL_checknumber(state, 2);
  307. // Get parameter 2 off the stack.
  308. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  309. Matrix* instance = getInstance(state);
  310. instance->add(param1, param2);
  311. return 0;
  312. }
  313. else
  314. {
  315. lua_pushstring(state, "lua_Matrix_add - Failed to match the given parameters to a valid function signature.");
  316. lua_error(state);
  317. }
  318. break;
  319. }
  320. default:
  321. {
  322. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  323. lua_error(state);
  324. break;
  325. }
  326. }
  327. return 0;
  328. }
  329. int lua_Matrix_decompose(lua_State* state)
  330. {
  331. // Get the number of parameters.
  332. int paramCount = lua_gettop(state);
  333. // Attempt to match the parameters to a valid binding.
  334. switch (paramCount)
  335. {
  336. case 4:
  337. {
  338. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  339. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  340. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  341. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  342. {
  343. // Get parameter 1 off the stack.
  344. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  345. // Get parameter 2 off the stack.
  346. ScriptUtil::LuaArray<Quaternion> param2 = ScriptUtil::getObjectPointer<Quaternion>(3, "Quaternion", false);
  347. // Get parameter 3 off the stack.
  348. ScriptUtil::LuaArray<Vector3> param3 = ScriptUtil::getObjectPointer<Vector3>(4, "Vector3", false);
  349. Matrix* instance = getInstance(state);
  350. bool result = instance->decompose(param1, param2, param3);
  351. // Push the return value onto the stack.
  352. lua_pushboolean(state, result);
  353. return 1;
  354. }
  355. else
  356. {
  357. lua_pushstring(state, "lua_Matrix_decompose - Failed to match the given parameters to a valid function signature.");
  358. lua_error(state);
  359. }
  360. break;
  361. }
  362. default:
  363. {
  364. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  365. lua_error(state);
  366. break;
  367. }
  368. }
  369. return 0;
  370. }
  371. int lua_Matrix_determinant(lua_State* state)
  372. {
  373. // Get the number of parameters.
  374. int paramCount = lua_gettop(state);
  375. // Attempt to match the parameters to a valid binding.
  376. switch (paramCount)
  377. {
  378. case 1:
  379. {
  380. if ((lua_type(state, 1) == LUA_TUSERDATA))
  381. {
  382. Matrix* instance = getInstance(state);
  383. float result = instance->determinant();
  384. // Push the return value onto the stack.
  385. lua_pushnumber(state, result);
  386. return 1;
  387. }
  388. else
  389. {
  390. lua_pushstring(state, "lua_Matrix_determinant - Failed to match the given parameters to a valid function signature.");
  391. lua_error(state);
  392. }
  393. break;
  394. }
  395. default:
  396. {
  397. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  398. lua_error(state);
  399. break;
  400. }
  401. }
  402. return 0;
  403. }
  404. int lua_Matrix_getBackVector(lua_State* state)
  405. {
  406. // Get the number of parameters.
  407. int paramCount = lua_gettop(state);
  408. // Attempt to match the parameters to a valid binding.
  409. switch (paramCount)
  410. {
  411. case 2:
  412. {
  413. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  414. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  415. {
  416. // Get parameter 1 off the stack.
  417. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  418. Matrix* instance = getInstance(state);
  419. instance->getBackVector(param1);
  420. return 0;
  421. }
  422. else
  423. {
  424. lua_pushstring(state, "lua_Matrix_getBackVector - Failed to match the given parameters to a valid function signature.");
  425. lua_error(state);
  426. }
  427. break;
  428. }
  429. default:
  430. {
  431. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  432. lua_error(state);
  433. break;
  434. }
  435. }
  436. return 0;
  437. }
  438. int lua_Matrix_getDownVector(lua_State* state)
  439. {
  440. // Get the number of parameters.
  441. int paramCount = lua_gettop(state);
  442. // Attempt to match the parameters to a valid binding.
  443. switch (paramCount)
  444. {
  445. case 2:
  446. {
  447. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  448. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  449. {
  450. // Get parameter 1 off the stack.
  451. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  452. Matrix* instance = getInstance(state);
  453. instance->getDownVector(param1);
  454. return 0;
  455. }
  456. else
  457. {
  458. lua_pushstring(state, "lua_Matrix_getDownVector - Failed to match the given parameters to a valid function signature.");
  459. lua_error(state);
  460. }
  461. break;
  462. }
  463. default:
  464. {
  465. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  466. lua_error(state);
  467. break;
  468. }
  469. }
  470. return 0;
  471. }
  472. int lua_Matrix_getForwardVector(lua_State* state)
  473. {
  474. // Get the number of parameters.
  475. int paramCount = lua_gettop(state);
  476. // Attempt to match the parameters to a valid binding.
  477. switch (paramCount)
  478. {
  479. case 2:
  480. {
  481. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  482. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  483. {
  484. // Get parameter 1 off the stack.
  485. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  486. Matrix* instance = getInstance(state);
  487. instance->getForwardVector(param1);
  488. return 0;
  489. }
  490. else
  491. {
  492. lua_pushstring(state, "lua_Matrix_getForwardVector - Failed to match the given parameters to a valid function signature.");
  493. lua_error(state);
  494. }
  495. break;
  496. }
  497. default:
  498. {
  499. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  500. lua_error(state);
  501. break;
  502. }
  503. }
  504. return 0;
  505. }
  506. int lua_Matrix_getLeftVector(lua_State* state)
  507. {
  508. // Get the number of parameters.
  509. int paramCount = lua_gettop(state);
  510. // Attempt to match the parameters to a valid binding.
  511. switch (paramCount)
  512. {
  513. case 2:
  514. {
  515. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  516. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  517. {
  518. // Get parameter 1 off the stack.
  519. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  520. Matrix* instance = getInstance(state);
  521. instance->getLeftVector(param1);
  522. return 0;
  523. }
  524. else
  525. {
  526. lua_pushstring(state, "lua_Matrix_getLeftVector - Failed to match the given parameters to a valid function signature.");
  527. lua_error(state);
  528. }
  529. break;
  530. }
  531. default:
  532. {
  533. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  534. lua_error(state);
  535. break;
  536. }
  537. }
  538. return 0;
  539. }
  540. int lua_Matrix_getRightVector(lua_State* state)
  541. {
  542. // Get the number of parameters.
  543. int paramCount = lua_gettop(state);
  544. // Attempt to match the parameters to a valid binding.
  545. switch (paramCount)
  546. {
  547. case 2:
  548. {
  549. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  550. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  551. {
  552. // Get parameter 1 off the stack.
  553. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  554. Matrix* instance = getInstance(state);
  555. instance->getRightVector(param1);
  556. return 0;
  557. }
  558. else
  559. {
  560. lua_pushstring(state, "lua_Matrix_getRightVector - Failed to match the given parameters to a valid function signature.");
  561. lua_error(state);
  562. }
  563. break;
  564. }
  565. default:
  566. {
  567. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  568. lua_error(state);
  569. break;
  570. }
  571. }
  572. return 0;
  573. }
  574. int lua_Matrix_getRotation(lua_State* state)
  575. {
  576. // Get the number of parameters.
  577. int paramCount = lua_gettop(state);
  578. // Attempt to match the parameters to a valid binding.
  579. switch (paramCount)
  580. {
  581. case 2:
  582. {
  583. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  584. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  585. {
  586. // Get parameter 1 off the stack.
  587. ScriptUtil::LuaArray<Quaternion> param1 = ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", false);
  588. Matrix* instance = getInstance(state);
  589. bool result = instance->getRotation(param1);
  590. // Push the return value onto the stack.
  591. lua_pushboolean(state, result);
  592. return 1;
  593. }
  594. else
  595. {
  596. lua_pushstring(state, "lua_Matrix_getRotation - Failed to match the given parameters to a valid function signature.");
  597. lua_error(state);
  598. }
  599. break;
  600. }
  601. default:
  602. {
  603. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  604. lua_error(state);
  605. break;
  606. }
  607. }
  608. return 0;
  609. }
  610. int lua_Matrix_getScale(lua_State* state)
  611. {
  612. // Get the number of parameters.
  613. int paramCount = lua_gettop(state);
  614. // Attempt to match the parameters to a valid binding.
  615. switch (paramCount)
  616. {
  617. case 2:
  618. {
  619. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  620. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  621. {
  622. // Get parameter 1 off the stack.
  623. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  624. Matrix* instance = getInstance(state);
  625. instance->getScale(param1);
  626. return 0;
  627. }
  628. else
  629. {
  630. lua_pushstring(state, "lua_Matrix_getScale - Failed to match the given parameters to a valid function signature.");
  631. lua_error(state);
  632. }
  633. break;
  634. }
  635. default:
  636. {
  637. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  638. lua_error(state);
  639. break;
  640. }
  641. }
  642. return 0;
  643. }
  644. int lua_Matrix_getTranslation(lua_State* state)
  645. {
  646. // Get the number of parameters.
  647. int paramCount = lua_gettop(state);
  648. // Attempt to match the parameters to a valid binding.
  649. switch (paramCount)
  650. {
  651. case 2:
  652. {
  653. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  654. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  655. {
  656. // Get parameter 1 off the stack.
  657. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  658. Matrix* instance = getInstance(state);
  659. instance->getTranslation(param1);
  660. return 0;
  661. }
  662. else
  663. {
  664. lua_pushstring(state, "lua_Matrix_getTranslation - Failed to match the given parameters to a valid function signature.");
  665. lua_error(state);
  666. }
  667. break;
  668. }
  669. default:
  670. {
  671. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  672. lua_error(state);
  673. break;
  674. }
  675. }
  676. return 0;
  677. }
  678. int lua_Matrix_getUpVector(lua_State* state)
  679. {
  680. // Get the number of parameters.
  681. int paramCount = lua_gettop(state);
  682. // Attempt to match the parameters to a valid binding.
  683. switch (paramCount)
  684. {
  685. case 2:
  686. {
  687. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  688. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  689. {
  690. // Get parameter 1 off the stack.
  691. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  692. Matrix* instance = getInstance(state);
  693. instance->getUpVector(param1);
  694. return 0;
  695. }
  696. else
  697. {
  698. lua_pushstring(state, "lua_Matrix_getUpVector - Failed to match the given parameters to a valid function signature.");
  699. lua_error(state);
  700. }
  701. break;
  702. }
  703. default:
  704. {
  705. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  706. lua_error(state);
  707. break;
  708. }
  709. }
  710. return 0;
  711. }
  712. int lua_Matrix_invert(lua_State* state)
  713. {
  714. // Get the number of parameters.
  715. int paramCount = lua_gettop(state);
  716. // Attempt to match the parameters to a valid binding.
  717. switch (paramCount)
  718. {
  719. case 1:
  720. {
  721. if ((lua_type(state, 1) == LUA_TUSERDATA))
  722. {
  723. Matrix* instance = getInstance(state);
  724. bool result = instance->invert();
  725. // Push the return value onto the stack.
  726. lua_pushboolean(state, result);
  727. return 1;
  728. }
  729. else
  730. {
  731. lua_pushstring(state, "lua_Matrix_invert - Failed to match the given parameters to a valid function signature.");
  732. lua_error(state);
  733. }
  734. break;
  735. }
  736. case 2:
  737. {
  738. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  739. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  740. {
  741. // Get parameter 1 off the stack.
  742. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  743. Matrix* instance = getInstance(state);
  744. bool result = instance->invert(param1);
  745. // Push the return value onto the stack.
  746. lua_pushboolean(state, result);
  747. return 1;
  748. }
  749. else
  750. {
  751. lua_pushstring(state, "lua_Matrix_invert - Failed to match the given parameters to a valid function signature.");
  752. lua_error(state);
  753. }
  754. break;
  755. }
  756. default:
  757. {
  758. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  759. lua_error(state);
  760. break;
  761. }
  762. }
  763. return 0;
  764. }
  765. int lua_Matrix_isIdentity(lua_State* state)
  766. {
  767. // Get the number of parameters.
  768. int paramCount = lua_gettop(state);
  769. // Attempt to match the parameters to a valid binding.
  770. switch (paramCount)
  771. {
  772. case 1:
  773. {
  774. if ((lua_type(state, 1) == LUA_TUSERDATA))
  775. {
  776. Matrix* instance = getInstance(state);
  777. bool result = instance->isIdentity();
  778. // Push the return value onto the stack.
  779. lua_pushboolean(state, result);
  780. return 1;
  781. }
  782. else
  783. {
  784. lua_pushstring(state, "lua_Matrix_isIdentity - Failed to match the given parameters to a valid function signature.");
  785. lua_error(state);
  786. }
  787. break;
  788. }
  789. default:
  790. {
  791. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  792. lua_error(state);
  793. break;
  794. }
  795. }
  796. return 0;
  797. }
  798. int lua_Matrix_m(lua_State* state)
  799. {
  800. // Validate the number of parameters.
  801. if (lua_gettop(state) > 2)
  802. {
  803. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  804. lua_error(state);
  805. }
  806. Matrix* instance = getInstance(state);
  807. if (lua_gettop(state) == 2)
  808. {
  809. // Get parameter 2 off the stack.
  810. ScriptUtil::LuaArray<float> param2 = ScriptUtil::getFloatPointer(2);
  811. memcpy(instance->m, param2, sizeof(float) * 16);
  812. return 0;
  813. }
  814. else
  815. {
  816. float* result = instance->m;
  817. // Push the return value onto the stack.
  818. lua_pushlightuserdata(state, result);
  819. return 1;
  820. }
  821. }
  822. int lua_Matrix_multiply(lua_State* state)
  823. {
  824. // Get the number of parameters.
  825. int paramCount = lua_gettop(state);
  826. // Attempt to match the parameters to a valid binding.
  827. switch (paramCount)
  828. {
  829. case 2:
  830. {
  831. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  832. lua_type(state, 2) == LUA_TNUMBER)
  833. {
  834. // Get parameter 1 off the stack.
  835. float param1 = (float)luaL_checknumber(state, 2);
  836. Matrix* instance = getInstance(state);
  837. instance->multiply(param1);
  838. return 0;
  839. }
  840. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  841. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  842. {
  843. // Get parameter 1 off the stack.
  844. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  845. Matrix* instance = getInstance(state);
  846. instance->multiply(*param1);
  847. return 0;
  848. }
  849. else
  850. {
  851. lua_pushstring(state, "lua_Matrix_multiply - Failed to match the given parameters to a valid function signature.");
  852. lua_error(state);
  853. }
  854. break;
  855. }
  856. case 3:
  857. {
  858. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  859. lua_type(state, 2) == LUA_TNUMBER &&
  860. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  861. {
  862. // Get parameter 1 off the stack.
  863. float param1 = (float)luaL_checknumber(state, 2);
  864. // Get parameter 2 off the stack.
  865. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  866. Matrix* instance = getInstance(state);
  867. instance->multiply(param1, param2);
  868. return 0;
  869. }
  870. else
  871. {
  872. lua_pushstring(state, "lua_Matrix_multiply - Failed to match the given parameters to a valid function signature.");
  873. lua_error(state);
  874. }
  875. break;
  876. }
  877. default:
  878. {
  879. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  880. lua_error(state);
  881. break;
  882. }
  883. }
  884. return 0;
  885. }
  886. int lua_Matrix_negate(lua_State* state)
  887. {
  888. // Get the number of parameters.
  889. int paramCount = lua_gettop(state);
  890. // Attempt to match the parameters to a valid binding.
  891. switch (paramCount)
  892. {
  893. case 1:
  894. {
  895. if ((lua_type(state, 1) == LUA_TUSERDATA))
  896. {
  897. Matrix* instance = getInstance(state);
  898. instance->negate();
  899. return 0;
  900. }
  901. else
  902. {
  903. lua_pushstring(state, "lua_Matrix_negate - Failed to match the given parameters to a valid function signature.");
  904. lua_error(state);
  905. }
  906. break;
  907. }
  908. case 2:
  909. {
  910. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  911. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  912. {
  913. // Get parameter 1 off the stack.
  914. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  915. Matrix* instance = getInstance(state);
  916. instance->negate(param1);
  917. return 0;
  918. }
  919. else
  920. {
  921. lua_pushstring(state, "lua_Matrix_negate - Failed to match the given parameters to a valid function signature.");
  922. lua_error(state);
  923. }
  924. break;
  925. }
  926. default:
  927. {
  928. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  929. lua_error(state);
  930. break;
  931. }
  932. }
  933. return 0;
  934. }
  935. int lua_Matrix_rotate(lua_State* state)
  936. {
  937. // Get the number of parameters.
  938. int paramCount = lua_gettop(state);
  939. // Attempt to match the parameters to a valid binding.
  940. switch (paramCount)
  941. {
  942. case 2:
  943. {
  944. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  945. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  946. {
  947. // Get parameter 1 off the stack.
  948. ScriptUtil::LuaArray<Quaternion> param1 = ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true);
  949. Matrix* instance = getInstance(state);
  950. instance->rotate(*param1);
  951. return 0;
  952. }
  953. else
  954. {
  955. lua_pushstring(state, "lua_Matrix_rotate - Failed to match the given parameters to a valid function signature.");
  956. lua_error(state);
  957. }
  958. break;
  959. }
  960. case 3:
  961. {
  962. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  963. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  964. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  965. {
  966. // Get parameter 1 off the stack.
  967. ScriptUtil::LuaArray<Quaternion> param1 = ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true);
  968. // Get parameter 2 off the stack.
  969. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  970. Matrix* instance = getInstance(state);
  971. instance->rotate(*param1, param2);
  972. return 0;
  973. }
  974. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  975. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  976. lua_type(state, 3) == LUA_TNUMBER)
  977. {
  978. // Get parameter 1 off the stack.
  979. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  980. // Get parameter 2 off the stack.
  981. float param2 = (float)luaL_checknumber(state, 3);
  982. Matrix* instance = getInstance(state);
  983. instance->rotate(*param1, param2);
  984. return 0;
  985. }
  986. else
  987. {
  988. lua_pushstring(state, "lua_Matrix_rotate - Failed to match the given parameters to a valid function signature.");
  989. lua_error(state);
  990. }
  991. break;
  992. }
  993. case 4:
  994. {
  995. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  996. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  997. lua_type(state, 3) == LUA_TNUMBER &&
  998. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  999. {
  1000. // Get parameter 1 off the stack.
  1001. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1002. // Get parameter 2 off the stack.
  1003. float param2 = (float)luaL_checknumber(state, 3);
  1004. // Get parameter 3 off the stack.
  1005. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(4, "Matrix", false);
  1006. Matrix* instance = getInstance(state);
  1007. instance->rotate(*param1, param2, param3);
  1008. return 0;
  1009. }
  1010. else
  1011. {
  1012. lua_pushstring(state, "lua_Matrix_rotate - Failed to match the given parameters to a valid function signature.");
  1013. lua_error(state);
  1014. }
  1015. break;
  1016. }
  1017. default:
  1018. {
  1019. lua_pushstring(state, "Invalid number of parameters (expected 2, 3 or 4).");
  1020. lua_error(state);
  1021. break;
  1022. }
  1023. }
  1024. return 0;
  1025. }
  1026. int lua_Matrix_rotateX(lua_State* state)
  1027. {
  1028. // Get the number of parameters.
  1029. int paramCount = lua_gettop(state);
  1030. // Attempt to match the parameters to a valid binding.
  1031. switch (paramCount)
  1032. {
  1033. case 2:
  1034. {
  1035. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1036. lua_type(state, 2) == LUA_TNUMBER)
  1037. {
  1038. // Get parameter 1 off the stack.
  1039. float param1 = (float)luaL_checknumber(state, 2);
  1040. Matrix* instance = getInstance(state);
  1041. instance->rotateX(param1);
  1042. return 0;
  1043. }
  1044. else
  1045. {
  1046. lua_pushstring(state, "lua_Matrix_rotateX - Failed to match the given parameters to a valid function signature.");
  1047. lua_error(state);
  1048. }
  1049. break;
  1050. }
  1051. case 3:
  1052. {
  1053. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1054. lua_type(state, 2) == LUA_TNUMBER &&
  1055. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1056. {
  1057. // Get parameter 1 off the stack.
  1058. float param1 = (float)luaL_checknumber(state, 2);
  1059. // Get parameter 2 off the stack.
  1060. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1061. Matrix* instance = getInstance(state);
  1062. instance->rotateX(param1, param2);
  1063. return 0;
  1064. }
  1065. else
  1066. {
  1067. lua_pushstring(state, "lua_Matrix_rotateX - Failed to match the given parameters to a valid function signature.");
  1068. lua_error(state);
  1069. }
  1070. break;
  1071. }
  1072. default:
  1073. {
  1074. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1075. lua_error(state);
  1076. break;
  1077. }
  1078. }
  1079. return 0;
  1080. }
  1081. int lua_Matrix_rotateY(lua_State* state)
  1082. {
  1083. // Get the number of parameters.
  1084. int paramCount = lua_gettop(state);
  1085. // Attempt to match the parameters to a valid binding.
  1086. switch (paramCount)
  1087. {
  1088. case 2:
  1089. {
  1090. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1091. lua_type(state, 2) == LUA_TNUMBER)
  1092. {
  1093. // Get parameter 1 off the stack.
  1094. float param1 = (float)luaL_checknumber(state, 2);
  1095. Matrix* instance = getInstance(state);
  1096. instance->rotateY(param1);
  1097. return 0;
  1098. }
  1099. else
  1100. {
  1101. lua_pushstring(state, "lua_Matrix_rotateY - Failed to match the given parameters to a valid function signature.");
  1102. lua_error(state);
  1103. }
  1104. break;
  1105. }
  1106. case 3:
  1107. {
  1108. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1109. lua_type(state, 2) == LUA_TNUMBER &&
  1110. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1111. {
  1112. // Get parameter 1 off the stack.
  1113. float param1 = (float)luaL_checknumber(state, 2);
  1114. // Get parameter 2 off the stack.
  1115. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1116. Matrix* instance = getInstance(state);
  1117. instance->rotateY(param1, param2);
  1118. return 0;
  1119. }
  1120. else
  1121. {
  1122. lua_pushstring(state, "lua_Matrix_rotateY - Failed to match the given parameters to a valid function signature.");
  1123. lua_error(state);
  1124. }
  1125. break;
  1126. }
  1127. default:
  1128. {
  1129. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1130. lua_error(state);
  1131. break;
  1132. }
  1133. }
  1134. return 0;
  1135. }
  1136. int lua_Matrix_rotateZ(lua_State* state)
  1137. {
  1138. // Get the number of parameters.
  1139. int paramCount = lua_gettop(state);
  1140. // Attempt to match the parameters to a valid binding.
  1141. switch (paramCount)
  1142. {
  1143. case 2:
  1144. {
  1145. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1146. lua_type(state, 2) == LUA_TNUMBER)
  1147. {
  1148. // Get parameter 1 off the stack.
  1149. float param1 = (float)luaL_checknumber(state, 2);
  1150. Matrix* instance = getInstance(state);
  1151. instance->rotateZ(param1);
  1152. return 0;
  1153. }
  1154. else
  1155. {
  1156. lua_pushstring(state, "lua_Matrix_rotateZ - Failed to match the given parameters to a valid function signature.");
  1157. lua_error(state);
  1158. }
  1159. break;
  1160. }
  1161. case 3:
  1162. {
  1163. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1164. lua_type(state, 2) == LUA_TNUMBER &&
  1165. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1166. {
  1167. // Get parameter 1 off the stack.
  1168. float param1 = (float)luaL_checknumber(state, 2);
  1169. // Get parameter 2 off the stack.
  1170. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1171. Matrix* instance = getInstance(state);
  1172. instance->rotateZ(param1, param2);
  1173. return 0;
  1174. }
  1175. else
  1176. {
  1177. lua_pushstring(state, "lua_Matrix_rotateZ - Failed to match the given parameters to a valid function signature.");
  1178. lua_error(state);
  1179. }
  1180. break;
  1181. }
  1182. default:
  1183. {
  1184. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1185. lua_error(state);
  1186. break;
  1187. }
  1188. }
  1189. return 0;
  1190. }
  1191. int lua_Matrix_scale(lua_State* state)
  1192. {
  1193. // Get the number of parameters.
  1194. int paramCount = lua_gettop(state);
  1195. // Attempt to match the parameters to a valid binding.
  1196. switch (paramCount)
  1197. {
  1198. case 2:
  1199. {
  1200. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1201. lua_type(state, 2) == LUA_TNUMBER)
  1202. {
  1203. // Get parameter 1 off the stack.
  1204. float param1 = (float)luaL_checknumber(state, 2);
  1205. Matrix* instance = getInstance(state);
  1206. instance->scale(param1);
  1207. return 0;
  1208. }
  1209. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1210. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1211. {
  1212. // Get parameter 1 off the stack.
  1213. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1214. Matrix* instance = getInstance(state);
  1215. instance->scale(*param1);
  1216. return 0;
  1217. }
  1218. else
  1219. {
  1220. lua_pushstring(state, "lua_Matrix_scale - Failed to match the given parameters to a valid function signature.");
  1221. lua_error(state);
  1222. }
  1223. break;
  1224. }
  1225. case 3:
  1226. {
  1227. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1228. lua_type(state, 2) == LUA_TNUMBER &&
  1229. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1230. {
  1231. // Get parameter 1 off the stack.
  1232. float param1 = (float)luaL_checknumber(state, 2);
  1233. // Get parameter 2 off the stack.
  1234. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1235. Matrix* instance = getInstance(state);
  1236. instance->scale(param1, param2);
  1237. return 0;
  1238. }
  1239. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1240. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  1241. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1242. {
  1243. // Get parameter 1 off the stack.
  1244. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1245. // Get parameter 2 off the stack.
  1246. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1247. Matrix* instance = getInstance(state);
  1248. instance->scale(*param1, param2);
  1249. return 0;
  1250. }
  1251. else
  1252. {
  1253. lua_pushstring(state, "lua_Matrix_scale - Failed to match the given parameters to a valid function signature.");
  1254. lua_error(state);
  1255. }
  1256. break;
  1257. }
  1258. case 4:
  1259. {
  1260. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1261. lua_type(state, 2) == LUA_TNUMBER &&
  1262. lua_type(state, 3) == LUA_TNUMBER &&
  1263. lua_type(state, 4) == LUA_TNUMBER)
  1264. {
  1265. // Get parameter 1 off the stack.
  1266. float param1 = (float)luaL_checknumber(state, 2);
  1267. // Get parameter 2 off the stack.
  1268. float param2 = (float)luaL_checknumber(state, 3);
  1269. // Get parameter 3 off the stack.
  1270. float param3 = (float)luaL_checknumber(state, 4);
  1271. Matrix* instance = getInstance(state);
  1272. instance->scale(param1, param2, param3);
  1273. return 0;
  1274. }
  1275. else
  1276. {
  1277. lua_pushstring(state, "lua_Matrix_scale - Failed to match the given parameters to a valid function signature.");
  1278. lua_error(state);
  1279. }
  1280. break;
  1281. }
  1282. case 5:
  1283. {
  1284. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1285. lua_type(state, 2) == LUA_TNUMBER &&
  1286. lua_type(state, 3) == LUA_TNUMBER &&
  1287. lua_type(state, 4) == LUA_TNUMBER &&
  1288. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
  1289. {
  1290. // Get parameter 1 off the stack.
  1291. float param1 = (float)luaL_checknumber(state, 2);
  1292. // Get parameter 2 off the stack.
  1293. float param2 = (float)luaL_checknumber(state, 3);
  1294. // Get parameter 3 off the stack.
  1295. float param3 = (float)luaL_checknumber(state, 4);
  1296. // Get parameter 4 off the stack.
  1297. ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(5, "Matrix", false);
  1298. Matrix* instance = getInstance(state);
  1299. instance->scale(param1, param2, param3, param4);
  1300. return 0;
  1301. }
  1302. else
  1303. {
  1304. lua_pushstring(state, "lua_Matrix_scale - Failed to match the given parameters to a valid function signature.");
  1305. lua_error(state);
  1306. }
  1307. break;
  1308. }
  1309. default:
  1310. {
  1311. lua_pushstring(state, "Invalid number of parameters (expected 2, 3, 4 or 5).");
  1312. lua_error(state);
  1313. break;
  1314. }
  1315. }
  1316. return 0;
  1317. }
  1318. int lua_Matrix_set(lua_State* state)
  1319. {
  1320. // Get the number of parameters.
  1321. int paramCount = lua_gettop(state);
  1322. // Attempt to match the parameters to a valid binding.
  1323. switch (paramCount)
  1324. {
  1325. case 2:
  1326. {
  1327. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1328. (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
  1329. {
  1330. // Get parameter 1 off the stack.
  1331. ScriptUtil::LuaArray<float> param1 = ScriptUtil::getFloatPointer(2);
  1332. Matrix* instance = getInstance(state);
  1333. instance->set(param1);
  1334. return 0;
  1335. }
  1336. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1337. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1338. {
  1339. // Get parameter 1 off the stack.
  1340. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  1341. Matrix* instance = getInstance(state);
  1342. instance->set(*param1);
  1343. return 0;
  1344. }
  1345. else
  1346. {
  1347. lua_pushstring(state, "lua_Matrix_set - Failed to match the given parameters to a valid function signature.");
  1348. lua_error(state);
  1349. }
  1350. break;
  1351. }
  1352. case 17:
  1353. {
  1354. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1355. lua_type(state, 2) == LUA_TNUMBER &&
  1356. lua_type(state, 3) == LUA_TNUMBER &&
  1357. lua_type(state, 4) == LUA_TNUMBER &&
  1358. lua_type(state, 5) == LUA_TNUMBER &&
  1359. lua_type(state, 6) == LUA_TNUMBER &&
  1360. lua_type(state, 7) == LUA_TNUMBER &&
  1361. lua_type(state, 8) == LUA_TNUMBER &&
  1362. lua_type(state, 9) == LUA_TNUMBER &&
  1363. lua_type(state, 10) == LUA_TNUMBER &&
  1364. lua_type(state, 11) == LUA_TNUMBER &&
  1365. lua_type(state, 12) == LUA_TNUMBER &&
  1366. lua_type(state, 13) == LUA_TNUMBER &&
  1367. lua_type(state, 14) == LUA_TNUMBER &&
  1368. lua_type(state, 15) == LUA_TNUMBER &&
  1369. lua_type(state, 16) == LUA_TNUMBER &&
  1370. lua_type(state, 17) == LUA_TNUMBER)
  1371. {
  1372. // Get parameter 1 off the stack.
  1373. float param1 = (float)luaL_checknumber(state, 2);
  1374. // Get parameter 2 off the stack.
  1375. float param2 = (float)luaL_checknumber(state, 3);
  1376. // Get parameter 3 off the stack.
  1377. float param3 = (float)luaL_checknumber(state, 4);
  1378. // Get parameter 4 off the stack.
  1379. float param4 = (float)luaL_checknumber(state, 5);
  1380. // Get parameter 5 off the stack.
  1381. float param5 = (float)luaL_checknumber(state, 6);
  1382. // Get parameter 6 off the stack.
  1383. float param6 = (float)luaL_checknumber(state, 7);
  1384. // Get parameter 7 off the stack.
  1385. float param7 = (float)luaL_checknumber(state, 8);
  1386. // Get parameter 8 off the stack.
  1387. float param8 = (float)luaL_checknumber(state, 9);
  1388. // Get parameter 9 off the stack.
  1389. float param9 = (float)luaL_checknumber(state, 10);
  1390. // Get parameter 10 off the stack.
  1391. float param10 = (float)luaL_checknumber(state, 11);
  1392. // Get parameter 11 off the stack.
  1393. float param11 = (float)luaL_checknumber(state, 12);
  1394. // Get parameter 12 off the stack.
  1395. float param12 = (float)luaL_checknumber(state, 13);
  1396. // Get parameter 13 off the stack.
  1397. float param13 = (float)luaL_checknumber(state, 14);
  1398. // Get parameter 14 off the stack.
  1399. float param14 = (float)luaL_checknumber(state, 15);
  1400. // Get parameter 15 off the stack.
  1401. float param15 = (float)luaL_checknumber(state, 16);
  1402. // Get parameter 16 off the stack.
  1403. float param16 = (float)luaL_checknumber(state, 17);
  1404. Matrix* instance = getInstance(state);
  1405. instance->set(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16);
  1406. return 0;
  1407. }
  1408. else
  1409. {
  1410. lua_pushstring(state, "lua_Matrix_set - Failed to match the given parameters to a valid function signature.");
  1411. lua_error(state);
  1412. }
  1413. break;
  1414. }
  1415. default:
  1416. {
  1417. lua_pushstring(state, "Invalid number of parameters (expected 2 or 17).");
  1418. lua_error(state);
  1419. break;
  1420. }
  1421. }
  1422. return 0;
  1423. }
  1424. int lua_Matrix_setIdentity(lua_State* state)
  1425. {
  1426. // Get the number of parameters.
  1427. int paramCount = lua_gettop(state);
  1428. // Attempt to match the parameters to a valid binding.
  1429. switch (paramCount)
  1430. {
  1431. case 1:
  1432. {
  1433. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1434. {
  1435. Matrix* instance = getInstance(state);
  1436. instance->setIdentity();
  1437. return 0;
  1438. }
  1439. else
  1440. {
  1441. lua_pushstring(state, "lua_Matrix_setIdentity - Failed to match the given parameters to a valid function signature.");
  1442. lua_error(state);
  1443. }
  1444. break;
  1445. }
  1446. default:
  1447. {
  1448. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1449. lua_error(state);
  1450. break;
  1451. }
  1452. }
  1453. return 0;
  1454. }
  1455. int lua_Matrix_setZero(lua_State* state)
  1456. {
  1457. // Get the number of parameters.
  1458. int paramCount = lua_gettop(state);
  1459. // Attempt to match the parameters to a valid binding.
  1460. switch (paramCount)
  1461. {
  1462. case 1:
  1463. {
  1464. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1465. {
  1466. Matrix* instance = getInstance(state);
  1467. instance->setZero();
  1468. return 0;
  1469. }
  1470. else
  1471. {
  1472. lua_pushstring(state, "lua_Matrix_setZero - Failed to match the given parameters to a valid function signature.");
  1473. lua_error(state);
  1474. }
  1475. break;
  1476. }
  1477. default:
  1478. {
  1479. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1480. lua_error(state);
  1481. break;
  1482. }
  1483. }
  1484. return 0;
  1485. }
  1486. int lua_Matrix_static_add(lua_State* state)
  1487. {
  1488. // Get the number of parameters.
  1489. int paramCount = lua_gettop(state);
  1490. // Attempt to match the parameters to a valid binding.
  1491. switch (paramCount)
  1492. {
  1493. case 3:
  1494. {
  1495. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1496. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  1497. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1498. {
  1499. // Get parameter 1 off the stack.
  1500. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
  1501. // Get parameter 2 off the stack.
  1502. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  1503. // Get parameter 3 off the stack.
  1504. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1505. Matrix::add(*param1, *param2, param3);
  1506. return 0;
  1507. }
  1508. else
  1509. {
  1510. lua_pushstring(state, "lua_Matrix_static_add - Failed to match the given parameters to a valid function signature.");
  1511. lua_error(state);
  1512. }
  1513. break;
  1514. }
  1515. default:
  1516. {
  1517. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1518. lua_error(state);
  1519. break;
  1520. }
  1521. }
  1522. return 0;
  1523. }
  1524. int lua_Matrix_static_createLookAt(lua_State* state)
  1525. {
  1526. // Get the number of parameters.
  1527. int paramCount = lua_gettop(state);
  1528. // Attempt to match the parameters to a valid binding.
  1529. switch (paramCount)
  1530. {
  1531. case 4:
  1532. {
  1533. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1534. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  1535. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  1536. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  1537. {
  1538. // Get parameter 1 off the stack.
  1539. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
  1540. // Get parameter 2 off the stack.
  1541. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1542. // Get parameter 3 off the stack.
  1543. ScriptUtil::LuaArray<Vector3> param3 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
  1544. // Get parameter 4 off the stack.
  1545. ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(4, "Matrix", false);
  1546. Matrix::createLookAt(*param1, *param2, *param3, param4);
  1547. return 0;
  1548. }
  1549. else
  1550. {
  1551. lua_pushstring(state, "lua_Matrix_static_createLookAt - Failed to match the given parameters to a valid function signature.");
  1552. lua_error(state);
  1553. }
  1554. break;
  1555. }
  1556. case 10:
  1557. {
  1558. if (lua_type(state, 1) == LUA_TNUMBER &&
  1559. lua_type(state, 2) == LUA_TNUMBER &&
  1560. lua_type(state, 3) == LUA_TNUMBER &&
  1561. lua_type(state, 4) == LUA_TNUMBER &&
  1562. lua_type(state, 5) == LUA_TNUMBER &&
  1563. lua_type(state, 6) == LUA_TNUMBER &&
  1564. lua_type(state, 7) == LUA_TNUMBER &&
  1565. lua_type(state, 8) == LUA_TNUMBER &&
  1566. lua_type(state, 9) == LUA_TNUMBER &&
  1567. (lua_type(state, 10) == LUA_TUSERDATA || lua_type(state, 10) == LUA_TTABLE || lua_type(state, 10) == LUA_TNIL))
  1568. {
  1569. // Get parameter 1 off the stack.
  1570. float param1 = (float)luaL_checknumber(state, 1);
  1571. // Get parameter 2 off the stack.
  1572. float param2 = (float)luaL_checknumber(state, 2);
  1573. // Get parameter 3 off the stack.
  1574. float param3 = (float)luaL_checknumber(state, 3);
  1575. // Get parameter 4 off the stack.
  1576. float param4 = (float)luaL_checknumber(state, 4);
  1577. // Get parameter 5 off the stack.
  1578. float param5 = (float)luaL_checknumber(state, 5);
  1579. // Get parameter 6 off the stack.
  1580. float param6 = (float)luaL_checknumber(state, 6);
  1581. // Get parameter 7 off the stack.
  1582. float param7 = (float)luaL_checknumber(state, 7);
  1583. // Get parameter 8 off the stack.
  1584. float param8 = (float)luaL_checknumber(state, 8);
  1585. // Get parameter 9 off the stack.
  1586. float param9 = (float)luaL_checknumber(state, 9);
  1587. // Get parameter 10 off the stack.
  1588. ScriptUtil::LuaArray<Matrix> param10 = ScriptUtil::getObjectPointer<Matrix>(10, "Matrix", false);
  1589. Matrix::createLookAt(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10);
  1590. return 0;
  1591. }
  1592. else
  1593. {
  1594. lua_pushstring(state, "lua_Matrix_static_createLookAt - Failed to match the given parameters to a valid function signature.");
  1595. lua_error(state);
  1596. }
  1597. break;
  1598. }
  1599. default:
  1600. {
  1601. lua_pushstring(state, "Invalid number of parameters (expected 4 or 10).");
  1602. lua_error(state);
  1603. break;
  1604. }
  1605. }
  1606. return 0;
  1607. }
  1608. int lua_Matrix_static_createOrthographic(lua_State* state)
  1609. {
  1610. // Get the number of parameters.
  1611. int paramCount = lua_gettop(state);
  1612. // Attempt to match the parameters to a valid binding.
  1613. switch (paramCount)
  1614. {
  1615. case 5:
  1616. {
  1617. if (lua_type(state, 1) == LUA_TNUMBER &&
  1618. lua_type(state, 2) == LUA_TNUMBER &&
  1619. lua_type(state, 3) == LUA_TNUMBER &&
  1620. lua_type(state, 4) == LUA_TNUMBER &&
  1621. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
  1622. {
  1623. // Get parameter 1 off the stack.
  1624. float param1 = (float)luaL_checknumber(state, 1);
  1625. // Get parameter 2 off the stack.
  1626. float param2 = (float)luaL_checknumber(state, 2);
  1627. // Get parameter 3 off the stack.
  1628. float param3 = (float)luaL_checknumber(state, 3);
  1629. // Get parameter 4 off the stack.
  1630. float param4 = (float)luaL_checknumber(state, 4);
  1631. // Get parameter 5 off the stack.
  1632. ScriptUtil::LuaArray<Matrix> param5 = ScriptUtil::getObjectPointer<Matrix>(5, "Matrix", false);
  1633. Matrix::createOrthographic(param1, param2, param3, param4, param5);
  1634. return 0;
  1635. }
  1636. else
  1637. {
  1638. lua_pushstring(state, "lua_Matrix_static_createOrthographic - Failed to match the given parameters to a valid function signature.");
  1639. lua_error(state);
  1640. }
  1641. break;
  1642. }
  1643. default:
  1644. {
  1645. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1646. lua_error(state);
  1647. break;
  1648. }
  1649. }
  1650. return 0;
  1651. }
  1652. int lua_Matrix_static_createOrthographicOffCenter(lua_State* state)
  1653. {
  1654. // Get the number of parameters.
  1655. int paramCount = lua_gettop(state);
  1656. // Attempt to match the parameters to a valid binding.
  1657. switch (paramCount)
  1658. {
  1659. case 7:
  1660. {
  1661. if (lua_type(state, 1) == LUA_TNUMBER &&
  1662. lua_type(state, 2) == LUA_TNUMBER &&
  1663. lua_type(state, 3) == LUA_TNUMBER &&
  1664. lua_type(state, 4) == LUA_TNUMBER &&
  1665. lua_type(state, 5) == LUA_TNUMBER &&
  1666. lua_type(state, 6) == LUA_TNUMBER &&
  1667. (lua_type(state, 7) == LUA_TUSERDATA || lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TNIL))
  1668. {
  1669. // Get parameter 1 off the stack.
  1670. float param1 = (float)luaL_checknumber(state, 1);
  1671. // Get parameter 2 off the stack.
  1672. float param2 = (float)luaL_checknumber(state, 2);
  1673. // Get parameter 3 off the stack.
  1674. float param3 = (float)luaL_checknumber(state, 3);
  1675. // Get parameter 4 off the stack.
  1676. float param4 = (float)luaL_checknumber(state, 4);
  1677. // Get parameter 5 off the stack.
  1678. float param5 = (float)luaL_checknumber(state, 5);
  1679. // Get parameter 6 off the stack.
  1680. float param6 = (float)luaL_checknumber(state, 6);
  1681. // Get parameter 7 off the stack.
  1682. ScriptUtil::LuaArray<Matrix> param7 = ScriptUtil::getObjectPointer<Matrix>(7, "Matrix", false);
  1683. Matrix::createOrthographicOffCenter(param1, param2, param3, param4, param5, param6, param7);
  1684. return 0;
  1685. }
  1686. else
  1687. {
  1688. lua_pushstring(state, "lua_Matrix_static_createOrthographicOffCenter - Failed to match the given parameters to a valid function signature.");
  1689. lua_error(state);
  1690. }
  1691. break;
  1692. }
  1693. default:
  1694. {
  1695. lua_pushstring(state, "Invalid number of parameters (expected 7).");
  1696. lua_error(state);
  1697. break;
  1698. }
  1699. }
  1700. return 0;
  1701. }
  1702. int lua_Matrix_static_createPerspective(lua_State* state)
  1703. {
  1704. // Get the number of parameters.
  1705. int paramCount = lua_gettop(state);
  1706. // Attempt to match the parameters to a valid binding.
  1707. switch (paramCount)
  1708. {
  1709. case 5:
  1710. {
  1711. if (lua_type(state, 1) == LUA_TNUMBER &&
  1712. lua_type(state, 2) == LUA_TNUMBER &&
  1713. lua_type(state, 3) == LUA_TNUMBER &&
  1714. lua_type(state, 4) == LUA_TNUMBER &&
  1715. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
  1716. {
  1717. // Get parameter 1 off the stack.
  1718. float param1 = (float)luaL_checknumber(state, 1);
  1719. // Get parameter 2 off the stack.
  1720. float param2 = (float)luaL_checknumber(state, 2);
  1721. // Get parameter 3 off the stack.
  1722. float param3 = (float)luaL_checknumber(state, 3);
  1723. // Get parameter 4 off the stack.
  1724. float param4 = (float)luaL_checknumber(state, 4);
  1725. // Get parameter 5 off the stack.
  1726. ScriptUtil::LuaArray<Matrix> param5 = ScriptUtil::getObjectPointer<Matrix>(5, "Matrix", false);
  1727. Matrix::createPerspective(param1, param2, param3, param4, param5);
  1728. return 0;
  1729. }
  1730. else
  1731. {
  1732. lua_pushstring(state, "lua_Matrix_static_createPerspective - Failed to match the given parameters to a valid function signature.");
  1733. lua_error(state);
  1734. }
  1735. break;
  1736. }
  1737. default:
  1738. {
  1739. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1740. lua_error(state);
  1741. break;
  1742. }
  1743. }
  1744. return 0;
  1745. }
  1746. int lua_Matrix_static_createRotation(lua_State* state)
  1747. {
  1748. // Get the number of parameters.
  1749. int paramCount = lua_gettop(state);
  1750. // Attempt to match the parameters to a valid binding.
  1751. switch (paramCount)
  1752. {
  1753. case 2:
  1754. {
  1755. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1756. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1757. {
  1758. // Get parameter 1 off the stack.
  1759. ScriptUtil::LuaArray<Quaternion> param1 = ScriptUtil::getObjectPointer<Quaternion>(1, "Quaternion", true);
  1760. // Get parameter 2 off the stack.
  1761. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1762. Matrix::createRotation(*param1, param2);
  1763. return 0;
  1764. }
  1765. else
  1766. {
  1767. lua_pushstring(state, "lua_Matrix_static_createRotation - Failed to match the given parameters to a valid function signature.");
  1768. lua_error(state);
  1769. }
  1770. break;
  1771. }
  1772. case 3:
  1773. {
  1774. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1775. lua_type(state, 2) == LUA_TNUMBER &&
  1776. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1777. {
  1778. // Get parameter 1 off the stack.
  1779. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
  1780. // Get parameter 2 off the stack.
  1781. float param2 = (float)luaL_checknumber(state, 2);
  1782. // Get parameter 3 off the stack.
  1783. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  1784. Matrix::createRotation(*param1, param2, param3);
  1785. return 0;
  1786. }
  1787. else
  1788. {
  1789. lua_pushstring(state, "lua_Matrix_static_createRotation - Failed to match the given parameters to a valid function signature.");
  1790. lua_error(state);
  1791. }
  1792. break;
  1793. }
  1794. default:
  1795. {
  1796. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1797. lua_error(state);
  1798. break;
  1799. }
  1800. }
  1801. return 0;
  1802. }
  1803. int lua_Matrix_static_createRotationX(lua_State* state)
  1804. {
  1805. // Get the number of parameters.
  1806. int paramCount = lua_gettop(state);
  1807. // Attempt to match the parameters to a valid binding.
  1808. switch (paramCount)
  1809. {
  1810. case 2:
  1811. {
  1812. if (lua_type(state, 1) == LUA_TNUMBER &&
  1813. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1814. {
  1815. // Get parameter 1 off the stack.
  1816. float param1 = (float)luaL_checknumber(state, 1);
  1817. // Get parameter 2 off the stack.
  1818. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1819. Matrix::createRotationX(param1, param2);
  1820. return 0;
  1821. }
  1822. else
  1823. {
  1824. lua_pushstring(state, "lua_Matrix_static_createRotationX - Failed to match the given parameters to a valid function signature.");
  1825. lua_error(state);
  1826. }
  1827. break;
  1828. }
  1829. default:
  1830. {
  1831. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1832. lua_error(state);
  1833. break;
  1834. }
  1835. }
  1836. return 0;
  1837. }
  1838. int lua_Matrix_static_createRotationY(lua_State* state)
  1839. {
  1840. // Get the number of parameters.
  1841. int paramCount = lua_gettop(state);
  1842. // Attempt to match the parameters to a valid binding.
  1843. switch (paramCount)
  1844. {
  1845. case 2:
  1846. {
  1847. if (lua_type(state, 1) == LUA_TNUMBER &&
  1848. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1849. {
  1850. // Get parameter 1 off the stack.
  1851. float param1 = (float)luaL_checknumber(state, 1);
  1852. // Get parameter 2 off the stack.
  1853. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1854. Matrix::createRotationY(param1, param2);
  1855. return 0;
  1856. }
  1857. else
  1858. {
  1859. lua_pushstring(state, "lua_Matrix_static_createRotationY - Failed to match the given parameters to a valid function signature.");
  1860. lua_error(state);
  1861. }
  1862. break;
  1863. }
  1864. default:
  1865. {
  1866. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1867. lua_error(state);
  1868. break;
  1869. }
  1870. }
  1871. return 0;
  1872. }
  1873. int lua_Matrix_static_createRotationZ(lua_State* state)
  1874. {
  1875. // Get the number of parameters.
  1876. int paramCount = lua_gettop(state);
  1877. // Attempt to match the parameters to a valid binding.
  1878. switch (paramCount)
  1879. {
  1880. case 2:
  1881. {
  1882. if (lua_type(state, 1) == LUA_TNUMBER &&
  1883. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1884. {
  1885. // Get parameter 1 off the stack.
  1886. float param1 = (float)luaL_checknumber(state, 1);
  1887. // Get parameter 2 off the stack.
  1888. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1889. Matrix::createRotationZ(param1, param2);
  1890. return 0;
  1891. }
  1892. else
  1893. {
  1894. lua_pushstring(state, "lua_Matrix_static_createRotationZ - Failed to match the given parameters to a valid function signature.");
  1895. lua_error(state);
  1896. }
  1897. break;
  1898. }
  1899. default:
  1900. {
  1901. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1902. lua_error(state);
  1903. break;
  1904. }
  1905. }
  1906. return 0;
  1907. }
  1908. int lua_Matrix_static_createScale(lua_State* state)
  1909. {
  1910. // Get the number of parameters.
  1911. int paramCount = lua_gettop(state);
  1912. // Attempt to match the parameters to a valid binding.
  1913. switch (paramCount)
  1914. {
  1915. case 2:
  1916. {
  1917. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1918. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1919. {
  1920. // Get parameter 1 off the stack.
  1921. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
  1922. // Get parameter 2 off the stack.
  1923. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1924. Matrix::createScale(*param1, param2);
  1925. return 0;
  1926. }
  1927. else
  1928. {
  1929. lua_pushstring(state, "lua_Matrix_static_createScale - Failed to match the given parameters to a valid function signature.");
  1930. lua_error(state);
  1931. }
  1932. break;
  1933. }
  1934. case 4:
  1935. {
  1936. if (lua_type(state, 1) == LUA_TNUMBER &&
  1937. lua_type(state, 2) == LUA_TNUMBER &&
  1938. lua_type(state, 3) == LUA_TNUMBER &&
  1939. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  1940. {
  1941. // Get parameter 1 off the stack.
  1942. float param1 = (float)luaL_checknumber(state, 1);
  1943. // Get parameter 2 off the stack.
  1944. float param2 = (float)luaL_checknumber(state, 2);
  1945. // Get parameter 3 off the stack.
  1946. float param3 = (float)luaL_checknumber(state, 3);
  1947. // Get parameter 4 off the stack.
  1948. ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(4, "Matrix", false);
  1949. Matrix::createScale(param1, param2, param3, param4);
  1950. return 0;
  1951. }
  1952. else
  1953. {
  1954. lua_pushstring(state, "lua_Matrix_static_createScale - Failed to match the given parameters to a valid function signature.");
  1955. lua_error(state);
  1956. }
  1957. break;
  1958. }
  1959. default:
  1960. {
  1961. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1962. lua_error(state);
  1963. break;
  1964. }
  1965. }
  1966. return 0;
  1967. }
  1968. int lua_Matrix_static_createTranslation(lua_State* state)
  1969. {
  1970. // Get the number of parameters.
  1971. int paramCount = lua_gettop(state);
  1972. // Attempt to match the parameters to a valid binding.
  1973. switch (paramCount)
  1974. {
  1975. case 2:
  1976. {
  1977. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  1978. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1979. {
  1980. // Get parameter 1 off the stack.
  1981. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
  1982. // Get parameter 2 off the stack.
  1983. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  1984. Matrix::createTranslation(*param1, param2);
  1985. return 0;
  1986. }
  1987. else
  1988. {
  1989. lua_pushstring(state, "lua_Matrix_static_createTranslation - Failed to match the given parameters to a valid function signature.");
  1990. lua_error(state);
  1991. }
  1992. break;
  1993. }
  1994. case 4:
  1995. {
  1996. if (lua_type(state, 1) == LUA_TNUMBER &&
  1997. lua_type(state, 2) == LUA_TNUMBER &&
  1998. lua_type(state, 3) == LUA_TNUMBER &&
  1999. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  2000. {
  2001. // Get parameter 1 off the stack.
  2002. float param1 = (float)luaL_checknumber(state, 1);
  2003. // Get parameter 2 off the stack.
  2004. float param2 = (float)luaL_checknumber(state, 2);
  2005. // Get parameter 3 off the stack.
  2006. float param3 = (float)luaL_checknumber(state, 3);
  2007. // Get parameter 4 off the stack.
  2008. ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(4, "Matrix", false);
  2009. Matrix::createTranslation(param1, param2, param3, param4);
  2010. return 0;
  2011. }
  2012. else
  2013. {
  2014. lua_pushstring(state, "lua_Matrix_static_createTranslation - Failed to match the given parameters to a valid function signature.");
  2015. lua_error(state);
  2016. }
  2017. break;
  2018. }
  2019. default:
  2020. {
  2021. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  2022. lua_error(state);
  2023. break;
  2024. }
  2025. }
  2026. return 0;
  2027. }
  2028. int lua_Matrix_static_identity(lua_State* state)
  2029. {
  2030. // Get the number of parameters.
  2031. int paramCount = lua_gettop(state);
  2032. // Attempt to match the parameters to a valid binding.
  2033. switch (paramCount)
  2034. {
  2035. case 0:
  2036. {
  2037. void* returnPtr = (void*)&(Matrix::identity());
  2038. if (returnPtr)
  2039. {
  2040. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  2041. object->instance = returnPtr;
  2042. object->owns = false;
  2043. luaL_getmetatable(state, "Matrix");
  2044. lua_setmetatable(state, -2);
  2045. }
  2046. else
  2047. {
  2048. lua_pushnil(state);
  2049. }
  2050. return 1;
  2051. break;
  2052. }
  2053. default:
  2054. {
  2055. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  2056. lua_error(state);
  2057. break;
  2058. }
  2059. }
  2060. return 0;
  2061. }
  2062. int lua_Matrix_static_multiply(lua_State* state)
  2063. {
  2064. // Get the number of parameters.
  2065. int paramCount = lua_gettop(state);
  2066. // Attempt to match the parameters to a valid binding.
  2067. switch (paramCount)
  2068. {
  2069. case 3:
  2070. {
  2071. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  2072. lua_type(state, 2) == LUA_TNUMBER &&
  2073. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2074. {
  2075. // Get parameter 1 off the stack.
  2076. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
  2077. // Get parameter 2 off the stack.
  2078. float param2 = (float)luaL_checknumber(state, 2);
  2079. // Get parameter 3 off the stack.
  2080. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  2081. Matrix::multiply(*param1, param2, param3);
  2082. return 0;
  2083. }
  2084. else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  2085. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2086. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2087. {
  2088. // Get parameter 1 off the stack.
  2089. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
  2090. // Get parameter 2 off the stack.
  2091. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  2092. // Get parameter 3 off the stack.
  2093. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  2094. Matrix::multiply(*param1, *param2, param3);
  2095. return 0;
  2096. }
  2097. else
  2098. {
  2099. lua_pushstring(state, "lua_Matrix_static_multiply - Failed to match the given parameters to a valid function signature.");
  2100. lua_error(state);
  2101. }
  2102. break;
  2103. }
  2104. default:
  2105. {
  2106. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  2107. lua_error(state);
  2108. break;
  2109. }
  2110. }
  2111. return 0;
  2112. }
  2113. int lua_Matrix_static_subtract(lua_State* state)
  2114. {
  2115. // Get the number of parameters.
  2116. int paramCount = lua_gettop(state);
  2117. // Attempt to match the parameters to a valid binding.
  2118. switch (paramCount)
  2119. {
  2120. case 3:
  2121. {
  2122. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  2123. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2124. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2125. {
  2126. // Get parameter 1 off the stack.
  2127. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
  2128. // Get parameter 2 off the stack.
  2129. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  2130. // Get parameter 3 off the stack.
  2131. ScriptUtil::LuaArray<Matrix> param3 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  2132. Matrix::subtract(*param1, *param2, param3);
  2133. return 0;
  2134. }
  2135. else
  2136. {
  2137. lua_pushstring(state, "lua_Matrix_static_subtract - Failed to match the given parameters to a valid function signature.");
  2138. lua_error(state);
  2139. }
  2140. break;
  2141. }
  2142. default:
  2143. {
  2144. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  2145. lua_error(state);
  2146. break;
  2147. }
  2148. }
  2149. return 0;
  2150. }
  2151. int lua_Matrix_static_zero(lua_State* state)
  2152. {
  2153. // Get the number of parameters.
  2154. int paramCount = lua_gettop(state);
  2155. // Attempt to match the parameters to a valid binding.
  2156. switch (paramCount)
  2157. {
  2158. case 0:
  2159. {
  2160. void* returnPtr = (void*)&(Matrix::zero());
  2161. if (returnPtr)
  2162. {
  2163. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  2164. object->instance = returnPtr;
  2165. object->owns = false;
  2166. luaL_getmetatable(state, "Matrix");
  2167. lua_setmetatable(state, -2);
  2168. }
  2169. else
  2170. {
  2171. lua_pushnil(state);
  2172. }
  2173. return 1;
  2174. break;
  2175. }
  2176. default:
  2177. {
  2178. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  2179. lua_error(state);
  2180. break;
  2181. }
  2182. }
  2183. return 0;
  2184. }
  2185. int lua_Matrix_subtract(lua_State* state)
  2186. {
  2187. // Get the number of parameters.
  2188. int paramCount = lua_gettop(state);
  2189. // Attempt to match the parameters to a valid binding.
  2190. switch (paramCount)
  2191. {
  2192. case 2:
  2193. {
  2194. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2195. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  2196. {
  2197. // Get parameter 1 off the stack.
  2198. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  2199. Matrix* instance = getInstance(state);
  2200. instance->subtract(*param1);
  2201. return 0;
  2202. }
  2203. else
  2204. {
  2205. lua_pushstring(state, "lua_Matrix_subtract - Failed to match the given parameters to a valid function signature.");
  2206. lua_error(state);
  2207. }
  2208. break;
  2209. }
  2210. default:
  2211. {
  2212. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  2213. lua_error(state);
  2214. break;
  2215. }
  2216. }
  2217. return 0;
  2218. }
  2219. int lua_Matrix_transformPoint(lua_State* state)
  2220. {
  2221. // Get the number of parameters.
  2222. int paramCount = lua_gettop(state);
  2223. // Attempt to match the parameters to a valid binding.
  2224. switch (paramCount)
  2225. {
  2226. case 2:
  2227. {
  2228. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2229. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  2230. {
  2231. // Get parameter 1 off the stack.
  2232. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  2233. Matrix* instance = getInstance(state);
  2234. instance->transformPoint(param1);
  2235. return 0;
  2236. }
  2237. else
  2238. {
  2239. lua_pushstring(state, "lua_Matrix_transformPoint - Failed to match the given parameters to a valid function signature.");
  2240. lua_error(state);
  2241. }
  2242. break;
  2243. }
  2244. case 3:
  2245. {
  2246. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2247. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2248. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2249. {
  2250. // Get parameter 1 off the stack.
  2251. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  2252. // Get parameter 2 off the stack.
  2253. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false);
  2254. Matrix* instance = getInstance(state);
  2255. instance->transformPoint(*param1, param2);
  2256. return 0;
  2257. }
  2258. else
  2259. {
  2260. lua_pushstring(state, "lua_Matrix_transformPoint - Failed to match the given parameters to a valid function signature.");
  2261. lua_error(state);
  2262. }
  2263. break;
  2264. }
  2265. default:
  2266. {
  2267. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  2268. lua_error(state);
  2269. break;
  2270. }
  2271. }
  2272. return 0;
  2273. }
  2274. int lua_Matrix_transformVector(lua_State* state)
  2275. {
  2276. // Get the number of parameters.
  2277. int paramCount = lua_gettop(state);
  2278. // Attempt to match the parameters to a valid binding.
  2279. switch (paramCount)
  2280. {
  2281. case 2:
  2282. {
  2283. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2284. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  2285. {
  2286. // Get parameter 1 off the stack.
  2287. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
  2288. Matrix* instance = getInstance(state);
  2289. instance->transformVector(param1);
  2290. return 0;
  2291. }
  2292. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2293. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  2294. {
  2295. // Get parameter 1 off the stack.
  2296. ScriptUtil::LuaArray<Vector4> param1 = ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false);
  2297. Matrix* instance = getInstance(state);
  2298. instance->transformVector(param1);
  2299. return 0;
  2300. }
  2301. else
  2302. {
  2303. lua_pushstring(state, "lua_Matrix_transformVector - Failed to match the given parameters to a valid function signature.");
  2304. lua_error(state);
  2305. }
  2306. break;
  2307. }
  2308. case 3:
  2309. {
  2310. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2311. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2312. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2313. {
  2314. // Get parameter 1 off the stack.
  2315. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  2316. // Get parameter 2 off the stack.
  2317. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false);
  2318. Matrix* instance = getInstance(state);
  2319. instance->transformVector(*param1, param2);
  2320. return 0;
  2321. }
  2322. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2323. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2324. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2325. {
  2326. // Get parameter 1 off the stack.
  2327. ScriptUtil::LuaArray<Vector4> param1 = ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", true);
  2328. // Get parameter 2 off the stack.
  2329. ScriptUtil::LuaArray<Vector4> param2 = ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false);
  2330. Matrix* instance = getInstance(state);
  2331. instance->transformVector(*param1, param2);
  2332. return 0;
  2333. }
  2334. else
  2335. {
  2336. lua_pushstring(state, "lua_Matrix_transformVector - Failed to match the given parameters to a valid function signature.");
  2337. lua_error(state);
  2338. }
  2339. break;
  2340. }
  2341. case 6:
  2342. {
  2343. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2344. lua_type(state, 2) == LUA_TNUMBER &&
  2345. lua_type(state, 3) == LUA_TNUMBER &&
  2346. lua_type(state, 4) == LUA_TNUMBER &&
  2347. lua_type(state, 5) == LUA_TNUMBER &&
  2348. (lua_type(state, 6) == LUA_TUSERDATA || lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TNIL))
  2349. {
  2350. // Get parameter 1 off the stack.
  2351. float param1 = (float)luaL_checknumber(state, 2);
  2352. // Get parameter 2 off the stack.
  2353. float param2 = (float)luaL_checknumber(state, 3);
  2354. // Get parameter 3 off the stack.
  2355. float param3 = (float)luaL_checknumber(state, 4);
  2356. // Get parameter 4 off the stack.
  2357. float param4 = (float)luaL_checknumber(state, 5);
  2358. // Get parameter 5 off the stack.
  2359. ScriptUtil::LuaArray<Vector3> param5 = ScriptUtil::getObjectPointer<Vector3>(6, "Vector3", false);
  2360. Matrix* instance = getInstance(state);
  2361. instance->transformVector(param1, param2, param3, param4, param5);
  2362. return 0;
  2363. }
  2364. else
  2365. {
  2366. lua_pushstring(state, "lua_Matrix_transformVector - Failed to match the given parameters to a valid function signature.");
  2367. lua_error(state);
  2368. }
  2369. break;
  2370. }
  2371. default:
  2372. {
  2373. lua_pushstring(state, "Invalid number of parameters (expected 2, 3 or 6).");
  2374. lua_error(state);
  2375. break;
  2376. }
  2377. }
  2378. return 0;
  2379. }
  2380. int lua_Matrix_translate(lua_State* state)
  2381. {
  2382. // Get the number of parameters.
  2383. int paramCount = lua_gettop(state);
  2384. // Attempt to match the parameters to a valid binding.
  2385. switch (paramCount)
  2386. {
  2387. case 2:
  2388. {
  2389. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2390. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  2391. {
  2392. // Get parameter 1 off the stack.
  2393. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  2394. Matrix* instance = getInstance(state);
  2395. instance->translate(*param1);
  2396. return 0;
  2397. }
  2398. else
  2399. {
  2400. lua_pushstring(state, "lua_Matrix_translate - Failed to match the given parameters to a valid function signature.");
  2401. lua_error(state);
  2402. }
  2403. break;
  2404. }
  2405. case 3:
  2406. {
  2407. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2408. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  2409. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  2410. {
  2411. // Get parameter 1 off the stack.
  2412. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  2413. // Get parameter 2 off the stack.
  2414. ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false);
  2415. Matrix* instance = getInstance(state);
  2416. instance->translate(*param1, param2);
  2417. return 0;
  2418. }
  2419. else
  2420. {
  2421. lua_pushstring(state, "lua_Matrix_translate - Failed to match the given parameters to a valid function signature.");
  2422. lua_error(state);
  2423. }
  2424. break;
  2425. }
  2426. case 4:
  2427. {
  2428. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2429. lua_type(state, 2) == LUA_TNUMBER &&
  2430. lua_type(state, 3) == LUA_TNUMBER &&
  2431. lua_type(state, 4) == LUA_TNUMBER)
  2432. {
  2433. // Get parameter 1 off the stack.
  2434. float param1 = (float)luaL_checknumber(state, 2);
  2435. // Get parameter 2 off the stack.
  2436. float param2 = (float)luaL_checknumber(state, 3);
  2437. // Get parameter 3 off the stack.
  2438. float param3 = (float)luaL_checknumber(state, 4);
  2439. Matrix* instance = getInstance(state);
  2440. instance->translate(param1, param2, param3);
  2441. return 0;
  2442. }
  2443. else
  2444. {
  2445. lua_pushstring(state, "lua_Matrix_translate - Failed to match the given parameters to a valid function signature.");
  2446. lua_error(state);
  2447. }
  2448. break;
  2449. }
  2450. case 5:
  2451. {
  2452. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2453. lua_type(state, 2) == LUA_TNUMBER &&
  2454. lua_type(state, 3) == LUA_TNUMBER &&
  2455. lua_type(state, 4) == LUA_TNUMBER &&
  2456. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
  2457. {
  2458. // Get parameter 1 off the stack.
  2459. float param1 = (float)luaL_checknumber(state, 2);
  2460. // Get parameter 2 off the stack.
  2461. float param2 = (float)luaL_checknumber(state, 3);
  2462. // Get parameter 3 off the stack.
  2463. float param3 = (float)luaL_checknumber(state, 4);
  2464. // Get parameter 4 off the stack.
  2465. ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(5, "Matrix", false);
  2466. Matrix* instance = getInstance(state);
  2467. instance->translate(param1, param2, param3, param4);
  2468. return 0;
  2469. }
  2470. else
  2471. {
  2472. lua_pushstring(state, "lua_Matrix_translate - Failed to match the given parameters to a valid function signature.");
  2473. lua_error(state);
  2474. }
  2475. break;
  2476. }
  2477. default:
  2478. {
  2479. lua_pushstring(state, "Invalid number of parameters (expected 2, 3, 4 or 5).");
  2480. lua_error(state);
  2481. break;
  2482. }
  2483. }
  2484. return 0;
  2485. }
  2486. int lua_Matrix_transpose(lua_State* state)
  2487. {
  2488. // Get the number of parameters.
  2489. int paramCount = lua_gettop(state);
  2490. // Attempt to match the parameters to a valid binding.
  2491. switch (paramCount)
  2492. {
  2493. case 1:
  2494. {
  2495. if ((lua_type(state, 1) == LUA_TUSERDATA))
  2496. {
  2497. Matrix* instance = getInstance(state);
  2498. instance->transpose();
  2499. return 0;
  2500. }
  2501. else
  2502. {
  2503. lua_pushstring(state, "lua_Matrix_transpose - Failed to match the given parameters to a valid function signature.");
  2504. lua_error(state);
  2505. }
  2506. break;
  2507. }
  2508. case 2:
  2509. {
  2510. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  2511. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  2512. {
  2513. // Get parameter 1 off the stack.
  2514. ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
  2515. Matrix* instance = getInstance(state);
  2516. instance->transpose(param1);
  2517. return 0;
  2518. }
  2519. else
  2520. {
  2521. lua_pushstring(state, "lua_Matrix_transpose - Failed to match the given parameters to a valid function signature.");
  2522. lua_error(state);
  2523. }
  2524. break;
  2525. }
  2526. default:
  2527. {
  2528. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  2529. lua_error(state);
  2530. break;
  2531. }
  2532. }
  2533. return 0;
  2534. }
  2535. }