f1393d68b5
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2950 127b21dd-08f5-0310-b4b7-95ae10353056
28 lines
744 B
Plaintext
28 lines
744 B
Plaintext
// No vNormal, because normal is always 0,0,1 in tangent space.
|
|
varying vec3 vEyeVector;
|
|
varying vec2 vTexCoords;
|
|
varying vec3 vLight1Vector;
|
|
varying vec3 vCoords;
|
|
|
|
|
|
void main(void)
|
|
{
|
|
vCoords = gl_Vertex.xyz;
|
|
|
|
// Build tangent basis.
|
|
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
|
|
vec3 binormal = cross(normal, gl_NormalMatrix * vec3(0, 1, 0));
|
|
vec3 tangent = -cross(normal, binormal);
|
|
|
|
mat3 TBN = mat3(tangent, binormal, normal);
|
|
|
|
vec3 eyeVector = -vec3(gl_ModelViewMatrix * gl_Vertex);
|
|
vEyeVector = eyeVector * TBN;
|
|
|
|
vec3 light1Vector = gl_LightSource[1].position.xyz + eyeVector;
|
|
vLight1Vector = light1Vector * TBN;
|
|
|
|
vTexCoords = gl_MultiTexCoord0.st;
|
|
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
|
}
|