@TheaterClass.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class TheaterClass : Region
  4. {
  5. enum SHOW
  6. {
  7. ALL,
  8. PUBLISHABLE,
  9. NON_PUBLISHABLE,
  10. INVALID,
  11. };
  12. static cchar8 *t_show[]
  13. ;
  14. class Options : PropWin
  15. {
  16. bool horizontal, rotate, auto_rot_flat_objects, scale_fit, center, draw_axis, axis_on_top, draw_box, light_dir;
  17. int rows;
  18. flt item_size, item_3d_scale, axis_size, time_angle, rot_speed, var_speed;
  19. Vec2 angle;
  20. UID env_id;
  21. SHOW show;
  22. Property *p_rows, *p_size, *p_scale, *p_angle;
  23. static void Horizontal( Options &options, C Str &text);
  24. static void Rows ( Options &options, C Str &text);
  25. static void Size ( Options &options, C Str &text);
  26. static void Show ( Options &options, C Str &text);
  27. static void FOV ( Options &options, C Str &text);
  28. static Str FOV (C Options &options );
  29. static void Angle ( Options &options, C Str &text);
  30. static Str Angle (C Options &options );
  31. static void Env ( Options &options, C Str &text);
  32. static Str Env (C Options &options );
  33. static void EditMode ( Options &options, C Str &text);
  34. static Str EditMode (C Options &options );
  35. Options& create();
  36. void rowsDelta (int delta );
  37. void sizeFactor(flt factor);
  38. void scaleFactor(flt factor);
  39. public:
  40. Options();
  41. };
  42. class ListElm
  43. {
  44. UID id;
  45. public:
  46. ListElm();
  47. };
  48. static ELM_TYPE modes[]
  49. ;
  50. enum OBJ_MODE
  51. {
  52. OBJ_ROT ,
  53. OBJ_SCALE,
  54. };
  55. static cchar8 *t_obj_mode[]
  56. ;
  57. class List2 : List<ListElm>
  58. {
  59. virtual int screenToVis(C Vec2 &screen, C GuiPC *gpc=null)C override;
  60. };
  61. enum
  62. {
  63. REFRESH_SIZE=1<<0,
  64. REFRESH_DATA=1<<1,
  65. };
  66. byte refresh;
  67. int old_rows;
  68. Menu menu;
  69. ViewportSkin viewport;
  70. Memc<ListElm> data;
  71. List2 list;
  72. Tabs mode, obj_mode, show_options;
  73. Options options;
  74. Memc<UID> transform_ids;
  75. int transform_rotate_y;
  76. flt transform_rotate_y_frac, transform_scale;
  77. Matrix transform_matrix;
  78. static void ModeChanged(TheaterClass &theater);
  79. static void Mode0(TheaterClass &theater);
  80. static void Mode1(TheaterClass &theater);
  81. static void Mode2(TheaterClass &theater);
  82. static void ModeS0(TheaterClass &theater);
  83. static void ModeS1(TheaterClass &theater);
  84. static void ToggleAxis (TheaterClass &theater);
  85. static void ToggleAxisTop(TheaterClass &theater);
  86. static void ToggleBox (TheaterClass &theater);
  87. static void ToggleCenter (TheaterClass &theater);
  88. static void ToggleScale (TheaterClass &theater);
  89. static void ToggleLight (TheaterClass &theater);
  90. static void ToggleOptions(TheaterClass &theater);
  91. static void DragElmsStart(ProjectEx &proj);
  92. flt depth()C;
  93. Matrix getMatrix(C UID &elm_id, Box box, C Rect &rect);
  94. void draw(C UID &elm_id, C Mesh &mesh, C Rect &rect);
  95. bool litSel()C;
  96. bool highlighted(int i)C;
  97. bool selected (int i)C;
  98. // this is a list of meshes with preallocated room for variations which we can reuse during rendering, because changing materials and adding new variations while rendering is now illegal
  99. class MeshMtrls : Mesh
  100. {
  101. int variations;
  102. void clean(); // skip setting shaders
  103. MeshMtrls& create(); // pre-allocate 32 variations so we can reuse them later
  104. bool available()C;
  105. Mesh& set(C MaterialPtr&mtrl, int&variation);
  106. public:
  107. MeshMtrls();
  108. };
  109. Memc<MeshMtrls> mesh_mtrls;
  110. void cleanMeshMaterial();
  111. Mesh& getMeshMaterial(C MaterialPtr&mtrl, int&variation);
  112. static void Render();
  113. void render();
  114. static void Draw(Viewport &viewport);
  115. void draw();
  116. void setVisibility(bool vis);
  117. void hideDo();
  118. void create();
  119. void moveAbove(GuiObj &go);
  120. void listElms(ElmNode &node, bool parent_contains_name=false);
  121. Vec2 offset()C;
  122. void offset(C Vec2 &offset);
  123. void refreshSize();
  124. void refreshData();
  125. void refreshNow();
  126. virtual void update(C GuiPC &gpc)override;
  127. void resize();
  128. public:
  129. TheaterClass();
  130. };
  131. /******************************************************************************/
  132. /******************************************************************************/
  133. extern TheaterClass Theater;
  134. /******************************************************************************/