-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.h
More file actions
44 lines (32 loc) · 797 Bytes
/
model.h
File metadata and controls
44 lines (32 loc) · 797 Bytes
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
#pragma once
#ifndef _MODEL_H_
#define _MODEL_H_
#include <glm/glm.hpp>
#include <string>
#include <vector>
struct Index {
int vert;
int norm;
int uv;
};
class Model {
std::vector<glm::vec3> verts = {};
std::vector<glm::vec3> norms = {};
std::vector<glm::vec2> uvs = {};
std::vector<Index> faces = {};
void triangulate();
public:
Model();
Model(const std::string filename);
std::vector<glm::vec4> transformed = {};
int nverts() const;
int nfaces() const;
int nnroms() const;
glm::vec3 vert(const int i);
glm::vec3 norm(const int i);
glm::vec3 vert(const int iface, const int nthvert);
int vertIdx(const int iface, const int nthvert);
glm::vec3 norm(const int iface, const int nthnorm);
int normIdx(const int iface, const int nthnorm);
};
#endif