lua_Effect.cpp 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. // Autogenerated by gameplay-luagen
  2. #include "Base.h"
  3. #include "ScriptController.h"
  4. #include "lua_Effect.h"
  5. #include "Base.h"
  6. #include "Effect.h"
  7. #include "FileSystem.h"
  8. #include "Game.h"
  9. #include "Ref.h"
  10. namespace gameplay
  11. {
  12. void luaRegister_Effect()
  13. {
  14. const luaL_Reg lua_members[] =
  15. {
  16. {"addRef", lua_Effect_addRef},
  17. {"bind", lua_Effect_bind},
  18. {"getId", lua_Effect_getId},
  19. {"getRefCount", lua_Effect_getRefCount},
  20. {"getUniform", lua_Effect_getUniform},
  21. {"getUniformCount", lua_Effect_getUniformCount},
  22. {"getVertexAttribute", lua_Effect_getVertexAttribute},
  23. {"release", lua_Effect_release},
  24. {"setValue", lua_Effect_setValue},
  25. {NULL, NULL}
  26. };
  27. const luaL_Reg lua_statics[] =
  28. {
  29. {"createFromFile", lua_Effect_static_createFromFile},
  30. {"createFromSource", lua_Effect_static_createFromSource},
  31. {"getCurrentEffect", lua_Effect_static_getCurrentEffect},
  32. {NULL, NULL}
  33. };
  34. std::vector<std::string> scopePath;
  35. gameplay::ScriptUtil::registerClass("Effect", lua_members, NULL, lua_Effect__gc, lua_statics, scopePath);
  36. }
  37. static Effect* getInstance(lua_State* state)
  38. {
  39. void* userdata = luaL_checkudata(state, 1, "Effect");
  40. luaL_argcheck(state, userdata != NULL, 1, "'Effect' expected.");
  41. return (Effect*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  42. }
  43. int lua_Effect__gc(lua_State* state)
  44. {
  45. // Get the number of parameters.
  46. int paramCount = lua_gettop(state);
  47. // Attempt to match the parameters to a valid binding.
  48. switch (paramCount)
  49. {
  50. case 1:
  51. {
  52. if ((lua_type(state, 1) == LUA_TUSERDATA))
  53. {
  54. void* userdata = luaL_checkudata(state, 1, "Effect");
  55. luaL_argcheck(state, userdata != NULL, 1, "'Effect' expected.");
  56. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  57. if (object->owns)
  58. {
  59. Effect* instance = (Effect*)object->instance;
  60. SAFE_RELEASE(instance);
  61. }
  62. return 0;
  63. }
  64. lua_pushstring(state, "lua_Effect__gc - Failed to match the given parameters to a valid function signature.");
  65. lua_error(state);
  66. break;
  67. }
  68. default:
  69. {
  70. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  71. lua_error(state);
  72. break;
  73. }
  74. }
  75. return 0;
  76. }
  77. int lua_Effect_addRef(lua_State* state)
  78. {
  79. // Get the number of parameters.
  80. int paramCount = lua_gettop(state);
  81. // Attempt to match the parameters to a valid binding.
  82. switch (paramCount)
  83. {
  84. case 1:
  85. {
  86. if ((lua_type(state, 1) == LUA_TUSERDATA))
  87. {
  88. Effect* instance = getInstance(state);
  89. instance->addRef();
  90. return 0;
  91. }
  92. lua_pushstring(state, "lua_Effect_addRef - Failed to match the given parameters to a valid function signature.");
  93. lua_error(state);
  94. break;
  95. }
  96. default:
  97. {
  98. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  99. lua_error(state);
  100. break;
  101. }
  102. }
  103. return 0;
  104. }
  105. int lua_Effect_bind(lua_State* state)
  106. {
  107. // Get the number of parameters.
  108. int paramCount = lua_gettop(state);
  109. // Attempt to match the parameters to a valid binding.
  110. switch (paramCount)
  111. {
  112. case 1:
  113. {
  114. if ((lua_type(state, 1) == LUA_TUSERDATA))
  115. {
  116. Effect* instance = getInstance(state);
  117. instance->bind();
  118. return 0;
  119. }
  120. lua_pushstring(state, "lua_Effect_bind - Failed to match the given parameters to a valid function signature.");
  121. lua_error(state);
  122. break;
  123. }
  124. default:
  125. {
  126. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  127. lua_error(state);
  128. break;
  129. }
  130. }
  131. return 0;
  132. }
  133. int lua_Effect_getId(lua_State* state)
  134. {
  135. // Get the number of parameters.
  136. int paramCount = lua_gettop(state);
  137. // Attempt to match the parameters to a valid binding.
  138. switch (paramCount)
  139. {
  140. case 1:
  141. {
  142. if ((lua_type(state, 1) == LUA_TUSERDATA))
  143. {
  144. Effect* instance = getInstance(state);
  145. const char* result = instance->getId();
  146. // Push the return value onto the stack.
  147. lua_pushstring(state, result);
  148. return 1;
  149. }
  150. lua_pushstring(state, "lua_Effect_getId - Failed to match the given parameters to a valid function signature.");
  151. lua_error(state);
  152. break;
  153. }
  154. default:
  155. {
  156. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  157. lua_error(state);
  158. break;
  159. }
  160. }
  161. return 0;
  162. }
  163. int lua_Effect_getRefCount(lua_State* state)
  164. {
  165. // Get the number of parameters.
  166. int paramCount = lua_gettop(state);
  167. // Attempt to match the parameters to a valid binding.
  168. switch (paramCount)
  169. {
  170. case 1:
  171. {
  172. if ((lua_type(state, 1) == LUA_TUSERDATA))
  173. {
  174. Effect* instance = getInstance(state);
  175. unsigned int result = instance->getRefCount();
  176. // Push the return value onto the stack.
  177. lua_pushunsigned(state, result);
  178. return 1;
  179. }
  180. lua_pushstring(state, "lua_Effect_getRefCount - Failed to match the given parameters to a valid function signature.");
  181. lua_error(state);
  182. break;
  183. }
  184. default:
  185. {
  186. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  187. lua_error(state);
  188. break;
  189. }
  190. }
  191. return 0;
  192. }
  193. int lua_Effect_getUniform(lua_State* state)
  194. {
  195. // Get the number of parameters.
  196. int paramCount = lua_gettop(state);
  197. // Attempt to match the parameters to a valid binding.
  198. switch (paramCount)
  199. {
  200. case 2:
  201. {
  202. do
  203. {
  204. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  205. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  206. {
  207. // Get parameter 1 off the stack.
  208. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  209. Effect* instance = getInstance(state);
  210. void* returnPtr = ((void*)instance->getUniform(param1));
  211. if (returnPtr)
  212. {
  213. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  214. object->instance = returnPtr;
  215. object->owns = false;
  216. luaL_getmetatable(state, "Uniform");
  217. lua_setmetatable(state, -2);
  218. }
  219. else
  220. {
  221. lua_pushnil(state);
  222. }
  223. return 1;
  224. }
  225. } while (0);
  226. do
  227. {
  228. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  229. lua_type(state, 2) == LUA_TNUMBER)
  230. {
  231. // Get parameter 1 off the stack.
  232. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  233. Effect* instance = getInstance(state);
  234. void* returnPtr = ((void*)instance->getUniform(param1));
  235. if (returnPtr)
  236. {
  237. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  238. object->instance = returnPtr;
  239. object->owns = false;
  240. luaL_getmetatable(state, "Uniform");
  241. lua_setmetatable(state, -2);
  242. }
  243. else
  244. {
  245. lua_pushnil(state);
  246. }
  247. return 1;
  248. }
  249. } while (0);
  250. lua_pushstring(state, "lua_Effect_getUniform - Failed to match the given parameters to a valid function signature.");
  251. lua_error(state);
  252. break;
  253. }
  254. default:
  255. {
  256. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  257. lua_error(state);
  258. break;
  259. }
  260. }
  261. return 0;
  262. }
  263. int lua_Effect_getUniformCount(lua_State* state)
  264. {
  265. // Get the number of parameters.
  266. int paramCount = lua_gettop(state);
  267. // Attempt to match the parameters to a valid binding.
  268. switch (paramCount)
  269. {
  270. case 1:
  271. {
  272. if ((lua_type(state, 1) == LUA_TUSERDATA))
  273. {
  274. Effect* instance = getInstance(state);
  275. unsigned int result = instance->getUniformCount();
  276. // Push the return value onto the stack.
  277. lua_pushunsigned(state, result);
  278. return 1;
  279. }
  280. lua_pushstring(state, "lua_Effect_getUniformCount - Failed to match the given parameters to a valid function signature.");
  281. lua_error(state);
  282. break;
  283. }
  284. default:
  285. {
  286. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  287. lua_error(state);
  288. break;
  289. }
  290. }
  291. return 0;
  292. }
  293. int lua_Effect_getVertexAttribute(lua_State* state)
  294. {
  295. // Get the number of parameters.
  296. int paramCount = lua_gettop(state);
  297. // Attempt to match the parameters to a valid binding.
  298. switch (paramCount)
  299. {
  300. case 2:
  301. {
  302. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  303. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  304. {
  305. // Get parameter 1 off the stack.
  306. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  307. Effect* instance = getInstance(state);
  308. void* returnPtr = (void*)new GLint(instance->getVertexAttribute(param1));
  309. if (returnPtr)
  310. {
  311. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  312. object->instance = returnPtr;
  313. object->owns = true;
  314. luaL_getmetatable(state, "GLint");
  315. lua_setmetatable(state, -2);
  316. }
  317. else
  318. {
  319. lua_pushnil(state);
  320. }
  321. return 1;
  322. }
  323. lua_pushstring(state, "lua_Effect_getVertexAttribute - Failed to match the given parameters to a valid function signature.");
  324. lua_error(state);
  325. break;
  326. }
  327. default:
  328. {
  329. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  330. lua_error(state);
  331. break;
  332. }
  333. }
  334. return 0;
  335. }
  336. int lua_Effect_release(lua_State* state)
  337. {
  338. // Get the number of parameters.
  339. int paramCount = lua_gettop(state);
  340. // Attempt to match the parameters to a valid binding.
  341. switch (paramCount)
  342. {
  343. case 1:
  344. {
  345. if ((lua_type(state, 1) == LUA_TUSERDATA))
  346. {
  347. Effect* instance = getInstance(state);
  348. instance->release();
  349. return 0;
  350. }
  351. lua_pushstring(state, "lua_Effect_release - Failed to match the given parameters to a valid function signature.");
  352. lua_error(state);
  353. break;
  354. }
  355. default:
  356. {
  357. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  358. lua_error(state);
  359. break;
  360. }
  361. }
  362. return 0;
  363. }
  364. int lua_Effect_setValue(lua_State* state)
  365. {
  366. // Get the number of parameters.
  367. int paramCount = lua_gettop(state);
  368. // Attempt to match the parameters to a valid binding.
  369. switch (paramCount)
  370. {
  371. case 3:
  372. {
  373. do
  374. {
  375. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  376. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  377. lua_type(state, 3) == LUA_TNUMBER)
  378. {
  379. // Get parameter 1 off the stack.
  380. bool param1Valid;
  381. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  382. if (!param1Valid)
  383. break;
  384. // Get parameter 2 off the stack.
  385. float param2 = (float)luaL_checknumber(state, 3);
  386. Effect* instance = getInstance(state);
  387. instance->setValue(param1, param2);
  388. return 0;
  389. }
  390. } while (0);
  391. do
  392. {
  393. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  394. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  395. (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA))
  396. {
  397. // Get parameter 1 off the stack.
  398. bool param1Valid;
  399. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  400. if (!param1Valid)
  401. break;
  402. // Get parameter 2 off the stack.
  403. gameplay::ScriptUtil::LuaArray<float> param2 = gameplay::ScriptUtil::getFloatPointer(3);
  404. Effect* instance = getInstance(state);
  405. instance->setValue(param1, param2);
  406. return 0;
  407. }
  408. } while (0);
  409. do
  410. {
  411. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  412. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  413. lua_type(state, 3) == LUA_TNUMBER)
  414. {
  415. // Get parameter 1 off the stack.
  416. bool param1Valid;
  417. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  418. if (!param1Valid)
  419. break;
  420. // Get parameter 2 off the stack.
  421. int param2 = (int)luaL_checkint(state, 3);
  422. Effect* instance = getInstance(state);
  423. instance->setValue(param1, param2);
  424. return 0;
  425. }
  426. } while (0);
  427. do
  428. {
  429. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  430. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  431. (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA))
  432. {
  433. // Get parameter 1 off the stack.
  434. bool param1Valid;
  435. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  436. if (!param1Valid)
  437. break;
  438. // Get parameter 2 off the stack.
  439. gameplay::ScriptUtil::LuaArray<int> param2 = gameplay::ScriptUtil::getIntPointer(3);
  440. Effect* instance = getInstance(state);
  441. instance->setValue(param1, param2);
  442. return 0;
  443. }
  444. } while (0);
  445. do
  446. {
  447. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  448. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  449. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  450. {
  451. // Get parameter 1 off the stack.
  452. bool param1Valid;
  453. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  454. if (!param1Valid)
  455. break;
  456. // Get parameter 2 off the stack.
  457. bool param2Valid;
  458. gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", true, &param2Valid);
  459. if (!param2Valid)
  460. break;
  461. Effect* instance = getInstance(state);
  462. instance->setValue(param1, *param2);
  463. return 0;
  464. }
  465. } while (0);
  466. do
  467. {
  468. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  469. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  470. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  471. {
  472. // Get parameter 1 off the stack.
  473. bool param1Valid;
  474. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  475. if (!param1Valid)
  476. break;
  477. // Get parameter 2 off the stack.
  478. bool param2Valid;
  479. gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false, &param2Valid);
  480. if (!param2Valid)
  481. break;
  482. Effect* instance = getInstance(state);
  483. instance->setValue(param1, param2);
  484. return 0;
  485. }
  486. } while (0);
  487. do
  488. {
  489. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  490. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  491. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  492. {
  493. // Get parameter 1 off the stack.
  494. bool param1Valid;
  495. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  496. if (!param1Valid)
  497. break;
  498. // Get parameter 2 off the stack.
  499. bool param2Valid;
  500. gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", true, &param2Valid);
  501. if (!param2Valid)
  502. break;
  503. Effect* instance = getInstance(state);
  504. instance->setValue(param1, *param2);
  505. return 0;
  506. }
  507. } while (0);
  508. do
  509. {
  510. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  511. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  512. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  513. {
  514. // Get parameter 1 off the stack.
  515. bool param1Valid;
  516. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  517. if (!param1Valid)
  518. break;
  519. // Get parameter 2 off the stack.
  520. bool param2Valid;
  521. gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid);
  522. if (!param2Valid)
  523. break;
  524. Effect* instance = getInstance(state);
  525. instance->setValue(param1, param2);
  526. return 0;
  527. }
  528. } while (0);
  529. do
  530. {
  531. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  532. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  533. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  534. {
  535. // Get parameter 1 off the stack.
  536. bool param1Valid;
  537. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  538. if (!param1Valid)
  539. break;
  540. // Get parameter 2 off the stack.
  541. bool param2Valid;
  542. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
  543. if (!param2Valid)
  544. break;
  545. Effect* instance = getInstance(state);
  546. instance->setValue(param1, *param2);
  547. return 0;
  548. }
  549. } while (0);
  550. do
  551. {
  552. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  553. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  554. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  555. {
  556. // Get parameter 1 off the stack.
  557. bool param1Valid;
  558. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  559. if (!param1Valid)
  560. break;
  561. // Get parameter 2 off the stack.
  562. bool param2Valid;
  563. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid);
  564. if (!param2Valid)
  565. break;
  566. Effect* instance = getInstance(state);
  567. instance->setValue(param1, param2);
  568. return 0;
  569. }
  570. } while (0);
  571. do
  572. {
  573. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  574. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  575. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  576. {
  577. // Get parameter 1 off the stack.
  578. bool param1Valid;
  579. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  580. if (!param1Valid)
  581. break;
  582. // Get parameter 2 off the stack.
  583. bool param2Valid;
  584. gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", true, &param2Valid);
  585. if (!param2Valid)
  586. break;
  587. Effect* instance = getInstance(state);
  588. instance->setValue(param1, *param2);
  589. return 0;
  590. }
  591. } while (0);
  592. do
  593. {
  594. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  595. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  596. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  597. {
  598. // Get parameter 1 off the stack.
  599. bool param1Valid;
  600. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  601. if (!param1Valid)
  602. break;
  603. // Get parameter 2 off the stack.
  604. bool param2Valid;
  605. gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid);
  606. if (!param2Valid)
  607. break;
  608. Effect* instance = getInstance(state);
  609. instance->setValue(param1, param2);
  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_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  617. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  618. {
  619. // Get parameter 1 off the stack.
  620. bool param1Valid;
  621. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  622. if (!param1Valid)
  623. break;
  624. // Get parameter 2 off the stack.
  625. bool param2Valid;
  626. gameplay::ScriptUtil::LuaArray<Texture::Sampler> param2 = gameplay::ScriptUtil::getObjectPointer<Texture::Sampler>(3, "TextureSampler", false, &param2Valid);
  627. if (!param2Valid)
  628. break;
  629. Effect* instance = getInstance(state);
  630. instance->setValue(param1, param2);
  631. return 0;
  632. }
  633. } while (0);
  634. lua_pushstring(state, "lua_Effect_setValue - Failed to match the given parameters to a valid function signature.");
  635. lua_error(state);
  636. break;
  637. }
  638. case 4:
  639. {
  640. do
  641. {
  642. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  643. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  644. (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA) &&
  645. lua_type(state, 4) == LUA_TNUMBER)
  646. {
  647. // Get parameter 1 off the stack.
  648. bool param1Valid;
  649. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  650. if (!param1Valid)
  651. break;
  652. // Get parameter 2 off the stack.
  653. gameplay::ScriptUtil::LuaArray<float> param2 = gameplay::ScriptUtil::getFloatPointer(3);
  654. // Get parameter 3 off the stack.
  655. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  656. Effect* instance = getInstance(state);
  657. instance->setValue(param1, param2, param3);
  658. return 0;
  659. }
  660. } while (0);
  661. do
  662. {
  663. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  664. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  665. (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA) &&
  666. lua_type(state, 4) == LUA_TNUMBER)
  667. {
  668. // Get parameter 1 off the stack.
  669. bool param1Valid;
  670. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  671. if (!param1Valid)
  672. break;
  673. // Get parameter 2 off the stack.
  674. gameplay::ScriptUtil::LuaArray<int> param2 = gameplay::ScriptUtil::getIntPointer(3);
  675. // Get parameter 3 off the stack.
  676. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  677. Effect* instance = getInstance(state);
  678. instance->setValue(param1, param2, param3);
  679. return 0;
  680. }
  681. } while (0);
  682. do
  683. {
  684. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  685. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  686. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  687. lua_type(state, 4) == LUA_TNUMBER)
  688. {
  689. // Get parameter 1 off the stack.
  690. bool param1Valid;
  691. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  692. if (!param1Valid)
  693. break;
  694. // Get parameter 2 off the stack.
  695. bool param2Valid;
  696. gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false, &param2Valid);
  697. if (!param2Valid)
  698. break;
  699. // Get parameter 3 off the stack.
  700. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  701. Effect* instance = getInstance(state);
  702. instance->setValue(param1, param2, param3);
  703. return 0;
  704. }
  705. } while (0);
  706. do
  707. {
  708. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  709. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  710. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  711. lua_type(state, 4) == LUA_TNUMBER)
  712. {
  713. // Get parameter 1 off the stack.
  714. bool param1Valid;
  715. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  716. if (!param1Valid)
  717. break;
  718. // Get parameter 2 off the stack.
  719. bool param2Valid;
  720. gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid);
  721. if (!param2Valid)
  722. break;
  723. // Get parameter 3 off the stack.
  724. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  725. Effect* instance = getInstance(state);
  726. instance->setValue(param1, param2, param3);
  727. return 0;
  728. }
  729. } while (0);
  730. do
  731. {
  732. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  733. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  734. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  735. lua_type(state, 4) == LUA_TNUMBER)
  736. {
  737. // Get parameter 1 off the stack.
  738. bool param1Valid;
  739. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  740. if (!param1Valid)
  741. break;
  742. // Get parameter 2 off the stack.
  743. bool param2Valid;
  744. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid);
  745. if (!param2Valid)
  746. break;
  747. // Get parameter 3 off the stack.
  748. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  749. Effect* instance = getInstance(state);
  750. instance->setValue(param1, param2, param3);
  751. return 0;
  752. }
  753. } while (0);
  754. do
  755. {
  756. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  757. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  758. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  759. lua_type(state, 4) == LUA_TNUMBER)
  760. {
  761. // Get parameter 1 off the stack.
  762. bool param1Valid;
  763. gameplay::ScriptUtil::LuaArray<Uniform> param1 = gameplay::ScriptUtil::getObjectPointer<Uniform>(2, "Uniform", false, &param1Valid);
  764. if (!param1Valid)
  765. break;
  766. // Get parameter 2 off the stack.
  767. bool param2Valid;
  768. gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid);
  769. if (!param2Valid)
  770. break;
  771. // Get parameter 3 off the stack.
  772. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  773. Effect* instance = getInstance(state);
  774. instance->setValue(param1, param2, param3);
  775. return 0;
  776. }
  777. } while (0);
  778. lua_pushstring(state, "lua_Effect_setValue - Failed to match the given parameters to a valid function signature.");
  779. lua_error(state);
  780. break;
  781. }
  782. default:
  783. {
  784. lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
  785. lua_error(state);
  786. break;
  787. }
  788. }
  789. return 0;
  790. }
  791. int lua_Effect_static_createFromFile(lua_State* state)
  792. {
  793. // Get the number of parameters.
  794. int paramCount = lua_gettop(state);
  795. // Attempt to match the parameters to a valid binding.
  796. switch (paramCount)
  797. {
  798. case 2:
  799. {
  800. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  801. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  802. {
  803. // Get parameter 1 off the stack.
  804. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  805. // Get parameter 2 off the stack.
  806. const char* param2 = gameplay::ScriptUtil::getString(2, false);
  807. void* returnPtr = ((void*)Effect::createFromFile(param1, param2));
  808. if (returnPtr)
  809. {
  810. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  811. object->instance = returnPtr;
  812. object->owns = false;
  813. luaL_getmetatable(state, "Effect");
  814. lua_setmetatable(state, -2);
  815. }
  816. else
  817. {
  818. lua_pushnil(state);
  819. }
  820. return 1;
  821. }
  822. lua_pushstring(state, "lua_Effect_static_createFromFile - Failed to match the given parameters to a valid function signature.");
  823. lua_error(state);
  824. break;
  825. }
  826. case 3:
  827. {
  828. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  829. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  830. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  831. {
  832. // Get parameter 1 off the stack.
  833. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  834. // Get parameter 2 off the stack.
  835. const char* param2 = gameplay::ScriptUtil::getString(2, false);
  836. // Get parameter 3 off the stack.
  837. const char* param3 = gameplay::ScriptUtil::getString(3, false);
  838. void* returnPtr = ((void*)Effect::createFromFile(param1, param2, param3));
  839. if (returnPtr)
  840. {
  841. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  842. object->instance = returnPtr;
  843. object->owns = false;
  844. luaL_getmetatable(state, "Effect");
  845. lua_setmetatable(state, -2);
  846. }
  847. else
  848. {
  849. lua_pushnil(state);
  850. }
  851. return 1;
  852. }
  853. lua_pushstring(state, "lua_Effect_static_createFromFile - Failed to match the given parameters to a valid function signature.");
  854. lua_error(state);
  855. break;
  856. }
  857. default:
  858. {
  859. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  860. lua_error(state);
  861. break;
  862. }
  863. }
  864. return 0;
  865. }
  866. int lua_Effect_static_createFromSource(lua_State* state)
  867. {
  868. // Get the number of parameters.
  869. int paramCount = lua_gettop(state);
  870. // Attempt to match the parameters to a valid binding.
  871. switch (paramCount)
  872. {
  873. case 2:
  874. {
  875. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  876. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  877. {
  878. // Get parameter 1 off the stack.
  879. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  880. // Get parameter 2 off the stack.
  881. const char* param2 = gameplay::ScriptUtil::getString(2, false);
  882. void* returnPtr = ((void*)Effect::createFromSource(param1, param2));
  883. if (returnPtr)
  884. {
  885. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  886. object->instance = returnPtr;
  887. object->owns = false;
  888. luaL_getmetatable(state, "Effect");
  889. lua_setmetatable(state, -2);
  890. }
  891. else
  892. {
  893. lua_pushnil(state);
  894. }
  895. return 1;
  896. }
  897. lua_pushstring(state, "lua_Effect_static_createFromSource - Failed to match the given parameters to a valid function signature.");
  898. lua_error(state);
  899. break;
  900. }
  901. case 3:
  902. {
  903. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  904. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  905. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  906. {
  907. // Get parameter 1 off the stack.
  908. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  909. // Get parameter 2 off the stack.
  910. const char* param2 = gameplay::ScriptUtil::getString(2, false);
  911. // Get parameter 3 off the stack.
  912. const char* param3 = gameplay::ScriptUtil::getString(3, false);
  913. void* returnPtr = ((void*)Effect::createFromSource(param1, param2, param3));
  914. if (returnPtr)
  915. {
  916. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  917. object->instance = returnPtr;
  918. object->owns = false;
  919. luaL_getmetatable(state, "Effect");
  920. lua_setmetatable(state, -2);
  921. }
  922. else
  923. {
  924. lua_pushnil(state);
  925. }
  926. return 1;
  927. }
  928. lua_pushstring(state, "lua_Effect_static_createFromSource - Failed to match the given parameters to a valid function signature.");
  929. lua_error(state);
  930. break;
  931. }
  932. default:
  933. {
  934. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  935. lua_error(state);
  936. break;
  937. }
  938. }
  939. return 0;
  940. }
  941. int lua_Effect_static_getCurrentEffect(lua_State* state)
  942. {
  943. // Get the number of parameters.
  944. int paramCount = lua_gettop(state);
  945. // Attempt to match the parameters to a valid binding.
  946. switch (paramCount)
  947. {
  948. case 0:
  949. {
  950. void* returnPtr = ((void*)Effect::getCurrentEffect());
  951. if (returnPtr)
  952. {
  953. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  954. object->instance = returnPtr;
  955. object->owns = false;
  956. luaL_getmetatable(state, "Effect");
  957. lua_setmetatable(state, -2);
  958. }
  959. else
  960. {
  961. lua_pushnil(state);
  962. }
  963. return 1;
  964. break;
  965. }
  966. default:
  967. {
  968. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  969. lua_error(state);
  970. break;
  971. }
  972. }
  973. return 0;
  974. }
  975. }