-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.h
More file actions
51 lines (41 loc) · 1.09 KB
/
model.h
File metadata and controls
51 lines (41 loc) · 1.09 KB
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
#ifndef __MODEL_H__
#define __MODEL_H__
#include <vector>
#include "geometry.h"
#include "tgaimage.h"
class Model {
private:
std::vector<Vec3f> verts{};
std::vector<Vec3f> textures{};
std::vector<Vec3f> norms{};
std::vector<std::vector<int>> faces_verts{};
std::vector<std::vector<int>> faces_texts{};
std::vector<std::vector<int>> faces_norms{};
TGAImage diffuse_map{};
TGAImage normal_map{};
TGAImage specular_map{};
void load_map(const char* texts_file, TGAImage& img);
public:
Model(
const char *obj_file,
const char *texts_file,
const char *nm_file,
const char *spec_file
);
~Model();
int nverts();
int nfaces();
Vec3f vert(int i);
Vec3f texture_vert(int i);
Vec3f vert_norm(int i);
Vec3f vert(int iface, int nthvert);
Vec3f texture_vert(int iface, int nthvert);
Vec3f vert_norm(int iface, int nthvert);
std::vector<int> face_verts(int idx);
std::vector<int> face_texts(int idx);
std::vector<int> face_norms(int idx);
TGAColor diffuse(Vec2f texture_coords);
Vec3f normal(Vec2f texture_coords);
float specular(Vec2f uvf);
};
#endif //__MODEL_H__