-
Notifications
You must be signed in to change notification settings - Fork 0
/
coal.cpp
89 lines (75 loc) · 2.79 KB
/
coal.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
85
86
87
88
89
#include "coal.hpp"
Coal::Coal(unsigned char visibility):
Cube(visibility)
{
}
void Coal::display()
{
if (_visibility & FRONT)
{
//face avant
_renderer->setNormal(_normals);
_renderer->addVertexUV(_points, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 3, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 6, COAL_UMAX, COAL_VMAX);
_renderer->setNormal(_normals);
_renderer->addVertexUV(_points, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 6, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 9, COAL_UMAX, COAL_VMIN);
}
if (_visibility & RIGHT)
{
//face droite
_renderer->setNormal(_normals + 3);
_renderer->addVertexUV(_points + 9, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 6, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 18, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 9, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 18, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 21, COAL_UMAX, COAL_VMIN);
}
if (_visibility & BACK)
{
//face arriere
_renderer->setNormal(_normals + 6);
_renderer->addVertexUV(_points + 21, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 18, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 15, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 21, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 15, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 12, COAL_UMAX, COAL_VMIN);
}
if (_visibility & LEFT)
{
//face gauche
_renderer->setNormal(_normals + 9);
_renderer->addVertexUV(_points + 12, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 15, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 3, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 12, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 3, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points, COAL_UMAX, COAL_VMIN);
}
if (_visibility & TOP)
{
//face haute
_renderer->setNormal(_normals + 12);
_renderer->addVertexUV(_points, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 9, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 21, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 21, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 12, COAL_UMAX, COAL_VMIN);
}
if (_visibility & BOT)
{
//face basse
_renderer->setNormal(_normals + 15);
_renderer->addVertexUV(_points + 3, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 15, COAL_UMIN, COAL_VMAX);
_renderer->addVertexUV(_points + 18, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 3, COAL_UMIN, COAL_VMIN);
_renderer->addVertexUV(_points + 18, COAL_UMAX, COAL_VMAX);
_renderer->addVertexUV(_points + 6, COAL_UMAX, COAL_VMIN);
}
}