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

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