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

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