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