summaryrefslogtreecommitdiff
path: root/progs/glsl/skinning.vert
diff options
context:
space:
mode:
Diffstat (limited to 'progs/glsl/skinning.vert')
-rw-r--r--progs/glsl/skinning.vert24
1 files changed, 24 insertions, 0 deletions
diff --git a/progs/glsl/skinning.vert b/progs/glsl/skinning.vert
new file mode 100644
index 0000000000..28970eee58
--- /dev/null
+++ b/progs/glsl/skinning.vert
@@ -0,0 +1,24 @@
+// Vertex weighting/blendin shader
+// Brian Paul
+// 4 Nov 2008
+
+uniform mat4 mat0, mat1;
+attribute float weight;
+
+void main()
+{
+ // simple diffuse shading
+ // Note that we should really transform the normal vector along with
+ // the postion below... someday.
+ vec3 lightVec = vec3(0, 0, 1);
+ vec3 norm = gl_NormalMatrix * gl_Normal;
+ float dot = 0.2 + max(0.0, dot(norm, lightVec));
+ gl_FrontColor = vec4(dot);
+
+ // compute sum of weighted transformations
+ vec4 pos0 = mat0 * gl_Vertex;
+ vec4 pos1 = mat1 * gl_Vertex;
+ vec4 pos = mix(pos0, pos1, weight);
+
+ gl_Position = gl_ModelViewProjectionMatrix * pos;
+}