-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvertex_data.h
98 lines (75 loc) · 3.31 KB
/
vertex_data.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef VERTEX_DATA_H
#define VERTEX_DATA_H
#include <QVector3D>
#include <QMatrix4x4>
float vertices_first_cube[] = {
// vertex // normals // tex
// front
-0.5f, 0.5f, 0.5f, 0.0, 0.0, 1.0, 0.0f, 1.0f,// top left 0
0.5f, 0.5f, 0.5f, 0.0, 0.0, 1.0, 1.0f, 1.0f,// top right 1
-0.5f, -0.5f, 0.5f, 0.0, 0.0, 1.0, 0.0f, 0.0f,// bottom left 2
0.5f, -0.5f, 0.5f, 0.0, 0.0, 1.0, 1.0f, 0.0f,// bottom right 3
// rear
-0.5f, 0.5f, -0.5f, 0.0, 0.0, -1.0, 1.0f, 1.0f, // top left rear 4
0.5f, 0.5f, -0.5f, 0.0, 0.0, -1.0, 0.0f, 1.0f, // top right rear 5
-0.5f, -0.5f, -0.5f, 0.0, 0.0, -1.0, 1.0f, 0.0f, // bottom left rear 6
0.5f, -0.5f, -0.5f, 0.0, 0.0, -1.0, 0.0f, 0.0f, // bottom right rear 7
// left
-0.5f, -0.5f, 0.5f, -1.0, 0.0, 0.0, 1.0f, 0.0f, // bottom left 2/8
-0.5f, -0.5f, -0.5f, -1.0, 0.0, 0.0, 0.0f, 0.0f, // bottom left rear 6/9
-0.5f, 0.5f, 0.5f, -1.0, 0.0, 0.0, 1.0f, 1.0f, // top left 0/10
-0.5f, 0.5f, -0.5f, -1.0, 0.0, 0.0, 0.0f, 1.0f, // top left rear 4/11
// right
0.5f, 0.5f, 0.5f, 1.0, 0.0, 0.0, 0.0f, 1.0f,// top right 1/12
0.5f, -0.5f, 0.5f, 1.0, 0.0, 0.0, 0.0f, 0.0f,// bottom right 3/13
0.5f, -0.5f, -0.5f, 1.0, 0.0, 0.0, 1.0f, 0.0f,// bottom right rear 7/14
0.5f, 0.5f, -0.5f, 1.0, 0.0, 0.0, 1.0f, 1.0f,// top right rear 5/15
// top
-0.5f, 0.5f, 0.5f, 0.0, 1.0, 0.0, 0.0f, 1.0f,// top left 0/16
0.5f, 0.5f, 0.5f, 0.0, 1.0, 0.0, 1.0f, 1.0f,// top right 1/17
-0.5f, 0.5f, -0.5f, 0.0, 1.0, 0.0, 0.0f, 0.0f,// top left rear 4/18
0.5f, 0.5f, -0.5f, 0.0, 1.0, 0.0, 1.0f, 0.0f,// top right rear 5/19
//bottom
-0.5f, -0.5f, 0.5f, 0.0, -1.0, 0.0, 0.0f, 1.0f, // bottom left 2/20
0.5f, -0.5f, 0.5f, 0.0, -1.0, 0.0, 1.0f, 1.0f, // bottom right 3/21
-0.5f, -0.5f, -0.5f, 0.0, -1.0, 0.0, 0.0f, 0.0f, // bottom left rear 6/22
0.5f, -0.5f, -0.5f, 0.0, -1.0, 0.0, 1.0f, 0.0f, // bottom right rear 7/23
};
/*
* 4____5
* /| /|
* 0_|__1 |
* | | | |
* | 6__|_7
* |/___|/
* 2 3
*
*/
unsigned int indices_first_cube[] = {
0, 1, 2, // front
2, 3, 1,
4, 5, 6, // rear
6, 7, 5,
8, 9, 10, // left
10, 11, 9,
12, 13, 14, // right
14, 15, 12,
16, 17, 18, // top
18, 19, 17,
20, 21, 22, // bottom
22, 23, 21,
};
QVector3D cubesPositions[] = {
QVector3D( 0.0f, 0.0f, 0.0f),
// QVector3D( 2.0f, 5.0f, -15.0f),
// QVector3D(-1.5f, -2.2f, -2.5f),
// QVector3D(-3.8f, -2.0f, -12.3f),
// QVector3D( 2.4f, -0.4f, -3.5f),
// QVector3D(-1.7f, 3.0f, -7.5f),
// QVector3D( 1.3f, -2.0f, -2.5f),
// QVector3D( 1.5f, 2.0f, -2.5f),
// QVector3D( 1.5f, 0.2f, -1.5f),
// QVector3D(-1.3f, 1.0f, -1.5f)
};
QMatrix4x4 cubesModelMatrices[sizeof(cubesPositions)/sizeof(cubesPositions[0])];
#endif // VERTEX_DATA_H