Blender V5.0
COM_morphological_distance_feather_weights.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"
11
13#include "COM_result.hh"
14
15namespace blender::compositor {
16
17class Context;
18
19/* ------------------------------------------------------------------------------------------------
20 * Morphological Distance Feather Key.
21 */
23 public:
24 int type;
25 float radius;
26
28
29 uint64_t hash() const;
30};
31
34
35/* -------------------------------------------------------------------------------------------------
36 * Morphological Distance Feather Weights.
37 *
38 * A cached resource that computes and caches 1D GPU textures containing the weights of the
39 * separable Gaussian filter of the given radius as well as an inverse distance falloff of the
40 * given type and radius. The weights and falloffs are symmetric, because the Gaussian and falloff
41 * functions are all even functions. Consequently, only the positive half of the filter is computed
42 * and the shader takes that into consideration. */
44 public:
47
48 MorphologicalDistanceFeatherWeights(Context &context, int type, int radius);
49
51
52 private:
53 void compute_weights(int radius);
54
55 void compute_distance_falloffs(int type, int radius);
56};
57
58/* ------------------------------------------------------------------------------------------------
59 * Morphological Distance Feather Key.
60 */
62 private:
64 map_;
65
66 public:
67 void reset() override;
68
69 /* Check if there is an available MorphologicalDistanceFeatherWeights cached resource with the
70 * given parameters in the container, if one exists, return it, otherwise, return a newly created
71 * one and add it to the container. In both cases, tag the cached resource as needed to keep it
72 * cached for the next evaluation. */
73 MorphologicalDistanceFeatherWeights &get(Context &context, int type, int radius);
74};
75
76} // namespace blender::compositor
unsigned long long int uint64_t
MorphologicalDistanceFeatherWeights & get(Context &context, int type, int radius)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)