Blender V4.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
9#pragma once
10
12
13#include "BKE_cryptomatte.hh"
14
15extern "C" {
16}
17
18namespace blender::eevee {
19
20class Instance;
21class HiZBuffer;
22
23/* -------------------------------------------------------------------- */
28 friend class Instance;
29 friend class HiZBuffer;
30 friend class PlanarProbePipeline;
31
32 private:
33 Instance &inst_;
34
35 struct PlanarResources : NonCopyable {
36 Framebuffer combined_fb = {"planar.combined_fb"};
37 Framebuffer gbuffer_fb = {"planar.gbuffer_fb"};
38 draw::View view = {"planar.view"};
39 };
40
41 std::array<PlanarResources, PLANAR_PROBE_MAX> resources_;
42
43 Texture radiance_tx_ = {"planar.radiance_tx"};
44 Texture depth_tx_ = {"planar.depth_tx"};
45
46 ClipPlaneBuf world_clip_buf_ = {"world_clip_buf"};
47 PlanarProbeDataBuf probe_planar_buf_ = {"probe_planar_buf"};
48
49 bool update_probes_ = false;
50
52 bool do_display_draw_ = false;
53 PlanarProbeDisplayDataBuf display_data_buf_;
54 PassSimple viewport_display_ps_ = {"PlanarProbeModule.Viewport Display"};
55
56 public:
57 PlanarProbeModule(Instance &instance) : inst_(instance) {}
58
59 void init();
60 void end_sync();
61
62 void set_view(const draw::View &main_view, int2 main_view_extent);
63
64 void viewport_draw(View &view, GPUFrameBuffer *view_fb);
65
66 template<typename PassType> void bind_resources(PassType &pass)
67 {
68 /* Disable filter to avoid interpolation with missing background. */
70 pass.bind_ubo(PLANAR_PROBE_BUF_SLOT, &probe_planar_buf_);
71 pass.bind_texture(PLANAR_PROBE_RADIANCE_TEX_SLOT, &radiance_tx_, no_filter);
72 pass.bind_texture(PLANAR_PROBE_DEPTH_TEX_SLOT, &depth_tx_);
73 }
74
75 bool enabled() const
76 {
77 return update_probes_;
78 }
79};
80
83} // namespace blender::eevee
A running instance of the engine.
void set_view(const draw::View &main_view, int2 main_view_extent)
void viewport_draw(View &view, GPUFrameBuffer *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
constexpr GPUSamplerState no_filter
draw::StorageArrayBuffer< PlanarProbeDisplayData > PlanarProbeDisplayDataBuf
draw::UniformArrayBuffer< PlanarProbeData, PLANAR_PROBE_MAX > PlanarProbeDataBuf
draw::UniformBuffer< ClipPlaneData > ClipPlaneBuf
static constexpr GPUSamplerState default_sampler()