Wed, 25 May 2022 17:42:02 +0300
Simplify PolygonCache
118 | 1 | #ifndef VERTEXPROGRAM_H |
2 | #define VERTEXPROGRAM_H | |
3 | #include "basicshaderprogram.h" | |
4 | class Document; | |
5 | ||
6 | class VertexProgram : public AbstractBasicShaderProgram | |
7 | { | |
8 | public: | |
119 | 9 | enum FragmentStyle |
10 | { | |
11 | Normal, | |
12 | Id | |
13 | }; | |
118 | 14 | struct Vertex |
15 | { | |
16 | glm::vec3 position; | |
17 | glm::vec3 color; | |
18 | }; | |
19 | VertexProgram(QObject* parent = nullptr); | |
20 | void build(const Document* document); | |
21 | protected: | |
22 | const char* vertexShaderSource() const override; | |
23 | const char* fragmentShaderSource() const override; | |
24 | const void* vertexData() const override; | |
25 | int vertexSize() const override; | |
26 | int vertexCount() const override; | |
27 | void setupVertexArrays() override; | |
28 | GLenum drawMode() const override; | |
29 | QOpenGLBuffer::UsagePattern usagePattern() const override; | |
119 | 30 | void setFragmentStyle(FragmentStyle newFragmentStyle); |
118 | 31 | private: |
32 | std::vector<Vertex> data; | |
119 | 33 | FragmentStyle fragmentStyle = Normal; |
118 | 34 | }; |
35 | ||
36 | #endif // VERTEXPROGRAM_H |