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

269 lines
7.1 KiB

  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 "entity/id.hpp"
  24. #include "entity/registry.hpp"
  25. #include "geom/aabb.hpp"
  26. #include "gl/vertex-array.hpp"
  27. #include "gl/vertex-buffer.hpp"
  28. #include "gl/texture-2d.hpp"
  29. #include "gl/rasterizer.hpp"
  30. #include "gl/framebuffer.hpp"
  31. #include "input/control.hpp"
  32. #include "input/control-set.hpp"
  33. #include "input/listener.hpp"
  34. #include "input/mapper.hpp"
  35. #include "input/event-router.hpp"
  36. #include "animation/tween.hpp"
  37. #include "scene/scene.hpp"
  38. #include <optional>
  39. #include <entt/entt.hpp>
  40. #include <fstream>
  41. #include <string>
  42. // Forward declarations
  43. class animator;
  44. class application;
  45. class bloom_pass;
  46. class clear_pass;
  47. class compositor;
  48. class config_file;
  49. class final_pass;
  50. class material;
  51. class material_pass;
  52. class orbit_cam;
  53. class pheromone_matrix;
  54. class resource_manager;
  55. class screen_transition;
  56. class shadow_map_pass;
  57. class simple_render_pass;
  58. class sky_pass;
  59. class timeline;
  60. class renderer;
  61. class outline_pass;
  62. struct biome;
  63. template <typename T> class animation;
  64. template <typename T> class material_property;
  65. namespace debug
  66. {
  67. class cli;
  68. class logger;
  69. }
  70. namespace entity
  71. {
  72. namespace system
  73. {
  74. class subterrain;
  75. class terrain;
  76. class vegetation;
  77. class tool;
  78. class ui;
  79. class spatial;
  80. class tracking;
  81. class painting;
  82. class astronomy;
  83. class blackbody;
  84. class atmosphere;
  85. class orbit;
  86. class behavior;
  87. class collision;
  88. class constraint;
  89. class locomotion;
  90. class control;
  91. class snapping;
  92. class camera;
  93. class nest;
  94. class render;
  95. class samara;
  96. }
  97. }
  98. /**
  99. *
  100. */
  101. struct game_context
  102. {
  103. application* app;
  104. debug::logger* logger;
  105. std::ofstream log_filestream;
  106. // Command-line options
  107. std::optional<std::string> option_biome;
  108. std::optional<bool> option_continue;
  109. std::optional<std::string> option_data;
  110. std::optional<bool> option_fullscreen;
  111. std::optional<bool> option_new_game;
  112. std::optional<bool> option_quick_start;
  113. std::optional<bool> option_reset;
  114. std::optional<int> option_vsync;
  115. std::optional<bool> option_windowed;
  116. // Paths
  117. std::string data_path;
  118. std::string config_path;
  119. std::string mods_path;
  120. std::string saves_path;
  121. std::string screenshots_path;
  122. std::string data_package_path;
  123. // Config
  124. config_file* config;
  125. // Resources
  126. resource_manager* resource_manager;
  127. // Localization
  128. std::string language_code;
  129. int language_index;
  130. string_table* string_table;
  131. string_table_map string_table_map;
  132. std::unordered_map<std::string, std::string>* strings;
  133. // Framebuffers
  134. gl::framebuffer* shadow_map_framebuffer;
  135. gl::texture_2d* shadow_map_depth_texture;
  136. gl::framebuffer* framebuffer_hdr;
  137. gl::texture_2d* framebuffer_hdr_color;
  138. gl::texture_2d* framebuffer_hdr_depth;
  139. gl::framebuffer* framebuffer_bloom; // General purpose framebuffer A
  140. gl::texture_2d* bloom_texture;
  141. // Rendering
  142. gl::rasterizer* rasterizer;
  143. renderer* renderer;
  144. gl::vertex_buffer* billboard_vbo;
  145. gl::vertex_array* billboard_vao;
  146. material* fallback_material;
  147. material* splash_billboard_material;
  148. gl::texture_2d** marker_albedo_textures;
  149. // Compositing
  150. bloom_pass* overworld_bloom_pass;
  151. clear_pass* overworld_clear_pass;
  152. clear_pass* overworld_shadow_map_clear_pass;
  153. clear_pass* ui_clear_pass;
  154. clear_pass* underworld_clear_pass;
  155. final_pass* overworld_final_pass;
  156. material_pass* overworld_material_pass;
  157. material_pass* ui_material_pass;
  158. material_pass* underworld_material_pass;
  159. outline_pass* overworld_outline_pass;
  160. shadow_map_pass* overworld_shadow_map_pass;
  161. simple_render_pass* underworld_final_pass;
  162. sky_pass* overworld_sky_pass;
  163. material_property<const gl::texture_2d*>* underground_color_texture_property;
  164. compositor* overworld_compositor;
  165. compositor* underworld_compositor;
  166. compositor* ui_compositor;
  167. // Scene
  168. scene::collection* active_scene;
  169. scene::collection* overworld_scene;
  170. scene::collection* underworld_scene;
  171. scene::collection* ui_scene;
  172. scene::camera* overworld_camera;
  173. scene::camera* underworld_camera;
  174. scene::camera* ui_camera;
  175. scene::directional_light* moon_light;
  176. scene::point_light* subterrain_light;
  177. scene::ambient_light* underworld_ambient_light;
  178. scene::billboard* splash_billboard;
  179. scene::spot_light* lens_spot_light;
  180. scene::spot_light* flashlight_spot_light;
  181. geom::aabb<float> no_cull;
  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. input::control_set* application_controls;
  199. input::control_set* camera_controls;
  200. input::control_set* menu_controls;
  201. input::control* menu_back_control;
  202. input::control* menu_select_control;
  203. input::control* screenshot_control;
  204. input::control* toggle_fullscreen_control;
  205. // Entities
  206. entity::registry* entity_registry;
  207. entity::id brush_entity;
  208. entity::id flashlight_entity;
  209. entity::id forceps_entity;
  210. entity::id lens_entity;
  211. entity::id marker_entity;
  212. entity::id container_entity;
  213. entity::id twig_entity;
  214. entity::id focal_point_entity;
  215. // Systems
  216. entity::system::behavior* behavior_system;
  217. entity::system::camera* camera_system;
  218. entity::system::collision* collision_system;
  219. entity::system::constraint* constraint_system;
  220. entity::system::control* control_system;
  221. entity::system::locomotion* locomotion_system;
  222. entity::system::nest* nest_system;
  223. entity::system::snapping* snapping_system;
  224. entity::system::render* render_system;
  225. entity::system::samara* samara_system;
  226. entity::system::subterrain* subterrain_system;
  227. entity::system::terrain* terrain_system;
  228. entity::system::tool* tool_system;
  229. entity::system::ui* ui_system;
  230. entity::system::vegetation* vegetation_system;
  231. entity::system::spatial* spatial_system;
  232. entity::system::tracking* tracking_system;
  233. entity::system::painting* painting_system;
  234. entity::system::blackbody* blackbody_system;
  235. entity::system::atmosphere* atmosphere_system;
  236. entity::system::astronomy* astronomy_system;
  237. entity::system::orbit* orbit_system;
  238. // Game
  239. biome* biome;
  240. // Debug
  241. debug::cli* cli;
  242. // Misc
  243. pheromone_matrix* pheromones;
  244. };
  245. #endif // ANTKEEPER_GAME_CONTEXT_HPP