Blender V5.0
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 combined_fb = {"planar.combined_fb"};
43 Framebuffer gbuffer_fb = {"planar.gbuffer_fb"};
44 draw::View view = {"planar.view"};
45 };
46
47 std::array<PlanarResources, PLANAR_PROBE_MAX> resources_;
48
49 Texture radiance_tx_ = {"planar.radiance_tx"};
50 Texture depth_tx_ = {"planar.depth_tx"};
51
52 ClipPlaneBuf world_clip_buf_ = {"world_clip_buf"};
53 PlanarProbeDataBuf probe_planar_buf_ = {"probe_planar_buf"};
54
55 bool update_probes_ = false;
56
58 bool do_display_draw_ = false;
59 PlanarProbeDisplayDataBuf display_data_buf_;
60 PassSimple viewport_display_ps_ = {"PlanarProbeModule.Viewport Display"};
61
62 public:
63 PlanarProbeModule(Instance &instance) : inst_(instance) {}
64
65 void init();
66 void end_sync();
67
68 void set_view(const draw::View &main_view, int2 main_view_extent);
69
70 void viewport_draw(View &view, gpu::FrameBuffer *view_fb);
71
72 template<typename PassType> void bind_resources(PassType &pass)
73 {
74 /* Disable filter to avoid interpolation with missing background. */
76 pass.bind_ubo(PLANAR_PROBE_BUF_SLOT, &probe_planar_buf_);
77 pass.bind_texture(PLANAR_PROBE_RADIANCE_TEX_SLOT, &radiance_tx_, no_filter);
78 pass.bind_texture(PLANAR_PROBE_DEPTH_TEX_SLOT, &depth_tx_);
79 }
80
81 bool enabled() const
82 {
83 return update_probes_;
84 }
85};
86
88
89} // namespace blender::eevee
static AppView * view
A running instance of the engine.
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
static constexpr GPUSamplerState default_sampler()