1 #ifndef CONVERSION_H
2 #define CONVERSION_H
3 #include <GL/gl.h>
4 
5 #include "ui_pieexport.h"
6 
7 #define VERTICES_PER_TRIANGLE 3
8 
9 // Load PIE files
10 #define iV_IMD_TEX	0x00000200
11 #define iV_IMD_XNOCUL	0x00002000
12 #define iV_IMD_TEXANIM	0x00004000
13 #define iV_IMD_TCMASK	0x00010000
14 #define MAX_POLYGON_SIZE 16
15 
16 #define OLD_TEXTURE_SIZE_FIX 256.0f
17 
18 #define pie_MAX_VERTICES		768
19 #define pie_MAX_POLYGONS		512
20 #define pie_MAX_VERTICES_PER_POLYGON	6
21 
22 typedef struct
23 {
24 	int index[MAX_POLYGON_SIZE];
25 	GLfloat texCoord[MAX_POLYGON_SIZE][2];
26 	int vertices;
27 	int frames, rate; // animation data
28 	GLfloat  width, height; // animation data
29 	bool cull;
30 } WZ_FACE;
31 
32 typedef struct
33 {
34 	GLfloat x, y, z;
35 } WZ_POSITION;
36 
37 class pie_Point
38 {
39 private:
40 	GLfloat x, y, z;
41 public:
42 
pie_Point(GLfloat x,GLfloat y,GLfloat z)43 	pie_Point(GLfloat x, GLfloat y, GLfloat z)
44 	{
45 		this->x = x;
46 		this->y = y;
47 		this->z = z;
48 	}
49 
getXYZ(GLfloat & x,GLfloat & y,GLfloat & z)50 	void getXYZ(GLfloat &x, GLfloat &y, GLfloat &z) const
51 	{
52 		x = this->x;
53 		y = this->y;
54 		z = this->z;
55 	}
56 
57 	bool operator < (const pie_Point& rhs) const
58 	{
59 		if (this->x == rhs.x && this->y == rhs.y)
60 		{
61 			return (this->z < rhs.z);
62 		}
63 		else if (this->x == rhs.x)
64 		{
65 			return (this->y < rhs.y);
66 		}
67 		else
68 		{
69 			return (this->x < rhs.x);
70 		}
71 	}
72 
73 	bool operator == (const pie_Point& rhs) const
74 	{
75 		return (this->x == rhs.x && this->x == rhs.x && this->x == rhs.x);
76 	}
77 };
78 
79 struct textCoords
80 {
81 	GLfloat u, v;
textCoordstextCoords82 	textCoords(GLfloat u, GLfloat v)
83 	{
84 		this->u = u;
85 		this->v = v;
86 	}
87 };
88 
89 /** PIE Export dialog*/
90 class QPieExportDialog : public QDialog, private Ui_PieExportDialog
91 {
92 public:
93 	QPieExportDialog(QWidget *parent = 0);
94 	~QPieExportDialog();
95 	int getPieVersion();
96 	int getFlags();
97 };
98 #endif // CONVERSION_H
99