Blender
V4.5
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_array.hh
"
11
#include "
BLI_map.hh
"
12
13
#include "
COM_cached_resource.hh
"
14
#include "
COM_result.hh
"
15
16
namespace
blender::compositor
{
17
18
class
Context
;
19
20
/* ------------------------------------------------------------------------------------------------
21
* Morphological Distance Feather Key.
22
*/
23
class
MorphologicalDistanceFeatherWeightsKey
{
24
public
:
25
int
type
;
26
float
radius
;
27
28
MorphologicalDistanceFeatherWeightsKey
(
int
type
,
float
radius
);
29
30
uint64_t
hash
()
const
;
31
};
32
33
bool
operator==
(
const
MorphologicalDistanceFeatherWeightsKey
&a,
34
const
MorphologicalDistanceFeatherWeightsKey
&
b
);
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. */
44
class
MorphologicalDistanceFeatherWeights
:
public
CachedResource
{
45
private
:
46
Array<float>
weights_;
47
Array<float>
falloffs_;
48
49
public
:
50
Result
weights_result
;
51
Result
falloffs_result
;
52
53
MorphologicalDistanceFeatherWeights
(
Context
&context,
int
type,
int
radius);
54
55
~MorphologicalDistanceFeatherWeights
();
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
*/
66
class
MorphologicalDistanceFeatherWeightsContainer
:
CachedResourceContainer
{
67
private
:
68
Map<MorphologicalDistanceFeatherWeightsKey, std::unique_ptr<MorphologicalDistanceFeatherWeights>
>
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
BLI_array.hh
BLI_map.hh
COM_cached_resource.hh
COM_result.hh
uint64_t
unsigned long long int uint64_t
Definition
btConvexHullComputer.cpp:33
blender::Array
Definition
BLI_array.hh:50
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:66
blender::compositor::MorphologicalDistanceFeatherWeightsContainer::get
MorphologicalDistanceFeatherWeights & get(Context &context, int type, int radius)
Definition
morphological_distance_feather_weights.cc:169
blender::compositor::MorphologicalDistanceFeatherWeightsContainer::reset
void reset() override
Definition
morphological_distance_feather_weights.cc:157
blender::compositor::MorphologicalDistanceFeatherWeightsKey
Definition
COM_morphological_distance_feather_weights.hh:23
blender::compositor::MorphologicalDistanceFeatherWeightsKey::type
int type
Definition
COM_morphological_distance_feather_weights.hh:25
blender::compositor::MorphologicalDistanceFeatherWeightsKey::radius
float radius
Definition
COM_morphological_distance_feather_weights.hh:26
blender::compositor::MorphologicalDistanceFeatherWeightsKey::hash
uint64_t hash() const
Definition
morphological_distance_feather_weights.cc:35
blender::compositor::MorphologicalDistanceFeatherWeightsKey::MorphologicalDistanceFeatherWeightsKey
MorphologicalDistanceFeatherWeightsKey(int type, float radius)
Definition
morphological_distance_feather_weights.cc:29
blender::compositor::MorphologicalDistanceFeatherWeights
Definition
COM_morphological_distance_feather_weights.hh:44
blender::compositor::MorphologicalDistanceFeatherWeights::MorphologicalDistanceFeatherWeights
MorphologicalDistanceFeatherWeights(Context &context, int type, int radius)
Definition
morphological_distance_feather_weights.cc:50
blender::compositor::MorphologicalDistanceFeatherWeights::~MorphologicalDistanceFeatherWeights
~MorphologicalDistanceFeatherWeights()
Definition
morphological_distance_feather_weights.cc:75
blender::compositor::MorphologicalDistanceFeatherWeights::weights_result
Result weights_result
Definition
COM_morphological_distance_feather_weights.hh:50
blender::compositor::MorphologicalDistanceFeatherWeights::falloffs_result
Result falloffs_result
Definition
COM_morphological_distance_feather_weights.hh:51
blender::compositor::Result
Definition
COM_result.hh:95
b
b
Definition
compositor_morphological_distance_info.hh:24
blender::compositor
Definition
BKE_node.hh:76
blender::compositor::operator==
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
Definition
bokeh_kernel.cc:44
Generated on
for Blender by
doxygen
1.15.0