Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/shaders/bump.vert @ 3928

Last change on this file since 3928 was 3556, checked in by bensch, 19 years ago

data/trunk: added bump-shader

File size: 877 bytes
Line 
1 varying vec4 passcolor; //The vertex color passed
2 varying vec3 LightDir; //The transformed light direction, to pass to the fragment shader
3 attribute vec3 tangent; //The inverse tangent to the geometry
4 attribute vec3 binormal; //The inverse binormal to the geometry
5 uniform vec3 lightdir; //The direction the light is shining
6 void main()
7 {
8   //Put the color in a varying variable
9   passcolor = gl_Color;
10   //Put the vertex in the position passed
11   gl_Position = ftransform();
12   //Construct a 3x3 matrix from the geometry\u2019s inverse tangent, binormal, and normal
13   mat3 rotmat = mat3(tangent,binormal,gl_Normal);
14   //Rotate the light into tangent space
15   LightDir = rotmat * normalize(lightdir);
16   //Normalize the light
17   normalize(LightDir);
18   //Use the first set of texture coordinates in the fragment shader
19   gl_TexCoord[0] = gl_MultiTexCoord0;
20 }
Note: See TracBrowser for help on using the repository browser.