-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cube.h
59 lines (46 loc) · 2.09 KB
/
Cube.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
#pragma once
#include "model.h"
class Cube : public Model {
public:
Cube(float size, short color = 15) : Model(36) {
float dim = size / 2;
vertices = new Vertex[36] {
Vertex(-dim, -dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex(-dim, dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex( dim, -dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex( dim, -dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex( dim, dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex(-dim, dim, dim, 0.0f, 0.0f, 1.0f, color),
Vertex(-dim, -dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex(-dim, dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex( dim, -dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex( dim, -dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex( dim, dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex(-dim, dim, -dim, 0.0f, 0.0f, -1.0f, color),
Vertex(dim, -dim, -dim, 1.0f, 0.0f, 0.0f, color),
Vertex(dim, dim, -dim, 1.0f, 0.0f, 0.0f, color),
Vertex(dim, -dim, dim, 1.0f, 0.0f, 0.0f, color),
Vertex(dim, dim, -dim, 1.0f, 0.0f, 0.0f, color),
Vertex(dim, -dim, dim, 1.0f, 0.0f, 0.0f, color),
Vertex(dim, dim, dim, 1.0f, 0.0f, 0.0f, color),
Vertex(-dim, -dim, -dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, dim, -dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, -dim, dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, dim, -dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, -dim, dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, dim, dim, -1.0f, 0.0f, 0.0f, color),
Vertex(-dim, -dim, -dim, 0.0f, -1.0f, 0.0f, color),
Vertex( dim, -dim, dim, 0.0f, -1.0f, 0.0f, color),
Vertex(-dim, -dim, dim, 0.0f, -1.0f, 0.0f, color),
Vertex(-dim, -dim, -dim, 0.0f, -1.0f, 0.0f, color),
Vertex( dim, -dim, dim, 0.0f, -1.0f, 0.0f, color),
Vertex( dim, -dim, -dim, 0.0f, -1.0f, 0.0f, color),
Vertex(-dim, dim, -dim, 0.0f, 1.0f, 0.0f, color),
Vertex( dim, dim, dim, 0.0f, 1.0f, 0.0f, color),
Vertex(-dim, dim, dim, 0.0f, 1.0f, 0.0f, color),
Vertex(-dim, dim, -dim, 0.0f, 1.0f, 0.0f, color),
Vertex( dim, dim, dim, 0.0f, 1.0f, 0.0f, color),
Vertex( dim, dim, -dim, 0.0f, 1.0f, 0.0f, color),
};
}
};