Viewport.pkg 5.7 KB

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