Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
VertexArrayBase.h
Go to the documentation of this file.
1#pragma once
2#include <QOpenGLVertexArrayObject>
3#include <misc/gen/TVector.h>
4#include <xgl/Color.h>
5#include <xgl/global.h>
6
7namespace sf::xgl
8{
9
13class _XGL_CLASS VertexArrayBase : public QOpenGLVertexArrayObject
14{
15 Q_OBJECT
16
17 public:
21 typedef unsigned VertexMember;
22
28 {
30 vmPosition = 1 << 0,
32 vmNormal = 1 << 1,
34 vmColor = 1 << 2,
36 vmTexCoord = 1 << 3,
37 };
38
43 {
47 dmDrawElements
48 };
49
53 enum ERenderOption : int
54 {
56 roNone = 0,
58 roWires = 1 << 0,
60 roNormals = 1 << 1
61 };
62 Q_DECLARE_FLAGS(RenderOptions, ERenderOption)
63
64
67 explicit VertexArrayBase(QObject* parent = nullptr);
68
73 virtual void draw() = 0;
74
78 virtual void paint() = 0;
79
84 virtual bool hasColor() const = 0;
85
90 virtual bool hasTexture() const = 0;
91
106 static const Color& getDefaultColor();
107
111 static void setDefaultColor(const QColor& color);
112
117
121 virtual NormalsDataType getNormalsData() const = 0;
122
126 void triggerGenerate();
127
131 void setRenderOptions(RenderOptions options);
132
136 RenderOptions getRenderOptions() const;
137
138 protected:
142 virtual bool setup() = 0;
143
147 virtual void clearData() = 0;
148
152 bool callGenerate();
157 virtual void generate() = 0;
158
166 virtual void modifyContext(bool before, bool draw, size_t mode_index);
167
173 bool isTriggered() const;
174
175 private:
179 bool _triggerGenerate;
180
184 RenderOptions _renderOptions;
185};
186
187}// namespace sf::xgl
Counted vector having additional methods and operators for ease of usage.
Definition TVector.h:25
Color class used in vertex arrays and has layout of 4 x GLfloat.
Definition Color.h:15
Base class for Vertex array derived classes.
Definition VertexArrayBase.h:14
EVertexMember
Possible member of a vertex structure. Where the position can not be omitted as part of the vertex.
Definition VertexArrayBase.h:28
ERenderOption
Render options.
Definition VertexArrayBase.h:54
EDrawMode
Drawing mode of by the template.
Definition VertexArrayBase.h:43
@ dmDrawArrays
Definition VertexArrayBase.h:45
unsigned VertexMember
Type used to describe vertex structure members.
Definition VertexArrayBase.h:21
Definition DemoRenderer.h:6
std::array< GLfloat, 3 > vector3f
Type which correspond with a GLSL type and used to implement Vertex structures.
Definition Types.h:21
#define _XGL_CLASS
Definition xgl/global.h:35