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

74 lines
2.3 KiB

  1. /*
  2. * Copyright (C) 2023 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_ATMOSPHERE_SYSTEM_HPP
  20. #define ANTKEEPER_GAME_ATMOSPHERE_SYSTEM_HPP
  21. #include "game/systems/updatable-system.hpp"
  22. #include <engine/entity/id.hpp>
  23. #include <engine/utility/fundamental-types.hpp>
  24. #include "game/components/atmosphere-component.hpp"
  25. #include <engine/render/passes/sky-pass.hpp>
  26. /**
  27. * Updates variables related to atmospheric scattering.
  28. */
  29. class atmosphere_system:
  30. public updatable_system
  31. {
  32. public:
  33. explicit atmosphere_system(entity::registry& registry);
  34. ~atmosphere_system();
  35. virtual void update(double t, double dt);
  36. /**
  37. * Sets the wavelengths of red, green, and blue light.
  38. *
  39. * @param wavelengths Vector containing the wavelengths of red (x), green (y), and blue (z) light, in meters.
  40. */
  41. void set_rgb_wavelengths(const double3& wavelengths);
  42. void set_sky_pass(::render::sky_pass* pass);
  43. /**
  44. * Sets the entity ID of the active atmosphere.
  45. *
  46. * @param entity_id Entity ID of the active atmosphere.
  47. */
  48. void set_active_atmosphere(entity::id entity_id);
  49. private:
  50. void update_atmosphere(entity::id entity_id);
  51. void update_sky_pass();
  52. void on_atmosphere_construct(entity::registry& registry, entity::id entity_id);
  53. void on_atmosphere_update(entity::registry& registry, entity::id entity_id);
  54. void on_atmosphere_destroy(entity::registry& registry, entity::id entity_id);
  55. entity::id active_atmosphere_eid;
  56. double3 rgb_wavelengths;
  57. double3 rgb_ozone_cross_sections;
  58. ::atmosphere_component* atmosphere_component;
  59. ::render::sky_pass* sky_pass;
  60. };
  61. #endif // ANTKEEPER_GAME_ATMOSPHERE_SYSTEM_HPP