20 #ifndef ANTKEEPER_RENDER_BLOOM_PASS_HPP
21 #define ANTKEEPER_RENDER_BLOOM_PASS_HPP
94 return m_target_textures.empty() ? nullptr : m_target_textures.front();
98 void rebuild_mip_chain();
99 void correct_filter_radius();
100 void rebuild_command_buffer();
102 std::shared_ptr<gl::texture_2d> m_source_texture;
103 std::shared_ptr<gl::image_2d> m_target_image;
104 std::vector<std::shared_ptr<gl::texture_2d>> m_target_textures;
105 std::vector<std::shared_ptr<gl::framebuffer>> m_target_framebuffers;
107 std::unique_ptr<gl::shader_program> m_downsample_karis_shader;
108 std::unique_ptr<gl::shader_program> m_downsample_shader;
109 std::unique_ptr<gl::shader_program> m_upsample_shader;
111 std::shared_ptr<gl::sampler> m_sampler;
112 std::unique_ptr<gl::vertex_array> m_vertex_array;
113 unsigned int m_mip_chain_length{0};
114 float m_filter_radius{0.005f};
115 math::fvec2 m_corrected_filter_radius{0.005f, 0.005f};
117 std::vector<std::function<void()>> m_command_buffer;
Graphics pipeline interface.
Physically-based bloom render pass.
void set_mip_chain_length(unsigned int length)
Sets the mip chain length.
void resize()
Resizes the mip chain resolution according to the resolution of the source texture.
void set_filter_radius(float radius)
Sets the upsample filter radius.
void render(render::context &ctx) override
Renders a bloom texture.
void set_source_texture(std::shared_ptr< gl::texture_2d > texture)
Sets the bloom source texture.
std::shared_ptr< gl::texture_2d > get_bloom_texture() const
Returns the texture containing the bloom result.
bloom_pass(gl::pipeline *pipeline, resource_manager *resource_manager)
Constructs a bloom pass.
Manages the loading, caching, and saving of resources.
T length(const quaternion< T > &q)
Calculates the length of a quaternion.