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

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