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

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