ld33_umonster

diff sdr/shadow.v.glsl @ 0:4a6683050e29

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 22 Aug 2015 07:15:00 +0300
parents
children 92d662deb66e
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sdr/shadow.v.glsl	Sat Aug 22 07:15:00 2015 +0300
     1.3 @@ -0,0 +1,21 @@
     1.4 +varying vec3 vdir, ldir, normal;
     1.5 +varying vec4 shadow_tc;
     1.6 +
     1.7 +void main()
     1.8 +{
     1.9 +	gl_Position = ftransform();
    1.10 +
    1.11 +	vec3 vpos = (gl_ModelViewMatrix * gl_Vertex).xyz;
    1.12 +	normal = gl_NormalMatrix * gl_Normal;
    1.13 +	vdir = -vpos;
    1.14 +	ldir = gl_LightSource[0].position.xyz - vpos;
    1.15 +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
    1.16 +
    1.17 +	mat4 offmat = mat4(0.5, 0.0, 0.0, 0.0,
    1.18 +			0.0, 0.5, 0.0, 0.0,
    1.19 +			0.0, 0.0, 0.5, 0.0,
    1.20 +			0.5, 0.5, 0.5, 1.0);
    1.21 +	mat4 tex_matrix = offmat * gl_TextureMatrix[1];
    1.22 +
    1.23 +	shadow_tc = tex_matrix * vec4(vpos, 1.0);
    1.24 +}