-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kierunkowskaz.cpp
84 lines (65 loc) · 2.44 KB
/
Kierunkowskaz.cpp
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
#include "Kierunkowskaz.h"
Kierunkowskaz::Kierunkowskaz(float x, float y, float z, bool isTurn) {
this->x = x;
this->y = y;
this->z = z;
this->isTurn = isTurn;
}
void Kierunkowskaz::draw() {
glPushMatrix();
glTranslatef(x, y, z);
float halfWidth = 0.1f / 2.0f;
float halfHeight = 0.05f / 2.0f;
float halfDepth = 0.05f / 2.0f;
if (!isTurn) {
glColor3f(1.0f, 0.7f, 0.0f);
}
else {
glColor3f(1.0f, 0.4f, 0.0f);
}
glBegin(GL_TRIANGLES);
// Przód
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, halfDepth);
// Ty³
glVertex3f(halfWidth, halfHeight, -halfDepth);
glVertex3f(-halfWidth, halfHeight, -halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, halfHeight, -halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, -halfHeight, -halfDepth);
// Góra
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, halfHeight, -halfDepth);
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, halfHeight, -halfDepth);
glVertex3f(-halfWidth, halfHeight, -halfDepth);
// Dó³
glVertex3f(halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, -halfHeight, -halfDepth);
// Lewa strona
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(-halfWidth, halfHeight, halfDepth);
glVertex3f(-halfWidth, -halfHeight, -halfDepth);
glVertex3f(-halfWidth, halfHeight, -halfDepth);
// Prawa strona
glVertex3f(halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, -halfHeight, halfDepth);
glVertex3f(halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, halfHeight, halfDepth);
glVertex3f(halfWidth, -halfHeight, -halfDepth);
glVertex3f(halfWidth, halfHeight, -halfDepth);
glEnd();
glPopMatrix();
}