summaryrefslogtreecommitdiffstats
path: root/matchblox/shaders/grayscale.vert
diff options
context:
space:
mode:
Diffstat (limited to 'matchblox/shaders/grayscale.vert')
-rw-r--r--matchblox/shaders/grayscale.vert19
1 files changed, 19 insertions, 0 deletions
diff --git a/matchblox/shaders/grayscale.vert b/matchblox/shaders/grayscale.vert
new file mode 100644
index 0000000..af155c8
--- /dev/null
+++ b/matchblox/shaders/grayscale.vert
@@ -0,0 +1,19 @@
+varying vec4 ambient, diffuse;
+varying vec3 normal, lightdir, halfvector;
+
+void main()
+{
+ //transform the normal
+ normal = gl_NormalMatrix * gl_Normal;
+
+ //determine the light direction
+ lightdir = normalize(gl_LightSource[0].position.xyz);
+ halfvector = normalize(gl_LightSource[0].halfVector.xyz);
+
+ //compute diffuse and ambient terms
+ diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
+ ambient = gl_FrontMaterial.ambient * (gl_LightSource[0].ambient + gl_LightModel.ambient);
+
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+}