💿🐜 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.

235 lines
6.0 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 "geometry/aabb.hpp"
  24. #include <optional>
  25. #include <entt/entt.hpp>
  26. #include <fstream>
  27. #include <string>
  28. // Forward declarations
  29. class ambient_light;
  30. class animator;
  31. class application;
  32. class behavior_system;
  33. class billboard;
  34. class bloom_pass;
  35. class camera;
  36. class camera_system;
  37. class clear_pass;
  38. class collision_system;
  39. class compositor;
  40. class config_file;
  41. class constraint_system;
  42. class control;
  43. class control_set;
  44. class control_system;
  45. class directional_light;
  46. class final_pass;
  47. class framebuffer;
  48. class locomotion_system;
  49. class logger;
  50. class material;
  51. class material_pass;
  52. class nest_system;
  53. class orbit_cam;
  54. class pheromone_matrix;
  55. class snapping_system;
  56. class point_light;
  57. class rasterizer;
  58. class render_system;
  59. class resource_manager;
  60. class samara_system;
  61. class scene;
  62. class screen_transition;
  63. class shadow_map_pass;
  64. class simple_render_pass;
  65. class sky_pass;
  66. class spotlight;
  67. class subterrain_system;
  68. class terrain_system;
  69. class texture_2d;
  70. class timeline;
  71. class tool_system;
  72. class ui_system;
  73. class vegetation_system;
  74. class vertex_array;
  75. class vertex_buffer;
  76. class renderer;
  77. class model_instance;
  78. class input_event_router;
  79. class input_mapper;
  80. class cli;
  81. template <typename T> class animation;
  82. template <typename T> class material_property;
  83. template <typename T> class tween;
  84. /**
  85. *
  86. */
  87. struct game_context
  88. {
  89. application* app;
  90. logger* logger;
  91. std::ofstream log_filestream;
  92. // Command-line options
  93. std::optional<bool> option_continue;
  94. std::optional<std::string> option_data;
  95. std::optional<bool> option_fullscreen;
  96. std::optional<bool> option_new_game;
  97. std::optional<bool> option_quick_start;
  98. std::optional<bool> option_reset;
  99. std::optional<int> option_vsync;
  100. std::optional<bool> option_windowed;
  101. // Paths
  102. std::string data_path;
  103. std::string config_path;
  104. std::string mods_path;
  105. std::string saves_path;
  106. std::string screenshots_path;
  107. std::string data_package_path;
  108. // Config
  109. config_file* config;
  110. // Resources
  111. resource_manager* resource_manager;
  112. // Localization
  113. std::string language_code;
  114. int language_index;
  115. string_table* string_table;
  116. string_table_map string_table_map;
  117. std::unordered_map<std::string, std::string>* strings;
  118. // Framebuffers
  119. framebuffer* shadow_map_framebuffer;
  120. texture_2d* shadow_map_depth_texture;
  121. framebuffer* framebuffer_hdr;
  122. texture_2d* framebuffer_hdr_color;
  123. texture_2d* framebuffer_hdr_depth;
  124. framebuffer* framebuffer_bloom; // General purpose framebuffer A
  125. texture_2d* bloom_texture;
  126. // Rendering
  127. rasterizer* rasterizer;
  128. renderer* renderer;
  129. vertex_buffer* billboard_vbo;
  130. vertex_array* billboard_vao;
  131. material* fallback_material;
  132. material* splash_billboard_material;
  133. // Compositing
  134. bloom_pass* overworld_bloom_pass;
  135. clear_pass* overworld_clear_pass;
  136. clear_pass* overworld_shadow_map_clear_pass;
  137. clear_pass* ui_clear_pass;
  138. clear_pass* underworld_clear_pass;
  139. final_pass* overworld_final_pass;
  140. material_pass* overworld_material_pass;
  141. material_pass* ui_material_pass;
  142. material_pass* underworld_material_pass;
  143. shadow_map_pass* overworld_shadow_map_pass;
  144. simple_render_pass* underworld_final_pass;
  145. sky_pass* overworld_sky_pass;
  146. material_property<const texture_2d*>* underground_color_texture_property;
  147. compositor* overworld_compositor;
  148. compositor* underworld_compositor;
  149. compositor* ui_compositor;
  150. // Scene
  151. scene* active_scene;
  152. scene* overworld_scene;
  153. scene* underworld_scene;
  154. scene* ui_scene;
  155. camera* overworld_camera;
  156. camera* underworld_camera;
  157. camera* ui_camera;
  158. ambient_light* sun_indirect;
  159. directional_light* sun_direct;
  160. point_light* subterrain_light;
  161. ambient_light* underworld_ambient_light;
  162. spotlight* spotlight;
  163. billboard* splash_billboard;
  164. aabb<float> no_cull;
  165. // Animation
  166. timeline* timeline;
  167. animator* animator;
  168. tween<double>* time_tween;
  169. tween<float3>* focal_point_tween;
  170. animation<float>* radial_transition_in;
  171. animation<float>* radial_transition_out;
  172. screen_transition* fade_transition;
  173. screen_transition* radial_transition_inner;
  174. screen_transition* radial_transition_outer;
  175. // Controls
  176. input_event_router* input_event_router;
  177. input_mapper* input_mapper;
  178. control_set* application_controls;
  179. control_set* camera_controls;
  180. control_set* menu_controls;
  181. control* menu_back_control;
  182. control* menu_select_control;
  183. control* screenshot_control;
  184. control* rotate_ccw_control;
  185. control* rotate_cw_control;
  186. control* toggle_fullscreen_control;
  187. // Entities
  188. entt::registry* ecs_registry;
  189. entt::entity brush_entity;
  190. entt::entity flashlight_entity;
  191. entt::entity forceps_entity;
  192. entt::entity lens_entity;
  193. entt::entity focal_point_entity;
  194. // Systems
  195. behavior_system* behavior_system;
  196. camera_system* camera_system;
  197. collision_system* collision_system;
  198. constraint_system* constraint_system;
  199. control_system* control_system;
  200. locomotion_system* locomotion_system;
  201. nest_system* nest_system;
  202. snapping_system* snapping_system;
  203. render_system* render_system;
  204. samara_system* samara_system;
  205. subterrain_system* subterrain_system;
  206. terrain_system* terrain_system;
  207. tool_system* tool_system;
  208. ui_system* ui_system;
  209. vegetation_system* vegetation_system;
  210. // Debug
  211. cli* cli;
  212. // Misc
  213. pheromone_matrix* pheromones;
  214. };
  215. #endif // ANTKEEPER_GAME_CONTEXT_HPP