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

257 lines
6.6 KiB

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