LibrePCB Developers Documentation
opengltriangleobject.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_OPENGLTRIANGLEOBJECT_H
21#define LIBREPCB_EDITOR_OPENGLTRIANGLEOBJECT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "openglobject.h"
27
28#include <optional/tl/optional.hpp>
29
30#include <QtCore>
31#include <QtOpenGL>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39/*******************************************************************************
40 * Class OpenGlTriangleObject
41 ******************************************************************************/
42
46class OpenGlTriangleObject final : public OpenGlObject {
47public:
48 // Constructors / Destructor
49 OpenGlTriangleObject() noexcept;
51 virtual ~OpenGlTriangleObject() noexcept;
52
53 // General Methods
54 void setData(const QColor& color, const QVector<QVector3D>& data) noexcept;
55 virtual void draw(QOpenGLFunctions& gl,
56 QOpenGLShaderProgram& program) noexcept override;
57
58 // Operator Overloadings
59 OpenGlTriangleObject& operator=(const OpenGlTriangleObject& rhs) = delete;
60
61private: // Data
62 QOpenGLBuffer mBuffer;
63 int mCount;
64
65 QMutex mMutex;
66 QColor mColor;
67 tl::optional<QVector<QVector3D>> mNewTriangles;
68};
69
70/*******************************************************************************
71 * End of File
72 ******************************************************************************/
73
74} // namespace editor
75} // namespace librepcb
76
77#endif
Represents one 3D object in an OpenGL 3D model.
Definition: openglobject.h:43
Asynchronously generates a 3D board scene for OpenGL rendering.
Definition: opengltriangleobject.h:46
QMutex mMutex
Definition: opengltriangleobject.h:65
QOpenGLBuffer mBuffer
Definition: opengltriangleobject.h:62
void setData(const QColor &color, const QVector< QVector3D > &data) noexcept
Definition: opengltriangleobject.cpp:54
OpenGlTriangleObject(const OpenGlTriangleObject &other)=delete
OpenGlTriangleObject() noexcept
Definition: opengltriangleobject.cpp:38
QColor mColor
Definition: opengltriangleobject.h:66
virtual ~OpenGlTriangleObject() noexcept
Definition: opengltriangleobject.cpp:46
tl::optional< QVector< QVector3D > > mNewTriangles
Definition: opengltriangleobject.h:67
virtual void draw(QOpenGLFunctions &gl, QOpenGLShaderProgram &program) noexcept override
Definition: opengltriangleobject.cpp:61
int mCount
Definition: opengltriangleobject.h:63
Definition: occmodel.cpp:77
Definition: uuid.h:183