8 uniform LightParams light;
9 uniform vec3 material_color;
12 uniform sampler2D occlusion_map;
14 #pragma MSP stage(vertex)
15 layout(location=0) in vec4 position;
16 layout(location=1) in vec3 normal;
17 layout(location=2) in vec2 texcoord;
20 vec4 p = position+vec4(offset, 1.0);
25 #pragma MSP stage(fragment)
26 layout(location=0) out vec4 frag_color;
29 float occlusion = float(texture(occlusion_map, texcoord));
30 vec3 light_color = light.color*light.intensity;
31 vec3 l = light.ambient+light_color*max(dot(light.dir, normalize(normal)), 0.0);
32 frag_color = vec4(material_color*l*occlusion, 1.0);
35 /* Expected output: vertex
36 layout(location=0) uniform mat4 mvp;
37 layout(location=4) uniform vec3 offset;
38 layout(location=0) in vec4 position;
39 layout(location=1) in vec3 normal;
40 layout(location=2) in vec2 texcoord;
41 layout(location=0) out vec3 _vs_out_normal;
42 layout(location=1) out vec2 _vs_out_texcoord;
45 gl_Position = mvp*(position+vec4(offset, 1.0));
46 _vs_out_normal = normal;
47 _vs_out_texcoord = texcoord;
51 /* Expected output: fragment
59 layout(location=5) uniform LightParams light;
60 layout(location=9) uniform vec3 material_color;
61 layout(location=10, binding=83) uniform sampler2D occlusion_map;
62 layout(location=0) out vec4 frag_color;
63 layout(location=1) in vec2 _vs_out_texcoord;
64 layout(location=0) in vec3 _vs_out_normal;
67 frag_color = vec4(material_color*(light.ambient+light.color*light.intensity*max(dot(light.dir, normalize(_vs_out_normal)), 0.0))*float(texture(occlusion_map, _vs_out_texcoord).x), 1.0);