Blender V5.3
eevee_lightprobe_planar.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "eevee_defines.hh"
14
15#include "draw_pass.hh"
16#include "draw_view.hh"
17
18namespace blender::eevee {
19
20using namespace draw;
21
22class Instance;
23class HiZBuffer;
24
25/* -------------------------------------------------------------------- */
28
32
34 friend class Instance;
35 friend class HiZBuffer;
36 friend class PlanarProbePipeline;
37
38 private:
39 Instance &inst_;
40
41 struct PlanarResources : NonCopyable {
42 Framebuffer prepass_fb = {"planar.prepass_fb"};
43 Framebuffer combined_fb = {"planar.combined_fb"};
44 Framebuffer gbuffer_fb = {"planar.gbuffer_fb"};
45 draw::View view = {"planar.view"};
46 };
47
48 std::array<PlanarResources, PLANAR_PROBE_MAX> resources_;
49
50 Texture radiance_tx_ = {"planar.radiance_tx"};
51 Texture depth_tx_ = {"planar.depth_tx"};
52
53 ClipPlaneBuf world_clip_buf_ = {"world_clip_buf"};
54 PlanarProbeDataBuf probe_planar_buf_ = {"probe_planar_buf"};
55
56 bool update_probes_ = false;
57
59 bool do_display_draw_ = false;
60 PlanarProbeDisplayDataBuf display_data_buf_;
61 PassSimple viewport_display_ps_ = {"PlanarProbeModule.Viewport Display"};
62
63 public:
64 PlanarProbeModule(Instance &instance) : inst_(instance) {}
65
66 void init();
67 void end_sync();
68
69 void set_view(const draw::View &main_view, int2 main_view_extent);
70
71 void viewport_draw(View &view, gpu::FrameBuffer *view_fb);
72
73 template<typename PassType> void bind_resources(PassType &pass)
74 {
75 pass.bind_ubo(PLANAR_PROBE_BUF_SLOT, &probe_planar_buf_);
76 pass.bind_texture(PLANAR_PROBE_RADIANCE_TEX_SLOT, &radiance_tx_);
77 pass.bind_texture(PLANAR_PROBE_DEPTH_TEX_SLOT, &depth_tx_);
78 }
79
81 struct Dummy {
83 Texture dummy_radiance_tx_ = {"planar.dummy_radiance_tx"};
84 Texture dummy_depth_tx_ = {"planar.dummy_depth_tx"};
85
86 template<typename PassType> void bind_resources(PassType &pass)
87 {
91 }
93
94 bool enabled() const
95 {
96 return update_probes_;
97 }
98};
99
101
102} // namespace blender::eevee
A running instance of the engine.
struct blender::eevee::PlanarProbeModule::Dummy dummy_resources
void set_view(const draw::View &main_view, int2 main_view_extent)
void viewport_draw(View &view, gpu::FrameBuffer *view_fb)
#define PLANAR_PROBE_DEPTH_TEX_SLOT
#define PLANAR_PROBE_RADIANCE_TEX_SLOT
#define PLANAR_PROBE_BUF_SLOT
PassType
detail::Pass< command::DrawCommandBuf > PassSimple
draw::StorageArrayBuffer< PlanarProbeDisplayData > PlanarProbeDisplayDataBuf
draw::UniformArrayBuffer< PlanarProbeData, PLANAR_PROBE_MAX > PlanarProbeDataBuf
draw::UniformBuffer< ClipPlaneData > ClipPlaneBuf
VecBase< int32_t, 2 > int2