Blender
V5.0
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::gpu
{
16
class
Shader
;
17
class
UniformBuf
;
18
}
// namespace blender::gpu
19
struct
View2D
;
20
21
namespace
blender::gpu
{
22
class
Batch;
23
}
24
25
namespace
blender::ed::vse
{
26
27
/* Utility to draw VSE timeline strip widgets in batches, with a dedicated
28
* shader. Internally, strip data for drawing is encoded into a uniform
29
* buffer. Strip coordinates are converted into pixel space, to avoid
30
* precision issues at large frames. Drawing assumes that a pixel space
31
* projection matrix is set. */
32
class
StripsDrawBatch
{
33
SeqContextDrawData context_;
34
Array<SeqStripDrawData>
strips_;
35
gpu::UniformBuf
*ubo_context_ =
nullptr
;
36
gpu::UniformBuf
*ubo_strips_ =
nullptr
;
37
gpu::Shader
*shader_ =
nullptr
;
38
gpu::Batch *batch_ =
nullptr
;
39
int
binding_context_ = 0;
40
int
binding_strips_ = 0;
41
int
strips_count_ = 0;
42
43
float2
view_mask_min_;
44
float2
view_mask_size_;
45
float2
view_cur_min_;
46
float2
view_cur_inv_size_;
47
48
public
:
49
StripsDrawBatch
(
const
View2D
*v2d);
50
~StripsDrawBatch
();
51
52
SeqStripDrawData
&
add_strip
(
float
content_start,
53
float
content_end,
54
float
top
,
55
float
bottom,
56
float
content_top,
57
float
left_handle,
58
float
right_handle,
59
float
handle_width,
60
bool
single_image);
61
62
void
flush_batch
();
63
64
/* Same math as `UI_view2d_view_to_region_*` but avoiding divisions,
65
* and without relying on View2D data type. */
66
float
pos_to_pixel_space_x
(
float
x
)
const
67
{
68
return
(view_mask_min_.x + (
x
- view_cur_min_.x) * view_cur_inv_size_.x) * view_mask_size_.x;
69
}
70
float
pos_to_pixel_space_y
(
float
y
)
const
71
{
72
return
(view_mask_min_.y + (
y
- view_cur_min_.y) * view_cur_inv_size_.y) * view_mask_size_.y;
73
}
74
float
size_to_pixel_space_x
(
float
x
)
const
75
{
76
return
x
* view_cur_inv_size_.x * view_mask_size_.x;
77
}
78
79
gpu::UniformBuf
*
get_ubo_context
()
const
80
{
81
return
ubo_context_;
82
}
83
};
84
85
uint
color_pack
(
const
uchar
rgba[4]);
86
float
calc_strip_round_radius
(
float
pixely);
87
88
}
// namespace blender::ed::vse
BLI_array.hh
x
x
Definition
BLI_expr_pylike_eval_test.cc:345
BLI_math_vector_types.hh
uchar
unsigned char uchar
Definition
BLI_sys_types.h:67
uint
unsigned int uint
Definition
BLI_sys_types.h:64
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:82
blender::ed::vse::StripsDrawBatch::pos_to_pixel_space_x
float pos_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:66
blender::ed::vse::StripsDrawBatch::size_to_pixel_space_x
float size_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:74
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:114
blender::ed::vse::StripsDrawBatch::get_ubo_context
gpu::UniformBuf * get_ubo_context() const
Definition
sequencer_strips_batch.hh:79
blender::ed::vse::StripsDrawBatch::pos_to_pixel_space_y
float pos_to_pixel_space_y(float y) const
Definition
sequencer_strips_batch.hh:70
blender::ed::vse::StripsDrawBatch::~StripsDrawBatch
~StripsDrawBatch()
Definition
sequencer_strips_batch.cc:72
blender::gpu::Shader
Definition
gpu_shader_private.hh:43
blender::gpu::UniformBuf
Definition
gpu_uniform_buffer_private.hh:25
y
y
Definition
compositor_morphological_blur_infos.hh:22
top
uint top
Definition
gpu_framebuffer.cc:580
blender::ed::vse
Definition
ED_sequencer.hh:19
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:32
blender::float2
VecBase< float, 2 > float2
Definition
BLI_math_vector_types.hh:618
SeqStripDrawData
Definition
GPU_shader_shared.hh:150
View2D
Definition
DNA_view2d_types.h:16
Generated on
for Blender by
doxygen
1.16.1