-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesh.h
57 lines (46 loc) · 1.07 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
// http://learnopengl.com/
#ifndef MESH_H
#define MESH_H
#define MAX_BONE_INFLUENCE 4
#include <vector>
#include <string>
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class Shader;
struct Vertex
{
glm::vec3 Position;
glm::vec3 Normal;
glm::vec2 TexCoords;
glm::vec3 Tangent;
glm::vec3 Bitangent;
int m_BoneIDs[MAX_BONE_INFLUENCE];
float m_Weights[MAX_BONE_INFLUENCE];
};
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;
unsigned int VAO;
Mesh(const std::vector<Vertex> &vertices,
const std::vector<unsigned int> &indices,
const std::vector<Texture> &textures);
Mesh(std::vector<Vertex> &&vertices,
std::vector<unsigned int> &&indices,
std::vector<Texture> &&textures);
void Draw(Shader &shader);
private:
unsigned int VBO, EBO;
void setupMesh();
};
#endif