Viewport.pkg 5.6 KB

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