lua_Camera.cpp 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_Camera.h"
  4. #include "Animation.h"
  5. #include "AnimationTarget.h"
  6. #include "Base.h"
  7. #include "Camera.h"
  8. #include "Game.h"
  9. #include "Node.h"
  10. #include "PhysicsController.h"
  11. #include "Ref.h"
  12. #include "ScriptController.h"
  13. #include "ScriptTarget.h"
  14. #include "Transform.h"
  15. namespace gameplay
  16. {
  17. void luaRegister_Camera()
  18. {
  19. const luaL_Reg lua_members[] =
  20. {
  21. {"addListener", lua_Camera_addListener},
  22. {"addRef", lua_Camera_addRef},
  23. {"getAspectRatio", lua_Camera_getAspectRatio},
  24. {"getCameraType", lua_Camera_getCameraType},
  25. {"getFarPlane", lua_Camera_getFarPlane},
  26. {"getFieldOfView", lua_Camera_getFieldOfView},
  27. {"getFrustum", lua_Camera_getFrustum},
  28. {"getInverseViewMatrix", lua_Camera_getInverseViewMatrix},
  29. {"getInverseViewProjectionMatrix", lua_Camera_getInverseViewProjectionMatrix},
  30. {"getNearPlane", lua_Camera_getNearPlane},
  31. {"getNode", lua_Camera_getNode},
  32. {"getProjectionMatrix", lua_Camera_getProjectionMatrix},
  33. {"getRefCount", lua_Camera_getRefCount},
  34. {"getViewMatrix", lua_Camera_getViewMatrix},
  35. {"getViewProjectionMatrix", lua_Camera_getViewProjectionMatrix},
  36. {"getZoomX", lua_Camera_getZoomX},
  37. {"getZoomY", lua_Camera_getZoomY},
  38. {"pickRay", lua_Camera_pickRay},
  39. {"project", lua_Camera_project},
  40. {"release", lua_Camera_release},
  41. {"removeListener", lua_Camera_removeListener},
  42. {"resetProjectionMatrix", lua_Camera_resetProjectionMatrix},
  43. {"setAspectRatio", lua_Camera_setAspectRatio},
  44. {"setFarPlane", lua_Camera_setFarPlane},
  45. {"setFieldOfView", lua_Camera_setFieldOfView},
  46. {"setNearPlane", lua_Camera_setNearPlane},
  47. {"setProjectionMatrix", lua_Camera_setProjectionMatrix},
  48. {"setZoomX", lua_Camera_setZoomX},
  49. {"setZoomY", lua_Camera_setZoomY},
  50. {"unproject", lua_Camera_unproject},
  51. {NULL, NULL}
  52. };
  53. const luaL_Reg lua_statics[] =
  54. {
  55. {"create", lua_Camera_static_create},
  56. {"createOrthographic", lua_Camera_static_createOrthographic},
  57. {"createPerspective", lua_Camera_static_createPerspective},
  58. {NULL, NULL}
  59. };
  60. std::vector<std::string> scopePath;
  61. gameplay::ScriptUtil::registerClass("Camera", lua_members, NULL, lua_Camera__gc, lua_statics, scopePath);
  62. }
  63. static Camera* getInstance(lua_State* state)
  64. {
  65. void* userdata = luaL_checkudata(state, 1, "Camera");
  66. luaL_argcheck(state, userdata != NULL, 1, "'Camera' expected.");
  67. return (Camera*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  68. }
  69. int lua_Camera__gc(lua_State* state)
  70. {
  71. // Get the number of parameters.
  72. int paramCount = lua_gettop(state);
  73. // Attempt to match the parameters to a valid binding.
  74. switch (paramCount)
  75. {
  76. case 1:
  77. {
  78. if ((lua_type(state, 1) == LUA_TUSERDATA))
  79. {
  80. void* userdata = luaL_checkudata(state, 1, "Camera");
  81. luaL_argcheck(state, userdata != NULL, 1, "'Camera' expected.");
  82. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  83. if (object->owns)
  84. {
  85. Camera* instance = (Camera*)object->instance;
  86. SAFE_RELEASE(instance);
  87. }
  88. return 0;
  89. }
  90. lua_pushstring(state, "lua_Camera__gc - Failed to match the given parameters to a valid function signature.");
  91. lua_error(state);
  92. break;
  93. }
  94. default:
  95. {
  96. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  97. lua_error(state);
  98. break;
  99. }
  100. }
  101. return 0;
  102. }
  103. int lua_Camera_addListener(lua_State* state)
  104. {
  105. // Get the number of parameters.
  106. int paramCount = lua_gettop(state);
  107. // Attempt to match the parameters to a valid binding.
  108. switch (paramCount)
  109. {
  110. case 2:
  111. {
  112. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  113. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  114. {
  115. // Get parameter 1 off the stack.
  116. bool param1Valid;
  117. gameplay::ScriptUtil::LuaArray<Camera::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<Camera::Listener>(2, "CameraListener", false, &param1Valid);
  118. if (!param1Valid)
  119. {
  120. lua_pushstring(state, "Failed to convert parameter 1 to type 'Camera::Listener'.");
  121. lua_error(state);
  122. }
  123. Camera* instance = getInstance(state);
  124. instance->addListener(param1);
  125. return 0;
  126. }
  127. lua_pushstring(state, "lua_Camera_addListener - Failed to match the given parameters to a valid function signature.");
  128. lua_error(state);
  129. break;
  130. }
  131. default:
  132. {
  133. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  134. lua_error(state);
  135. break;
  136. }
  137. }
  138. return 0;
  139. }
  140. int lua_Camera_addRef(lua_State* state)
  141. {
  142. // Get the number of parameters.
  143. int paramCount = lua_gettop(state);
  144. // Attempt to match the parameters to a valid binding.
  145. switch (paramCount)
  146. {
  147. case 1:
  148. {
  149. if ((lua_type(state, 1) == LUA_TUSERDATA))
  150. {
  151. Camera* instance = getInstance(state);
  152. instance->addRef();
  153. return 0;
  154. }
  155. lua_pushstring(state, "lua_Camera_addRef - Failed to match the given parameters to a valid function signature.");
  156. lua_error(state);
  157. break;
  158. }
  159. default:
  160. {
  161. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  162. lua_error(state);
  163. break;
  164. }
  165. }
  166. return 0;
  167. }
  168. int lua_Camera_getAspectRatio(lua_State* state)
  169. {
  170. // Get the number of parameters.
  171. int paramCount = lua_gettop(state);
  172. // Attempt to match the parameters to a valid binding.
  173. switch (paramCount)
  174. {
  175. case 1:
  176. {
  177. if ((lua_type(state, 1) == LUA_TUSERDATA))
  178. {
  179. Camera* instance = getInstance(state);
  180. float result = instance->getAspectRatio();
  181. // Push the return value onto the stack.
  182. lua_pushnumber(state, result);
  183. return 1;
  184. }
  185. lua_pushstring(state, "lua_Camera_getAspectRatio - Failed to match the given parameters to a valid function signature.");
  186. lua_error(state);
  187. break;
  188. }
  189. default:
  190. {
  191. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  192. lua_error(state);
  193. break;
  194. }
  195. }
  196. return 0;
  197. }
  198. int lua_Camera_getCameraType(lua_State* state)
  199. {
  200. // Get the number of parameters.
  201. int paramCount = lua_gettop(state);
  202. // Attempt to match the parameters to a valid binding.
  203. switch (paramCount)
  204. {
  205. case 1:
  206. {
  207. if ((lua_type(state, 1) == LUA_TUSERDATA))
  208. {
  209. Camera* instance = getInstance(state);
  210. Camera::Type result = instance->getCameraType();
  211. // Push the return value onto the stack.
  212. lua_pushnumber(state, (int)result);
  213. return 1;
  214. }
  215. lua_pushstring(state, "lua_Camera_getCameraType - Failed to match the given parameters to a valid function signature.");
  216. lua_error(state);
  217. break;
  218. }
  219. default:
  220. {
  221. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  222. lua_error(state);
  223. break;
  224. }
  225. }
  226. return 0;
  227. }
  228. int lua_Camera_getFarPlane(lua_State* state)
  229. {
  230. // Get the number of parameters.
  231. int paramCount = lua_gettop(state);
  232. // Attempt to match the parameters to a valid binding.
  233. switch (paramCount)
  234. {
  235. case 1:
  236. {
  237. if ((lua_type(state, 1) == LUA_TUSERDATA))
  238. {
  239. Camera* instance = getInstance(state);
  240. float result = instance->getFarPlane();
  241. // Push the return value onto the stack.
  242. lua_pushnumber(state, result);
  243. return 1;
  244. }
  245. lua_pushstring(state, "lua_Camera_getFarPlane - Failed to match the given parameters to a valid function signature.");
  246. lua_error(state);
  247. break;
  248. }
  249. default:
  250. {
  251. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  252. lua_error(state);
  253. break;
  254. }
  255. }
  256. return 0;
  257. }
  258. int lua_Camera_getFieldOfView(lua_State* state)
  259. {
  260. // Get the number of parameters.
  261. int paramCount = lua_gettop(state);
  262. // Attempt to match the parameters to a valid binding.
  263. switch (paramCount)
  264. {
  265. case 1:
  266. {
  267. if ((lua_type(state, 1) == LUA_TUSERDATA))
  268. {
  269. Camera* instance = getInstance(state);
  270. float result = instance->getFieldOfView();
  271. // Push the return value onto the stack.
  272. lua_pushnumber(state, result);
  273. return 1;
  274. }
  275. lua_pushstring(state, "lua_Camera_getFieldOfView - Failed to match the given parameters to a valid function signature.");
  276. lua_error(state);
  277. break;
  278. }
  279. default:
  280. {
  281. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  282. lua_error(state);
  283. break;
  284. }
  285. }
  286. return 0;
  287. }
  288. int lua_Camera_getFrustum(lua_State* state)
  289. {
  290. // Get the number of parameters.
  291. int paramCount = lua_gettop(state);
  292. // Attempt to match the parameters to a valid binding.
  293. switch (paramCount)
  294. {
  295. case 1:
  296. {
  297. if ((lua_type(state, 1) == LUA_TUSERDATA))
  298. {
  299. Camera* instance = getInstance(state);
  300. void* returnPtr = (void*)&(instance->getFrustum());
  301. if (returnPtr)
  302. {
  303. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  304. object->instance = returnPtr;
  305. object->owns = false;
  306. luaL_getmetatable(state, "Frustum");
  307. lua_setmetatable(state, -2);
  308. }
  309. else
  310. {
  311. lua_pushnil(state);
  312. }
  313. return 1;
  314. }
  315. lua_pushstring(state, "lua_Camera_getFrustum - Failed to match the given parameters to a valid function signature.");
  316. lua_error(state);
  317. break;
  318. }
  319. default:
  320. {
  321. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  322. lua_error(state);
  323. break;
  324. }
  325. }
  326. return 0;
  327. }
  328. int lua_Camera_getInverseViewMatrix(lua_State* state)
  329. {
  330. // Get the number of parameters.
  331. int paramCount = lua_gettop(state);
  332. // Attempt to match the parameters to a valid binding.
  333. switch (paramCount)
  334. {
  335. case 1:
  336. {
  337. if ((lua_type(state, 1) == LUA_TUSERDATA))
  338. {
  339. Camera* instance = getInstance(state);
  340. void* returnPtr = (void*)&(instance->getInverseViewMatrix());
  341. if (returnPtr)
  342. {
  343. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  344. object->instance = returnPtr;
  345. object->owns = false;
  346. luaL_getmetatable(state, "Matrix");
  347. lua_setmetatable(state, -2);
  348. }
  349. else
  350. {
  351. lua_pushnil(state);
  352. }
  353. return 1;
  354. }
  355. lua_pushstring(state, "lua_Camera_getInverseViewMatrix - Failed to match the given parameters to a valid function signature.");
  356. lua_error(state);
  357. break;
  358. }
  359. default:
  360. {
  361. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  362. lua_error(state);
  363. break;
  364. }
  365. }
  366. return 0;
  367. }
  368. int lua_Camera_getInverseViewProjectionMatrix(lua_State* state)
  369. {
  370. // Get the number of parameters.
  371. int paramCount = lua_gettop(state);
  372. // Attempt to match the parameters to a valid binding.
  373. switch (paramCount)
  374. {
  375. case 1:
  376. {
  377. if ((lua_type(state, 1) == LUA_TUSERDATA))
  378. {
  379. Camera* instance = getInstance(state);
  380. void* returnPtr = (void*)&(instance->getInverseViewProjectionMatrix());
  381. if (returnPtr)
  382. {
  383. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  384. object->instance = returnPtr;
  385. object->owns = false;
  386. luaL_getmetatable(state, "Matrix");
  387. lua_setmetatable(state, -2);
  388. }
  389. else
  390. {
  391. lua_pushnil(state);
  392. }
  393. return 1;
  394. }
  395. lua_pushstring(state, "lua_Camera_getInverseViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  396. lua_error(state);
  397. break;
  398. }
  399. default:
  400. {
  401. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  402. lua_error(state);
  403. break;
  404. }
  405. }
  406. return 0;
  407. }
  408. int lua_Camera_getNearPlane(lua_State* state)
  409. {
  410. // Get the number of parameters.
  411. int paramCount = lua_gettop(state);
  412. // Attempt to match the parameters to a valid binding.
  413. switch (paramCount)
  414. {
  415. case 1:
  416. {
  417. if ((lua_type(state, 1) == LUA_TUSERDATA))
  418. {
  419. Camera* instance = getInstance(state);
  420. float result = instance->getNearPlane();
  421. // Push the return value onto the stack.
  422. lua_pushnumber(state, result);
  423. return 1;
  424. }
  425. lua_pushstring(state, "lua_Camera_getNearPlane - Failed to match the given parameters to a valid function signature.");
  426. lua_error(state);
  427. break;
  428. }
  429. default:
  430. {
  431. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  432. lua_error(state);
  433. break;
  434. }
  435. }
  436. return 0;
  437. }
  438. int lua_Camera_getNode(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 1:
  446. {
  447. if ((lua_type(state, 1) == LUA_TUSERDATA))
  448. {
  449. Camera* instance = getInstance(state);
  450. void* returnPtr = (void*)instance->getNode();
  451. if (returnPtr)
  452. {
  453. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  454. object->instance = returnPtr;
  455. object->owns = false;
  456. luaL_getmetatable(state, "Node");
  457. lua_setmetatable(state, -2);
  458. }
  459. else
  460. {
  461. lua_pushnil(state);
  462. }
  463. return 1;
  464. }
  465. lua_pushstring(state, "lua_Camera_getNode - Failed to match the given parameters to a valid function signature.");
  466. lua_error(state);
  467. break;
  468. }
  469. default:
  470. {
  471. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  472. lua_error(state);
  473. break;
  474. }
  475. }
  476. return 0;
  477. }
  478. int lua_Camera_getProjectionMatrix(lua_State* state)
  479. {
  480. // Get the number of parameters.
  481. int paramCount = lua_gettop(state);
  482. // Attempt to match the parameters to a valid binding.
  483. switch (paramCount)
  484. {
  485. case 1:
  486. {
  487. if ((lua_type(state, 1) == LUA_TUSERDATA))
  488. {
  489. Camera* instance = getInstance(state);
  490. void* returnPtr = (void*)&(instance->getProjectionMatrix());
  491. if (returnPtr)
  492. {
  493. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  494. object->instance = returnPtr;
  495. object->owns = false;
  496. luaL_getmetatable(state, "Matrix");
  497. lua_setmetatable(state, -2);
  498. }
  499. else
  500. {
  501. lua_pushnil(state);
  502. }
  503. return 1;
  504. }
  505. lua_pushstring(state, "lua_Camera_getProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  506. lua_error(state);
  507. break;
  508. }
  509. default:
  510. {
  511. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  512. lua_error(state);
  513. break;
  514. }
  515. }
  516. return 0;
  517. }
  518. int lua_Camera_getRefCount(lua_State* state)
  519. {
  520. // Get the number of parameters.
  521. int paramCount = lua_gettop(state);
  522. // Attempt to match the parameters to a valid binding.
  523. switch (paramCount)
  524. {
  525. case 1:
  526. {
  527. if ((lua_type(state, 1) == LUA_TUSERDATA))
  528. {
  529. Camera* instance = getInstance(state);
  530. unsigned int result = instance->getRefCount();
  531. // Push the return value onto the stack.
  532. lua_pushunsigned(state, result);
  533. return 1;
  534. }
  535. lua_pushstring(state, "lua_Camera_getRefCount - Failed to match the given parameters to a valid function signature.");
  536. lua_error(state);
  537. break;
  538. }
  539. default:
  540. {
  541. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  542. lua_error(state);
  543. break;
  544. }
  545. }
  546. return 0;
  547. }
  548. int lua_Camera_getViewMatrix(lua_State* state)
  549. {
  550. // Get the number of parameters.
  551. int paramCount = lua_gettop(state);
  552. // Attempt to match the parameters to a valid binding.
  553. switch (paramCount)
  554. {
  555. case 1:
  556. {
  557. if ((lua_type(state, 1) == LUA_TUSERDATA))
  558. {
  559. Camera* instance = getInstance(state);
  560. void* returnPtr = (void*)&(instance->getViewMatrix());
  561. if (returnPtr)
  562. {
  563. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  564. object->instance = returnPtr;
  565. object->owns = false;
  566. luaL_getmetatable(state, "Matrix");
  567. lua_setmetatable(state, -2);
  568. }
  569. else
  570. {
  571. lua_pushnil(state);
  572. }
  573. return 1;
  574. }
  575. lua_pushstring(state, "lua_Camera_getViewMatrix - Failed to match the given parameters to a valid function signature.");
  576. lua_error(state);
  577. break;
  578. }
  579. default:
  580. {
  581. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  582. lua_error(state);
  583. break;
  584. }
  585. }
  586. return 0;
  587. }
  588. int lua_Camera_getViewProjectionMatrix(lua_State* state)
  589. {
  590. // Get the number of parameters.
  591. int paramCount = lua_gettop(state);
  592. // Attempt to match the parameters to a valid binding.
  593. switch (paramCount)
  594. {
  595. case 1:
  596. {
  597. if ((lua_type(state, 1) == LUA_TUSERDATA))
  598. {
  599. Camera* instance = getInstance(state);
  600. void* returnPtr = (void*)&(instance->getViewProjectionMatrix());
  601. if (returnPtr)
  602. {
  603. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  604. object->instance = returnPtr;
  605. object->owns = false;
  606. luaL_getmetatable(state, "Matrix");
  607. lua_setmetatable(state, -2);
  608. }
  609. else
  610. {
  611. lua_pushnil(state);
  612. }
  613. return 1;
  614. }
  615. lua_pushstring(state, "lua_Camera_getViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  616. lua_error(state);
  617. break;
  618. }
  619. default:
  620. {
  621. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  622. lua_error(state);
  623. break;
  624. }
  625. }
  626. return 0;
  627. }
  628. int lua_Camera_getZoomX(lua_State* state)
  629. {
  630. // Get the number of parameters.
  631. int paramCount = lua_gettop(state);
  632. // Attempt to match the parameters to a valid binding.
  633. switch (paramCount)
  634. {
  635. case 1:
  636. {
  637. if ((lua_type(state, 1) == LUA_TUSERDATA))
  638. {
  639. Camera* instance = getInstance(state);
  640. float result = instance->getZoomX();
  641. // Push the return value onto the stack.
  642. lua_pushnumber(state, result);
  643. return 1;
  644. }
  645. lua_pushstring(state, "lua_Camera_getZoomX - Failed to match the given parameters to a valid function signature.");
  646. lua_error(state);
  647. break;
  648. }
  649. default:
  650. {
  651. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  652. lua_error(state);
  653. break;
  654. }
  655. }
  656. return 0;
  657. }
  658. int lua_Camera_getZoomY(lua_State* state)
  659. {
  660. // Get the number of parameters.
  661. int paramCount = lua_gettop(state);
  662. // Attempt to match the parameters to a valid binding.
  663. switch (paramCount)
  664. {
  665. case 1:
  666. {
  667. if ((lua_type(state, 1) == LUA_TUSERDATA))
  668. {
  669. Camera* instance = getInstance(state);
  670. float result = instance->getZoomY();
  671. // Push the return value onto the stack.
  672. lua_pushnumber(state, result);
  673. return 1;
  674. }
  675. lua_pushstring(state, "lua_Camera_getZoomY - Failed to match the given parameters to a valid function signature.");
  676. lua_error(state);
  677. break;
  678. }
  679. default:
  680. {
  681. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  682. lua_error(state);
  683. break;
  684. }
  685. }
  686. return 0;
  687. }
  688. int lua_Camera_pickRay(lua_State* state)
  689. {
  690. // Get the number of parameters.
  691. int paramCount = lua_gettop(state);
  692. // Attempt to match the parameters to a valid binding.
  693. switch (paramCount)
  694. {
  695. case 5:
  696. {
  697. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  698. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  699. lua_type(state, 3) == LUA_TNUMBER &&
  700. lua_type(state, 4) == LUA_TNUMBER &&
  701. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
  702. {
  703. // Get parameter 1 off the stack.
  704. bool param1Valid;
  705. gameplay::ScriptUtil::LuaArray<Rectangle> param1 = gameplay::ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
  706. if (!param1Valid)
  707. {
  708. lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
  709. lua_error(state);
  710. }
  711. // Get parameter 2 off the stack.
  712. float param2 = (float)luaL_checknumber(state, 3);
  713. // Get parameter 3 off the stack.
  714. float param3 = (float)luaL_checknumber(state, 4);
  715. // Get parameter 4 off the stack.
  716. bool param4Valid;
  717. gameplay::ScriptUtil::LuaArray<Ray> param4 = gameplay::ScriptUtil::getObjectPointer<Ray>(5, "Ray", false, &param4Valid);
  718. if (!param4Valid)
  719. {
  720. lua_pushstring(state, "Failed to convert parameter 4 to type 'Ray'.");
  721. lua_error(state);
  722. }
  723. Camera* instance = getInstance(state);
  724. instance->pickRay(*param1, param2, param3, param4);
  725. return 0;
  726. }
  727. lua_pushstring(state, "lua_Camera_pickRay - Failed to match the given parameters to a valid function signature.");
  728. lua_error(state);
  729. break;
  730. }
  731. default:
  732. {
  733. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  734. lua_error(state);
  735. break;
  736. }
  737. }
  738. return 0;
  739. }
  740. int lua_Camera_project(lua_State* state)
  741. {
  742. // Get the number of parameters.
  743. int paramCount = lua_gettop(state);
  744. // Attempt to match the parameters to a valid binding.
  745. switch (paramCount)
  746. {
  747. case 4:
  748. {
  749. do
  750. {
  751. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  752. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  753. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  754. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  755. {
  756. // Get parameter 1 off the stack.
  757. bool param1Valid;
  758. gameplay::ScriptUtil::LuaArray<Rectangle> param1 = gameplay::ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
  759. if (!param1Valid)
  760. break;
  761. // Get parameter 2 off the stack.
  762. bool param2Valid;
  763. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
  764. if (!param2Valid)
  765. break;
  766. // Get parameter 3 off the stack.
  767. bool param3Valid;
  768. gameplay::ScriptUtil::LuaArray<Vector2> param3 = gameplay::ScriptUtil::getObjectPointer<Vector2>(4, "Vector2", false, &param3Valid);
  769. if (!param3Valid)
  770. break;
  771. Camera* instance = getInstance(state);
  772. instance->project(*param1, *param2, param3);
  773. return 0;
  774. }
  775. } while (0);
  776. do
  777. {
  778. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  779. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  780. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  781. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  782. {
  783. // Get parameter 1 off the stack.
  784. bool param1Valid;
  785. gameplay::ScriptUtil::LuaArray<Rectangle> param1 = gameplay::ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
  786. if (!param1Valid)
  787. break;
  788. // Get parameter 2 off the stack.
  789. bool param2Valid;
  790. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
  791. if (!param2Valid)
  792. break;
  793. // Get parameter 3 off the stack.
  794. bool param3Valid;
  795. gameplay::ScriptUtil::LuaArray<Vector3> param3 = gameplay::ScriptUtil::getObjectPointer<Vector3>(4, "Vector3", false, &param3Valid);
  796. if (!param3Valid)
  797. break;
  798. Camera* instance = getInstance(state);
  799. instance->project(*param1, *param2, param3);
  800. return 0;
  801. }
  802. } while (0);
  803. lua_pushstring(state, "lua_Camera_project - Failed to match the given parameters to a valid function signature.");
  804. lua_error(state);
  805. break;
  806. }
  807. default:
  808. {
  809. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  810. lua_error(state);
  811. break;
  812. }
  813. }
  814. return 0;
  815. }
  816. int lua_Camera_release(lua_State* state)
  817. {
  818. // Get the number of parameters.
  819. int paramCount = lua_gettop(state);
  820. // Attempt to match the parameters to a valid binding.
  821. switch (paramCount)
  822. {
  823. case 1:
  824. {
  825. if ((lua_type(state, 1) == LUA_TUSERDATA))
  826. {
  827. Camera* instance = getInstance(state);
  828. instance->release();
  829. return 0;
  830. }
  831. lua_pushstring(state, "lua_Camera_release - Failed to match the given parameters to a valid function signature.");
  832. lua_error(state);
  833. break;
  834. }
  835. default:
  836. {
  837. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  838. lua_error(state);
  839. break;
  840. }
  841. }
  842. return 0;
  843. }
  844. int lua_Camera_removeListener(lua_State* state)
  845. {
  846. // Get the number of parameters.
  847. int paramCount = lua_gettop(state);
  848. // Attempt to match the parameters to a valid binding.
  849. switch (paramCount)
  850. {
  851. case 2:
  852. {
  853. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  854. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  855. {
  856. // Get parameter 1 off the stack.
  857. bool param1Valid;
  858. gameplay::ScriptUtil::LuaArray<Camera::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<Camera::Listener>(2, "CameraListener", false, &param1Valid);
  859. if (!param1Valid)
  860. {
  861. lua_pushstring(state, "Failed to convert parameter 1 to type 'Camera::Listener'.");
  862. lua_error(state);
  863. }
  864. Camera* instance = getInstance(state);
  865. instance->removeListener(param1);
  866. return 0;
  867. }
  868. lua_pushstring(state, "lua_Camera_removeListener - Failed to match the given parameters to a valid function signature.");
  869. lua_error(state);
  870. break;
  871. }
  872. default:
  873. {
  874. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  875. lua_error(state);
  876. break;
  877. }
  878. }
  879. return 0;
  880. }
  881. int lua_Camera_resetProjectionMatrix(lua_State* state)
  882. {
  883. // Get the number of parameters.
  884. int paramCount = lua_gettop(state);
  885. // Attempt to match the parameters to a valid binding.
  886. switch (paramCount)
  887. {
  888. case 1:
  889. {
  890. if ((lua_type(state, 1) == LUA_TUSERDATA))
  891. {
  892. Camera* instance = getInstance(state);
  893. instance->resetProjectionMatrix();
  894. return 0;
  895. }
  896. lua_pushstring(state, "lua_Camera_resetProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  897. lua_error(state);
  898. break;
  899. }
  900. default:
  901. {
  902. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  903. lua_error(state);
  904. break;
  905. }
  906. }
  907. return 0;
  908. }
  909. int lua_Camera_setAspectRatio(lua_State* state)
  910. {
  911. // Get the number of parameters.
  912. int paramCount = lua_gettop(state);
  913. // Attempt to match the parameters to a valid binding.
  914. switch (paramCount)
  915. {
  916. case 2:
  917. {
  918. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  919. lua_type(state, 2) == LUA_TNUMBER)
  920. {
  921. // Get parameter 1 off the stack.
  922. float param1 = (float)luaL_checknumber(state, 2);
  923. Camera* instance = getInstance(state);
  924. instance->setAspectRatio(param1);
  925. return 0;
  926. }
  927. lua_pushstring(state, "lua_Camera_setAspectRatio - Failed to match the given parameters to a valid function signature.");
  928. lua_error(state);
  929. break;
  930. }
  931. default:
  932. {
  933. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  934. lua_error(state);
  935. break;
  936. }
  937. }
  938. return 0;
  939. }
  940. int lua_Camera_setFarPlane(lua_State* state)
  941. {
  942. // Get the number of parameters.
  943. int paramCount = lua_gettop(state);
  944. // Attempt to match the parameters to a valid binding.
  945. switch (paramCount)
  946. {
  947. case 2:
  948. {
  949. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  950. lua_type(state, 2) == LUA_TNUMBER)
  951. {
  952. // Get parameter 1 off the stack.
  953. float param1 = (float)luaL_checknumber(state, 2);
  954. Camera* instance = getInstance(state);
  955. instance->setFarPlane(param1);
  956. return 0;
  957. }
  958. lua_pushstring(state, "lua_Camera_setFarPlane - Failed to match the given parameters to a valid function signature.");
  959. lua_error(state);
  960. break;
  961. }
  962. default:
  963. {
  964. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  965. lua_error(state);
  966. break;
  967. }
  968. }
  969. return 0;
  970. }
  971. int lua_Camera_setFieldOfView(lua_State* state)
  972. {
  973. // Get the number of parameters.
  974. int paramCount = lua_gettop(state);
  975. // Attempt to match the parameters to a valid binding.
  976. switch (paramCount)
  977. {
  978. case 2:
  979. {
  980. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  981. lua_type(state, 2) == LUA_TNUMBER)
  982. {
  983. // Get parameter 1 off the stack.
  984. float param1 = (float)luaL_checknumber(state, 2);
  985. Camera* instance = getInstance(state);
  986. instance->setFieldOfView(param1);
  987. return 0;
  988. }
  989. lua_pushstring(state, "lua_Camera_setFieldOfView - Failed to match the given parameters to a valid function signature.");
  990. lua_error(state);
  991. break;
  992. }
  993. default:
  994. {
  995. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  996. lua_error(state);
  997. break;
  998. }
  999. }
  1000. return 0;
  1001. }
  1002. int lua_Camera_setNearPlane(lua_State* state)
  1003. {
  1004. // Get the number of parameters.
  1005. int paramCount = lua_gettop(state);
  1006. // Attempt to match the parameters to a valid binding.
  1007. switch (paramCount)
  1008. {
  1009. case 2:
  1010. {
  1011. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1012. lua_type(state, 2) == LUA_TNUMBER)
  1013. {
  1014. // Get parameter 1 off the stack.
  1015. float param1 = (float)luaL_checknumber(state, 2);
  1016. Camera* instance = getInstance(state);
  1017. instance->setNearPlane(param1);
  1018. return 0;
  1019. }
  1020. lua_pushstring(state, "lua_Camera_setNearPlane - Failed to match the given parameters to a valid function signature.");
  1021. lua_error(state);
  1022. break;
  1023. }
  1024. default:
  1025. {
  1026. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1027. lua_error(state);
  1028. break;
  1029. }
  1030. }
  1031. return 0;
  1032. }
  1033. int lua_Camera_setProjectionMatrix(lua_State* state)
  1034. {
  1035. // Get the number of parameters.
  1036. int paramCount = lua_gettop(state);
  1037. // Attempt to match the parameters to a valid binding.
  1038. switch (paramCount)
  1039. {
  1040. case 2:
  1041. {
  1042. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1043. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1044. {
  1045. // Get parameter 1 off the stack.
  1046. bool param1Valid;
  1047. gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, &param1Valid);
  1048. if (!param1Valid)
  1049. {
  1050. lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
  1051. lua_error(state);
  1052. }
  1053. Camera* instance = getInstance(state);
  1054. instance->setProjectionMatrix(*param1);
  1055. return 0;
  1056. }
  1057. lua_pushstring(state, "lua_Camera_setProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  1058. lua_error(state);
  1059. break;
  1060. }
  1061. default:
  1062. {
  1063. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1064. lua_error(state);
  1065. break;
  1066. }
  1067. }
  1068. return 0;
  1069. }
  1070. int lua_Camera_setZoomX(lua_State* state)
  1071. {
  1072. // Get the number of parameters.
  1073. int paramCount = lua_gettop(state);
  1074. // Attempt to match the parameters to a valid binding.
  1075. switch (paramCount)
  1076. {
  1077. case 2:
  1078. {
  1079. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1080. lua_type(state, 2) == LUA_TNUMBER)
  1081. {
  1082. // Get parameter 1 off the stack.
  1083. float param1 = (float)luaL_checknumber(state, 2);
  1084. Camera* instance = getInstance(state);
  1085. instance->setZoomX(param1);
  1086. return 0;
  1087. }
  1088. lua_pushstring(state, "lua_Camera_setZoomX - Failed to match the given parameters to a valid function signature.");
  1089. lua_error(state);
  1090. break;
  1091. }
  1092. default:
  1093. {
  1094. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1095. lua_error(state);
  1096. break;
  1097. }
  1098. }
  1099. return 0;
  1100. }
  1101. int lua_Camera_setZoomY(lua_State* state)
  1102. {
  1103. // Get the number of parameters.
  1104. int paramCount = lua_gettop(state);
  1105. // Attempt to match the parameters to a valid binding.
  1106. switch (paramCount)
  1107. {
  1108. case 2:
  1109. {
  1110. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1111. lua_type(state, 2) == LUA_TNUMBER)
  1112. {
  1113. // Get parameter 1 off the stack.
  1114. float param1 = (float)luaL_checknumber(state, 2);
  1115. Camera* instance = getInstance(state);
  1116. instance->setZoomY(param1);
  1117. return 0;
  1118. }
  1119. lua_pushstring(state, "lua_Camera_setZoomY - Failed to match the given parameters to a valid function signature.");
  1120. lua_error(state);
  1121. break;
  1122. }
  1123. default:
  1124. {
  1125. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1126. lua_error(state);
  1127. break;
  1128. }
  1129. }
  1130. return 0;
  1131. }
  1132. int lua_Camera_static_create(lua_State* state)
  1133. {
  1134. // Get the number of parameters.
  1135. int paramCount = lua_gettop(state);
  1136. // Attempt to match the parameters to a valid binding.
  1137. switch (paramCount)
  1138. {
  1139. case 1:
  1140. {
  1141. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
  1142. {
  1143. // Get parameter 1 off the stack.
  1144. bool param1Valid;
  1145. gameplay::ScriptUtil::LuaArray<Properties> param1 = gameplay::ScriptUtil::getObjectPointer<Properties>(1, "Properties", false, &param1Valid);
  1146. if (!param1Valid)
  1147. {
  1148. lua_pushstring(state, "Failed to convert parameter 1 to type 'Properties'.");
  1149. lua_error(state);
  1150. }
  1151. void* returnPtr = (void*)Camera::create(param1);
  1152. if (returnPtr)
  1153. {
  1154. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  1155. object->instance = returnPtr;
  1156. object->owns = false;
  1157. luaL_getmetatable(state, "Camera");
  1158. lua_setmetatable(state, -2);
  1159. }
  1160. else
  1161. {
  1162. lua_pushnil(state);
  1163. }
  1164. return 1;
  1165. }
  1166. lua_pushstring(state, "lua_Camera_static_create - Failed to match the given parameters to a valid function signature.");
  1167. lua_error(state);
  1168. break;
  1169. }
  1170. default:
  1171. {
  1172. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1173. lua_error(state);
  1174. break;
  1175. }
  1176. }
  1177. return 0;
  1178. }
  1179. int lua_Camera_static_createOrthographic(lua_State* state)
  1180. {
  1181. // Get the number of parameters.
  1182. int paramCount = lua_gettop(state);
  1183. // Attempt to match the parameters to a valid binding.
  1184. switch (paramCount)
  1185. {
  1186. case 5:
  1187. {
  1188. if (lua_type(state, 1) == LUA_TNUMBER &&
  1189. lua_type(state, 2) == LUA_TNUMBER &&
  1190. lua_type(state, 3) == LUA_TNUMBER &&
  1191. lua_type(state, 4) == LUA_TNUMBER &&
  1192. lua_type(state, 5) == LUA_TNUMBER)
  1193. {
  1194. // Get parameter 1 off the stack.
  1195. float param1 = (float)luaL_checknumber(state, 1);
  1196. // Get parameter 2 off the stack.
  1197. float param2 = (float)luaL_checknumber(state, 2);
  1198. // Get parameter 3 off the stack.
  1199. float param3 = (float)luaL_checknumber(state, 3);
  1200. // Get parameter 4 off the stack.
  1201. float param4 = (float)luaL_checknumber(state, 4);
  1202. // Get parameter 5 off the stack.
  1203. float param5 = (float)luaL_checknumber(state, 5);
  1204. void* returnPtr = (void*)Camera::createOrthographic(param1, param2, param3, param4, param5);
  1205. if (returnPtr)
  1206. {
  1207. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  1208. object->instance = returnPtr;
  1209. object->owns = false;
  1210. luaL_getmetatable(state, "Camera");
  1211. lua_setmetatable(state, -2);
  1212. }
  1213. else
  1214. {
  1215. lua_pushnil(state);
  1216. }
  1217. return 1;
  1218. }
  1219. lua_pushstring(state, "lua_Camera_static_createOrthographic - Failed to match the given parameters to a valid function signature.");
  1220. lua_error(state);
  1221. break;
  1222. }
  1223. default:
  1224. {
  1225. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1226. lua_error(state);
  1227. break;
  1228. }
  1229. }
  1230. return 0;
  1231. }
  1232. int lua_Camera_static_createPerspective(lua_State* state)
  1233. {
  1234. // Get the number of parameters.
  1235. int paramCount = lua_gettop(state);
  1236. // Attempt to match the parameters to a valid binding.
  1237. switch (paramCount)
  1238. {
  1239. case 4:
  1240. {
  1241. if (lua_type(state, 1) == LUA_TNUMBER &&
  1242. lua_type(state, 2) == LUA_TNUMBER &&
  1243. lua_type(state, 3) == LUA_TNUMBER &&
  1244. lua_type(state, 4) == LUA_TNUMBER)
  1245. {
  1246. // Get parameter 1 off the stack.
  1247. float param1 = (float)luaL_checknumber(state, 1);
  1248. // Get parameter 2 off the stack.
  1249. float param2 = (float)luaL_checknumber(state, 2);
  1250. // Get parameter 3 off the stack.
  1251. float param3 = (float)luaL_checknumber(state, 3);
  1252. // Get parameter 4 off the stack.
  1253. float param4 = (float)luaL_checknumber(state, 4);
  1254. void* returnPtr = (void*)Camera::createPerspective(param1, param2, param3, param4);
  1255. if (returnPtr)
  1256. {
  1257. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  1258. object->instance = returnPtr;
  1259. object->owns = false;
  1260. luaL_getmetatable(state, "Camera");
  1261. lua_setmetatable(state, -2);
  1262. }
  1263. else
  1264. {
  1265. lua_pushnil(state);
  1266. }
  1267. return 1;
  1268. }
  1269. lua_pushstring(state, "lua_Camera_static_createPerspective - Failed to match the given parameters to a valid function signature.");
  1270. lua_error(state);
  1271. break;
  1272. }
  1273. default:
  1274. {
  1275. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  1276. lua_error(state);
  1277. break;
  1278. }
  1279. }
  1280. return 0;
  1281. }
  1282. int lua_Camera_unproject(lua_State* state)
  1283. {
  1284. // Get the number of parameters.
  1285. int paramCount = lua_gettop(state);
  1286. // Attempt to match the parameters to a valid binding.
  1287. switch (paramCount)
  1288. {
  1289. case 6:
  1290. {
  1291. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1292. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  1293. lua_type(state, 3) == LUA_TNUMBER &&
  1294. lua_type(state, 4) == LUA_TNUMBER &&
  1295. lua_type(state, 5) == LUA_TNUMBER &&
  1296. (lua_type(state, 6) == LUA_TUSERDATA || lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TNIL))
  1297. {
  1298. // Get parameter 1 off the stack.
  1299. bool param1Valid;
  1300. gameplay::ScriptUtil::LuaArray<Rectangle> param1 = gameplay::ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
  1301. if (!param1Valid)
  1302. {
  1303. lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
  1304. lua_error(state);
  1305. }
  1306. // Get parameter 2 off the stack.
  1307. float param2 = (float)luaL_checknumber(state, 3);
  1308. // Get parameter 3 off the stack.
  1309. float param3 = (float)luaL_checknumber(state, 4);
  1310. // Get parameter 4 off the stack.
  1311. float param4 = (float)luaL_checknumber(state, 5);
  1312. // Get parameter 5 off the stack.
  1313. bool param5Valid;
  1314. gameplay::ScriptUtil::LuaArray<Vector3> param5 = gameplay::ScriptUtil::getObjectPointer<Vector3>(6, "Vector3", false, &param5Valid);
  1315. if (!param5Valid)
  1316. {
  1317. lua_pushstring(state, "Failed to convert parameter 5 to type 'Vector3'.");
  1318. lua_error(state);
  1319. }
  1320. Camera* instance = getInstance(state);
  1321. instance->unproject(*param1, param2, param3, param4, param5);
  1322. return 0;
  1323. }
  1324. lua_pushstring(state, "lua_Camera_unproject - Failed to match the given parameters to a valid function signature.");
  1325. lua_error(state);
  1326. break;
  1327. }
  1328. default:
  1329. {
  1330. lua_pushstring(state, "Invalid number of parameters (expected 6).");
  1331. lua_error(state);
  1332. break;
  1333. }
  1334. }
  1335. return 0;
  1336. }
  1337. }