💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
5.9 KiB

  1. /*
  2. * Copyright (C) 2020 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_GAME_CONTEXT_HPP
  20. #define ANTKEEPER_GAME_CONTEXT_HPP
  21. #include "utility/fundamental-types.hpp"
  22. #include "resources/string-table.hpp"
  23. #include <optional>
  24. #include <entt/entt.hpp>
  25. #include <fstream>
  26. #include <string>
  27. // Forward declarations
  28. class ambient_light;
  29. class animator;
  30. class application;
  31. class behavior_system;
  32. class billboard;
  33. class bloom_pass;
  34. class camera;
  35. class camera_system;
  36. class clear_pass;
  37. class collision_system;
  38. class compositor;
  39. class config_file;
  40. class constraint_system;
  41. class control;
  42. class control_set;
  43. class control_system;
  44. class directional_light;
  45. class final_pass;
  46. class framebuffer;
  47. class locomotion_system;
  48. class logger;
  49. class material;
  50. class material_pass;
  51. class nest_system;
  52. class orbit_cam;
  53. class pheromone_matrix;
  54. class placement_system;
  55. class point_light;
  56. class rasterizer;
  57. class render_system;
  58. class resource_manager;
  59. class samara_system;
  60. class scene;
  61. class screen_transition;
  62. class shadow_map_pass;
  63. class simple_render_pass;
  64. class sky_pass;
  65. class spotlight;
  66. class subterrain_system;
  67. class terrain_system;
  68. class texture_2d;
  69. class timeline;
  70. class tool_system;
  71. class ui_system;
  72. class vegetation_system;
  73. class vertex_array;
  74. class vertex_buffer;
  75. class renderer;
  76. class model_instance;
  77. class input_event_router;
  78. class input_mapper;
  79. class cli;
  80. template <typename T> class animation;
  81. template <typename T> class material_property;
  82. template <typename T> class tween;
  83. /**
  84. *
  85. */
  86. struct game_context
  87. {
  88. application* app;
  89. logger* logger;
  90. std::ofstream log_filestream;
  91. // Command-line options
  92. std::optional<bool> option_continue;
  93. std::optional<std::string> option_data;
  94. std::optional<bool> option_fullscreen;
  95. std::optional<bool> option_new_game;
  96. std::optional<bool> option_quick_start;
  97. std::optional<bool> option_reset;
  98. std::optional<int> option_vsync;
  99. std::optional<bool> option_windowed;
  100. // Paths
  101. std::string data_path;
  102. std::string config_path;
  103. std::string mods_path;
  104. std::string saves_path;
  105. std::string screenshots_path;
  106. std::string data_package_path;
  107. // Config
  108. config_file* config;
  109. // Resources
  110. resource_manager* resource_manager;
  111. // Localization
  112. std::string language_code;
  113. int language_index;
  114. string_table* string_table;
  115. string_table_map string_table_map;
  116. std::unordered_map<std::string, std::string>* strings;
  117. // Framebuffers
  118. framebuffer* shadow_map_framebuffer;
  119. texture_2d* shadow_map_depth_texture;
  120. framebuffer* framebuffer_hdr;
  121. texture_2d* framebuffer_hdr_color;
  122. texture_2d* framebuffer_hdr_depth;
  123. framebuffer* framebuffer_bloom; // General purpose framebuffer A
  124. texture_2d* bloom_texture;
  125. // Rendering
  126. rasterizer* rasterizer;
  127. renderer* renderer;
  128. vertex_buffer* billboard_vbo;
  129. vertex_array* billboard_vao;
  130. material* fallback_material;
  131. material* splash_billboard_material;
  132. // Compositing
  133. bloom_pass* overworld_bloom_pass;
  134. clear_pass* overworld_clear_pass;
  135. clear_pass* overworld_shadow_map_clear_pass;
  136. clear_pass* ui_clear_pass;
  137. clear_pass* underworld_clear_pass;
  138. final_pass* overworld_final_pass;
  139. material_pass* overworld_material_pass;
  140. material_pass* ui_material_pass;
  141. material_pass* underworld_material_pass;
  142. shadow_map_pass* overworld_shadow_map_pass;
  143. simple_render_pass* underworld_final_pass;
  144. sky_pass* overworld_sky_pass;
  145. material_property<const texture_2d*>* underground_color_texture_property;
  146. compositor* overworld_compositor;
  147. compositor* underworld_compositor;
  148. compositor* ui_compositor;
  149. // Scene
  150. scene* active_scene;
  151. scene* overworld_scene;
  152. scene* underworld_scene;
  153. scene* ui_scene;
  154. camera* overworld_camera;
  155. camera* underworld_camera;
  156. camera* ui_camera;
  157. ambient_light* sun_indirect;
  158. directional_light* sun_direct;
  159. point_light* subterrain_light;
  160. ambient_light* underworld_ambient_light;
  161. spotlight* spotlight;
  162. billboard* splash_billboard;
  163. // Animation
  164. timeline* timeline;
  165. animator* animator;
  166. tween<double>* time_tween;
  167. tween<float3>* focal_point_tween;
  168. animation<float>* radial_transition_in;
  169. animation<float>* radial_transition_out;
  170. screen_transition* fade_transition;
  171. screen_transition* radial_transition_inner;
  172. screen_transition* radial_transition_outer;
  173. // Controls
  174. input_event_router* input_event_router;
  175. input_mapper* input_mapper;
  176. control_set* application_controls;
  177. control_set* camera_controls;
  178. control_set* menu_controls;
  179. control* menu_back_control;
  180. control* menu_select_control;
  181. control* screenshot_control;
  182. control* rotate_ccw_control;
  183. control* rotate_cw_control;
  184. control* toggle_fullscreen_control;
  185. // Entities
  186. entt::registry* ecs_registry;
  187. entt::entity brush_entity;
  188. entt::entity flashlight_entity;
  189. entt::entity forceps_entity;
  190. entt::entity lens_entity;
  191. // Systems
  192. behavior_system* behavior_system;
  193. camera_system* camera_system;
  194. collision_system* collision_system;
  195. constraint_system* constraint_system;
  196. control_system* control_system;
  197. locomotion_system* locomotion_system;
  198. nest_system* nest_system;
  199. placement_system* placement_system;
  200. render_system* render_system;
  201. samara_system* samara_system;
  202. subterrain_system* subterrain_system;
  203. terrain_system* terrain_system;
  204. tool_system* tool_system;
  205. ui_system* ui_system;
  206. vegetation_system* vegetation_system;
  207. // Debug
  208. cli* cli;
  209. // Misc
  210. orbit_cam* orbit_cam;
  211. pheromone_matrix* pheromones;
  212. };
  213. #endif // ANTKEEPER_GAME_CONTEXT_HPP