From 18b7caedb71a56381fafaa724ad3c9fa2dc8e465 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 11 Dec 2012 12:34:57 -0800 Subject: Initial import --- data/simple.vert | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 data/simple.vert (limited to 'data/simple.vert') diff --git a/data/simple.vert b/data/simple.vert new file mode 100644 index 0000000..1850a67 --- /dev/null +++ b/data/simple.vert @@ -0,0 +1,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; +} -- cgit v1.2.3