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

80 lines
2.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_ENTITY_SYSTEM_VEGETATION_HPP
  20. #define ANTKEEPER_ENTITY_SYSTEM_VEGETATION_HPP
  21. #include "entity/systems/updatable.hpp"
  22. #include "entity/components/terrain.hpp"
  23. #include "entity/id.hpp"
  24. #include "scene/collection.hpp"
  25. class model;
  26. namespace entity {
  27. namespace system {
  28. /**
  29. * Places vegetation patches on terrain.
  30. */
  31. class vegetation: public updatable
  32. {
  33. public:
  34. vegetation(entity::registry& registry);
  35. ~vegetation();
  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(entity::registry& registry, entity::id entity_id, entity::component::terrain& component);
  54. void on_terrain_destroy(entity::registry& registry, entity::id entity_id);
  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. } // namespace system
  64. } // namespace entity
  65. #endif // ANTKEEPER_ENTITY_SYSTEM_VEGETATION_HPP