renderable_node.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* renderable_node.h - renderable node & Empty
  2. * Copyright (C) 2017-2018 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef CORE_RENDERABLE_NODE_H_1EC6DC54_CD77_51B1_B90F_EAE99727BE6D
  18. #define CORE_RENDERABLE_NODE_H_1EC6DC54_CD77_51B1_B90F_EAE99727BE6D
  19. #include <core/node/new_node.h>
  20. #include "renderable.h"
  21. namespace rainynite::core {
  22. /**
  23. * Base class for all renderable nodes.
  24. *
  25. * Since Renderable is only tag class, the point of this base class
  26. * is to provide empty get() override.
  27. */
  28. template <class Self, typename... Ts>
  29. class RenderableNode :
  30. public NewNode<
  31. Self,
  32. Renderable,
  33. Ts...
  34. >
  35. {
  36. protected:
  37. Renderable get(shared_ptr<Context> /*ctx*/) const override {
  38. return {};
  39. }
  40. };
  41. class Empty : public RenderableNode<Empty> {
  42. DOC_STRING(
  43. "Empty renderable"
  44. )
  45. NODE_PROPERTIES()
  46. DEFAULT_VALUES()
  47. };
  48. } // namespace rainynite::core
  49. #endif