Merge branch '7.8'
[mesa.git] / progs / glsl / skinning.vert
1 // Vertex weighting/blendin shader
2 // Brian Paul
3 // 4 Nov 2008
4
5 uniform mat4 mat0, mat1;
6 attribute float weight;
7
8 void main()
9 {
10 // simple diffuse shading
11 // Note that we should really transform the normal vector along with
12 // the postion below... someday.
13 vec3 lightVec = vec3(0, 0, 1);
14 vec3 norm = gl_NormalMatrix * gl_Normal;
15 float dot = 0.2 + max(0.0, dot(norm, lightVec));
16 gl_FrontColor = vec4(dot);
17
18 // compute sum of weighted transformations
19 vec4 pos0 = mat0 * gl_Vertex;
20 vec4 pos1 = mat1 * gl_Vertex;
21 vec4 pos = mix(pos0, pos1, weight);
22
23 gl_Position = gl_ModelViewProjectionMatrix * pos;
24 }