Blender V4.3
COM_bokeh_kernel.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
5#pragma once
6
7#include <cstdint>
8#include <memory>
9
10#include "BLI_map.hh"
12
13#include "GPU_shader.hh"
14#include "GPU_texture.hh"
15
17#include "COM_result.hh"
18
20
21class Context;
22
23/* ------------------------------------------------------------------------------------------------
24 * Bokeh Kernel Key.
25 */
27 public:
29 int sides;
30 float rotation;
31 float roundness;
34
36 int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift);
37
38 uint64_t hash() const;
39};
40
41bool operator==(const BokehKernelKey &a, const BokehKernelKey &b);
42
43/* -------------------------------------------------------------------------------------------------
44 * Bokeh Kernel.
45 *
46 * A cached resource that computes and caches a result containing the unnormalized convolution
47 * kernel, which when convolved with an image emulates a bokeh lens with the given parameters. */
49 public:
51
52 public:
53 BokehKernel(Context &context,
54 int2 size,
55 int sides,
56 float rotation,
57 float roundness,
58 float catadioptric,
59 float lens_shift);
60
62};
63
64/* ------------------------------------------------------------------------------------------------
65 * Bokeh Kernel Container.
66 */
68 private:
70
71 public:
72 void reset() override;
73
74 /* Check if there is an available BokehKernel cached resource with the given parameters in the
75 * container, if one exists, return it, otherwise, return a newly created one and add it to the
76 * container. In both cases, tag the cached resource as needed to keep it cached for the next
77 * evaluation. */
78 Result &get(Context &context,
79 int2 size,
80 int sides,
81 float rotation,
82 float roundness,
83 float catadioptric,
84 float lens_shift);
85};
86
87} // namespace blender::realtime_compositor
Result & get(Context &context, int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
BokehKernelKey(int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
BokehKernel(Context &context, int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
local_group_size(16, 16) .push_constant(Type b
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
unsigned __int64 uint64_t
Definition stdint.h:90