lua_BoundingBox.cpp 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. // Autogenerated by gameplay-luagen
  2. #include "Base.h"
  3. #include "ScriptController.h"
  4. #include "lua_BoundingBox.h"
  5. #include "Base.h"
  6. #include "BoundingBox.h"
  7. #include "BoundingSphere.h"
  8. #include "Plane.h"
  9. namespace gameplay
  10. {
  11. void luaRegister_BoundingBox()
  12. {
  13. const luaL_Reg lua_members[] =
  14. {
  15. {"getCenter", lua_BoundingBox_getCenter},
  16. {"getCorners", lua_BoundingBox_getCorners},
  17. {"intersects", lua_BoundingBox_intersects},
  18. {"isEmpty", lua_BoundingBox_isEmpty},
  19. {"max", lua_BoundingBox_max},
  20. {"merge", lua_BoundingBox_merge},
  21. {"min", lua_BoundingBox_min},
  22. {"set", lua_BoundingBox_set},
  23. {"transform", lua_BoundingBox_transform},
  24. {NULL, NULL}
  25. };
  26. const luaL_Reg lua_statics[] =
  27. {
  28. {"empty", lua_BoundingBox_static_empty},
  29. {NULL, NULL}
  30. };
  31. std::vector<std::string> scopePath;
  32. gameplay::ScriptUtil::registerClass("BoundingBox", lua_members, lua_BoundingBox__init, lua_BoundingBox__gc, lua_statics, scopePath);
  33. }
  34. static BoundingBox* getInstance(lua_State* state)
  35. {
  36. void* userdata = luaL_checkudata(state, 1, "BoundingBox");
  37. luaL_argcheck(state, userdata != NULL, 1, "'BoundingBox' expected.");
  38. return (BoundingBox*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  39. }
  40. int lua_BoundingBox__gc(lua_State* state)
  41. {
  42. // Get the number of parameters.
  43. int paramCount = lua_gettop(state);
  44. // Attempt to match the parameters to a valid binding.
  45. switch (paramCount)
  46. {
  47. case 1:
  48. {
  49. if ((lua_type(state, 1) == LUA_TUSERDATA))
  50. {
  51. void* userdata = luaL_checkudata(state, 1, "BoundingBox");
  52. luaL_argcheck(state, userdata != NULL, 1, "'BoundingBox' expected.");
  53. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  54. if (object->owns)
  55. {
  56. BoundingBox* instance = (BoundingBox*)object->instance;
  57. SAFE_DELETE(instance);
  58. }
  59. return 0;
  60. }
  61. lua_pushstring(state, "lua_BoundingBox__gc - Failed to match the given parameters to a valid function signature.");
  62. lua_error(state);
  63. break;
  64. }
  65. default:
  66. {
  67. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  68. lua_error(state);
  69. break;
  70. }
  71. }
  72. return 0;
  73. }
  74. int lua_BoundingBox__init(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 0:
  82. {
  83. void* returnPtr = ((void*)new BoundingBox());
  84. if (returnPtr)
  85. {
  86. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  87. object->instance = returnPtr;
  88. object->owns = true;
  89. luaL_getmetatable(state, "BoundingBox");
  90. lua_setmetatable(state, -2);
  91. }
  92. else
  93. {
  94. lua_pushnil(state);
  95. }
  96. return 1;
  97. break;
  98. }
  99. case 1:
  100. {
  101. do
  102. {
  103. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
  104. {
  105. // Get parameter 1 off the stack.
  106. bool param1Valid;
  107. gameplay::ScriptUtil::LuaArray<BoundingBox> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingBox>(1, "BoundingBox", true, &param1Valid);
  108. if (!param1Valid)
  109. break;
  110. void* returnPtr = ((void*)new BoundingBox(*param1));
  111. if (returnPtr)
  112. {
  113. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  114. object->instance = returnPtr;
  115. object->owns = true;
  116. luaL_getmetatable(state, "BoundingBox");
  117. lua_setmetatable(state, -2);
  118. }
  119. else
  120. {
  121. lua_pushnil(state);
  122. }
  123. return 1;
  124. }
  125. } while (0);
  126. lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
  127. lua_error(state);
  128. break;
  129. }
  130. case 2:
  131. {
  132. do
  133. {
  134. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
  135. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  136. {
  137. // Get parameter 1 off the stack.
  138. bool param1Valid;
  139. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true, &param1Valid);
  140. if (!param1Valid)
  141. break;
  142. // Get parameter 2 off the stack.
  143. bool param2Valid;
  144. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
  145. if (!param2Valid)
  146. break;
  147. void* returnPtr = ((void*)new BoundingBox(*param1, *param2));
  148. if (returnPtr)
  149. {
  150. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  151. object->instance = returnPtr;
  152. object->owns = true;
  153. luaL_getmetatable(state, "BoundingBox");
  154. lua_setmetatable(state, -2);
  155. }
  156. else
  157. {
  158. lua_pushnil(state);
  159. }
  160. return 1;
  161. }
  162. } while (0);
  163. lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
  164. lua_error(state);
  165. break;
  166. }
  167. case 6:
  168. {
  169. do
  170. {
  171. if (lua_type(state, 1) == LUA_TNUMBER &&
  172. lua_type(state, 2) == LUA_TNUMBER &&
  173. lua_type(state, 3) == LUA_TNUMBER &&
  174. lua_type(state, 4) == LUA_TNUMBER &&
  175. lua_type(state, 5) == LUA_TNUMBER &&
  176. lua_type(state, 6) == LUA_TNUMBER)
  177. {
  178. // Get parameter 1 off the stack.
  179. float param1 = (float)luaL_checknumber(state, 1);
  180. // Get parameter 2 off the stack.
  181. float param2 = (float)luaL_checknumber(state, 2);
  182. // Get parameter 3 off the stack.
  183. float param3 = (float)luaL_checknumber(state, 3);
  184. // Get parameter 4 off the stack.
  185. float param4 = (float)luaL_checknumber(state, 4);
  186. // Get parameter 5 off the stack.
  187. float param5 = (float)luaL_checknumber(state, 5);
  188. // Get parameter 6 off the stack.
  189. float param6 = (float)luaL_checknumber(state, 6);
  190. void* returnPtr = ((void*)new BoundingBox(param1, param2, param3, param4, param5, param6));
  191. if (returnPtr)
  192. {
  193. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  194. object->instance = returnPtr;
  195. object->owns = true;
  196. luaL_getmetatable(state, "BoundingBox");
  197. lua_setmetatable(state, -2);
  198. }
  199. else
  200. {
  201. lua_pushnil(state);
  202. }
  203. return 1;
  204. }
  205. } while (0);
  206. lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
  207. lua_error(state);
  208. break;
  209. }
  210. default:
  211. {
  212. lua_pushstring(state, "Invalid number of parameters (expected 0, 1, 2 or 6).");
  213. lua_error(state);
  214. break;
  215. }
  216. }
  217. return 0;
  218. }
  219. int lua_BoundingBox_getCenter(lua_State* state)
  220. {
  221. // Get the number of parameters.
  222. int paramCount = lua_gettop(state);
  223. // Attempt to match the parameters to a valid binding.
  224. switch (paramCount)
  225. {
  226. case 1:
  227. {
  228. do
  229. {
  230. if ((lua_type(state, 1) == LUA_TUSERDATA))
  231. {
  232. BoundingBox* instance = getInstance(state);
  233. void* returnPtr = (void*)new Vector3(instance->getCenter());
  234. if (returnPtr)
  235. {
  236. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  237. object->instance = returnPtr;
  238. object->owns = true;
  239. luaL_getmetatable(state, "Vector3");
  240. lua_setmetatable(state, -2);
  241. }
  242. else
  243. {
  244. lua_pushnil(state);
  245. }
  246. return 1;
  247. }
  248. } while (0);
  249. lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
  250. lua_error(state);
  251. break;
  252. }
  253. case 2:
  254. {
  255. do
  256. {
  257. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  258. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  259. {
  260. // Get parameter 1 off the stack.
  261. bool param1Valid;
  262. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param1Valid);
  263. if (!param1Valid)
  264. break;
  265. BoundingBox* instance = getInstance(state);
  266. instance->getCenter(param1);
  267. return 0;
  268. }
  269. } while (0);
  270. lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
  271. lua_error(state);
  272. break;
  273. }
  274. default:
  275. {
  276. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  277. lua_error(state);
  278. break;
  279. }
  280. }
  281. return 0;
  282. }
  283. int lua_BoundingBox_getCorners(lua_State* state)
  284. {
  285. // Get the number of parameters.
  286. int paramCount = lua_gettop(state);
  287. // Attempt to match the parameters to a valid binding.
  288. switch (paramCount)
  289. {
  290. case 2:
  291. {
  292. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  293. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  294. {
  295. // Get parameter 1 off the stack.
  296. bool param1Valid;
  297. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param1Valid);
  298. if (!param1Valid)
  299. {
  300. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  301. lua_error(state);
  302. }
  303. BoundingBox* instance = getInstance(state);
  304. instance->getCorners(param1);
  305. return 0;
  306. }
  307. lua_pushstring(state, "lua_BoundingBox_getCorners - Failed to match the given parameters to a valid function signature.");
  308. lua_error(state);
  309. break;
  310. }
  311. default:
  312. {
  313. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  314. lua_error(state);
  315. break;
  316. }
  317. }
  318. return 0;
  319. }
  320. int lua_BoundingBox_intersects(lua_State* state)
  321. {
  322. // Get the number of parameters.
  323. int paramCount = lua_gettop(state);
  324. // Attempt to match the parameters to a valid binding.
  325. switch (paramCount)
  326. {
  327. case 2:
  328. {
  329. do
  330. {
  331. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  332. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  333. {
  334. // Get parameter 1 off the stack.
  335. bool param1Valid;
  336. gameplay::ScriptUtil::LuaArray<BoundingBox> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
  337. if (!param1Valid)
  338. break;
  339. BoundingBox* instance = getInstance(state);
  340. bool result = instance->intersects(*param1);
  341. // Push the return value onto the stack.
  342. lua_pushboolean(state, result);
  343. return 1;
  344. }
  345. } while (0);
  346. do
  347. {
  348. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  349. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  350. {
  351. // Get parameter 1 off the stack.
  352. bool param1Valid;
  353. gameplay::ScriptUtil::LuaArray<BoundingSphere> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
  354. if (!param1Valid)
  355. break;
  356. BoundingBox* instance = getInstance(state);
  357. bool result = instance->intersects(*param1);
  358. // Push the return value onto the stack.
  359. lua_pushboolean(state, result);
  360. return 1;
  361. }
  362. } while (0);
  363. do
  364. {
  365. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  366. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  367. {
  368. // Get parameter 1 off the stack.
  369. bool param1Valid;
  370. gameplay::ScriptUtil::LuaArray<Frustum> param1 = gameplay::ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true, &param1Valid);
  371. if (!param1Valid)
  372. break;
  373. BoundingBox* instance = getInstance(state);
  374. bool result = instance->intersects(*param1);
  375. // Push the return value onto the stack.
  376. lua_pushboolean(state, result);
  377. return 1;
  378. }
  379. } while (0);
  380. do
  381. {
  382. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  383. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  384. {
  385. // Get parameter 1 off the stack.
  386. bool param1Valid;
  387. gameplay::ScriptUtil::LuaArray<Plane> param1 = gameplay::ScriptUtil::getObjectPointer<Plane>(2, "Plane", true, &param1Valid);
  388. if (!param1Valid)
  389. break;
  390. BoundingBox* instance = getInstance(state);
  391. float result = instance->intersects(*param1);
  392. // Push the return value onto the stack.
  393. lua_pushnumber(state, result);
  394. return 1;
  395. }
  396. } while (0);
  397. do
  398. {
  399. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  400. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  401. {
  402. // Get parameter 1 off the stack.
  403. bool param1Valid;
  404. gameplay::ScriptUtil::LuaArray<Ray> param1 = gameplay::ScriptUtil::getObjectPointer<Ray>(2, "Ray", true, &param1Valid);
  405. if (!param1Valid)
  406. break;
  407. BoundingBox* instance = getInstance(state);
  408. float result = instance->intersects(*param1);
  409. // Push the return value onto the stack.
  410. lua_pushnumber(state, result);
  411. return 1;
  412. }
  413. } while (0);
  414. lua_pushstring(state, "lua_BoundingBox_intersects - Failed to match the given parameters to a valid function signature.");
  415. lua_error(state);
  416. break;
  417. }
  418. default:
  419. {
  420. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  421. lua_error(state);
  422. break;
  423. }
  424. }
  425. return 0;
  426. }
  427. int lua_BoundingBox_isEmpty(lua_State* state)
  428. {
  429. // Get the number of parameters.
  430. int paramCount = lua_gettop(state);
  431. // Attempt to match the parameters to a valid binding.
  432. switch (paramCount)
  433. {
  434. case 1:
  435. {
  436. if ((lua_type(state, 1) == LUA_TUSERDATA))
  437. {
  438. BoundingBox* instance = getInstance(state);
  439. bool result = instance->isEmpty();
  440. // Push the return value onto the stack.
  441. lua_pushboolean(state, result);
  442. return 1;
  443. }
  444. lua_pushstring(state, "lua_BoundingBox_isEmpty - Failed to match the given parameters to a valid function signature.");
  445. lua_error(state);
  446. break;
  447. }
  448. default:
  449. {
  450. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  451. lua_error(state);
  452. break;
  453. }
  454. }
  455. return 0;
  456. }
  457. int lua_BoundingBox_max(lua_State* state)
  458. {
  459. // Validate the number of parameters.
  460. if (lua_gettop(state) > 2)
  461. {
  462. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  463. lua_error(state);
  464. }
  465. BoundingBox* instance = getInstance(state);
  466. if (lua_gettop(state) == 2)
  467. {
  468. // Get parameter 2 off the stack.
  469. bool param2Valid;
  470. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
  471. if (!param2Valid)
  472. {
  473. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  474. lua_error(state);
  475. }
  476. instance->max = *param2;
  477. return 0;
  478. }
  479. else
  480. {
  481. void* returnPtr = (void*)new Vector3(instance->max);
  482. if (returnPtr)
  483. {
  484. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  485. object->instance = returnPtr;
  486. object->owns = true;
  487. luaL_getmetatable(state, "Vector3");
  488. lua_setmetatable(state, -2);
  489. }
  490. else
  491. {
  492. lua_pushnil(state);
  493. }
  494. return 1;
  495. }
  496. }
  497. int lua_BoundingBox_merge(lua_State* state)
  498. {
  499. // Get the number of parameters.
  500. int paramCount = lua_gettop(state);
  501. // Attempt to match the parameters to a valid binding.
  502. switch (paramCount)
  503. {
  504. case 2:
  505. {
  506. do
  507. {
  508. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  509. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  510. {
  511. // Get parameter 1 off the stack.
  512. bool param1Valid;
  513. gameplay::ScriptUtil::LuaArray<BoundingSphere> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
  514. if (!param1Valid)
  515. break;
  516. BoundingBox* instance = getInstance(state);
  517. instance->merge(*param1);
  518. return 0;
  519. }
  520. } while (0);
  521. do
  522. {
  523. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  524. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  525. {
  526. // Get parameter 1 off the stack.
  527. bool param1Valid;
  528. gameplay::ScriptUtil::LuaArray<BoundingBox> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
  529. if (!param1Valid)
  530. break;
  531. BoundingBox* instance = getInstance(state);
  532. instance->merge(*param1);
  533. return 0;
  534. }
  535. } while (0);
  536. lua_pushstring(state, "lua_BoundingBox_merge - Failed to match the given parameters to a valid function signature.");
  537. lua_error(state);
  538. break;
  539. }
  540. default:
  541. {
  542. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  543. lua_error(state);
  544. break;
  545. }
  546. }
  547. return 0;
  548. }
  549. int lua_BoundingBox_min(lua_State* state)
  550. {
  551. // Validate the number of parameters.
  552. if (lua_gettop(state) > 2)
  553. {
  554. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  555. lua_error(state);
  556. }
  557. BoundingBox* instance = getInstance(state);
  558. if (lua_gettop(state) == 2)
  559. {
  560. // Get parameter 2 off the stack.
  561. bool param2Valid;
  562. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
  563. if (!param2Valid)
  564. {
  565. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  566. lua_error(state);
  567. }
  568. instance->min = *param2;
  569. return 0;
  570. }
  571. else
  572. {
  573. void* returnPtr = (void*)new Vector3(instance->min);
  574. if (returnPtr)
  575. {
  576. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  577. object->instance = returnPtr;
  578. object->owns = true;
  579. luaL_getmetatable(state, "Vector3");
  580. lua_setmetatable(state, -2);
  581. }
  582. else
  583. {
  584. lua_pushnil(state);
  585. }
  586. return 1;
  587. }
  588. }
  589. int lua_BoundingBox_set(lua_State* state)
  590. {
  591. // Get the number of parameters.
  592. int paramCount = lua_gettop(state);
  593. // Attempt to match the parameters to a valid binding.
  594. switch (paramCount)
  595. {
  596. case 2:
  597. {
  598. do
  599. {
  600. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  601. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  602. {
  603. // Get parameter 1 off the stack.
  604. bool param1Valid;
  605. gameplay::ScriptUtil::LuaArray<BoundingBox> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
  606. if (!param1Valid)
  607. break;
  608. BoundingBox* instance = getInstance(state);
  609. instance->set(*param1);
  610. return 0;
  611. }
  612. } while (0);
  613. do
  614. {
  615. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  616. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  617. {
  618. // Get parameter 1 off the stack.
  619. bool param1Valid;
  620. gameplay::ScriptUtil::LuaArray<BoundingSphere> param1 = gameplay::ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
  621. if (!param1Valid)
  622. break;
  623. BoundingBox* instance = getInstance(state);
  624. instance->set(*param1);
  625. return 0;
  626. }
  627. } while (0);
  628. lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
  629. lua_error(state);
  630. break;
  631. }
  632. case 3:
  633. {
  634. do
  635. {
  636. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  637. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  638. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  639. {
  640. // Get parameter 1 off the stack.
  641. bool param1Valid;
  642. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  643. if (!param1Valid)
  644. break;
  645. // Get parameter 2 off the stack.
  646. bool param2Valid;
  647. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
  648. if (!param2Valid)
  649. break;
  650. BoundingBox* instance = getInstance(state);
  651. instance->set(*param1, *param2);
  652. return 0;
  653. }
  654. } while (0);
  655. lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
  656. lua_error(state);
  657. break;
  658. }
  659. case 7:
  660. {
  661. do
  662. {
  663. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  664. lua_type(state, 2) == LUA_TNUMBER &&
  665. lua_type(state, 3) == LUA_TNUMBER &&
  666. lua_type(state, 4) == LUA_TNUMBER &&
  667. lua_type(state, 5) == LUA_TNUMBER &&
  668. lua_type(state, 6) == LUA_TNUMBER &&
  669. lua_type(state, 7) == LUA_TNUMBER)
  670. {
  671. // Get parameter 1 off the stack.
  672. float param1 = (float)luaL_checknumber(state, 2);
  673. // Get parameter 2 off the stack.
  674. float param2 = (float)luaL_checknumber(state, 3);
  675. // Get parameter 3 off the stack.
  676. float param3 = (float)luaL_checknumber(state, 4);
  677. // Get parameter 4 off the stack.
  678. float param4 = (float)luaL_checknumber(state, 5);
  679. // Get parameter 5 off the stack.
  680. float param5 = (float)luaL_checknumber(state, 6);
  681. // Get parameter 6 off the stack.
  682. float param6 = (float)luaL_checknumber(state, 7);
  683. BoundingBox* instance = getInstance(state);
  684. instance->set(param1, param2, param3, param4, param5, param6);
  685. return 0;
  686. }
  687. } while (0);
  688. lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
  689. lua_error(state);
  690. break;
  691. }
  692. default:
  693. {
  694. lua_pushstring(state, "Invalid number of parameters (expected 2, 3 or 7).");
  695. lua_error(state);
  696. break;
  697. }
  698. }
  699. return 0;
  700. }
  701. int lua_BoundingBox_static_empty(lua_State* state)
  702. {
  703. // Get the number of parameters.
  704. int paramCount = lua_gettop(state);
  705. // Attempt to match the parameters to a valid binding.
  706. switch (paramCount)
  707. {
  708. case 0:
  709. {
  710. void* returnPtr = (void*)&(BoundingBox::empty());
  711. if (returnPtr)
  712. {
  713. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  714. object->instance = returnPtr;
  715. object->owns = false;
  716. luaL_getmetatable(state, "BoundingBox");
  717. lua_setmetatable(state, -2);
  718. }
  719. else
  720. {
  721. lua_pushnil(state);
  722. }
  723. return 1;
  724. break;
  725. }
  726. default:
  727. {
  728. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  729. lua_error(state);
  730. break;
  731. }
  732. }
  733. return 0;
  734. }
  735. int lua_BoundingBox_transform(lua_State* state)
  736. {
  737. // Get the number of parameters.
  738. int paramCount = lua_gettop(state);
  739. // Attempt to match the parameters to a valid binding.
  740. switch (paramCount)
  741. {
  742. case 2:
  743. {
  744. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  745. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  746. {
  747. // Get parameter 1 off the stack.
  748. bool param1Valid;
  749. gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, &param1Valid);
  750. if (!param1Valid)
  751. {
  752. lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
  753. lua_error(state);
  754. }
  755. BoundingBox* instance = getInstance(state);
  756. instance->transform(*param1);
  757. return 0;
  758. }
  759. lua_pushstring(state, "lua_BoundingBox_transform - Failed to match the given parameters to a valid function signature.");
  760. lua_error(state);
  761. break;
  762. }
  763. default:
  764. {
  765. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  766. lua_error(state);
  767. break;
  768. }
  769. }
  770. return 0;
  771. }
  772. }