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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
31
32#ifndef VERTEX_COMMON_H_
33#define VERTEX_COMMON_H_
34
35#include <gal/opengl/kiglew.h> // Must be included first
36
37#include <math/vector2d.h>
38
39#include <cstddef>
40
41namespace KIGFX
42{
59
61struct VERTEX
62{
63 GLfloat x, y, z; // Coordinates
64 GLubyte r, g, b, a; // Color
65 GLfloat shader[4]; // Shader type & params
66};
67
68static constexpr size_t VERTEX_SIZE = sizeof( VERTEX );
69static constexpr size_t VERTEX_STRIDE = VERTEX_SIZE / sizeof( GLfloat );
70
71static constexpr size_t COORD_OFFSET = offsetof( VERTEX, x );
72static constexpr size_t COORD_SIZE = sizeof( VERTEX::x ) + sizeof( VERTEX::y ) +
73 sizeof( VERTEX::z );
74static constexpr size_t COORD_STRIDE = COORD_SIZE / sizeof( GLfloat );
75
76static constexpr size_t COLOR_OFFSET = offsetof( VERTEX, r );
77static constexpr size_t COLOR_SIZE = sizeof( VERTEX::r ) + sizeof( VERTEX::g ) +
78 sizeof( VERTEX::b ) + sizeof( VERTEX::a );
79static constexpr size_t COLOR_STRIDE = COLOR_SIZE / sizeof( GLubyte );
80
81// Shader attributes
82static constexpr size_t SHADER_OFFSET = offsetof( VERTEX, shader );
83static constexpr size_t SHADER_SIZE = sizeof( VERTEX::shader );
84static constexpr size_t SHADER_STRIDE = SHADER_SIZE / sizeof( GLfloat );
85
86static constexpr size_t INDEX_SIZE = sizeof( GLuint );
87
88} // namespace KIGFX
89
90#endif /* VERTEX_COMMON_H_ */
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:33
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]