Newer
Older
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
#shader vertex
#version 410 core
layout(location = 0) in vec4 position;
uniform mat4 projection = mat4( 1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1);
uniform float time = 0;
mat4 rotate(float x, float y, float z) {
return mat4(
(cos(y + z) + cos(y - z)) / 2, (-sin(y + z) + sin(y - z)) / 2, -sin(y), 0,
(cos(x + y + z) - cos(x - y + z) + cos(x + y - z) - cos(x - y - z) + 2 * sin(x + z) - 2 * sin(x - z)) / 4, (2 * cos(x + z) + 2 * cos(x - z) - sin(x + y + z) + sin(x - y + z) + sin(x + y - z) - sin(x - y - z)) / 4, (-sin(x + y) - sin(x - y)) / 2, 0,
(-2 * cos(x + z) + 2 * cos(x - z) + sin(x + y + z) - sin(x - y + z) + sin(x + y - z) - sin(x - y - z)) / 4, (cos(x + y + z) - cos(x - y + z) - cos(x + y - z) + cos(x - y - z) + 2 * sin(x + z) + 2 * sin(x - z)) / 4, (cos(x + y) + cos(x - y)) / 2, 0,
0, 0, 0, 1
);
}
void main() {
mat4 translation = mat4(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, -3, 0);
mat4 rot = mat4(0.525322, 0.000000, -0.850904, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.850904, 0.000000, 0.525322, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000);
float F = sqrt(position.x*position.x + position.y*position.y + position.z*position.z);
gl_Position = projection * translation * rotate(time*0.1*F, time*0.333334*F, time*0.1666666667*F) * position;
}
#shader fragment
#version 410 core
layout(location = 0) out vec4 out_color;
void main() {
out_color = vec4(1, 1, 1, 1);
}