Viewport.pkg 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. $#include "Graphics/Viewport.h"
  2. class Viewport
  3. {
  4. Viewport();
  5. Viewport(Scene* scene, Camera* camera, RenderPath* renderPath = 0);
  6. Viewport(Scene* scene, Camera* camera, const IntRect& rect, RenderPath* renderPath = 0);
  7. ~Viewport();
  8. void SetScene(Scene* scene);
  9. void SetCamera(Camera* camera);
  10. void SetCullCamera(Camera* camera);
  11. void SetRect(const IntRect& rect);
  12. void SetRenderPath(RenderPath* path);
  13. void SetRenderPath(XMLFile* file);
  14. void SetDrawDebug(bool enable);
  15. Scene* GetScene() const;
  16. Camera* GetCamera() const;
  17. Camera* GetCullCamera() const;
  18. const IntRect& GetRect() const;
  19. RenderPath* GetRenderPath() const;
  20. bool GetDrawDebug() const;
  21. Ray GetScreenRay(int x, int y) const;
  22. IntVector2 WorldToScreenPoint(const Vector3& worldPos) const;
  23. Vector3 ScreenToWorldPoint(int x, int y, float depth) const;
  24. tolua_property__get_set Scene* scene;
  25. tolua_property__get_set Camera* camera;
  26. tolua_property__get_set Camera* cullCamera;
  27. tolua_property__get_set IntRect& rect;
  28. tolua_property__get_set RenderPath* renderPath;
  29. tolua_property__get_set bool drawDebug;
  30. };
  31. ${
  32. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new00
  33. static int tolua_GraphicsLuaAPI_Viewport_new00(lua_State* tolua_S)
  34. {
  35. return ToluaNewObject<Viewport>(tolua_S);
  36. }
  37. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new00_local
  38. static int tolua_GraphicsLuaAPI_Viewport_new00_local(lua_State* tolua_S)
  39. {
  40. return ToluaNewObjectGC<Viewport>(tolua_S);
  41. }
  42. /* method: new of class Viewport */
  43. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new01
  44. static int tolua_GraphicsLuaAPI_Viewport_new01(lua_State* tolua_S)
  45. {
  46. tolua_Error tolua_err;
  47. if (
  48. !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
  49. !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
  50. !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
  51. !tolua_isusertype(tolua_S,4,"RenderPath",1,&tolua_err) ||
  52. !tolua_isnoobj(tolua_S,5,&tolua_err)
  53. )
  54. goto tolua_lerror;
  55. else
  56. {
  57. Scene* scene = ((Scene*) tolua_tousertype(tolua_S,2,0));
  58. Camera* camera = ((Camera*) tolua_tousertype(tolua_S,3,0));
  59. RenderPath* renderPath = ((RenderPath*) tolua_tousertype(tolua_S,4,0));
  60. {
  61. Viewport* tolua_ret = (Viewport*) Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,renderPath));
  62. tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
  63. }
  64. }
  65. return 1;
  66. tolua_lerror:
  67. return tolua_GraphicsLuaAPI_Viewport_new00(tolua_S);
  68. }
  69. /* method: new_local of class Viewport */
  70. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new01_local
  71. static int tolua_GraphicsLuaAPI_Viewport_new01_local(lua_State* tolua_S)
  72. {
  73. tolua_Error tolua_err;
  74. if (
  75. !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
  76. !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
  77. !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
  78. !tolua_isusertype(tolua_S,4,"RenderPath",1,&tolua_err) ||
  79. !tolua_isnoobj(tolua_S,5,&tolua_err)
  80. )
  81. goto tolua_lerror;
  82. else
  83. {
  84. Scene* scene = ((Scene*) tolua_tousertype(tolua_S,2,0));
  85. Camera* camera = ((Camera*) tolua_tousertype(tolua_S,3,0));
  86. RenderPath* renderPath = ((RenderPath*) tolua_tousertype(tolua_S,4,0));
  87. {
  88. Viewport* tolua_ret = (Viewport*) Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,renderPath));
  89. tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
  90. tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  91. }
  92. }
  93. return 1;
  94. tolua_lerror:
  95. return tolua_GraphicsLuaAPI_Viewport_new00_local(tolua_S);
  96. }
  97. /* method: new of class Viewport */
  98. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new02
  99. static int tolua_GraphicsLuaAPI_Viewport_new02(lua_State* tolua_S)
  100. {
  101. tolua_Error tolua_err;
  102. if (
  103. !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
  104. !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
  105. !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
  106. (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const IntRect",0,&tolua_err)) ||
  107. !tolua_isusertype(tolua_S,5,"RenderPath",1,&tolua_err) ||
  108. !tolua_isnoobj(tolua_S,6,&tolua_err)
  109. )
  110. goto tolua_lerror;
  111. else
  112. {
  113. Scene* scene = ((Scene*) tolua_tousertype(tolua_S,2,0));
  114. Camera* camera = ((Camera*) tolua_tousertype(tolua_S,3,0));
  115. const IntRect* rect = ((const IntRect*) tolua_tousertype(tolua_S,4,0));
  116. RenderPath* renderPath = ((RenderPath*) tolua_tousertype(tolua_S,5,0));
  117. {
  118. Viewport* tolua_ret = (Viewport*) Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,*rect,renderPath));
  119. tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
  120. }
  121. }
  122. return 1;
  123. tolua_lerror:
  124. return tolua_GraphicsLuaAPI_Viewport_new01(tolua_S);
  125. }
  126. /* method: new_local of class Viewport */
  127. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new02_local
  128. static int tolua_GraphicsLuaAPI_Viewport_new02_local(lua_State* tolua_S)
  129. {
  130. tolua_Error tolua_err;
  131. if (
  132. !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
  133. !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
  134. !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
  135. (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const IntRect",0,&tolua_err)) ||
  136. !tolua_isusertype(tolua_S,5,"RenderPath",1,&tolua_err) ||
  137. !tolua_isnoobj(tolua_S,6,&tolua_err)
  138. )
  139. goto tolua_lerror;
  140. else
  141. {
  142. Scene* scene = ((Scene*) tolua_tousertype(tolua_S,2,0));
  143. Camera* camera = ((Camera*) tolua_tousertype(tolua_S,3,0));
  144. const IntRect* rect = ((const IntRect*) tolua_tousertype(tolua_S,4,0));
  145. RenderPath* renderPath = ((RenderPath*) tolua_tousertype(tolua_S,5,0));
  146. {
  147. Viewport* tolua_ret = (Viewport*) Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,*rect,renderPath));
  148. tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
  149. tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  150. }
  151. }
  152. return 1;
  153. tolua_lerror:
  154. return tolua_GraphicsLuaAPI_Viewport_new01_local(tolua_S);
  155. }
  156. $}