1 const int n_lights = 0;
7 uniform LightParams lights[n_lights];
9 uniform mat4 model_matrix;
10 uniform mat4 vp_matrix;
12 #pragma MSP stage(vertex)
13 layout(location=0) in vec4 position;
14 layout(location=1) in vec3 normal;
17 out vec3 world_normal = mat3(model_matrix)*normal;
18 gl_Position = vp_matrix*model_matrix*position;
21 #pragma MSP stage(fragment)
22 layout(location=0) out vec4 frag_color;
26 for(int i=0; i<n_lights; ++i)
27 color += max(dot(normalize(world_normal), lights[i].direction), 0.0)*lights[i].color;
28 frag_color = vec4(color, 1.0);
33 /* Expected output: vertex
34 layout(location=0) uniform mat4 model_matrix;
35 layout(location=4) uniform mat4 vp_matrix;
36 layout(location=0) in vec4 position;
39 gl_Position = vp_matrix*model_matrix*position;
40 gl_Position.z = gl_Position.z*2.0-gl_Position.w;
44 /* Expected output: fragment
45 layout(location=8) uniform vec3 ambient;
46 layout(location=0) out vec4 frag_color;
49 frag_color = vec4(ambient, 1.0);