-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmesh.h
73 lines (56 loc) · 1.29 KB
/
mesh.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
//#define DLLEXPORT __declspec(dllimport)
#include <QPointer>
#include <QSharedPointer>
#include <QVector>
#include <QVector3D>
#include <QVector2D>
#include <QOpenGLFunctions>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QImage>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <shader.h>
#include "stb_image.h"
#include "modeltexture.h"
struct Vertex
{
QVector3D position;
QVector3D normalCoord;
QVector2D textureCoord;
QVector3D tangent;
QVector3D biTangent;
};
struct Texture{
GLuint id;
QString type;
aiString path;
};
struct Material
{
QString Name;
QVector3D Ambient;
QVector3D Diffuse;
QVector3D Specular;
QVector3D Emission;
float Shininess;
};
class Mesh : public QObject
{
Q_OBJECT
public:
QVector<Vertex> vertices;
QVector<GLuint> indices;
QVector<Texture> textures;
QSharedPointer<Material> material;
Mesh(QVector<Vertex> vertices_, QVector<GLuint> indices_, QVector<Texture> textures_, QSharedPointer<Material> material_, QOpenGLContext* ogl);
~Mesh();
QOpenGLContext* ogl_;
void Draw(Shader &shader);
private:
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vbo;
QOpenGLBuffer m_ebo;
void setupMesh();
};