-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMesh.h
More file actions
48 lines (38 loc) · 961 Bytes
/
Mesh.h
File metadata and controls
48 lines (38 loc) · 961 Bytes
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
#ifndef MESH_H
#define MESH_H
#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions_3_3_Core>
#include <QVector3D>
#include <string>
#include <vector>
#include <memory>
struct Vertex
{
QVector3D position;
QVector3D normal;
QVector3D tangent;
QVector3D bitangent;
QVector2D textureCoordinates;
};
struct Texture
{
unsigned int id;
std::string type;
std::string path;
};
class Mesh
{
public:
std::vector<Vertex> vertices;
std::vector<unsigned int> indices;
std::vector<Texture> textures;
Mesh();
Mesh(std::vector<Vertex> vertices, std::vector<unsigned int> indices, std::vector<Texture> textures);
void clear();
void draw(QOpenGLShaderProgram* program);
private:
std::unique_ptr<QOpenGLFunctions_3_3_Core> openGL = std::make_unique<QOpenGLFunctions_3_3_Core>();
unsigned int VAO, VBO, EBO;
void setupMesh();
};
#endif // MESH_H