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

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