Antkeeper  0.0.1
resample-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_RESAMPLE_PASS_HPP
21 #define ANTKEEPER_RENDER_RESAMPLE_PASS_HPP
22 
23 #include <engine/render/pass.hpp>
29 #include <engine/gl/texture.hpp>
30 #include <functional>
31 #include <memory>
32 
33 class resource_manager;
34 
35 namespace render {
36 
40 class resample_pass: public pass
41 {
42 public:
51 
58  void render(render::context& ctx) override;
59 
65  void set_source_texture(std::shared_ptr<gl::texture_2d> texture);
66 
67 private:
68  void rebuild_command_buffer();
69 
70  std::unique_ptr<gl::vertex_array> m_vertex_array;
71  std::unique_ptr<gl::shader_program> m_shader_program;
72  std::shared_ptr<gl::texture_2d> m_source_texture;
73  std::vector<std::function<void()>> m_command_buffer;
74 };
75 
76 } // namespace render
77 
78 #endif // ANTKEEPER_RENDER_RESAMPLE_PASS_HPP
Graphics pipeline interface.
Definition: pipeline.hpp:48
Render pass.
Definition: pass.hpp:34
Resamples a texture.
resample_pass(gl::pipeline *pipeline, const gl::framebuffer *framebuffer, resource_manager *resource_manager)
Constructs a resample pass.
void set_source_texture(std::shared_ptr< gl::texture_2d > texture)
Sets the resample source texture.
void render(render::context &ctx) override
Resamples a texture.
Manages the loading, caching, and saving of resources.
High-level rendering.
Context of a renderer.
Definition: context.hpp:40