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

262 lines
6.7 KiB

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