-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model.h
58 lines (40 loc) · 1.23 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
47
48
49
50
51
52
53
54
55
56
57
#ifndef MODEL_CLASS_H
#define MODEL_CLASS_H
#include <json/json.h>
#include "Mesh.h"
using json = nlohmann::json;
class Model
{
private:
const char* file;
std::vector<unsigned char> data;
json JSON;
std::vector<std::string> loadedTexName;
std::vector<Texture> loadedTex;
void LoadMesh(unsigned int indMesh);
void TraverseNode(unsigned int nextNode, glm::mat4 matrix = glm::mat4(1.0f));
std::vector <unsigned char> GetData();
std::vector <float> GetFloats(json accessor);
std::vector<GLuint> GetIndices(json accessor);
std::vector<Texture> GetTextures();
std::vector<Vertex> AssembleVertices
(
std::vector<glm::vec3> positions,
std::vector<glm::vec3> normals,
std::vector<glm::vec2> texUVs
);
std::vector<glm::vec2> GroupFloatsVec2(std::vector<float> floatVec);
std::vector<glm::vec3> GroupFloatsVec3(std::vector<float> floatVec);
std::vector<glm::vec4> GroupFloatsVec4(std::vector<float> floatVec);
public:
std::vector<Mesh> meshes;
glm::vec3 defaultColor;
// TO DO: Create a parent transform matrix and pass it to the TraverseNode in the constructor
Model(const char* file, glm::vec3 defaultColor = glm::vec3(1.0f, 1.0f, 1.0f));
void Draw
(
Shader& shader,
Camera& camera
);
};
#endif // !MODEL_CLASS_H