💿🐜 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.3 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_RENDER_RENDERER_HPP
  20. #define ANTKEEPER_RENDER_RENDERER_HPP
  21. #include "render/operation.hpp"
  22. #include "render/context.hpp"
  23. #include "render/queue.hpp"
  24. #include "gl/vertex-array.hpp"
  25. namespace scene
  26. {
  27. class collection;
  28. class object_base;
  29. class model_instance;
  30. class billboard;
  31. class lod_group;
  32. class text;
  33. }
  34. namespace render {
  35. /**
  36. *
  37. */
  38. class renderer
  39. {
  40. public:
  41. renderer();
  42. ~renderer();
  43. /**
  44. * Renders a collection of scene objects.
  45. *
  46. * @param t Current time, in seconds.
  47. * @param dt Timestep, in seconds.
  48. * @param alpha Subframe interpolation factor.
  49. * @parma collection Collection of scene objects to render.
  50. */
  51. void render(float t, float dt, float alpha, const scene::collection& collection) const;
  52. /**
  53. * Sets the VAO to be used when generating render operations for billboards.
  54. */
  55. void set_billboard_vao(gl::vertex_array* vao);
  56. private:
  57. void process_object(const render::context& ctx, render::queue& queue, const scene::object_base* object) const;
  58. void process_model_instance(const render::context& ctx, render::queue& queue, const scene::model_instance* model_instance) const;
  59. void process_billboard(const render::context& ctx, render::queue& queue, const scene::billboard* billboard) const;
  60. void process_lod_group(const render::context& ctx, render::queue& queue, const scene::lod_group* lod_group) const;
  61. void process_text(const render::context& ctx, render::queue& queue, const scene::text* text) const;
  62. mutable render::operation billboard_op;
  63. float4x4* skinning_palette;
  64. };
  65. } // namespace render
  66. #endif // ANTKEEPER_RENDER_RENDERER_HPP