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

60 lines
1.9 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_SYSTEM_MORPHOGENESIS_HPP
  20. #define ANTKEEPER_GAME_SYSTEM_MORPHOGENESIS_HPP
  21. #include "game/system/updatable.hpp"
  22. namespace game {
  23. namespace system {
  24. /**
  25. * Constructs the forms of organisms from their genetic codes.
  26. *
  27. * Algorithm:
  28. *
  29. * 1. Consider inital egg cell as a sphere at the origin.
  30. * 2. Use the marching cubes algorithm to generate a mesh from the isosurface formed by the sum of all cells.
  31. * 3. Generate evenly-distributed points across surface area of the mesh (Poisson sample?).
  32. * 4. For each point, evaluate morphogenic genes to determine type, direction, and color of the next cell.
  33. * 5. Create new cells given the output of step 4.
  34. * 6. Go to step 2 and repeat.
  35. */
  36. class morphogenesis:
  37. public updatable
  38. {
  39. public:
  40. morphogenesis(entity::registry& registry);
  41. /**
  42. * Scales then adds the timestep `dt` to the current time, then recalculates the positions of morphogenesising bodies.
  43. *
  44. * @param t Time, in seconds.
  45. * @param dt Delta time, in seconds.
  46. */
  47. virtual void update(double t, double dt);
  48. private:
  49. };
  50. } // namespace system
  51. } // namespace game
  52. #endif // ANTKEEPER_GAME_SYSTEM_MORPHOGENESIS_HPP