Blender V5.0
COM_fog_glow_kernel.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <complex>
8#include <cstdint>
9#include <memory>
10
11#include "BLI_map.hh"
14
16
17namespace blender::compositor {
18
19/* ------------------------------------------------------------------------------------------------
20 * Fog Glow Kernel Key.
21 */
32
33bool operator==(const FogGlowKernelKey &a, const FogGlowKernelKey &b);
34
35/* -------------------------------------------------------------------------------------------------
36 * Fog Glow Kernel.
37 *
38 * A cached resource that computes and caches a Fog Glow convolution kernel in the frequency domain
39 * using FFTW's real to complex transform. The kernel is computed within a specific kernel size but
40 * zero padded to match a certain spatial size. */
42 private:
43 /* The normalization factor that should be used to normalize the kernel frequencies. See the
44 * implementation for more information. */
45 float normalization_factor_ = 1.0f;
46
47 /* The kernel in the frequency domain. See the implementation for more information. */
48 std::complex<float> *frequencies_ = nullptr;
49
50 public:
51 FogGlowKernel(int kernel_size, int2 spatial_size, math::AngleRadian field_of_view);
52
54
55 std::complex<float> *frequencies() const;
56
57 float normalization_factor() const;
58};
59
60/* ------------------------------------------------------------------------------------------------
61 * Fog Glow Kernel Container.
62 */
64 private:
66
67 public:
68 void reset() override;
69
70 /* Check if there is an available FogGlowKernel cached resource with the given parameters in the
71 * container, if one exists, return it, otherwise, return a newly created one and add it to the
72 * container. In both cases, tag the cached resource as needed to keep it cached for the next
73 * evaluation. */
74 FogGlowKernel &get(int kernel_size, int2 spatial_size, math::AngleRadian field_of_view);
75};
76
77} // namespace blender::compositor
unsigned long long int uint64_t
FogGlowKernel & get(int kernel_size, int2 spatial_size, math::AngleRadian field_of_view)
FogGlowKernelKey(int kernel_size, int2 spatial_size, math::AngleRadian field_of_view)
std::complex< float > * frequencies() const
FogGlowKernel(int kernel_size, int2 spatial_size, math::AngleRadian field_of_view)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
AngleRadianBase< float > AngleRadian
VecBase< int32_t, 2 > int2