tavli

annotate sdr/shadow.v.glsl @ 21:c3fbf9616dbd

slot bounds, and ray testing
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 02 Jul 2015 00:01:39 +0300
parents 986c0b76513f
children
rev   line source
nuclear@18 1 varying vec3 vdir, ldir, normal;
nuclear@18 2 varying vec4 shadow_tc;
nuclear@18 3
nuclear@18 4 void main()
nuclear@18 5 {
nuclear@18 6 gl_Position = ftransform();
nuclear@18 7
nuclear@18 8 vec3 vpos = (gl_ModelViewMatrix * gl_Vertex).xyz;
nuclear@18 9 normal = gl_NormalMatrix * gl_Normal;
nuclear@18 10 vdir = -vpos;
nuclear@18 11 ldir = gl_LightSource[0].position.xyz - vpos;
nuclear@18 12 gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
nuclear@18 13
nuclear@18 14 mat4 offmat = mat4(0.5, 0.0, 0.0, 0.0,
nuclear@18 15 0.0, 0.5, 0.0, 0.0,
nuclear@18 16 0.0, 0.0, 0.5, 0.0,
nuclear@18 17 0.5, 0.5, 0.5, 1.0);
nuclear@18 18 mat4 tex_matrix = offmat * gl_TextureMatrix[1];
nuclear@18 19
nuclear@19 20 shadow_tc = tex_matrix * vec4(vpos, 1.0);
nuclear@18 21 }