Scene.cpp 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618
  1. // Copyright (C) 2014, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // WARNING: The file is auto generated.
  6. #include "anki/script/LuaBinder.h"
  7. #include "anki/script/ScriptManager.h"
  8. #include "anki/Scene.h"
  9. namespace anki {
  10. //==============================================================================
  11. template<typename T, typename... TArgs>
  12. static T* newSceneNode(SceneGraph* scene, CString name, TArgs... args)
  13. {
  14. T* ptr;
  15. Error err = scene->template newSceneNode<T>(
  16. name, ptr, args...);
  17. if(!err)
  18. {
  19. return ptr;
  20. }
  21. else
  22. {
  23. return nullptr;
  24. }
  25. }
  26. //==============================================================================
  27. static SceneGraph* getSceneGraph(lua_State* l)
  28. {
  29. LuaBinder* binder = reinterpret_cast<LuaBinder*>(lua_getuserdata(l));
  30. ScriptManager* scriptManager =
  31. reinterpret_cast<ScriptManager*>(binder->getParent());
  32. return &scriptManager->_getSceneGraph();
  33. }
  34. //==============================================================================
  35. // MoveComponent =
  36. //==============================================================================
  37. //==============================================================================
  38. static const char* classnameMoveComponent = "MoveComponent";
  39. template<>
  40. I64 LuaBinder::getWrappedTypeSignature<MoveComponent>()
  41. {
  42. return 2038493110845313445;
  43. }
  44. template<>
  45. const char* LuaBinder::getWrappedTypeName<MoveComponent>()
  46. {
  47. return classnameMoveComponent;
  48. }
  49. //==============================================================================
  50. /// Pre-wrap method MoveComponent::setLocalOrigin.
  51. static inline int pwrapMoveComponentsetLocalOrigin(lua_State* l)
  52. {
  53. UserData* ud;
  54. (void)ud;
  55. void* voidp;
  56. (void)voidp;
  57. LuaBinder::checkArgsCount(l, 2);
  58. // Get "this" as "self"
  59. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  60. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  61. ANKI_ASSERT(self != nullptr);
  62. // Pop arguments
  63. if(LuaBinder::checkUserData(l, 2, "Vec4", 6804478823655046386, ud)) return -1;
  64. Vec4* iarg0 = static_cast<Vec4*>(ud->m_data);
  65. const Vec4& arg0(*iarg0);
  66. // Call the method
  67. self->setLocalOrigin(arg0);
  68. return 0;
  69. }
  70. //==============================================================================
  71. /// Wrap method MoveComponent::setLocalOrigin.
  72. static int wrapMoveComponentsetLocalOrigin(lua_State* l)
  73. {
  74. int res = pwrapMoveComponentsetLocalOrigin(l);
  75. if(res >= 0) return res;
  76. lua_error(l);
  77. return 0;
  78. }
  79. //==============================================================================
  80. /// Pre-wrap method MoveComponent::getLocalOrigin.
  81. static inline int pwrapMoveComponentgetLocalOrigin(lua_State* l)
  82. {
  83. UserData* ud;
  84. (void)ud;
  85. void* voidp;
  86. (void)voidp;
  87. LuaBinder::checkArgsCount(l, 1);
  88. // Get "this" as "self"
  89. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  90. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  91. ANKI_ASSERT(self != nullptr);
  92. // Call the method
  93. const Vec4& ret = self->getLocalOrigin();
  94. // Push return value
  95. voidp = lua_newuserdata(l, sizeof(UserData));
  96. ud = static_cast<UserData*>(voidp);
  97. luaL_setmetatable(l, "Vec4");
  98. ud->m_data = const_cast<void*>(static_cast<const void*>(&ret));
  99. ud->m_gc = false;
  100. ud->m_sig = 6804478823655046386;
  101. return 1;
  102. }
  103. //==============================================================================
  104. /// Wrap method MoveComponent::getLocalOrigin.
  105. static int wrapMoveComponentgetLocalOrigin(lua_State* l)
  106. {
  107. int res = pwrapMoveComponentgetLocalOrigin(l);
  108. if(res >= 0) return res;
  109. lua_error(l);
  110. return 0;
  111. }
  112. //==============================================================================
  113. /// Pre-wrap method MoveComponent::setLocalRotation.
  114. static inline int pwrapMoveComponentsetLocalRotation(lua_State* l)
  115. {
  116. UserData* ud;
  117. (void)ud;
  118. void* voidp;
  119. (void)voidp;
  120. LuaBinder::checkArgsCount(l, 2);
  121. // Get "this" as "self"
  122. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  123. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  124. ANKI_ASSERT(self != nullptr);
  125. // Pop arguments
  126. if(LuaBinder::checkUserData(l, 2, "Mat3x4", -2654194732934255869, ud)) return -1;
  127. Mat3x4* iarg0 = static_cast<Mat3x4*>(ud->m_data);
  128. const Mat3x4& arg0(*iarg0);
  129. // Call the method
  130. self->setLocalRotation(arg0);
  131. return 0;
  132. }
  133. //==============================================================================
  134. /// Wrap method MoveComponent::setLocalRotation.
  135. static int wrapMoveComponentsetLocalRotation(lua_State* l)
  136. {
  137. int res = pwrapMoveComponentsetLocalRotation(l);
  138. if(res >= 0) return res;
  139. lua_error(l);
  140. return 0;
  141. }
  142. //==============================================================================
  143. /// Pre-wrap method MoveComponent::getLocalRotation.
  144. static inline int pwrapMoveComponentgetLocalRotation(lua_State* l)
  145. {
  146. UserData* ud;
  147. (void)ud;
  148. void* voidp;
  149. (void)voidp;
  150. LuaBinder::checkArgsCount(l, 1);
  151. // Get "this" as "self"
  152. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  153. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  154. ANKI_ASSERT(self != nullptr);
  155. // Call the method
  156. const Mat3x4& ret = self->getLocalRotation();
  157. // Push return value
  158. voidp = lua_newuserdata(l, sizeof(UserData));
  159. ud = static_cast<UserData*>(voidp);
  160. luaL_setmetatable(l, "Mat3x4");
  161. ud->m_data = const_cast<void*>(static_cast<const void*>(&ret));
  162. ud->m_gc = false;
  163. ud->m_sig = -2654194732934255869;
  164. return 1;
  165. }
  166. //==============================================================================
  167. /// Wrap method MoveComponent::getLocalRotation.
  168. static int wrapMoveComponentgetLocalRotation(lua_State* l)
  169. {
  170. int res = pwrapMoveComponentgetLocalRotation(l);
  171. if(res >= 0) return res;
  172. lua_error(l);
  173. return 0;
  174. }
  175. //==============================================================================
  176. /// Pre-wrap method MoveComponent::setLocalScale.
  177. static inline int pwrapMoveComponentsetLocalScale(lua_State* l)
  178. {
  179. UserData* ud;
  180. (void)ud;
  181. void* voidp;
  182. (void)voidp;
  183. LuaBinder::checkArgsCount(l, 2);
  184. // Get "this" as "self"
  185. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  186. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  187. ANKI_ASSERT(self != nullptr);
  188. // Pop arguments
  189. F32 arg0;
  190. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  191. // Call the method
  192. self->setLocalScale(arg0);
  193. return 0;
  194. }
  195. //==============================================================================
  196. /// Wrap method MoveComponent::setLocalScale.
  197. static int wrapMoveComponentsetLocalScale(lua_State* l)
  198. {
  199. int res = pwrapMoveComponentsetLocalScale(l);
  200. if(res >= 0) return res;
  201. lua_error(l);
  202. return 0;
  203. }
  204. //==============================================================================
  205. /// Pre-wrap method MoveComponent::getLocalScale.
  206. static inline int pwrapMoveComponentgetLocalScale(lua_State* l)
  207. {
  208. UserData* ud;
  209. (void)ud;
  210. void* voidp;
  211. (void)voidp;
  212. LuaBinder::checkArgsCount(l, 1);
  213. // Get "this" as "self"
  214. if(LuaBinder::checkUserData(l, 1, classnameMoveComponent, 2038493110845313445, ud)) return -1;
  215. MoveComponent* self = static_cast<MoveComponent*>(ud->m_data);
  216. ANKI_ASSERT(self != nullptr);
  217. // Call the method
  218. F32 ret = self->getLocalScale();
  219. // Push return value
  220. lua_pushnumber(l, ret);
  221. return 1;
  222. }
  223. //==============================================================================
  224. /// Wrap method MoveComponent::getLocalScale.
  225. static int wrapMoveComponentgetLocalScale(lua_State* l)
  226. {
  227. int res = pwrapMoveComponentgetLocalScale(l);
  228. if(res >= 0) return res;
  229. lua_error(l);
  230. return 0;
  231. }
  232. //==============================================================================
  233. /// Wrap class MoveComponent.
  234. static inline void wrapMoveComponent(lua_State* l)
  235. {
  236. LuaBinder::createClass(l, classnameMoveComponent);
  237. LuaBinder::pushLuaCFuncMethod(l, "setLocalOrigin", wrapMoveComponentsetLocalOrigin);
  238. LuaBinder::pushLuaCFuncMethod(l, "getLocalOrigin", wrapMoveComponentgetLocalOrigin);
  239. LuaBinder::pushLuaCFuncMethod(l, "setLocalRotation", wrapMoveComponentsetLocalRotation);
  240. LuaBinder::pushLuaCFuncMethod(l, "getLocalRotation", wrapMoveComponentgetLocalRotation);
  241. LuaBinder::pushLuaCFuncMethod(l, "setLocalScale", wrapMoveComponentsetLocalScale);
  242. LuaBinder::pushLuaCFuncMethod(l, "getLocalScale", wrapMoveComponentgetLocalScale);
  243. lua_settop(l, 0);
  244. }
  245. //==============================================================================
  246. // LightComponent =
  247. //==============================================================================
  248. //==============================================================================
  249. static const char* classnameLightComponent = "LightComponent";
  250. template<>
  251. I64 LuaBinder::getWrappedTypeSignature<LightComponent>()
  252. {
  253. return 7940823622056993903;
  254. }
  255. template<>
  256. const char* LuaBinder::getWrappedTypeName<LightComponent>()
  257. {
  258. return classnameLightComponent;
  259. }
  260. //==============================================================================
  261. /// Pre-wrap method LightComponent::setDiffuseColor.
  262. static inline int pwrapLightComponentsetDiffuseColor(lua_State* l)
  263. {
  264. UserData* ud;
  265. (void)ud;
  266. void* voidp;
  267. (void)voidp;
  268. LuaBinder::checkArgsCount(l, 2);
  269. // Get "this" as "self"
  270. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  271. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  272. ANKI_ASSERT(self != nullptr);
  273. // Pop arguments
  274. if(LuaBinder::checkUserData(l, 2, "Vec4", 6804478823655046386, ud)) return -1;
  275. Vec4* iarg0 = static_cast<Vec4*>(ud->m_data);
  276. const Vec4& arg0(*iarg0);
  277. // Call the method
  278. self->setDiffuseColor(arg0);
  279. return 0;
  280. }
  281. //==============================================================================
  282. /// Wrap method LightComponent::setDiffuseColor.
  283. static int wrapLightComponentsetDiffuseColor(lua_State* l)
  284. {
  285. int res = pwrapLightComponentsetDiffuseColor(l);
  286. if(res >= 0) return res;
  287. lua_error(l);
  288. return 0;
  289. }
  290. //==============================================================================
  291. /// Pre-wrap method LightComponent::getDiffuseColor.
  292. static inline int pwrapLightComponentgetDiffuseColor(lua_State* l)
  293. {
  294. UserData* ud;
  295. (void)ud;
  296. void* voidp;
  297. (void)voidp;
  298. LuaBinder::checkArgsCount(l, 1);
  299. // Get "this" as "self"
  300. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  301. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  302. ANKI_ASSERT(self != nullptr);
  303. // Call the method
  304. const Vec4& ret = self->getDiffuseColor();
  305. // Push return value
  306. voidp = lua_newuserdata(l, sizeof(UserData));
  307. ud = static_cast<UserData*>(voidp);
  308. luaL_setmetatable(l, "Vec4");
  309. ud->m_data = const_cast<void*>(static_cast<const void*>(&ret));
  310. ud->m_gc = false;
  311. ud->m_sig = 6804478823655046386;
  312. return 1;
  313. }
  314. //==============================================================================
  315. /// Wrap method LightComponent::getDiffuseColor.
  316. static int wrapLightComponentgetDiffuseColor(lua_State* l)
  317. {
  318. int res = pwrapLightComponentgetDiffuseColor(l);
  319. if(res >= 0) return res;
  320. lua_error(l);
  321. return 0;
  322. }
  323. //==============================================================================
  324. /// Pre-wrap method LightComponent::setSpecularColor.
  325. static inline int pwrapLightComponentsetSpecularColor(lua_State* l)
  326. {
  327. UserData* ud;
  328. (void)ud;
  329. void* voidp;
  330. (void)voidp;
  331. LuaBinder::checkArgsCount(l, 2);
  332. // Get "this" as "self"
  333. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  334. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  335. ANKI_ASSERT(self != nullptr);
  336. // Pop arguments
  337. if(LuaBinder::checkUserData(l, 2, "Vec4", 6804478823655046386, ud)) return -1;
  338. Vec4* iarg0 = static_cast<Vec4*>(ud->m_data);
  339. const Vec4& arg0(*iarg0);
  340. // Call the method
  341. self->setSpecularColor(arg0);
  342. return 0;
  343. }
  344. //==============================================================================
  345. /// Wrap method LightComponent::setSpecularColor.
  346. static int wrapLightComponentsetSpecularColor(lua_State* l)
  347. {
  348. int res = pwrapLightComponentsetSpecularColor(l);
  349. if(res >= 0) return res;
  350. lua_error(l);
  351. return 0;
  352. }
  353. //==============================================================================
  354. /// Pre-wrap method LightComponent::getSpecularColor.
  355. static inline int pwrapLightComponentgetSpecularColor(lua_State* l)
  356. {
  357. UserData* ud;
  358. (void)ud;
  359. void* voidp;
  360. (void)voidp;
  361. LuaBinder::checkArgsCount(l, 1);
  362. // Get "this" as "self"
  363. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  364. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  365. ANKI_ASSERT(self != nullptr);
  366. // Call the method
  367. const Vec4& ret = self->getSpecularColor();
  368. // Push return value
  369. voidp = lua_newuserdata(l, sizeof(UserData));
  370. ud = static_cast<UserData*>(voidp);
  371. luaL_setmetatable(l, "Vec4");
  372. ud->m_data = const_cast<void*>(static_cast<const void*>(&ret));
  373. ud->m_gc = false;
  374. ud->m_sig = 6804478823655046386;
  375. return 1;
  376. }
  377. //==============================================================================
  378. /// Wrap method LightComponent::getSpecularColor.
  379. static int wrapLightComponentgetSpecularColor(lua_State* l)
  380. {
  381. int res = pwrapLightComponentgetSpecularColor(l);
  382. if(res >= 0) return res;
  383. lua_error(l);
  384. return 0;
  385. }
  386. //==============================================================================
  387. /// Pre-wrap method LightComponent::setRadius.
  388. static inline int pwrapLightComponentsetRadius(lua_State* l)
  389. {
  390. UserData* ud;
  391. (void)ud;
  392. void* voidp;
  393. (void)voidp;
  394. LuaBinder::checkArgsCount(l, 2);
  395. // Get "this" as "self"
  396. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  397. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  398. ANKI_ASSERT(self != nullptr);
  399. // Pop arguments
  400. F32 arg0;
  401. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  402. // Call the method
  403. self->setRadius(arg0);
  404. return 0;
  405. }
  406. //==============================================================================
  407. /// Wrap method LightComponent::setRadius.
  408. static int wrapLightComponentsetRadius(lua_State* l)
  409. {
  410. int res = pwrapLightComponentsetRadius(l);
  411. if(res >= 0) return res;
  412. lua_error(l);
  413. return 0;
  414. }
  415. //==============================================================================
  416. /// Pre-wrap method LightComponent::getRadius.
  417. static inline int pwrapLightComponentgetRadius(lua_State* l)
  418. {
  419. UserData* ud;
  420. (void)ud;
  421. void* voidp;
  422. (void)voidp;
  423. LuaBinder::checkArgsCount(l, 1);
  424. // Get "this" as "self"
  425. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  426. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  427. ANKI_ASSERT(self != nullptr);
  428. // Call the method
  429. F32 ret = self->getRadius();
  430. // Push return value
  431. lua_pushnumber(l, ret);
  432. return 1;
  433. }
  434. //==============================================================================
  435. /// Wrap method LightComponent::getRadius.
  436. static int wrapLightComponentgetRadius(lua_State* l)
  437. {
  438. int res = pwrapLightComponentgetRadius(l);
  439. if(res >= 0) return res;
  440. lua_error(l);
  441. return 0;
  442. }
  443. //==============================================================================
  444. /// Pre-wrap method LightComponent::setDistance.
  445. static inline int pwrapLightComponentsetDistance(lua_State* l)
  446. {
  447. UserData* ud;
  448. (void)ud;
  449. void* voidp;
  450. (void)voidp;
  451. LuaBinder::checkArgsCount(l, 2);
  452. // Get "this" as "self"
  453. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  454. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  455. ANKI_ASSERT(self != nullptr);
  456. // Pop arguments
  457. F32 arg0;
  458. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  459. // Call the method
  460. self->setDistance(arg0);
  461. return 0;
  462. }
  463. //==============================================================================
  464. /// Wrap method LightComponent::setDistance.
  465. static int wrapLightComponentsetDistance(lua_State* l)
  466. {
  467. int res = pwrapLightComponentsetDistance(l);
  468. if(res >= 0) return res;
  469. lua_error(l);
  470. return 0;
  471. }
  472. //==============================================================================
  473. /// Pre-wrap method LightComponent::getDistance.
  474. static inline int pwrapLightComponentgetDistance(lua_State* l)
  475. {
  476. UserData* ud;
  477. (void)ud;
  478. void* voidp;
  479. (void)voidp;
  480. LuaBinder::checkArgsCount(l, 1);
  481. // Get "this" as "self"
  482. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  483. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  484. ANKI_ASSERT(self != nullptr);
  485. // Call the method
  486. F32 ret = self->getDistance();
  487. // Push return value
  488. lua_pushnumber(l, ret);
  489. return 1;
  490. }
  491. //==============================================================================
  492. /// Wrap method LightComponent::getDistance.
  493. static int wrapLightComponentgetDistance(lua_State* l)
  494. {
  495. int res = pwrapLightComponentgetDistance(l);
  496. if(res >= 0) return res;
  497. lua_error(l);
  498. return 0;
  499. }
  500. //==============================================================================
  501. /// Pre-wrap method LightComponent::setInnerAngle.
  502. static inline int pwrapLightComponentsetInnerAngle(lua_State* l)
  503. {
  504. UserData* ud;
  505. (void)ud;
  506. void* voidp;
  507. (void)voidp;
  508. LuaBinder::checkArgsCount(l, 2);
  509. // Get "this" as "self"
  510. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  511. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  512. ANKI_ASSERT(self != nullptr);
  513. // Pop arguments
  514. F32 arg0;
  515. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  516. // Call the method
  517. self->setInnerAngle(arg0);
  518. return 0;
  519. }
  520. //==============================================================================
  521. /// Wrap method LightComponent::setInnerAngle.
  522. static int wrapLightComponentsetInnerAngle(lua_State* l)
  523. {
  524. int res = pwrapLightComponentsetInnerAngle(l);
  525. if(res >= 0) return res;
  526. lua_error(l);
  527. return 0;
  528. }
  529. //==============================================================================
  530. /// Pre-wrap method LightComponent::getInnerAngle.
  531. static inline int pwrapLightComponentgetInnerAngle(lua_State* l)
  532. {
  533. UserData* ud;
  534. (void)ud;
  535. void* voidp;
  536. (void)voidp;
  537. LuaBinder::checkArgsCount(l, 1);
  538. // Get "this" as "self"
  539. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  540. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  541. ANKI_ASSERT(self != nullptr);
  542. // Call the method
  543. F32 ret = self->getInnerAngle();
  544. // Push return value
  545. lua_pushnumber(l, ret);
  546. return 1;
  547. }
  548. //==============================================================================
  549. /// Wrap method LightComponent::getInnerAngle.
  550. static int wrapLightComponentgetInnerAngle(lua_State* l)
  551. {
  552. int res = pwrapLightComponentgetInnerAngle(l);
  553. if(res >= 0) return res;
  554. lua_error(l);
  555. return 0;
  556. }
  557. //==============================================================================
  558. /// Pre-wrap method LightComponent::setOuterAngle.
  559. static inline int pwrapLightComponentsetOuterAngle(lua_State* l)
  560. {
  561. UserData* ud;
  562. (void)ud;
  563. void* voidp;
  564. (void)voidp;
  565. LuaBinder::checkArgsCount(l, 2);
  566. // Get "this" as "self"
  567. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  568. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  569. ANKI_ASSERT(self != nullptr);
  570. // Pop arguments
  571. F32 arg0;
  572. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  573. // Call the method
  574. self->setOuterAngle(arg0);
  575. return 0;
  576. }
  577. //==============================================================================
  578. /// Wrap method LightComponent::setOuterAngle.
  579. static int wrapLightComponentsetOuterAngle(lua_State* l)
  580. {
  581. int res = pwrapLightComponentsetOuterAngle(l);
  582. if(res >= 0) return res;
  583. lua_error(l);
  584. return 0;
  585. }
  586. //==============================================================================
  587. /// Pre-wrap method LightComponent::getOuterAngle.
  588. static inline int pwrapLightComponentgetOuterAngle(lua_State* l)
  589. {
  590. UserData* ud;
  591. (void)ud;
  592. void* voidp;
  593. (void)voidp;
  594. LuaBinder::checkArgsCount(l, 1);
  595. // Get "this" as "self"
  596. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  597. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  598. ANKI_ASSERT(self != nullptr);
  599. // Call the method
  600. F32 ret = self->getOuterAngle();
  601. // Push return value
  602. lua_pushnumber(l, ret);
  603. return 1;
  604. }
  605. //==============================================================================
  606. /// Wrap method LightComponent::getOuterAngle.
  607. static int wrapLightComponentgetOuterAngle(lua_State* l)
  608. {
  609. int res = pwrapLightComponentgetOuterAngle(l);
  610. if(res >= 0) return res;
  611. lua_error(l);
  612. return 0;
  613. }
  614. //==============================================================================
  615. /// Pre-wrap method LightComponent::setShadowEnabled.
  616. static inline int pwrapLightComponentsetShadowEnabled(lua_State* l)
  617. {
  618. UserData* ud;
  619. (void)ud;
  620. void* voidp;
  621. (void)voidp;
  622. LuaBinder::checkArgsCount(l, 2);
  623. // Get "this" as "self"
  624. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  625. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  626. ANKI_ASSERT(self != nullptr);
  627. // Pop arguments
  628. Bool arg0;
  629. if(LuaBinder::checkNumber(l, 2, arg0)) return -1;
  630. // Call the method
  631. self->setShadowEnabled(arg0);
  632. return 0;
  633. }
  634. //==============================================================================
  635. /// Wrap method LightComponent::setShadowEnabled.
  636. static int wrapLightComponentsetShadowEnabled(lua_State* l)
  637. {
  638. int res = pwrapLightComponentsetShadowEnabled(l);
  639. if(res >= 0) return res;
  640. lua_error(l);
  641. return 0;
  642. }
  643. //==============================================================================
  644. /// Pre-wrap method LightComponent::getShadowEnabled.
  645. static inline int pwrapLightComponentgetShadowEnabled(lua_State* l)
  646. {
  647. UserData* ud;
  648. (void)ud;
  649. void* voidp;
  650. (void)voidp;
  651. LuaBinder::checkArgsCount(l, 1);
  652. // Get "this" as "self"
  653. if(LuaBinder::checkUserData(l, 1, classnameLightComponent, 7940823622056993903, ud)) return -1;
  654. LightComponent* self = static_cast<LightComponent*>(ud->m_data);
  655. ANKI_ASSERT(self != nullptr);
  656. // Call the method
  657. Bool ret = self->getShadowEnabled();
  658. // Push return value
  659. lua_pushboolean(l, ret);
  660. return 1;
  661. }
  662. //==============================================================================
  663. /// Wrap method LightComponent::getShadowEnabled.
  664. static int wrapLightComponentgetShadowEnabled(lua_State* l)
  665. {
  666. int res = pwrapLightComponentgetShadowEnabled(l);
  667. if(res >= 0) return res;
  668. lua_error(l);
  669. return 0;
  670. }
  671. //==============================================================================
  672. /// Wrap class LightComponent.
  673. static inline void wrapLightComponent(lua_State* l)
  674. {
  675. LuaBinder::createClass(l, classnameLightComponent);
  676. LuaBinder::pushLuaCFuncMethod(l, "setDiffuseColor", wrapLightComponentsetDiffuseColor);
  677. LuaBinder::pushLuaCFuncMethod(l, "getDiffuseColor", wrapLightComponentgetDiffuseColor);
  678. LuaBinder::pushLuaCFuncMethod(l, "setSpecularColor", wrapLightComponentsetSpecularColor);
  679. LuaBinder::pushLuaCFuncMethod(l, "getSpecularColor", wrapLightComponentgetSpecularColor);
  680. LuaBinder::pushLuaCFuncMethod(l, "setRadius", wrapLightComponentsetRadius);
  681. LuaBinder::pushLuaCFuncMethod(l, "getRadius", wrapLightComponentgetRadius);
  682. LuaBinder::pushLuaCFuncMethod(l, "setDistance", wrapLightComponentsetDistance);
  683. LuaBinder::pushLuaCFuncMethod(l, "getDistance", wrapLightComponentgetDistance);
  684. LuaBinder::pushLuaCFuncMethod(l, "setInnerAngle", wrapLightComponentsetInnerAngle);
  685. LuaBinder::pushLuaCFuncMethod(l, "getInnerAngle", wrapLightComponentgetInnerAngle);
  686. LuaBinder::pushLuaCFuncMethod(l, "setOuterAngle", wrapLightComponentsetOuterAngle);
  687. LuaBinder::pushLuaCFuncMethod(l, "getOuterAngle", wrapLightComponentgetOuterAngle);
  688. LuaBinder::pushLuaCFuncMethod(l, "setShadowEnabled", wrapLightComponentsetShadowEnabled);
  689. LuaBinder::pushLuaCFuncMethod(l, "getShadowEnabled", wrapLightComponentgetShadowEnabled);
  690. lua_settop(l, 0);
  691. }
  692. //==============================================================================
  693. // SceneNode =
  694. //==============================================================================
  695. //==============================================================================
  696. static const char* classnameSceneNode = "SceneNode";
  697. template<>
  698. I64 LuaBinder::getWrappedTypeSignature<SceneNode>()
  699. {
  700. return -2220074417980276571;
  701. }
  702. template<>
  703. const char* LuaBinder::getWrappedTypeName<SceneNode>()
  704. {
  705. return classnameSceneNode;
  706. }
  707. //==============================================================================
  708. /// Pre-wrap method SceneNode::getName.
  709. static inline int pwrapSceneNodegetName(lua_State* l)
  710. {
  711. UserData* ud;
  712. (void)ud;
  713. void* voidp;
  714. (void)voidp;
  715. LuaBinder::checkArgsCount(l, 1);
  716. // Get "this" as "self"
  717. if(LuaBinder::checkUserData(l, 1, classnameSceneNode, -2220074417980276571, ud)) return -1;
  718. SceneNode* self = static_cast<SceneNode*>(ud->m_data);
  719. ANKI_ASSERT(self != nullptr);
  720. // Call the method
  721. CString ret = self->getName();
  722. // Push return value
  723. lua_pushstring(l, &ret[0]);
  724. return 1;
  725. }
  726. //==============================================================================
  727. /// Wrap method SceneNode::getName.
  728. static int wrapSceneNodegetName(lua_State* l)
  729. {
  730. int res = pwrapSceneNodegetName(l);
  731. if(res >= 0) return res;
  732. lua_error(l);
  733. return 0;
  734. }
  735. //==============================================================================
  736. /// Pre-wrap method SceneNode::addChild.
  737. static inline int pwrapSceneNodeaddChild(lua_State* l)
  738. {
  739. UserData* ud;
  740. (void)ud;
  741. void* voidp;
  742. (void)voidp;
  743. LuaBinder::checkArgsCount(l, 2);
  744. // Get "this" as "self"
  745. if(LuaBinder::checkUserData(l, 1, classnameSceneNode, -2220074417980276571, ud)) return -1;
  746. SceneNode* self = static_cast<SceneNode*>(ud->m_data);
  747. ANKI_ASSERT(self != nullptr);
  748. // Pop arguments
  749. if(LuaBinder::checkUserData(l, 2, "SceneNode", -2220074417980276571, ud)) return -1;
  750. SceneNode* iarg0 = static_cast<SceneNode*>(ud->m_data);
  751. SceneNode* arg0(iarg0);
  752. // Call the method
  753. Error ret = self->addChild(arg0);
  754. // Push return value
  755. if(ANKI_UNLIKELY(ret))
  756. {
  757. lua_pushstring(l, "Glue code returned an error");
  758. return -1;
  759. }
  760. lua_pushnumber(l, ret);
  761. return 1;
  762. }
  763. //==============================================================================
  764. /// Wrap method SceneNode::addChild.
  765. static int wrapSceneNodeaddChild(lua_State* l)
  766. {
  767. int res = pwrapSceneNodeaddChild(l);
  768. if(res >= 0) return res;
  769. lua_error(l);
  770. return 0;
  771. }
  772. //==============================================================================
  773. /// Pre-wrap method SceneNode::tryGetComponent<MoveComponent>.
  774. static inline int pwrapSceneNodegetMoveComponent(lua_State* l)
  775. {
  776. UserData* ud;
  777. (void)ud;
  778. void* voidp;
  779. (void)voidp;
  780. LuaBinder::checkArgsCount(l, 1);
  781. // Get "this" as "self"
  782. if(LuaBinder::checkUserData(l, 1, classnameSceneNode, -2220074417980276571, ud)) return -1;
  783. SceneNode* self = static_cast<SceneNode*>(ud->m_data);
  784. ANKI_ASSERT(self != nullptr);
  785. // Call the method
  786. MoveComponent* ret = self->tryGetComponent<MoveComponent>();
  787. // Push return value
  788. if(ANKI_UNLIKELY(ret == nullptr))
  789. {
  790. lua_pushstring(l, "Glue code returned nullptr");
  791. return -1;
  792. }
  793. voidp = lua_newuserdata(l, sizeof(UserData));
  794. ud = static_cast<UserData*>(voidp);
  795. luaL_setmetatable(l, "MoveComponent");
  796. ud->m_data = static_cast<void*>(ret);
  797. ud->m_gc = false;
  798. ud->m_sig = 2038493110845313445;
  799. return 1;
  800. }
  801. //==============================================================================
  802. /// Wrap method SceneNode::tryGetComponent<MoveComponent>.
  803. static int wrapSceneNodegetMoveComponent(lua_State* l)
  804. {
  805. int res = pwrapSceneNodegetMoveComponent(l);
  806. if(res >= 0) return res;
  807. lua_error(l);
  808. return 0;
  809. }
  810. //==============================================================================
  811. /// Pre-wrap method SceneNode::tryGetComponent<LightComponent>.
  812. static inline int pwrapSceneNodegetLightComponent(lua_State* l)
  813. {
  814. UserData* ud;
  815. (void)ud;
  816. void* voidp;
  817. (void)voidp;
  818. LuaBinder::checkArgsCount(l, 1);
  819. // Get "this" as "self"
  820. if(LuaBinder::checkUserData(l, 1, classnameSceneNode, -2220074417980276571, ud)) return -1;
  821. SceneNode* self = static_cast<SceneNode*>(ud->m_data);
  822. ANKI_ASSERT(self != nullptr);
  823. // Call the method
  824. LightComponent* ret = self->tryGetComponent<LightComponent>();
  825. // Push return value
  826. if(ANKI_UNLIKELY(ret == nullptr))
  827. {
  828. lua_pushstring(l, "Glue code returned nullptr");
  829. return -1;
  830. }
  831. voidp = lua_newuserdata(l, sizeof(UserData));
  832. ud = static_cast<UserData*>(voidp);
  833. luaL_setmetatable(l, "LightComponent");
  834. ud->m_data = static_cast<void*>(ret);
  835. ud->m_gc = false;
  836. ud->m_sig = 7940823622056993903;
  837. return 1;
  838. }
  839. //==============================================================================
  840. /// Wrap method SceneNode::tryGetComponent<LightComponent>.
  841. static int wrapSceneNodegetLightComponent(lua_State* l)
  842. {
  843. int res = pwrapSceneNodegetLightComponent(l);
  844. if(res >= 0) return res;
  845. lua_error(l);
  846. return 0;
  847. }
  848. //==============================================================================
  849. /// Wrap class SceneNode.
  850. static inline void wrapSceneNode(lua_State* l)
  851. {
  852. LuaBinder::createClass(l, classnameSceneNode);
  853. LuaBinder::pushLuaCFuncMethod(l, "getName", wrapSceneNodegetName);
  854. LuaBinder::pushLuaCFuncMethod(l, "addChild", wrapSceneNodeaddChild);
  855. LuaBinder::pushLuaCFuncMethod(l, "getMoveComponent", wrapSceneNodegetMoveComponent);
  856. LuaBinder::pushLuaCFuncMethod(l, "getLightComponent", wrapSceneNodegetLightComponent);
  857. lua_settop(l, 0);
  858. }
  859. //==============================================================================
  860. // ModelNode =
  861. //==============================================================================
  862. //==============================================================================
  863. static const char* classnameModelNode = "ModelNode";
  864. template<>
  865. I64 LuaBinder::getWrappedTypeSignature<ModelNode>()
  866. {
  867. return -1856316251880904290;
  868. }
  869. template<>
  870. const char* LuaBinder::getWrappedTypeName<ModelNode>()
  871. {
  872. return classnameModelNode;
  873. }
  874. //==============================================================================
  875. /// Pre-wrap method ModelNode::getSceneNodeBase.
  876. static inline int pwrapModelNodegetSceneNodeBase(lua_State* l)
  877. {
  878. UserData* ud;
  879. (void)ud;
  880. void* voidp;
  881. (void)voidp;
  882. LuaBinder::checkArgsCount(l, 1);
  883. // Get "this" as "self"
  884. if(LuaBinder::checkUserData(l, 1, classnameModelNode, -1856316251880904290, ud)) return -1;
  885. ModelNode* self = static_cast<ModelNode*>(ud->m_data);
  886. ANKI_ASSERT(self != nullptr);
  887. // Call the method
  888. SceneNode& ret = *self;
  889. // Push return value
  890. voidp = lua_newuserdata(l, sizeof(UserData));
  891. ud = static_cast<UserData*>(voidp);
  892. luaL_setmetatable(l, "SceneNode");
  893. ud->m_data = static_cast<void*>(&ret);
  894. ud->m_gc = false;
  895. ud->m_sig = -2220074417980276571;
  896. return 1;
  897. }
  898. //==============================================================================
  899. /// Wrap method ModelNode::getSceneNodeBase.
  900. static int wrapModelNodegetSceneNodeBase(lua_State* l)
  901. {
  902. int res = pwrapModelNodegetSceneNodeBase(l);
  903. if(res >= 0) return res;
  904. lua_error(l);
  905. return 0;
  906. }
  907. //==============================================================================
  908. /// Wrap class ModelNode.
  909. static inline void wrapModelNode(lua_State* l)
  910. {
  911. LuaBinder::createClass(l, classnameModelNode);
  912. LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapModelNodegetSceneNodeBase);
  913. lua_settop(l, 0);
  914. }
  915. //==============================================================================
  916. // InstanceNode =
  917. //==============================================================================
  918. //==============================================================================
  919. static const char* classnameInstanceNode = "InstanceNode";
  920. template<>
  921. I64 LuaBinder::getWrappedTypeSignature<InstanceNode>()
  922. {
  923. return -2063375830923741403;
  924. }
  925. template<>
  926. const char* LuaBinder::getWrappedTypeName<InstanceNode>()
  927. {
  928. return classnameInstanceNode;
  929. }
  930. //==============================================================================
  931. /// Pre-wrap method InstanceNode::getSceneNodeBase.
  932. static inline int pwrapInstanceNodegetSceneNodeBase(lua_State* l)
  933. {
  934. UserData* ud;
  935. (void)ud;
  936. void* voidp;
  937. (void)voidp;
  938. LuaBinder::checkArgsCount(l, 1);
  939. // Get "this" as "self"
  940. if(LuaBinder::checkUserData(l, 1, classnameInstanceNode, -2063375830923741403, ud)) return -1;
  941. InstanceNode* self = static_cast<InstanceNode*>(ud->m_data);
  942. ANKI_ASSERT(self != nullptr);
  943. // Call the method
  944. SceneNode& ret = *self;
  945. // Push return value
  946. voidp = lua_newuserdata(l, sizeof(UserData));
  947. ud = static_cast<UserData*>(voidp);
  948. luaL_setmetatable(l, "SceneNode");
  949. ud->m_data = static_cast<void*>(&ret);
  950. ud->m_gc = false;
  951. ud->m_sig = -2220074417980276571;
  952. return 1;
  953. }
  954. //==============================================================================
  955. /// Wrap method InstanceNode::getSceneNodeBase.
  956. static int wrapInstanceNodegetSceneNodeBase(lua_State* l)
  957. {
  958. int res = pwrapInstanceNodegetSceneNodeBase(l);
  959. if(res >= 0) return res;
  960. lua_error(l);
  961. return 0;
  962. }
  963. //==============================================================================
  964. /// Wrap class InstanceNode.
  965. static inline void wrapInstanceNode(lua_State* l)
  966. {
  967. LuaBinder::createClass(l, classnameInstanceNode);
  968. LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapInstanceNodegetSceneNodeBase);
  969. lua_settop(l, 0);
  970. }
  971. //==============================================================================
  972. // PointLight =
  973. //==============================================================================
  974. //==============================================================================
  975. static const char* classnamePointLight = "PointLight";
  976. template<>
  977. I64 LuaBinder::getWrappedTypeSignature<PointLight>()
  978. {
  979. return 3561037663389896020;
  980. }
  981. template<>
  982. const char* LuaBinder::getWrappedTypeName<PointLight>()
  983. {
  984. return classnamePointLight;
  985. }
  986. //==============================================================================
  987. /// Pre-wrap method PointLight::getSceneNodeBase.
  988. static inline int pwrapPointLightgetSceneNodeBase(lua_State* l)
  989. {
  990. UserData* ud;
  991. (void)ud;
  992. void* voidp;
  993. (void)voidp;
  994. LuaBinder::checkArgsCount(l, 1);
  995. // Get "this" as "self"
  996. if(LuaBinder::checkUserData(l, 1, classnamePointLight, 3561037663389896020, ud)) return -1;
  997. PointLight* self = static_cast<PointLight*>(ud->m_data);
  998. ANKI_ASSERT(self != nullptr);
  999. // Call the method
  1000. SceneNode& ret = *self;
  1001. // Push return value
  1002. voidp = lua_newuserdata(l, sizeof(UserData));
  1003. ud = static_cast<UserData*>(voidp);
  1004. luaL_setmetatable(l, "SceneNode");
  1005. ud->m_data = static_cast<void*>(&ret);
  1006. ud->m_gc = false;
  1007. ud->m_sig = -2220074417980276571;
  1008. return 1;
  1009. }
  1010. //==============================================================================
  1011. /// Wrap method PointLight::getSceneNodeBase.
  1012. static int wrapPointLightgetSceneNodeBase(lua_State* l)
  1013. {
  1014. int res = pwrapPointLightgetSceneNodeBase(l);
  1015. if(res >= 0) return res;
  1016. lua_error(l);
  1017. return 0;
  1018. }
  1019. //==============================================================================
  1020. /// Wrap class PointLight.
  1021. static inline void wrapPointLight(lua_State* l)
  1022. {
  1023. LuaBinder::createClass(l, classnamePointLight);
  1024. LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapPointLightgetSceneNodeBase);
  1025. lua_settop(l, 0);
  1026. }
  1027. //==============================================================================
  1028. // SpotLight =
  1029. //==============================================================================
  1030. //==============================================================================
  1031. static const char* classnameSpotLight = "SpotLight";
  1032. template<>
  1033. I64 LuaBinder::getWrappedTypeSignature<SpotLight>()
  1034. {
  1035. return 7940385212889719421;
  1036. }
  1037. template<>
  1038. const char* LuaBinder::getWrappedTypeName<SpotLight>()
  1039. {
  1040. return classnameSpotLight;
  1041. }
  1042. //==============================================================================
  1043. /// Pre-wrap method SpotLight::getSceneNodeBase.
  1044. static inline int pwrapSpotLightgetSceneNodeBase(lua_State* l)
  1045. {
  1046. UserData* ud;
  1047. (void)ud;
  1048. void* voidp;
  1049. (void)voidp;
  1050. LuaBinder::checkArgsCount(l, 1);
  1051. // Get "this" as "self"
  1052. if(LuaBinder::checkUserData(l, 1, classnameSpotLight, 7940385212889719421, ud)) return -1;
  1053. SpotLight* self = static_cast<SpotLight*>(ud->m_data);
  1054. ANKI_ASSERT(self != nullptr);
  1055. // Call the method
  1056. SceneNode& ret = *self;
  1057. // Push return value
  1058. voidp = lua_newuserdata(l, sizeof(UserData));
  1059. ud = static_cast<UserData*>(voidp);
  1060. luaL_setmetatable(l, "SceneNode");
  1061. ud->m_data = static_cast<void*>(&ret);
  1062. ud->m_gc = false;
  1063. ud->m_sig = -2220074417980276571;
  1064. return 1;
  1065. }
  1066. //==============================================================================
  1067. /// Wrap method SpotLight::getSceneNodeBase.
  1068. static int wrapSpotLightgetSceneNodeBase(lua_State* l)
  1069. {
  1070. int res = pwrapSpotLightgetSceneNodeBase(l);
  1071. if(res >= 0) return res;
  1072. lua_error(l);
  1073. return 0;
  1074. }
  1075. //==============================================================================
  1076. /// Wrap class SpotLight.
  1077. static inline void wrapSpotLight(lua_State* l)
  1078. {
  1079. LuaBinder::createClass(l, classnameSpotLight);
  1080. LuaBinder::pushLuaCFuncMethod(l, "getSceneNodeBase", wrapSpotLightgetSceneNodeBase);
  1081. lua_settop(l, 0);
  1082. }
  1083. //==============================================================================
  1084. // SceneGraph =
  1085. //==============================================================================
  1086. //==============================================================================
  1087. static const char* classnameSceneGraph = "SceneGraph";
  1088. template<>
  1089. I64 LuaBinder::getWrappedTypeSignature<SceneGraph>()
  1090. {
  1091. return -7754439619132389154;
  1092. }
  1093. template<>
  1094. const char* LuaBinder::getWrappedTypeName<SceneGraph>()
  1095. {
  1096. return classnameSceneGraph;
  1097. }
  1098. //==============================================================================
  1099. /// Pre-wrap method SceneGraph::newModelNode.
  1100. static inline int pwrapSceneGraphnewModelNode(lua_State* l)
  1101. {
  1102. UserData* ud;
  1103. (void)ud;
  1104. void* voidp;
  1105. (void)voidp;
  1106. LuaBinder::checkArgsCount(l, 3);
  1107. // Get "this" as "self"
  1108. if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud)) return -1;
  1109. SceneGraph* self = static_cast<SceneGraph*>(ud->m_data);
  1110. ANKI_ASSERT(self != nullptr);
  1111. // Pop arguments
  1112. const char* arg0;
  1113. if(LuaBinder::checkString(l, 2, arg0)) return -1;
  1114. const char* arg1;
  1115. if(LuaBinder::checkString(l, 3, arg1)) return -1;
  1116. // Call the method
  1117. ModelNode* ret = newSceneNode<ModelNode>(self, arg0, arg1);
  1118. // Push return value
  1119. if(ANKI_UNLIKELY(ret == nullptr))
  1120. {
  1121. lua_pushstring(l, "Glue code returned nullptr");
  1122. return -1;
  1123. }
  1124. voidp = lua_newuserdata(l, sizeof(UserData));
  1125. ud = static_cast<UserData*>(voidp);
  1126. luaL_setmetatable(l, "ModelNode");
  1127. ud->m_data = static_cast<void*>(ret);
  1128. ud->m_gc = false;
  1129. ud->m_sig = -1856316251880904290;
  1130. return 1;
  1131. }
  1132. //==============================================================================
  1133. /// Wrap method SceneGraph::newModelNode.
  1134. static int wrapSceneGraphnewModelNode(lua_State* l)
  1135. {
  1136. int res = pwrapSceneGraphnewModelNode(l);
  1137. if(res >= 0) return res;
  1138. lua_error(l);
  1139. return 0;
  1140. }
  1141. //==============================================================================
  1142. /// Pre-wrap method SceneGraph::newInstanceNode.
  1143. static inline int pwrapSceneGraphnewInstanceNode(lua_State* l)
  1144. {
  1145. UserData* ud;
  1146. (void)ud;
  1147. void* voidp;
  1148. (void)voidp;
  1149. LuaBinder::checkArgsCount(l, 2);
  1150. // Get "this" as "self"
  1151. if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud)) return -1;
  1152. SceneGraph* self = static_cast<SceneGraph*>(ud->m_data);
  1153. ANKI_ASSERT(self != nullptr);
  1154. // Pop arguments
  1155. const char* arg0;
  1156. if(LuaBinder::checkString(l, 2, arg0)) return -1;
  1157. // Call the method
  1158. InstanceNode* ret = newSceneNode<InstanceNode>(self, arg0);
  1159. // Push return value
  1160. if(ANKI_UNLIKELY(ret == nullptr))
  1161. {
  1162. lua_pushstring(l, "Glue code returned nullptr");
  1163. return -1;
  1164. }
  1165. voidp = lua_newuserdata(l, sizeof(UserData));
  1166. ud = static_cast<UserData*>(voidp);
  1167. luaL_setmetatable(l, "InstanceNode");
  1168. ud->m_data = static_cast<void*>(ret);
  1169. ud->m_gc = false;
  1170. ud->m_sig = -2063375830923741403;
  1171. return 1;
  1172. }
  1173. //==============================================================================
  1174. /// Wrap method SceneGraph::newInstanceNode.
  1175. static int wrapSceneGraphnewInstanceNode(lua_State* l)
  1176. {
  1177. int res = pwrapSceneGraphnewInstanceNode(l);
  1178. if(res >= 0) return res;
  1179. lua_error(l);
  1180. return 0;
  1181. }
  1182. //==============================================================================
  1183. /// Pre-wrap method SceneGraph::newPointLight.
  1184. static inline int pwrapSceneGraphnewPointLight(lua_State* l)
  1185. {
  1186. UserData* ud;
  1187. (void)ud;
  1188. void* voidp;
  1189. (void)voidp;
  1190. LuaBinder::checkArgsCount(l, 2);
  1191. // Get "this" as "self"
  1192. if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud)) return -1;
  1193. SceneGraph* self = static_cast<SceneGraph*>(ud->m_data);
  1194. ANKI_ASSERT(self != nullptr);
  1195. // Pop arguments
  1196. const char* arg0;
  1197. if(LuaBinder::checkString(l, 2, arg0)) return -1;
  1198. // Call the method
  1199. PointLight* ret = newSceneNode<PointLight>(self, arg0);
  1200. // Push return value
  1201. if(ANKI_UNLIKELY(ret == nullptr))
  1202. {
  1203. lua_pushstring(l, "Glue code returned nullptr");
  1204. return -1;
  1205. }
  1206. voidp = lua_newuserdata(l, sizeof(UserData));
  1207. ud = static_cast<UserData*>(voidp);
  1208. luaL_setmetatable(l, "PointLight");
  1209. ud->m_data = static_cast<void*>(ret);
  1210. ud->m_gc = false;
  1211. ud->m_sig = 3561037663389896020;
  1212. return 1;
  1213. }
  1214. //==============================================================================
  1215. /// Wrap method SceneGraph::newPointLight.
  1216. static int wrapSceneGraphnewPointLight(lua_State* l)
  1217. {
  1218. int res = pwrapSceneGraphnewPointLight(l);
  1219. if(res >= 0) return res;
  1220. lua_error(l);
  1221. return 0;
  1222. }
  1223. //==============================================================================
  1224. /// Pre-wrap method SceneGraph::newSpotLight.
  1225. static inline int pwrapSceneGraphnewSpotLight(lua_State* l)
  1226. {
  1227. UserData* ud;
  1228. (void)ud;
  1229. void* voidp;
  1230. (void)voidp;
  1231. LuaBinder::checkArgsCount(l, 2);
  1232. // Get "this" as "self"
  1233. if(LuaBinder::checkUserData(l, 1, classnameSceneGraph, -7754439619132389154, ud)) return -1;
  1234. SceneGraph* self = static_cast<SceneGraph*>(ud->m_data);
  1235. ANKI_ASSERT(self != nullptr);
  1236. // Pop arguments
  1237. const char* arg0;
  1238. if(LuaBinder::checkString(l, 2, arg0)) return -1;
  1239. // Call the method
  1240. SpotLight* ret = newSceneNode<SpotLight>(self, arg0);
  1241. // Push return value
  1242. if(ANKI_UNLIKELY(ret == nullptr))
  1243. {
  1244. lua_pushstring(l, "Glue code returned nullptr");
  1245. return -1;
  1246. }
  1247. voidp = lua_newuserdata(l, sizeof(UserData));
  1248. ud = static_cast<UserData*>(voidp);
  1249. luaL_setmetatable(l, "SpotLight");
  1250. ud->m_data = static_cast<void*>(ret);
  1251. ud->m_gc = false;
  1252. ud->m_sig = 7940385212889719421;
  1253. return 1;
  1254. }
  1255. //==============================================================================
  1256. /// Wrap method SceneGraph::newSpotLight.
  1257. static int wrapSceneGraphnewSpotLight(lua_State* l)
  1258. {
  1259. int res = pwrapSceneGraphnewSpotLight(l);
  1260. if(res >= 0) return res;
  1261. lua_error(l);
  1262. return 0;
  1263. }
  1264. //==============================================================================
  1265. /// Wrap class SceneGraph.
  1266. static inline void wrapSceneGraph(lua_State* l)
  1267. {
  1268. LuaBinder::createClass(l, classnameSceneGraph);
  1269. LuaBinder::pushLuaCFuncMethod(l, "newModelNode", wrapSceneGraphnewModelNode);
  1270. LuaBinder::pushLuaCFuncMethod(l, "newInstanceNode", wrapSceneGraphnewInstanceNode);
  1271. LuaBinder::pushLuaCFuncMethod(l, "newPointLight", wrapSceneGraphnewPointLight);
  1272. LuaBinder::pushLuaCFuncMethod(l, "newSpotLight", wrapSceneGraphnewSpotLight);
  1273. lua_settop(l, 0);
  1274. }
  1275. //==============================================================================
  1276. /// Pre-wrap function getSceneGraph.
  1277. static inline int pwrapgetSceneGraph(lua_State* l)
  1278. {
  1279. UserData* ud;
  1280. (void)ud;
  1281. void* voidp;
  1282. (void)voidp;
  1283. LuaBinder::checkArgsCount(l, 0);
  1284. // Call the function
  1285. SceneGraph* ret = getSceneGraph(l);
  1286. // Push return value
  1287. if(ANKI_UNLIKELY(ret == nullptr))
  1288. {
  1289. lua_pushstring(l, "Glue code returned nullptr");
  1290. return -1;
  1291. }
  1292. voidp = lua_newuserdata(l, sizeof(UserData));
  1293. ud = static_cast<UserData*>(voidp);
  1294. luaL_setmetatable(l, "SceneGraph");
  1295. ud->m_data = static_cast<void*>(ret);
  1296. ud->m_gc = false;
  1297. ud->m_sig = -7754439619132389154;
  1298. return 1;
  1299. }
  1300. //==============================================================================
  1301. /// Wrap function getSceneGraph.
  1302. static int wrapgetSceneGraph(lua_State* l)
  1303. {
  1304. int res = pwrapgetSceneGraph(l);
  1305. if(res >= 0) return res;
  1306. lua_error(l);
  1307. return 0;
  1308. }
  1309. //==============================================================================
  1310. /// Wrap the module.
  1311. void wrapModuleScene(lua_State* l)
  1312. {
  1313. wrapMoveComponent(l);
  1314. wrapLightComponent(l);
  1315. wrapSceneNode(l);
  1316. wrapModelNode(l);
  1317. wrapInstanceNode(l);
  1318. wrapPointLight(l);
  1319. wrapSpotLight(l);
  1320. wrapSceneGraph(l);
  1321. LuaBinder::pushLuaCFunc(l, "getSceneGraph", wrapgetSceneGraph);
  1322. }
  1323. } // end namespace anki