ld33_umonster

annotate sdr/shadow.v.glsl @ 4:7b1fa527b51b

added torus mesh gen
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 23 Aug 2015 04:31:29 +0300
parents
children 92d662deb66e
rev   line source
nuclear@0 1 varying vec3 vdir, ldir, normal;
nuclear@0 2 varying vec4 shadow_tc;
nuclear@0 3
nuclear@0 4 void main()
nuclear@0 5 {
nuclear@0 6 gl_Position = ftransform();
nuclear@0 7
nuclear@0 8 vec3 vpos = (gl_ModelViewMatrix * gl_Vertex).xyz;
nuclear@0 9 normal = gl_NormalMatrix * gl_Normal;
nuclear@0 10 vdir = -vpos;
nuclear@0 11 ldir = gl_LightSource[0].position.xyz - vpos;
nuclear@0 12 gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
nuclear@0 13
nuclear@0 14 mat4 offmat = mat4(0.5, 0.0, 0.0, 0.0,
nuclear@0 15 0.0, 0.5, 0.0, 0.0,
nuclear@0 16 0.0, 0.0, 0.5, 0.0,
nuclear@0 17 0.5, 0.5, 0.5, 1.0);
nuclear@0 18 mat4 tex_matrix = offmat * gl_TextureMatrix[1];
nuclear@0 19
nuclear@0 20 shadow_tc = tex_matrix * vec4(vpos, 1.0);
nuclear@0 21 }