summaryrefslogtreecommitdiff
path: root/progs/glsl/reflect.vert.txt
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-26 10:13:02 -0600
committerBrian <brian@yutani.localnet.net>2007-03-26 10:13:02 -0600
commitd619cceea47dc3070ebb7f7ea4f8b6b31a672d38 (patch)
treef8b8a9f3fdc3f17a43436af270b22754b1749d31 /progs/glsl/reflect.vert.txt
parent76f3b66e0489526694d6a39b4a6ac3b1c2bee100 (diff)
parente71c34aaa173ca451fa02e526ead77758f7eeb74 (diff)
merge of glsl-compiler-1 branch
Diffstat (limited to 'progs/glsl/reflect.vert.txt')
-rw-r--r--progs/glsl/reflect.vert.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/progs/glsl/reflect.vert.txt b/progs/glsl/reflect.vert.txt
new file mode 100644
index 0000000000..402be38bf7
--- /dev/null
+++ b/progs/glsl/reflect.vert.txt
@@ -0,0 +1,19 @@
+// Vertex shader for cube-texture reflection mapping
+// Brian Paul
+
+
+varying vec3 normal;
+
+void main()
+{
+ vec3 n = gl_NormalMatrix * gl_Normal;
+ vec3 u = normalize(vec3(gl_ModelViewMatrix * gl_Vertex));
+ float two_n_dot_u = 2.0 * dot(n, u);
+ vec4 f;
+ f.xyz = u - n * two_n_dot_u;
+
+ // outputs
+ normal = n;
+ gl_TexCoord[0] = gl_TextureMatrix[0] * f;
+ gl_Position = ftransform();
+}