gtsam_points
Loading...
Searching...
No Matches
screen_space_splatting.hpp
Go to the documentation of this file.
1#ifndef GLK_SCREEN_SPACE_SPLATTING_HPP
2#define GLK_SCREEN_SPACE_SPLATTING_HPP
3
4#include <glk/query.hpp>
8
9namespace glk {
10
11class GLProfiler;
12
14public:
15 ScreenSpaceSplatting(const Eigen::Vector2i& size = Eigen::Vector2i(1920, 1080));
16 virtual ~ScreenSpaceSplatting() override;
17
18 virtual void set_size(const Eigen::Vector2i& size) override;
19 virtual void draw(const TextureRenderer& renderer, const glk::Texture& color_texture, const glk::Texture& depth_texture, const TextureRendererInput::Ptr& input, glk::FrameBuffer* frame_buffer = nullptr) override;
20
21 const glk::Texture& position() const;
22 const glk::Texture& normal() const;
23 const glk::Texture& color() const;
24
25private:
26 void extract_points_on_screen(const glk::Texture& depth_texture);
27 void estimate_initial_radius(const glk::Texture& depth_texture);
28 void estimate_knn_radius();
29 void estimate_gaussian(GLProfiler& prof, const TextureRenderer& renderer);
30 void render_splatting(GLProfiler& prof, const glk::Texture& color_texture);
31
32private:
33 glk::GLSLShader texture_shader;
34 glk::GLSLShader position_shader;
35 std::unique_ptr<glk::FrameBuffer> position_buffer;
36
37 glk::GLSLShader white_shader;
38 glk::GLSLShader point_extraction_shader;
39 std::unique_ptr<glk::PointCloudBuffer> sampling_points_buffer;
40 std::unique_ptr<glk::TransformFeedback> points_on_screen;
41 std::unique_ptr<glk::Query> query;
42
43 glk::GLSLShader debug_shader;
44
45 // initial radius estimation
46 int k_neighbors;
47 int k_tolerance;
48 int initial_estimation_grid_size;
49 glk::GLSLShader increment_shader;
50 std::unique_ptr<glk::FrameBuffer> initial_estimation_buffer;
51
52 // knn estimation
53 int num_iterations;
54 glk::GLSLShader initial_radius_shader;
55 glk::GLSLShader distribution_shader;
56 glk::GLSLShader gathering_shader;
57 glk::GLSLShader bounds_update_shader;
58
59 std::unique_ptr<glk::FrameBuffer> radius_buffer_ping;
60 std::unique_ptr<glk::FrameBuffer> radius_buffer_pong;
61 std::unique_ptr<glk::FrameBuffer> neighbor_counts_buffer;
62 std::unique_ptr<glk::FrameBuffer> feedback_radius_buffer;
63
64 // computed radius
65 glk::GLSLShader farthest_point_shader;
66 glk::GLSLShader radius_finalization_shader;
67 std::unique_ptr<glk::FrameBuffer> finalized_radius_buffer;
68
69 // gaussian estimation
70 glk::GLSLShader gaussian_gathering_shader;
71 glk::GLSLShader gaussian_finalization_shader;
72 std::unique_ptr<glk::FrameBuffer> gaussian_accum_buffer;
73 std::unique_ptr<glk::FrameBuffer> gaussian_dists_buffer;
74
75 // splatting
76 glk::GLSLShader splatting_first_shader;
77 glk::GLSLShader splatting_second_shader;
78 std::unique_ptr<glk::FrameBuffer> splatting_buffer;
79
80 // final result
81 glk::GLSLShader splatting_finalization_shader;
82 std::unique_ptr<glk::FrameBuffer> result_buffer;
83};
84
85} // namespace glk
86
87#endif
Definition frame_buffer.hpp:12
Definition profiler.hpp:15
Definition glsl_shader.hpp:20
Definition screen_effect.hpp:15
Definition screen_space_splatting.hpp:13
virtual void draw(const TextureRenderer &renderer, const glk::Texture &color_texture, const glk::Texture &depth_texture, const TextureRendererInput::Ptr &input, glk::FrameBuffer *frame_buffer=nullptr) override
virtual void set_size(const Eigen::Vector2i &size) override
virtual ~ScreenSpaceSplatting() override
const glk::Texture & color() const
ScreenSpaceSplatting(const Eigen::Vector2i &size=Eigen::Vector2i(1920, 1080))
const glk::Texture & normal() const
const glk::Texture & position() const
TextureRenderer.
Definition texture_renderer.hpp:20
Definition texture.hpp:10
Definition async_buffer_copy.hpp:6
std::shared_ptr< TextureRendererInput > Ptr
Definition texture_renderer_input.hpp:13