-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathentity.h
135 lines (100 loc) · 2.96 KB
/
entity.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#pragma once
////////////////////////////////////////////////////////////////////
// Class definitions
////////////////////////////////////////////////////////////////////
class Vertex
{
public:
Vector3 p;
double tex[ 2 ];
};
class Texture
{
private:
Texture* m_pNext;
int m_iWidth;
int m_iHeight;
public:
enum eGT { GT_FOUND = 0, GT_LOADED, GT_ERROR };
unsigned int uiID;
char name[ MAX_TEXTURE_LENGTH + 1 ];
Texture ( );
~Texture ( );
Texture* GetTexture ( char *pacTexture_, LPVOID lpView_, DWORD dwFileSize_, eGT &rResult_ );
Texture* GetNext ( ) const { return m_pNext; }
bool IsLast ( ) const;
int GetHeight ( ) const { return m_iHeight; }
int GetWidth ( ) const { return m_iWidth; }
void SetNext ( Texture* pTexture_ );
};
class Poly
{
public:
enum eCP
{
FRONT = 0, SPLIT, BACK, ONPLANE
};
Vertex *verts;
Plane plane;
unsigned int TextureID;
Poly *GetNext ( ) const { return m_pNext; }
Poly *CopyList ( ) const;
Poly *CopyPoly ( ) const;
Poly *ClipToList ( Poly *pPoly_, bool bClipOnPlane_ );
int GetNumberOfVertices ( ) const { return m_iNumberOfVertices; }
void AddVertex ( Vertex &Vertex_ );
void AddPoly ( Poly *pPoly_ );
void SetNext ( Poly *pPoly_ );
void WritePoly ( ofstream &ofsFile_ ) const;
bool CalculatePlane ( );
void SortVerticesCW ( );
void ToLeftHanded ( );
void CalculateTextureCoordinates ( int texWidth, int texHeight, Plane texAxis[ 2 ], double texScale[ 2 ] );
void Poly::SplitPoly ( Poly *pPoly_, Poly **ppFront_, Poly **ppBack_ );
eCP ClassifyPoly ( Poly *pPoly_ );
bool IsLast ( ) const;
const bool operator == ( const Poly &arg_ ) const;
Poly ( );
~Poly ( );
private:
Poly *m_pNext;
int m_iNumberOfVertices;
};
class Property
{
private:
char *m_pacName; // Property's name (zero terminated string)
char *m_pacValue; // Property's value (zero terminated string)
Property *m_pNext; // Next property in linked list
public:
const char *GetName ( ) const { return m_pacName; }
const char *GetValue ( ) const { return m_pacValue; }
Property *GetNext ( ) const { return m_pNext; }
void SetName ( const char *pacName_ );
void SetValue ( const char *pacValue_ );
void SetNext ( Property *pProperty_ );
void WriteProperty ( ofstream &ofsFile_ ) const;
bool IsLast ( ) const;
Property ( );
~Property ( );
};
class Entity
{
private:
Entity *m_pNext;
Property *m_pProperties;
Poly *m_pPolys;
public:
Entity *GetNext ( ) const { return m_pNext; }
Property *GetProperties ( ) { return m_pProperties; }
Poly *GetPolys ( ) const { return m_pPolys; }
unsigned int GetNumberOfProperties ( ) const;
unsigned int GetNumberOfPolys ( ) const;
void AddEntity ( Entity *pEntity_ );
void AddProperty ( Property *pProperty_ );
void AddPoly ( Poly *pPoly_ );
void WriteEntity ( ofstream& ofsFile_ ) const;
bool IsLast ( ) const;
Entity ( );
~Entity ( );
};