-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.h
45 lines (41 loc) · 1.36 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
#pragma once
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include "Mesh.h"
#include <vector>
#include <string>
#include <map>
#include "Utility.h"
using namespace std;
class Model
{
public:
Model(const string& name, const string& path, Material* mat, bool isInstanced = false, bool gamma = false);
Model(const string& name, Material* mat);
~Model();
virtual void Draw(int numInstances = 1);
void Initialize();
bool SetParameterValue(int id, void* parameterValue);
int GetParameterId(string parameterName);
Material* GetMaterial();
void InitializeInstanced(void* data, int numInstances);
Box GetEnclosingBox();
protected:
void LoadModel();
void ProcessNode(aiNode* node, const aiScene* scene);
void FindAdjacencies(aiMesh* mesh, vector<unsigned int>& indices);
Mesh ProcessMesh(aiMesh* mesh, const aiScene* scene);
vector<Texture> LoadMaterialTextures(aiMaterial* mat, aiTextureType type, string typeName);
unsigned int TextureFromFile(const char *path, const string &directory, bool gamma = false);
/* Data. */
string name;
string path;
string directory;
vector<Mesh> meshes;
Material* material;
vector<Material*> childMaterials;
map<string, Texture> loadedTextures; // maps all the loaded textures so far-- avoids reloading stuff.
bool gammaCorrection;
bool isInstanced;
};