-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_loading.hpp
69 lines (54 loc) · 2.57 KB
/
model_loading.hpp
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
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef MODEL_LOADING_HPP
#define MODEL_LOADING_HPP
#include <glm/glm.hpp>
#include <string>
#include <utility>
#include <vector>
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <functional>
#include "sbpt_generated_includes.hpp"
enum TextureType { DIFFUSE, SPECULAR };
struct TextureInfo {
TextureType type;
std::string path;
};
std::vector<IndexedVertexPositions> parse_model_into_ivps(const std::string &model_path);
std::vector<IVPTextured> parse_model_into_ivpts(const std::string &model_path, bool flip_uvs);
std::vector<IVPNTextured> parse_model_into_ivpnts(const std::string &model_path, bool flip_uvs);
std::string get_directory_of_asset(const std::string &asset_path);
class RecIvpntCollector {
public:
RecIvpntCollector(const std::string &model_path);
std::string directory_to_model;
std::vector<IVPNTextured> ivpnts;
void rec_process_nodes(aiNode *node, const aiScene *scene);
};
class RecIvptCollector {
public:
RecIvptCollector(const std::string &model_path);
std::string directory_to_model;
std::vector<IVPTextured> ivpts;
void rec_process_nodes(aiNode *node, const aiScene *scene);
};
class RecIvpCollector {
public:
std::vector<IndexedVertexPositions> ivps;
void rec_process_nodes(aiNode *node, const aiScene *scene);
};
IndexedVertexPositions process_mesh_ivps(aiMesh *mesh, const aiScene *scene);
IVPTextured process_mesh_ivpts(aiMesh *mesh, const aiScene *scene, const std::string &directory_to_model);
IVPNTextured process_mesh_ivpnts(aiMesh *mesh, const aiScene *scene, const std::string &directory_to_model);
std::vector<unsigned int> process_mesh_indices(aiMesh *mesh);
std::vector<TextureInfo> process_mesh_materials(aiMesh *mesh, const aiScene *scene,
const std::string &directory_to_asset_being_loaded = "");
std::vector<TextureInfo> get_texture_info_for_material(aiMaterial *material, aiTextureType type,
TextureType texture_type,
const std::string &directory_to_asset_being_loaded = "");
std::vector<glm::vec3> process_mesh_vertex_positions(aiMesh *mesh);
std::vector<glm::vec2> process_mesh_texture_coordinates(aiMesh *mesh);
std::vector<glm::vec3> process_mesh_normals(aiMesh *mesh);
glm::vec3 assimp_to_glm_3d_vector(aiVector3D assimp_vector);
std::vector<glm::vec3> get_ordered_vertex_positions(std::vector<glm::vec3> &vertex_positions,
std::vector<unsigned int> &indices);
#endif // MODEL_LOADING_HPP