Antkeeper  0.0.1
pass.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 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 
20 #ifndef ANTKEEPER_RENDER_PASS_HPP
21 #define ANTKEEPER_RENDER_PASS_HPP
22 
23 #include <engine/gl/pipeline.hpp>
27 
28 namespace render {
29 
33 class pass
34 {
35 public:
36  pass(gl::pipeline* pipeline, const gl::framebuffer* framebuffer);
37  virtual ~pass();
38 
39  virtual void render(render::context& ctx) = 0;
40 
41  void set_enabled(bool enabled);
42 
43  [[nodiscard]] inline constexpr bool is_enabled() const noexcept
44  {
45  return m_enabled;
46  }
47 
48  void set_framebuffer(const gl::framebuffer* framebuffer);
49 
50  inline void set_clear_mask(std::uint8_t mask) noexcept
51  {
52  m_clear_mask = mask;
53  }
54 
55  inline void set_clear_value(const gl::clear_value& value) noexcept
56  {
57  m_clear_value = value;
58  }
59 
60  void clear();
61 
62 protected:
65  std::uint8_t m_clear_mask{};
67 
68 private:
69  bool m_enabled;
70 };
71 
72 } // namespace render
73 
74 #endif // ANTKEEPER_RENDER_PASS_HPP
Graphics pipeline interface.
Definition: pipeline.hpp:48
Render pass.
Definition: pass.hpp:34
void set_enabled(bool enabled)
Definition: pass.cpp:33
virtual ~pass()
Definition: pass.cpp:30
pass(gl::pipeline *pipeline, const gl::framebuffer *framebuffer)
Definition: pass.cpp:24
virtual void render(render::context &ctx)=0
constexpr bool is_enabled() const noexcept
Definition: pass.hpp:43
void set_clear_value(const gl::clear_value &value) noexcept
Definition: pass.hpp:55
std::uint8_t m_clear_mask
Definition: pass.hpp:65
void set_clear_mask(std::uint8_t mask) noexcept
Definition: pass.hpp:50
void set_framebuffer(const gl::framebuffer *framebuffer)
Definition: pass.cpp:38
void clear()
Definition: pass.cpp:43
gl::pipeline * m_pipeline
Definition: pass.hpp:63
const gl::framebuffer * m_framebuffer
Definition: pass.hpp:64
gl::clear_value m_clear_value
Definition: pass.hpp:66
High-level rendering.
Clear value.
Definition: clear-value.hpp:33
Context of a renderer.
Definition: context.hpp:40