KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vertex_common.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2013 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
27
28#ifndef VERTEX_COMMON_H_
29#define VERTEX_COMMON_H_
30
31#include <kicad_gl/kiglad.h> // Must be included first
32
33#include <math/vector2d.h>
34
35#include <cstddef>
36
37namespace KIGFX
38{
55
57struct VERTEX
58{
59 GLfloat x, y, z; // Coordinates
60 GLubyte r, g, b, a; // Color
61 GLfloat shader[4]; // Shader type & params
62};
63
64static constexpr size_t VERTEX_SIZE = sizeof( VERTEX );
65static constexpr size_t VERTEX_STRIDE = VERTEX_SIZE / sizeof( GLfloat );
66
67static constexpr size_t COORD_OFFSET = offsetof( VERTEX, x );
68static constexpr size_t COORD_SIZE = sizeof( VERTEX::x ) + sizeof( VERTEX::y ) +
69 sizeof( VERTEX::z );
70static constexpr size_t COORD_STRIDE = COORD_SIZE / sizeof( GLfloat );
71
72static constexpr size_t COLOR_OFFSET = offsetof( VERTEX, r );
73static constexpr size_t COLOR_SIZE = sizeof( VERTEX::r ) + sizeof( VERTEX::g ) +
74 sizeof( VERTEX::b ) + sizeof( VERTEX::a );
75static constexpr size_t COLOR_STRIDE = COLOR_SIZE / sizeof( GLubyte );
76
77// Shader attributes
78static constexpr size_t SHADER_OFFSET = offsetof( VERTEX, shader );
79static constexpr size_t SHADER_SIZE = sizeof( VERTEX::shader );
80static constexpr size_t SHADER_STRIDE = SHADER_SIZE / sizeof( GLfloat );
81
82static constexpr size_t INDEX_SIZE = sizeof( GLuint );
83
84} // namespace KIGFX
85
86#endif /* VERTEX_COMMON_H_ */
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
static constexpr size_t COLOR_OFFSET
static constexpr size_t COORD_OFFSET
static constexpr size_t VERTEX_SIZE
SHADER_MODE
< Possible types of shaders (keep consistent with the actual shader source in kicad_vert....
@ SHADER_NONE
@ SHADER_LINE_C
@ SHADER_LINE_B
@ SHADER_FONT
@ SHADER_LINE_F
@ SHADER_LINE_E
@ SHADER_STROKED_CIRCLE
@ SHADER_HOLE_WALL
@ SHADER_LINE_A
@ SHADER_LINE_D
@ SHADER_FILLED_CIRCLE
static constexpr size_t SHADER_OFFSET
static constexpr size_t COLOR_STRIDE
static constexpr size_t SHADER_SIZE
static constexpr size_t VERTEX_STRIDE
static constexpr size_t COORD_SIZE
static constexpr size_t INDEX_SIZE
static constexpr size_t SHADER_STRIDE
static constexpr size_t COORD_STRIDE
static constexpr size_t COLOR_SIZE
GLfloat shader[4]