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