-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.h
More file actions
37 lines (31 loc) · 917 Bytes
/
Model.h
File metadata and controls
37 lines (31 loc) · 917 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
#ifndef MODEL_H
#define MODEL_H
#include <string>
#include <vector>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <glad/glad.h>
#include "shaderClass.h"
#include "Texture.h"
struct Mesh {
// OpenGL 2.1 doesn't use VAOs, so we just store VBO and EBO
unsigned int VBO, EBO;
unsigned int indexCount;
unsigned int materialIndex;
};
class Model {
public:
Model(const char* path);
~Model();
void Draw(Shader& shader);
private:
std::vector<Mesh> meshes;
std::vector<Texture*> textures;
std::vector<Texture*> loadedTextures;
std::string directory;
void loadModel(const std::string& path);
void processMesh(aiMesh* mesh, const aiScene* scene);
void loadMaterialTextures(aiMaterial* mat, aiTextureType type, unsigned int materialIndex);
};
#endif // MODEL_H