tavli

view sdr/shadow.v.glsl @ 19:37dead56f01e

fixed shadows
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Jun 2015 06:18:45 +0300
parents 986c0b76513f
children
line source
1 varying vec3 vdir, ldir, normal;
2 varying vec4 shadow_tc;
4 void main()
5 {
6 gl_Position = ftransform();
8 vec3 vpos = (gl_ModelViewMatrix * gl_Vertex).xyz;
9 normal = gl_NormalMatrix * gl_Normal;
10 vdir = -vpos;
11 ldir = gl_LightSource[0].position.xyz - vpos;
12 gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
14 mat4 offmat = mat4(0.5, 0.0, 0.0, 0.0,
15 0.0, 0.5, 0.0, 0.0,
16 0.0, 0.0, 0.5, 0.0,
17 0.5, 0.5, 0.5, 1.0);
18 mat4 tex_matrix = offmat * gl_TextureMatrix[1];
20 shadow_tc = tex_matrix * vec4(vpos, 1.0);
21 }