-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmodel.h
executable file
·78 lines (64 loc) · 1.46 KB
/
model.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef MODEL_H
#define MODEL_H
#include <QObject>
#include <QPainter>
#include <QPaintEngine>
#include <QMap>
#include <QVector>
#include "glm.h"
class QOpenGLContext;
class QOpenGLShaderProgram;
class ModelTriangle
{
public:
QVector<QVector3D> vertices;
QVector<QVector3D> normals;
QVector<QVector3D> texcoords;
QVector<QVector4D> colors4;
int vertex1;
int vertex2;
int vertex3;
signals:
public slots:
};
class ModelGroup
{
public:
QVector<ModelTriangle*> triangles;
signals:
public slots:
};
class Model
{
public:
Model(QString filename);
// functions
void load(QString filename);
void draw(QMatrix4x4 modelview);
void setTexture(GLuint texture);
bool setVertexShaderFile(QString filename);
bool setFragmentShaderFile(QString filename);
void setProgram(QOpenGLShaderProgram *program);
bool linkShaderProgram();
void initShaderProgram();
void updateColorForVertex(int vertex, qreal r, qreal g, qreal b, qreal a);
QMap<int, QVector<QVector<int> > > trianglesMap;
void resetColors();
// variables
GLMmodel *model;
QVector<QVector3D> vertices;
QVector<QVector3D> normals;
QVector<ModelGroup> groups;
GLuint texture;
QOpenGLShaderProgram* program;
int vertexAttr;
int normalAttr;
int matrixUniform;
int texCoordAttr;
int textureUniform;
int colorAttr;
int readGreyBrain;
int lightAttr;
QOpenGLContext* context;
};
#endif // MODEL_H