]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/matrix_from_elements.glsl
Fix GLSL matrix construction from individual elements
[libs/gl.git] / tests / glsl / matrix_from_elements.glsl
1 uniform Transform
2 {
3         vec3 translation;
4         float rotation;
5 };
6
7 #pragma MSP stage(vertex)
8 layout(location=0) in vec2 position;
9 void main()
10 {
11         float c = cos(rotation);
12         float s = sin(rotation);
13         mat3 m = mat3(c, s, 0.0, -s, c, 0.0, translation);
14         gl_Position = vec4((m*vec3(position, 1.0)).xy, 0.0, 1.0);
15 }
16
17 /* Expected output: vertex
18 layout(binding=48) uniform Transform
19 {
20         vec3 translation;
21         float rotation;
22 };
23 layout(location=0) in vec2 position;
24 void main()
25 {
26         float c = cos(rotation);
27         float s = sin(rotation);
28
29         gl_Position = vec4((mat3(vec3(c, s, 0.0), vec3(-s, c, 0.0), translation)*vec3(position, 1.0)).xy, 0.0, 1.0);
30 }
31 */