Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/data_extern/programs/GLSL120/skinningTwoWeightsShadowCasterVp.glsl @ 12181

Last change on this file since 12181 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 840 bytes
Line 
1#version 120
2// Example GLSL program for skinning with two bone weights per vertex
3
4attribute vec4 vertex;
5attribute vec4 uv0;
6attribute vec4 blendIndices;
7attribute vec4 blendWeights;
8
9uniform mat4x3 worldMatrix3x4Array[24];
10uniform mat4 viewProjectionMatrix;
11uniform vec4 ambient;
12
13void main()
14{
15        vec3 blendPos = vec3(0,0,0);
16
17        for (int bone = 0; bone < 2; ++bone)
18        {
19        // ATI GLSL compiler can't handle indexing an array within an array so calculate the inner index first
20                int idx = int(blendIndices[bone]);
21
22                // now weight this into final
23                float weight = blendWeights[bone];
24                blendPos += worldMatrix3x4Array[idx]* vertex * weight;
25        }
26
27        // apply view / projection to position
28        gl_Position = viewProjectionMatrix * vec4(blendPos, 1);
29       
30        gl_FrontSecondaryColor = vec4(0,0,0,0);
31        gl_FrontColor = ambient;
32        gl_TexCoord[0] = uv0;
33}
Note: See TracBrowser for help on using the repository browser.