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

74 lines
2.0 KiB

  1. /*
  2. * Copyright (C) 2020 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_SIMPLE_RENDER_PASS_HPP
  20. #define ANTKEEPER_SIMPLE_RENDER_PASS_HPP
  21. #include "renderer/render-pass.hpp"
  22. #include "animation/tween.hpp"
  23. #include <vmq/vmq.hpp>
  24. using namespace vmq::types;
  25. class shader_program;
  26. class shader_input;
  27. class vertex_buffer;
  28. class vertex_array;
  29. class material;
  30. template <class T>
  31. class material_property;
  32. /**
  33. * Simple render passes are associated with a single shader and a single material.
  34. */
  35. class simple_render_pass: public render_pass
  36. {
  37. public:
  38. simple_render_pass(::rasterizer* rasterizer, const ::framebuffer* framebuffer, ::shader_program* shader_program);
  39. virtual ~simple_render_pass();
  40. virtual void render(render_context* context) const final;
  41. void set_time_tween(const tween<double>* time);
  42. const ::material* get_material() const;
  43. ::material* get_material();
  44. private:
  45. shader_program* shader_program;
  46. material* material;
  47. material_property<float>* time_property;
  48. material_property<float2>* resolution_property;
  49. const tween<double>* time_tween;
  50. vertex_buffer* quad_vbo;
  51. vertex_array* quad_vao;
  52. };
  53. inline const ::material* simple_render_pass::get_material() const
  54. {
  55. return material;
  56. }
  57. inline ::material* simple_render_pass::get_material()
  58. {
  59. return material;
  60. }
  61. #endif // ANTKEEPER_SIMPLE_RENDER_PASS_HPP