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

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