-
Notifications
You must be signed in to change notification settings - Fork 0
/
Type.h
79 lines (74 loc) · 1.03 KB
/
Type.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
#ifndef TYPE_H
#define TYPE_H
//
// Utitily Vec2, Vec3 and Color classes
//
// Vec3
class Vec3
{
public:
float x,y,z;
Vec3(void)
{
x = y = z = 0;
}
Vec3(float X,float Y,float Z)
{
x = X;
y = Y;
z = Z;
}
};
// Vec2
class Vec2
{
public:
float x,y;
Vec2(void)
{
x = y = 0;
}
Vec2(float X,float Y)
{
x = X;
y = Y;
}
};
// RGB based Color class
class Color
{
private:
float v[4];
public:
float r,g,b,a;
Color()
{
r = 0;
g = 0;
b = 0;
a = 1;
}
Color(float R,float G,float B,float A=1)
{
r = R;
g = G;
b = B;
a = A;
}
Color(const Vec3& V)
{
r = V.x;
g = V.y;
b = V.z;
a = 1;
}
float* fv()
{
v[0] = r;
v[1] = g;
v[2] = b;
v[3] = a;
return v;
}
};
#endif