-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mesh.h
60 lines (48 loc) · 1.22 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
#ifndef MESH_H
#define MESH_H
#include <glad/glad.h> // holds all OpenGL type declarations
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "Shader.h"
#include"Texture.h"
#include <string>
#include <vector>
using namespace std;
#define MAX_BONE_INFLUENCE 4
struct Vertex {
// position
glm::vec3 Position;
// normal
glm::vec3 Normal;
// texCoords
glm::vec2 TexCoords;
// tangent
glm::vec3 Tangent;
// bitangent
glm::vec3 Bitangent;
//bone indexes which will influence this vertex
int m_BoneIDs[MAX_BONE_INFLUENCE];
//weights from each bone
float m_Weights[MAX_BONE_INFLUENCE];
};
class Mesh {
public:
// mesh Data
vector<Vertex> vertices;
vector<unsigned int> indices;
vector<Texture2D> textures;
//std::vector<float> boundingBox;
unsigned int VAO;
// constructor
Mesh() {};
Mesh(vector<Vertex> vertices, vector<unsigned int> indices, vector<Texture2D> textures);
Mesh(vector<Vertex> vertices, vector<unsigned int> indices);
// render the mesh
void Draw(Shader& shader);
private:
// render data
unsigned int VBO, EBO;
// initializes all the buffer objects/arrays
void setupMesh();
};
#endif