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

73 lines
2.0 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_VEGETATION_SYSTEM_HPP
  20. #define ANTKEEPER_VEGETATION_SYSTEM_HPP
  21. #include "entity-system.hpp"
  22. #include "game/components/terrain-component.hpp"
  23. class model;
  24. class scene;
  25. /**
  26. * Places vegetation patches on terrain.
  27. */
  28. class vegetation_system: public entity_system
  29. {
  30. public:
  31. vegetation_system(entt::registry& registry);
  32. ~vegetation_system();
  33. virtual void update(double t, double dt);
  34. /**
  35. * Sets the terrain patch size.
  36. *
  37. * @param size Size of the terrain patch.
  38. */
  39. void set_terrain_patch_size(float size);
  40. /**
  41. * Sets the vegetation patch size.
  42. *
  43. * @param subdivisions Number of times a terrain patch should be subdivided into vegetation patches.
  44. */
  45. void set_vegetation_patch_resolution(int subdivisions);
  46. void set_vegetation_density(float density);
  47. void set_vegetation_model(::model* model);
  48. void set_scene(::scene* scene);
  49. private:
  50. void on_terrain_construct(entt::registry& registry, entt::entity entity, ecs::terrain_component& component);
  51. void on_terrain_destroy(entt::registry& registry, entt::entity entity);
  52. float terrain_patch_size;
  53. float vegetation_patch_size;
  54. int vegetation_patch_columns;
  55. int vegetation_patch_rows;
  56. float vegetation_density;
  57. model* vegetation_model;
  58. ::scene* scene;
  59. };
  60. #endif // ANTKEEPER_VEGETATION_SYSTEM_HPP