LibrePCB Developers Documentation
Loading...
Searching...
No Matches
openglobject.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_OPENGLOBJECT_H
21#define LIBREPCB_EDITOR_OPENGLOBJECT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtOpenGL>
28#include <QtWidgets>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34namespace editor {
35
36/*******************************************************************************
37 * Class OpenGlObject
38 ******************************************************************************/
39
44public:
45 enum class Type {
46 Board,
47 Copper,
51 Device,
52 };
53
54 // Constructors / Destructor
55 OpenGlObject() = delete;
56 explicit OpenGlObject(Type type) noexcept : mType(type) {}
57 OpenGlObject(const OpenGlObject& other) noexcept = delete;
58 virtual ~OpenGlObject() noexcept = default;
59
60 // General Methods
61 Type getType() const noexcept { return mType; }
62 virtual void draw(QOpenGLFunctions& gl, QOpenGLShaderProgram& program,
63 qreal alpha) noexcept = 0;
64
65protected:
66 const Type mType;
67};
68
69/*******************************************************************************
70 * End of File
71 ******************************************************************************/
72
73} // namespace editor
74} // namespace librepcb
75
76#endif
Represents one 3D object in an OpenGL 3D model.
Definition openglobject.h:43
virtual ~OpenGlObject() noexcept=default
OpenGlObject(const OpenGlObject &other) noexcept=delete
Type
Definition openglobject.h:45
Type getType() const noexcept
Definition openglobject.h:61
virtual void draw(QOpenGLFunctions &gl, QOpenGLShaderProgram &program, qreal alpha) noexcept=0
const Type mType
Definition openglobject.h:66
OpenGlObject(Type type) noexcept
Definition openglobject.h:56
Definition occmodel.cpp:77