lua_Mesh.cpp 52 KB

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