Blender V4.3
COM_distortion_grid.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"
12
13#include "GPU_shader.hh"
14#include "GPU_texture.hh"
15
16#include "DNA_movieclip_types.h"
17
19
21
22class Context;
23
24enum class DistortionType : uint8_t {
25 Distort,
27};
28
29/* ------------------------------------------------------------------------------------------------
30 * Distortion Grid Key.
31 */
46
47bool operator==(const DistortionGridKey &a, const DistortionGridKey &b);
48
49/* -------------------------------------------------------------------------------------------------
50 * Distortion Grid.
51 *
52 * A cached resource that computes and caches a GPU texture containing the normalized coordinates
53 * after applying the camera distortion of a given movie clip tracking camera. See the constructor
54 * for more information. */
56 private:
57 GPUTexture *texture_ = nullptr;
58
59 public:
60 /* The calibration size is the size of the image where the tracking camera was calibrated, this
61 * is the size of the movie clip in most cases. */
62 DistortionGrid(Context &context,
63 MovieClip *movie_clip,
64 int2 size,
65 DistortionType type,
66 int2 calibration_size);
67
69
70 void bind_as_texture(GPUShader *shader, const char *texture_name) const;
71
72 void unbind_as_texture() const;
73};
74
75/* ------------------------------------------------------------------------------------------------
76 * Distortion Grid Container.
77 */
79 private:
81
82 public:
83 void reset() override;
84
85 /* Check if there is an available DistortionGrid cached resource with the given parameters in the
86 * container, if one exists, return it, otherwise, return a newly created one and add it to the
87 * container. In both cases, tag the cached resource as needed to keep it cached for the next
88 * evaluation. */
90 Context &context, MovieClip *movie_clip, int2 size, DistortionType type, int frame_number);
91};
92
93} // namespace blender::realtime_compositor
struct GPUShader GPUShader
DistortionGrid & get(Context &context, MovieClip *movie_clip, int2 size, DistortionType type, int frame_number)
DistortionGridKey(const MovieTrackingCamera &camera, int2 size, DistortionType type, int2 calibration_size)
DistortionGrid(Context &context, MovieClip *movie_clip, int2 size, DistortionType type, int2 calibration_size)
void bind_as_texture(GPUShader *shader, const char *texture_name) const
local_group_size(16, 16) .push_constant(Type b
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
unsigned char uint8_t
Definition stdint.h:78
unsigned __int64 uint64_t
Definition stdint.h:90