summaryrefslogtreecommitdiff
path: root/data/simple.vert
diff options
context:
space:
mode:
Diffstat (limited to 'data/simple.vert')
-rw-r--r--data/simple.vert33
1 files changed, 33 insertions, 0 deletions
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;
+}