2 varying vec3 lightDir; // interpolated surface local coordinate light direction
3 varying vec3 viewDir; // interpolated surface local coordinate view direction
6 attribute vec2 TexCoord0;
7 attribute vec3 Position;
11 // Do standard vertex stuff
13 gl_Position = gl_ModelViewProjectionMatrix * vec4(Position, 1.0);
14 gl_TexCoord[0] = vec4(TexCoord0, 0.0, 0.0);
16 // Compute the binormal
18 vec3 n = normalize(gl_NormalMatrix * Normal);
19 //vec3 t = normalize(gl_NormalMatrix * vec3 (gl_Color));
20 vec3 t = normalize(cross(vec3(1.141, 2.78, 3.14), n));
23 // Transform light position into surface local coordinates
25 vec3 LightPosition = gl_LightSource[0].position.xyz;
28 v.x = dot(LightPosition, t);
29 v.y = dot(LightPosition, b);
30 v.z = dot(LightPosition, n);
31 lightDir = normalize(v);
32 vec3 pos = vec3 (gl_ModelViewMatrix * vec4(Position, 1.0));
38 viewDir = normalize(v);