LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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 <QtCore>
29#include <QtOpenGL>
30
31#include <optional>
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
50 explicit OpenGlTriangleObject(Type type) noexcept;
52 virtual ~OpenGlTriangleObject() noexcept;
53
54 // General Methods
55 void setData(const QColor& color, const QVector<QVector3D>& data) noexcept;
56 virtual void draw(QOpenGLFunctions& gl, QOpenGLShaderProgram& program,
57 qreal alpha) noexcept override;
58
59 // Operator Overloadings
60 OpenGlTriangleObject& operator=(const OpenGlTriangleObject& rhs) = delete;
61
62private: // Data
63 QOpenGLBuffer mBuffer;
64 int mCount;
65
66 QMutex mMutex;
67 QColor mColor;
68 std::optional<QVector<QVector3D>> mNewTriangles;
69};
70
71/*******************************************************************************
72 * End of File
73 ******************************************************************************/
74
75} // namespace editor
76} // namespace librepcb
77
78#endif
Represents one 3D object in an OpenGL 3D model.
Definition openglobject.h:43
Type
Definition openglobject.h:45
Asynchronously generates a 3D board scene for OpenGL rendering.
Definition opengltriangleobject.h:46
virtual void draw(QOpenGLFunctions &gl, QOpenGLShaderProgram &program, qreal alpha) noexcept override
Definition opengltriangleobject.cpp:62
QMutex mMutex
Definition opengltriangleobject.h:66
QOpenGLBuffer mBuffer
Definition opengltriangleobject.h:63
std::optional< QVector< QVector3D > > mNewTriangles
Definition opengltriangleobject.h:68
void setData(const QColor &color, const QVector< QVector3D > &data) noexcept
Definition opengltriangleobject.cpp:55
OpenGlTriangleObject(const OpenGlTriangleObject &other)=delete
QColor mColor
Definition opengltriangleobject.h:67
virtual ~OpenGlTriangleObject() noexcept
Definition opengltriangleobject.cpp:47
int mCount
Definition opengltriangleobject.h:64
Definition occmodel.cpp:77
Definition uuid.h:186