Blender V4.3
sequencer_quads_batch.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
9#pragma once
10
11#include "BLI_sys_types.h"
12
13namespace blender::gpu {
14class Batch;
15class IndexBuf;
16class VertBuf;
17} // namespace blender::gpu
18struct ColorVertex;
19
29 public:
32
34 void draw();
36 void add_quad(float x1, float y1, float x2, float y2, const uchar color[4])
37 {
38 add_quad(x1, y1, x1, y2, x2, y1, x2, y2, color, color, color, color);
39 }
41 void add_quad(float x1,
42 float y1,
43 float x2,
44 float y2,
45 float x3,
46 float y3,
47 float x4,
48 float y4,
49 const uchar color[4])
50 {
51 add_quad(x1, y1, x2, y2, x3, y3, x4, y4, color, color, color, color);
52 }
54 void add_quad(float x1,
55 float y1,
56 float x2,
57 float y2,
58 float x3,
59 float y3,
60 float x4,
61 float y4,
62 const uchar color1[4],
63 const uchar color2[4],
64 const uchar color3[4],
65 const uchar color4[4]);
67 void add_wire_quad(float x1, float y1, float x2, float y2, const uchar color[4]);
69 void add_line(float x1, float y1, float x2, float y2, const uchar color[4])
70 {
71 add_line(x1, y1, x2, y2, color, color);
72 }
74 void add_line(
75 float x1, float y1, float x2, float y2, const uchar color1[4], const uchar color2[4]);
76
77 private:
78 static constexpr int MAX_QUADS = 1024;
79 static constexpr int MAX_LINES = 4096;
80
81 blender::gpu::VertBuf *vbo_quads = nullptr;
82 blender::gpu::IndexBuf *ibo_quads = nullptr;
83 blender::gpu::Batch *batch_quads = nullptr;
84 ColorVertex *verts_quads = nullptr;
85 int quads_num = 0;
86
87 blender::gpu::VertBuf *vbo_lines = nullptr;
88 blender::gpu::Batch *batch_lines = nullptr;
89 ColorVertex *verts_lines = nullptr;
90 int lines_num = 0;
91};
unsigned char uchar
void add_line(float x1, float y1, float x2, float y2, const uchar color[4])
void add_quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const uchar color[4])
void add_wire_quad(float x1, float y1, float x2, float y2, const uchar color[4])
void add_quad(float x1, float y1, float x2, float y2, const uchar color[4])