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

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