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

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