[go: up one dir, main page]

Menu

[r21]: / include / obj.h  Maximize  Restore  History

Download this file

72 lines (54 with data), 1.6 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
#ifndef OBJ_H
#define OBJ_H
using namespace std;
/*-----------------------------------------------------------------//
//Here we have our data types our loader class will need and use...//
// */
struct ObjVertex{
float X, Y, Z;
};
struct ObjNormal{
float X, Y, Z;
};
struct ObjTexCoord{
float U, V;
};
struct ObjTriangle{
int Vertex[3];
int Normal[3];
int TexCoord[3];
int Texture;
};
class ObjModel {
public:
ObjModel();
~ObjModel();
ObjModel(const ObjModel& copy);
ObjModel& operator=(const ObjModel& right);
int NumVertex, NumNormal, NumTexCoord, NumTriangle;
ObjVertex *VertexArray;
ObjNormal *NormalArray;
ObjTexCoord *TexCoordArray;
ObjTriangle *TriangleArray;
};
/* //
//-----------------------------------------------------------------*/
/*-----------------------------------------------------------------//
// The meat of the sandwitch, the class to load .obj files //
// */
class ObjLoader {
public:
ObjLoader();
~ObjLoader();
ObjLoader(string file);
void LoadObj(string file);
void FreeObj(void);
ObjModel ReturnObj(void);
protected:
string *fileName;
ObjModel *theObj;
void ReadData(void);
};
/* //
//-----------------------------------------------------------------*/
#endif