Blender
V4.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
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::seq
{
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
inline
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
inline
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
inline
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::seq
BLI_array.hh
BLI_math_vector_types.hh
uchar
unsigned char uchar
Definition
BLI_sys_types.h:71
uint
unsigned int uint
Definition
BLI_sys_types.h:68
GPU_shader_shared.hh
GPUShader
struct GPUShader GPUShader
Definition
blender/display_driver.h:21
blender::Array
Definition
BLI_array.hh:50
blender::ed::seq::StripsDrawBatch
Definition
sequencer_strips_batch.hh:30
blender::ed::seq::StripsDrawBatch::flush_batch
void flush_batch()
Definition
sequencer_strips_batch.cc:114
blender::ed::seq::StripsDrawBatch::StripsDrawBatch
StripsDrawBatch(const View2D *v2d)
Definition
sequencer_strips_batch.cc:45
blender::ed::seq::StripsDrawBatch::~StripsDrawBatch
~StripsDrawBatch()
Definition
sequencer_strips_batch.cc:72
blender::ed::seq::StripsDrawBatch::pos_to_pixel_space_x
float pos_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:64
blender::ed::seq::StripsDrawBatch::pos_to_pixel_space_y
float pos_to_pixel_space_y(float y) const
Definition
sequencer_strips_batch.hh:68
blender::ed::seq::StripsDrawBatch::get_ubo_context
GPUUniformBuf * get_ubo_context() const
Definition
sequencer_strips_batch.hh:77
blender::ed::seq::StripsDrawBatch::size_to_pixel_space_x
float size_to_pixel_space_x(float x) const
Definition
sequencer_strips_batch.hh:72
blender::ed::seq::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::seq
Definition
sequencer_intern.hh:50
blender::ed::seq::color_pack
uint color_pack(const uchar rgba[4])
Definition
sequencer_strips_batch.cc:25
blender::ed::seq::calc_strip_round_radius
float calc_strip_round_radius(float pixely)
Definition
sequencer_strips_batch.cc:30
blender::gpu
Definition
blf_internal_types.hh:23
SeqStripDrawData
Definition
GPU_shader_shared.hh:119
View2D
Definition
DNA_view2d_types.h:16
blender::VecBase< float, 2 >
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0