-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobj.h
45 lines (33 loc) · 1001 Bytes
/
obj.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
#pragma once
#include <vector>
#include "util.h"
#include "Group.h"
#include "VertexCache.h"
struct ObjFile {
ObjFile(std::ifstream &fin, const std::string &name = "NoName");
void toASCII(std::ofstream &fout);
void toBin(std::ofstream &fout);
private:
void AddGroup(const std::string &name)
{
groups.push_back(Group(name));
}
void SetMaterial(const std::string &line)
{
// TODO: Be more useful with Material
//std::cout << "Material: '" << line << "'" << std::endl;
}
int PushVertex(int pos_idx, int tc_idx, int norm_idx);
void AddFace(const std::string &line);
void AddVertex(const std::string &line);
void AddNormal(const std::string &line);
void AddTexcoord(const std::string &line);
std::string name;
public:
std::vector<Group> groups;
std::vector<float3> positions;
std::vector<float3> normals;
std::vector<float2> coords;
std::vector<int> indices;
VertexCache vc;
};