Blender
V4.5
source
blender
compositor
cached_resources
COM_keying_screen.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
#include <string>
10
11
#include "
BLI_map.hh
"
12
#include "
BLI_math_vector_types.hh
"
13
14
#include "
DNA_movieclip_types.h
"
15
#include "
DNA_tracking_types.h
"
16
17
#include "
COM_cached_resource.hh
"
18
#include "
COM_result.hh
"
19
20
namespace
blender::compositor
{
21
22
class
Context;
23
24
/* ------------------------------------------------------------------------------------------------
25
* Keying Screen Key.
26
*/
27
class
KeyingScreenKey
{
28
public
:
29
int2
frame
;
30
float
smoothness
;
31
32
KeyingScreenKey
(
int
frame
,
float
smoothness
);
33
34
uint64_t
hash
()
const
;
35
};
36
37
bool
operator==
(
const
KeyingScreenKey
&a,
const
KeyingScreenKey
&
b
);
38
39
/* -------------------------------------------------------------------------------------------------
40
* Keying Screen.
41
*
42
* A cached resource that computes and caches a result containing the keying screen computed by
43
* interpolating the markers of the given movie tracking object in the given movie clip. */
44
class
KeyingScreen
:
public
CachedResource
{
45
public
:
46
Result
result
;
47
48
KeyingScreen
(
Context
&context,
49
MovieClip
*movie_clip,
50
MovieTrackingObject
*movie_tracking_object,
51
const
float
smoothness);
52
53
~KeyingScreen
();
54
55
private
:
56
void
compute_gpu(
Context
&context,
57
const
float
smoothness,
58
Vector<float2>
&marker_positions,
59
const
Vector<float4>
&marker_colors);
60
61
void
compute_cpu(
const
float
smoothness,
62
const
Vector<float2>
&marker_positions,
63
const
Vector<float4>
&marker_colors);
64
};
65
66
/* ------------------------------------------------------------------------------------------------
67
* Keying Screen Container.
68
*/
69
class
KeyingScreenContainer
:
CachedResourceContainer
{
70
private
:
71
Map<std::string, Map<KeyingScreenKey, std::unique_ptr<KeyingScreen>
>> map_;
72
73
/* A map that stores the update counts of the keying screens at the moment they were cached. */
74
Map<std::string, uint64_t>
update_counts_;
75
76
public
:
77
void
reset
()
override
;
78
79
/* Check if the given movie clip ID has changed since the last time it was retrieved through its
80
* recalculate flag, and if so, invalidate its corresponding cached keying screens and reset the
81
* recalculate flag to ready it to track the next change. Then, check if there is an available
82
* KeyingScreen cached resource with the given parameters in the container, if one exists, return
83
* it, otherwise, return a newly created one and add it to the container. In both cases, tag the
84
* cached resource as needed to keep it cached for the next evaluation. */
85
Result
&
get
(
Context
&context,
86
MovieClip
*movie_clip,
87
MovieTrackingObject
*movie_tracking_object,
88
float
smoothness);
89
};
90
91
}
// namespace blender::compositor
BLI_map.hh
BLI_math_vector_types.hh
COM_cached_resource.hh
COM_result.hh
DNA_movieclip_types.h
DNA_tracking_types.h
blender::Map
Definition
BLI_map.hh:129
blender::Vector
Definition
BLI_vector.hh:76
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::KeyingScreenContainer
Definition
COM_keying_screen.hh:69
blender::compositor::KeyingScreenContainer::get
Result & get(Context &context, MovieClip *movie_clip, MovieTrackingObject *movie_tracking_object, float smoothness)
Definition
keying_screen.cc:259
blender::compositor::KeyingScreenContainer::reset
void reset() override
Definition
keying_screen.cc:242
blender::compositor::KeyingScreenKey
Definition
COM_keying_screen.hh:27
blender::compositor::KeyingScreenKey::KeyingScreenKey
KeyingScreenKey(int frame, float smoothness)
Definition
keying_screen.cc:40
blender::compositor::KeyingScreenKey::frame
int2 frame
Definition
COM_keying_screen.hh:29
blender::compositor::KeyingScreenKey::hash
uint64_t hash() const
Definition
keying_screen.cc:45
blender::compositor::KeyingScreenKey::smoothness
float smoothness
Definition
COM_keying_screen.hh:30
blender::compositor::KeyingScreen
Definition
COM_keying_screen.hh:44
blender::compositor::KeyingScreen::~KeyingScreen
~KeyingScreen()
Definition
keying_screen.cc:233
blender::compositor::KeyingScreen::result
Result result
Definition
COM_keying_screen.hh:46
blender::compositor::KeyingScreen::KeyingScreen
KeyingScreen(Context &context, MovieClip *movie_clip, MovieTrackingObject *movie_tracking_object, const float smoothness)
Definition
keying_screen.cc:127
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
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:90
MovieClip
Definition
DNA_movieclip_types.h:57
MovieTrackingObject
Definition
DNA_tracking_types.h:347
blender::VecBase< int32_t, 2 >
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0