-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwaveFrontLoader.h
More file actions
77 lines (58 loc) · 1.41 KB
/
waveFrontLoader.h
File metadata and controls
77 lines (58 loc) · 1.41 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef _WAVEFRONTLOADER
#define _WAVEFRONTLOADER
#include "ofMain.h"
class waveFrontLoader {
public:
ofMesh mesh;
waveFrontLoader();
~waveFrontLoader();
void loadFile(const char *fileName);
void loadMaterial(bool load);
ofMesh generateMesh();
private:
typedef struct
{
ofIndexType v1,v2,v3;
ofIndexType vn1,vn2,vn3;
}
Index;
typedef struct
{
float r;
float g;
float b;
}
colorRGB;
typedef struct
{
colorRGB ambientColor;
colorRGB diffuseColor;
colorRGB specularColor;
float alpha;
}
matColor;
std::vector<ofVec3f> vertices;
std::vector<ofVec3f> normals;
std::vector<Index> indices;
std::map<int,ofVec3f>faceVertices;
std::map<int,ofVec3f>faceNormals;
std::map<string,matColor> materialColors;
std::map<int,string>materialLocations;
int indexCount;
int faceCount;
int materialColorCount;
int materialCount;
bool materialBool;
char tempMatName[255];
matColor tempColor;
matColor emptyColor;
void parseLine(char *line);
void parseVertex(char *line);
void parseNormal(char *line);
void parseFace(char *line);
void parseMaterialLocation(char *line);
void parseMaterial(char *line);
void addFace(ofVec3f *vertex, ofVec3f *normal, ofColor *color);
ofColor mapColor(colorRGB vertexColor);
};
#endif