lua_PhysicsRigidBodyParameters.cpp 31 KB

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