-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.h
47 lines (37 loc) · 1.69 KB
/
model.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
/*******************************************************************
** Taken and adapted from learnopengl.com (loading model tutorial)
******************************************************************/
#pragma once
// Std. Includes
#include <string>
#include <vector>
using namespace std;
// GL Includes
#include <GL/glew.h> // Contains all the necessery OpenGL includes
#include <glm/glm.hpp>
#include <assimp/scene.h>
#include "Mesh.h"
#include "state_manager.h"
class Model
{
friend class ResourceManager;
public:
/* Model Data */
glm::vec3 Span_lrf, Span_udb; //distance between each side of the model and its origin (left,right, front and up,down,back)
// Constructor.
Model();
// Draws the model, and thus all its meshes
void Draw(StateManager &manager, Shader shader, glm::vec3 position, glm::vec3 size, glm::vec3 rotation, glm::vec3 color, GLfloat alpha, glm::mat4 projection, glm::mat4 view);
private:
/* Model Data */
vector<Mesh> meshes;
string directory;
vector<Texture> textures_loaded; // Stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.
/* Functions */
// Processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).
void processNode(aiNode* node, const aiScene* scene);
Mesh processMesh(aiMesh* mesh, const aiScene* scene);
// Checks all material textures of a given type and loads the textures if they're not loaded yet.
// The required info is returned as a Texture struct.
vector<Texture> loadMaterialTextures(aiMaterial* mat, aiTextureType type, string typeName);
};