Blender
V5.3
source
blender
editors
space_sequencer
sequencer_strips_batch.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2024 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include "
BLI_array.hh
"
12
#include "
BLI_math_vector_types.hh
"
13
#include "
GPU_shader_shared.hh
"
14
15
namespace
blender
{
16
17
namespace
gpu
{
18
class
Shader
;
19
class
UniformBuf
;
20
}
// namespace gpu
21
struct
View2D
;
22
23
namespace
gpu
{
24
class
Batch;
25
}
26
27
namespace
ed::vse
{
28
29
/* Utility to draw VSE timeline strip widgets in batches, with a dedicated
30
* shader. Internally, strip data for drawing is encoded into a uniform
31
* buffer. Strip coordinates are converted into pixel space, to avoid
32
* precision issues at large frames. Drawing assumes that a pixel space
33
* projection matrix is set. */
34
class
StripsDrawBatch
{
35
SeqContextDrawData context_;
36
Array<SeqStripDrawData>
strips_;
37
gpu::UniformBuf
*ubo_context_ =
nullptr
;
38
gpu::UniformBuf
*ubo_strips_ =
nullptr
;
39
gpu::Shader
*shader_ =
nullptr
;
40
gpu::Batch *batch_ =
nullptr
;
41
int
binding_context_ = 0;
42
int
binding_strips_ = 0;
43
int
strips_count_ = 0;
44
45
float2
view_mask_min_;
46
float2
view_mask_size_;
47
float2
view_cur_min_;
48
float2
view_cur_inv_size_;
49
50
public
:
51
StripsDrawBatch
(
const
View2D
*v2d);
52
~StripsDrawBatch
();
53
54
SeqStripDrawData
&
add_strip
(
float
content_start,
55
float
content_end,
56
float
top,
57
float
bottom,
58
float
content_top,
59
float
left_handle,
60
float
right_handle,
61
float
handle_width,
62
bool
single_image);
63
64
void
flush_batch
();
65
66
/* Same math as `view2d_view_to_region_*` but avoiding divisions,
67
* and without relying on View2D data type. */
68
float
pos_to_pixel_space_x
(
float
x
)
const
69
{
70
return
(view_mask_min_.x + (
x
- view_cur_min_.x) * view_cur_inv_size_.x) * view_mask_size_.x;
71
}
72
float
pos_to_pixel_space_y
(
float
y
)
const
73
{
74
return
(view_mask_min_.y + (
y
- view_cur_min_.y) * view_cur_inv_size_.y) * view_mask_size_.y;
75
}
76
float
size_to_pixel_space_x
(
float
x
)
const
77
{
78
return
x
* view_cur_inv_size_.x * view_mask_size_.x;
79
}
80
81
gpu::UniformBuf
*
get_ubo_context
()
const
82
{
83
return
ubo_context_;
84
}
85
};
86
87
uint
color_pack
(
const
uchar
rgba[4]);
88
float
calc_strip_round_radius
(
float
pixely);
89
90
}
// namespace ed::vse
91
}
// namespace blender
BLI_array.hh
BLI_math_vector_types.hh
GPU_shader_shared.hh
blender::Array
Definition
BLI_array.hh:50
blender::ed::vse::StripsDrawBatch::add_strip
SeqStripDrawData & add_strip(float content_start, float content_end, float top, float bottom, float content_top, float left_handle, float right_handle, float handle_width, bool single_image)
Definition
sequencer_strips_batch.cc:80
blender::ed::vse::StripsDrawBatch::pos_to_pixel_space_x
float pos_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:68
blender::ed::vse::StripsDrawBatch::size_to_pixel_space_x
float size_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:76
blender::ed::vse::StripsDrawBatch::StripsDrawBatch
StripsDrawBatch(const View2D *v2d)
Definition
sequencer_strips_batch.cc:45
blender::ed::vse::StripsDrawBatch::flush_batch
void flush_batch()
Definition
sequencer_strips_batch.cc:112
blender::ed::vse::StripsDrawBatch::get_ubo_context
gpu::UniformBuf * get_ubo_context() const
Definition
sequencer_strips_batch.hh:81
blender::ed::vse::StripsDrawBatch::pos_to_pixel_space_y
float pos_to_pixel_space_y(float y) const
Definition
sequencer_strips_batch.hh:72
blender::gpu::Shader
Definition
gpu_shader_private.hh:52
blender::gpu::UniformBuf
Definition
gpu_uniform_buffer_private.hh:25
y
y
Definition
compositor_morphological_blur_infos.hh:32
blender::ed::vse
Definition
ED_sequencer.hh:26
blender::ed::vse::calc_strip_round_radius
float calc_strip_round_radius(float pixely)
Definition
sequencer_strips_batch.cc:30
blender::ed::vse::color_pack
uint color_pack(const uchar rgba[4])
Definition
sequencer_strips_batch.cc:25
blender::gpu
Definition
blf_internal_types.hh:35
blender
BMesh Iterators.
Definition
ANIM_action.hh:30
blender::uint
unsigned int uint
Definition
BKE_text.h:55
blender::float2
VecBase< float, 2 > float2
Definition
BLI_math_vector_types.hh:798
blender::uchar
unsigned char uchar
Definition
BKE_text.h:58
blender::x
x
Definition
BLI_expr_pylike_eval_test.cc:347
SeqStripDrawData
Definition
GPU_shader_shared.hh:150
blender::View2D
Definition
DNA_view2d_types.h:133
Generated on
for Blender by
doxygen
1.18.0