blob: 1850a67dde7c4d040a0afde6362bd52ae9145938 (
plain)
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
|
#version 130
#extension GL_ARB_explicit_attrib_location: require
uniform mat4 mvp;
uniform mat3 mv_normal;
layout(location = 0) in vec2 uv;
out vec4 color;
out vec2 frag_uv;
// Direction of the normal in camera-space.
out vec3 normal_cs;
void main(void)
{
/* Center the region at the origin. Assume that it's 7 units by 7
* units.
*/
vec2 bias_uv = uv - 0.5;
vec4 position = vec4(bias_uv.x * 7.,
0.0,
bias_uv.y * 7.,
1.0);
gl_Position = mvp * position;
/* Transform the normal by the inverse-transpose of the model-view
* matrix.
*/
normal_cs = mv_normal * vec3(0., 1., 0.);
frag_uv = uv;
}
|