Blender
V5.0
source
blender
compositor
cached_resources
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
12
#include "
COM_cached_resource.hh
"
13
#include "
COM_result.hh
"
14
15
namespace
blender::compositor
{
16
17
class
Context
;
18
19
/* ------------------------------------------------------------------------------------------------
20
* Morphological Distance Feather Key.
21
*/
22
class
MorphologicalDistanceFeatherWeightsKey
{
23
public
:
24
int
type
;
25
float
radius
;
26
27
MorphologicalDistanceFeatherWeightsKey
(
int
type
,
float
radius
);
28
29
uint64_t
hash
()
const
;
30
};
31
32
bool
operator==
(
const
MorphologicalDistanceFeatherWeightsKey
&a,
33
const
MorphologicalDistanceFeatherWeightsKey
&
b
);
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. */
43
class
MorphologicalDistanceFeatherWeights
:
public
CachedResource
{
44
public
:
45
Result
weights_result
;
46
Result
falloffs_result
;
47
48
MorphologicalDistanceFeatherWeights
(
Context
&context,
int
type,
int
radius);
49
50
~MorphologicalDistanceFeatherWeights
();
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
*/
61
class
MorphologicalDistanceFeatherWeightsContainer
:
CachedResourceContainer
{
62
private
:
63
Map<MorphologicalDistanceFeatherWeightsKey, std::unique_ptr<MorphologicalDistanceFeatherWeights>
>
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
BLI_map.hh
COM_cached_resource.hh
COM_result.hh
uint64_t
unsigned long long int uint64_t
Definition
btConvexHullComputer.cpp:33
blender::Map
Definition
BLI_map.hh:129
blender::compositor::CachedResourceContainer
Definition
COM_cached_resource.hh:43
blender::compositor::CachedResource
Definition
COM_cached_resource.hh:26
blender::compositor::Context
Definition
COM_context.hh:44
blender::compositor::MorphologicalDistanceFeatherWeightsContainer
Definition
COM_morphological_distance_feather_weights.hh:61
blender::compositor::MorphologicalDistanceFeatherWeightsContainer::get
MorphologicalDistanceFeatherWeights & get(Context &context, int type, int radius)
Definition
morphological_distance_feather_weights.cc:161
blender::compositor::MorphologicalDistanceFeatherWeightsContainer::reset
void reset() override
Definition
morphological_distance_feather_weights.cc:149
blender::compositor::MorphologicalDistanceFeatherWeightsKey
Definition
COM_morphological_distance_feather_weights.hh:22
blender::compositor::MorphologicalDistanceFeatherWeightsKey::type
int type
Definition
COM_morphological_distance_feather_weights.hh:24
blender::compositor::MorphologicalDistanceFeatherWeightsKey::radius
float radius
Definition
COM_morphological_distance_feather_weights.hh:25
blender::compositor::MorphologicalDistanceFeatherWeightsKey::hash
uint64_t hash() const
Definition
morphological_distance_feather_weights.cc:32
blender::compositor::MorphologicalDistanceFeatherWeightsKey::MorphologicalDistanceFeatherWeightsKey
MorphologicalDistanceFeatherWeightsKey(int type, float radius)
Definition
morphological_distance_feather_weights.cc:26
blender::compositor::MorphologicalDistanceFeatherWeights
Definition
COM_morphological_distance_feather_weights.hh:43
blender::compositor::MorphologicalDistanceFeatherWeights::MorphologicalDistanceFeatherWeights
MorphologicalDistanceFeatherWeights(Context &context, int type, int radius)
Definition
morphological_distance_feather_weights.cc:47
blender::compositor::MorphologicalDistanceFeatherWeights::~MorphologicalDistanceFeatherWeights
~MorphologicalDistanceFeatherWeights()
Definition
morphological_distance_feather_weights.cc:66
blender::compositor::MorphologicalDistanceFeatherWeights::weights_result
Result weights_result
Definition
COM_morphological_distance_feather_weights.hh:45
blender::compositor::MorphologicalDistanceFeatherWeights::falloffs_result
Result falloffs_result
Definition
COM_morphological_distance_feather_weights.hh:46
blender::compositor::Result
Definition
COM_result.hh:100
b
b
Definition
compositor_morphological_distance_infos.hh:24
blender::compositor
Definition
BKE_node.hh:77
blender::compositor::operator==
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
Definition
bokeh_kernel.cc:44
Generated on
for Blender by
doxygen
1.16.1