diff options
author | Brian Paul <[email protected]> | 2008-11-04 16:56:59 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-11-04 16:56:59 -0700 |
commit | aab429c8df228271786890691a43786baf091b37 (patch) | |
tree | d8b66a8071a7c803e0d6f77dae2054cfcea10143 /progs/glsl/skinning.vert | |
parent | 6c8274078d08e5d87c993603b9bfcdf1ffa51278 (diff) |
added glsl/skinning.c test to test matrix blending/weighting
Diffstat (limited to 'progs/glsl/skinning.vert')
-rw-r--r-- | progs/glsl/skinning.vert | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/progs/glsl/skinning.vert b/progs/glsl/skinning.vert new file mode 100644 index 00000000000..28970eee584 --- /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; +} |