aboutsummaryrefslogtreecommitdiff
path: root/data/shaders/light-refract.vert
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/light-refract.vert')
-rw-r--r--data/shaders/light-refract.vert28
1 files changed, 28 insertions, 0 deletions
diff --git a/data/shaders/light-refract.vert b/data/shaders/light-refract.vert
new file mode 100644
index 0000000..9beeb9c
--- /dev/null
+++ b/data/shaders/light-refract.vert
@@ -0,0 +1,28 @@
+attribute vec3 position;
+attribute vec3 normal;
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 NormalMatrix;
+uniform mat4 ModelViewMatrix;
+uniform mat4 LightMatrix;
+
+varying vec3 vertex_normal;
+varying vec4 vertex_position;
+varying vec4 MapCoord;
+
+void main(void)
+{
+ vec4 current_position = vec4(position, 1.0);
+
+ // Transform the normal to eye coordinates
+ vertex_normal = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));
+
+ // Transform the current position to eye coordinates
+ vertex_position = ModelViewMatrix * current_position;
+
+ // Transform the current position for use as texture coordinates
+ MapCoord = LightMatrix * current_position;
+
+ // Transform the current position to clip coordinates
+ gl_Position = ModelViewProjectionMatrix * current_position;
+}