SuperimposeMesh
All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Model.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD 3-Clause license. See the accompanying LICENSE file for details.
6  */
7 
8 #ifndef MODEL_H
9 #define MODEL_H
10 
11 #include <SuperimposeMesh/Shader.h>
12 #include <SuperimposeMesh/Mesh.h>
13 
14 #include <vector>
15 #include <string>
16 
17 #include <assimp/scene.h>
18 
19 #include <GL/glew.h>
20 
21 
22 class Model
23 {
24 public:
25  Model(const GLchar* path);
26 
27  void Draw(Shader shader);
28 
29  bool has_texture();
30 
31 protected:
32  void loadModel(std::string path);
33 
34  void processNode(aiNode* node, const aiScene* scene);
35 
36  Mesh processMesh(aiMesh* mesh, const aiScene* scene);
37 
38  GLint TextureFromFile(const char* path, std::string directory);
39 
40  std::vector<Mesh::Texture> loadMaterialTextures(aiMaterial* mat, aiTextureType type, std::string typeName);
41 
42 private:
43  std::vector<Mesh> meshes_;
44 
45  std::string directory_;
46 
47  std::vector<Mesh::Texture> textures_loaded_;
48 };
49 
50 #endif /* MODEL_H */
void Draw(Shader shader)
Definition: Model.cpp:27
Definition: Shader.h:17
Definition: Mesh.h:23
Mesh processMesh(aiMesh *mesh, const aiScene *scene)
Definition: Model.cpp:84
std::vector< Mesh::Texture > textures_loaded_
Definition: Model.h:47
void loadModel(std::string path)
Definition: Model.cpp:42
Model(const GLchar *path)
Definition: Model.cpp:21
Definition: Model.h:22
std::string directory_
Definition: Model.h:45
bool has_texture()
Definition: Model.cpp:36
void processNode(aiNode *node, const aiScene *scene)
Definition: Model.cpp:67
GLint TextureFromFile(const char *path, std::string directory)
Definition: Model.cpp:176
std::vector< Mesh::Texture > loadMaterialTextures(aiMaterial *mat, aiTextureType type, std::string typeName)
Definition: Model.cpp:139
std::vector< Mesh > meshes_
Definition: Model.h:43