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

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