forked from Blackcatn13/houseDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtil.h
More file actions
143 lines (123 loc) · 2.79 KB
/
Util.h
File metadata and controls
143 lines (123 loc) · 2.79 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
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
136
137
138
139
140
141
142
143
#ifndef _UTIL_H
#define _UTIL_H
#include "Point3D.h"
#include <string>
using namespace std;
#define PI 3.14159265358979323846
#define PI_2 1.57079632679489661923
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#ifdef FREEGLUT
#include <GL/freeglut.h>
#else
#include <GL/glut.h>
#endif
#endif
#include <math.h>
#include <QDebug>
#define FLOOR_HEIGHT 3
#define INIT_WIDTH 800
#define INIT_HEIGHT 600
#define STAIR_HEIGHT 0.75f
#define STAIR_WIDTH 1
#define STAIR_DEEP 4
enum Views {PERSPECTIVE, ORTHOGONAL, FP};
enum Modes {EDITOR_2D, EXPLORER, EXPLORER_ISO};
enum Types {WALL, OBJECT, FLOOR, LIGHT, STAIR, NEITHER};
enum EditModes {SELECTING, INSERTING, DELETING, NOTHING};
enum sType {LIGHTSHADER, TEXTURE, SIMPLE, NOSHADER, ONETEXTURE};
struct Point2D{
GLfloat x;
GLfloat y;
Point2D()
{
x = 0.0;
y = 0.0;
}
Point2D(float nx, float ny)
{
x = nx;
y = ny;
}
};
struct materials
{
string M1;
string M2;
string M3;
string M4;
};
struct colors
{
CPoint3D c1;
CPoint3D c2;
CPoint3D c3;
CPoint3D c4;
};
struct textures
{
string ObjectName;
materials material;
colors color;
};
struct ModelInfo{
CPoint3D position;
CPoint3D rotation;
CPoint3D scale;
CPoint3D center;
string modelName;
float radius;
textures textureName;
Types type;
ModelInfo()
{
position = CPoint3D();
rotation = CPoint3D();
scale = CPoint3D(1, 1, 1);
center = CPoint3D(0,0,0);
modelName = "";
radius = 0;
textureName.ObjectName = "";
textureName.material.M1 = "";
textureName.material.M2 = "";
textureName.material.M3 = "";
textureName.material.M4 = "";
type = NEITHER;
}
ModelInfo(CPoint3D pos, CPoint3D rot, CPoint3D sc, CPoint3D c, string name, string texture, float rad, Types t)
{
position = pos;
rotation = rot;
scale = sc;
center = c;
modelName = name;
radius = rad;
textureName.ObjectName = texture;
type = t;
}
bool operator==(const ModelInfo &mi) const
{
if(type != mi.type)
return false;
if(modelName != mi.modelName)
return false;
if(position != mi.position)
return false;
if(rotation != mi.rotation)
return false;
return true;
}
// Modificar constructor per tal de poder pasarli parametres i segons el tipus de model
// fdeixarne alguns com a predefinits.
// Override metode ==
};
#endif /* _UTIL_H */