20 #ifndef ANTKEEPER_RENDER_LIGHT_PROBE_STAGE_HPP
21 #define ANTKEEPER_RENDER_LIGHT_PROBE_STAGE_HPP
95 return m_sh_sample_count;
101 return m_cubemap_filter_sample_count;
105 void rebuild_cubemap_to_sh_shader_program();
106 void rebuild_cubemap_downsample_shader_program();
107 void rebuild_cubemap_filter_lut_shader_program();
108 void rebuild_cubemap_filter_lut_texture();
109 void rebuild_cubemap_filter_shader_program();
110 void sh_parameters_changed();
111 void cubemap_filter_parameters_changed();
113 void update_light_probes_luminance(
const std::vector<scene::object_base*>& light_probes);
114 void update_light_probes_illuminance(
const std::vector<scene::object_base*>& light_probes);
118 std::vector<std::shared_ptr<gl::sampler>> m_downsample_samplers;
119 std::vector<std::shared_ptr<gl::sampler>> m_filter_samplers;
120 std::unique_ptr<gl::vertex_array> m_vertex_array;
122 std::shared_ptr<gl::shader_template> m_cubemap_to_sh_shader_template;
123 std::unique_ptr<gl::shader_program> m_cubemap_to_sh_shader_program;
125 std::size_t m_sh_sample_count{512};
126 bool m_reproject_sh{
true};
128 std::shared_ptr<gl::shader_template> m_cubemap_downsample_shader_template;
129 std::unique_ptr<gl::shader_program> m_cubemap_downsample_shader_program;
132 std::vector<std::unique_ptr<gl::framebuffer>> m_cubemap_downsample_framebuffers;
133 std::unique_ptr<gl::texture_cube> m_cubemap_downsample_texture;
135 std::shared_ptr<gl::texture_2d> m_cubemap_filter_lut_texture;
136 std::unique_ptr<gl::framebuffer> m_cubemap_filter_lut_framebuffer;
137 std::shared_ptr<gl::shader_template> m_cubemap_filter_lut_shader_template;
138 std::unique_ptr<gl::shader_program> m_cubemap_filter_lut_shader_program;
143 std::shared_ptr<gl::shader_template> m_cubemap_filter_shader_template;
144 std::unique_ptr<gl::shader_program> m_cubemap_filter_shader_program;
149 std::size_t m_cubemap_filter_sample_count{32};
150 std::size_t m_cubemap_filter_mip_count{5};
151 float m_cubemap_filter_mip_bias{1.0f};
152 bool m_refilter_cubemaps{
true};
Graphics pipeline interface.
void execute(render::context &ctx) override
Executes the render stage.
std::size_t get_cubemap_filter_sample_count() const noexcept
Returns the number of samples used when filtering luminance cubemaps.
void set_cubemap_filter_sample_count(std::size_t count)
Sets the number of samples to use when filtering luminance cubemap mip chains.
void set_cubemap_filter_mip_bias(float bias)
Sets the mip bias to use when filtering luminance cubemap mip chains.
void set_sh_sample_count(std::size_t count)
Sets the number of samples to use when projecting luminance cubemaps into spherical harmonics.
std::size_t get_sh_sample_count() const noexcept
Returns the number of samples used when projecting luminance cubemaps into spherical harmonics.
light_probe_stage(gl::pipeline &pipeline, ::resource_manager &resource_manager)
Constructs a light probe stage.
Abstract base class for a single stage in a render pipeline.
Manages the loading, caching, and saving of resources.
constexpr int count(T x) noexcept
Returns the number of set bits in a value, known as a population count or Hamming weight.