diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-04-01 23:07:56 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-04-01 23:07:56 +0200 |
commit | e172cde8c082fa3e338b3eb11079b36952874936 (patch) | |
tree | 90f65a54ce7b6a663ead31496549e0b9338c81d8 /terrain_vertex.glsl | |
parent | 3b360c21777aad02394a643b32be2ab25362bba1 (diff) |
Terrain shader lighting - work in progress.
Diffstat (limited to 'terrain_vertex.glsl')
-rw-r--r-- | terrain_vertex.glsl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/terrain_vertex.glsl b/terrain_vertex.glsl new file mode 100644 index 0000000..25b0c25 --- /dev/null +++ b/terrain_vertex.glsl @@ -0,0 +1,19 @@ +varying vec3 normal, light_pos, V, N; +varying vec4 diffuse, ambient; + +void main() { + V = vec3(gl_ModelViewMatrix * gl_Vertex); + N = normalize(gl_NormalMatrix * gl_Normal); + + normal = gl_Normal; + light_pos = vec3(0, 1, 0); + + diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; + ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; + + gl_FrontColor = gl_Color; + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; +} + +/* vim: set syn=glsl: */ |