Renderer.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. // Copyright (C) 2009-2018, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // WARNING: This file is auto generated.
  6. #include <anki/script/LuaBinder.h>
  7. #include <anki/script/ScriptManager.h>
  8. #include <anki/Renderer.h>
  9. namespace anki
  10. {
  11. static MainRenderer* getMainRenderer(lua_State* l)
  12. {
  13. LuaBinder* binder = nullptr;
  14. lua_getallocf(l, reinterpret_cast<void**>(&binder));
  15. ScriptManager* scriptManager = reinterpret_cast<ScriptManager*>(binder->getParent());
  16. return &scriptManager->getMainRenderer();
  17. }
  18. LuaUserDataTypeInfo luaUserDataTypeInfoDbg = {
  19. -2784798555522127122, "Dbg", LuaUserData::computeSizeForGarbageCollected<Dbg>(), nullptr, nullptr};
  20. template<>
  21. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Dbg>()
  22. {
  23. return luaUserDataTypeInfoDbg;
  24. }
  25. /// Pre-wrap method Dbg::getEnabled.
  26. static inline int pwrapDbggetEnabled(lua_State* l)
  27. {
  28. LuaUserData* ud;
  29. (void)ud;
  30. void* voidp;
  31. (void)voidp;
  32. PtrSize size;
  33. (void)size;
  34. if(ANKI_UNLIKELY(LuaBinder::checkArgsCount(l, 1)))
  35. {
  36. return -1;
  37. }
  38. // Get "this" as "self"
  39. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoDbg, ud))
  40. {
  41. return -1;
  42. }
  43. Dbg* self = ud->getData<Dbg>();
  44. // Call the method
  45. Bool ret = self->getEnabled();
  46. // Push return value
  47. lua_pushboolean(l, ret);
  48. return 1;
  49. }
  50. /// Wrap method Dbg::getEnabled.
  51. static int wrapDbggetEnabled(lua_State* l)
  52. {
  53. int res = pwrapDbggetEnabled(l);
  54. if(res >= 0)
  55. {
  56. return res;
  57. }
  58. lua_error(l);
  59. return 0;
  60. }
  61. /// Pre-wrap method Dbg::setEnabled.
  62. static inline int pwrapDbgsetEnabled(lua_State* l)
  63. {
  64. LuaUserData* ud;
  65. (void)ud;
  66. void* voidp;
  67. (void)voidp;
  68. PtrSize size;
  69. (void)size;
  70. if(ANKI_UNLIKELY(LuaBinder::checkArgsCount(l, 2)))
  71. {
  72. return -1;
  73. }
  74. // Get "this" as "self"
  75. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoDbg, ud))
  76. {
  77. return -1;
  78. }
  79. Dbg* self = ud->getData<Dbg>();
  80. // Pop arguments
  81. Bool arg0;
  82. if(ANKI_UNLIKELY(LuaBinder::checkNumber(l, 2, arg0)))
  83. {
  84. return -1;
  85. }
  86. // Call the method
  87. self->setEnabled(arg0);
  88. return 0;
  89. }
  90. /// Wrap method Dbg::setEnabled.
  91. static int wrapDbgsetEnabled(lua_State* l)
  92. {
  93. int res = pwrapDbgsetEnabled(l);
  94. if(res >= 0)
  95. {
  96. return res;
  97. }
  98. lua_error(l);
  99. return 0;
  100. }
  101. /// Wrap class Dbg.
  102. static inline void wrapDbg(lua_State* l)
  103. {
  104. LuaBinder::createClass(l, &luaUserDataTypeInfoDbg);
  105. LuaBinder::pushLuaCFuncMethod(l, "getEnabled", wrapDbggetEnabled);
  106. LuaBinder::pushLuaCFuncMethod(l, "setEnabled", wrapDbgsetEnabled);
  107. lua_settop(l, 0);
  108. }
  109. LuaUserDataTypeInfo luaUserDataTypeInfoMainRenderer = {
  110. 919289102518575326, "MainRenderer", LuaUserData::computeSizeForGarbageCollected<MainRenderer>(), nullptr, nullptr};
  111. template<>
  112. const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<MainRenderer>()
  113. {
  114. return luaUserDataTypeInfoMainRenderer;
  115. }
  116. /// Pre-wrap method MainRenderer::getAspectRatio.
  117. static inline int pwrapMainRenderergetAspectRatio(lua_State* l)
  118. {
  119. LuaUserData* ud;
  120. (void)ud;
  121. void* voidp;
  122. (void)voidp;
  123. PtrSize size;
  124. (void)size;
  125. if(ANKI_UNLIKELY(LuaBinder::checkArgsCount(l, 1)))
  126. {
  127. return -1;
  128. }
  129. // Get "this" as "self"
  130. if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoMainRenderer, ud))
  131. {
  132. return -1;
  133. }
  134. MainRenderer* self = ud->getData<MainRenderer>();
  135. // Call the method
  136. F32 ret = self->getAspectRatio();
  137. // Push return value
  138. lua_pushnumber(l, ret);
  139. return 1;
  140. }
  141. /// Wrap method MainRenderer::getAspectRatio.
  142. static int wrapMainRenderergetAspectRatio(lua_State* l)
  143. {
  144. int res = pwrapMainRenderergetAspectRatio(l);
  145. if(res >= 0)
  146. {
  147. return res;
  148. }
  149. lua_error(l);
  150. return 0;
  151. }
  152. /// Wrap class MainRenderer.
  153. static inline void wrapMainRenderer(lua_State* l)
  154. {
  155. LuaBinder::createClass(l, &luaUserDataTypeInfoMainRenderer);
  156. LuaBinder::pushLuaCFuncMethod(l, "getAspectRatio", wrapMainRenderergetAspectRatio);
  157. lua_settop(l, 0);
  158. }
  159. /// Pre-wrap function getMainRenderer.
  160. static inline int pwrapgetMainRenderer(lua_State* l)
  161. {
  162. LuaUserData* ud;
  163. (void)ud;
  164. void* voidp;
  165. (void)voidp;
  166. PtrSize size;
  167. (void)size;
  168. if(ANKI_UNLIKELY(LuaBinder::checkArgsCount(l, 0)))
  169. {
  170. return -1;
  171. }
  172. // Call the function
  173. MainRenderer* ret = getMainRenderer(l);
  174. // Push return value
  175. if(ANKI_UNLIKELY(ret == nullptr))
  176. {
  177. lua_pushstring(l, "Glue code returned nullptr");
  178. return -1;
  179. }
  180. voidp = lua_newuserdata(l, sizeof(LuaUserData));
  181. ud = static_cast<LuaUserData*>(voidp);
  182. luaL_setmetatable(l, "MainRenderer");
  183. extern LuaUserDataTypeInfo luaUserDataTypeInfoMainRenderer;
  184. ud->initPointed(&luaUserDataTypeInfoMainRenderer, const_cast<MainRenderer*>(ret));
  185. return 1;
  186. }
  187. /// Wrap function getMainRenderer.
  188. static int wrapgetMainRenderer(lua_State* l)
  189. {
  190. int res = pwrapgetMainRenderer(l);
  191. if(res >= 0)
  192. {
  193. return res;
  194. }
  195. lua_error(l);
  196. return 0;
  197. }
  198. /// Wrap the module.
  199. void wrapModuleRenderer(lua_State* l)
  200. {
  201. wrapDbg(l);
  202. wrapMainRenderer(l);
  203. LuaBinder::pushLuaCFunc(l, "getMainRenderer", wrapgetMainRenderer);
  204. }
  205. } // end namespace anki