Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/skinningTwoWeightsShadowCasterVp.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 5 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 1.1 KB
Line 
1#version 100
2
3precision highp int;
4precision highp float;
5
6/*
7  Two-weight-per-vertex hardware skinning, shadow caster pass
8*/
9
10attribute vec4 vertex;
11attribute vec4 uv0;
12attribute vec4 blendIndices;
13attribute vec4 blendWeights;
14
15// 3x4 matrix, passed as vec4's for compatibility with GL ES 2.0
16// Support 24 bones ie 24*3, but use 72 since our parser can pick that out for sizing
17uniform vec4 worldMatrix3x4Array[72];
18uniform mat4 viewProjectionMatrix;
19uniform vec4 ambient;
20
21varying vec4 colour;
22
23void main()
24{
25        vec3 blendPos = vec3(0.0);
26
27        for (int bone = 0; bone < 2; ++bone)
28        {
29                // Perform matrix multiplication manually since no 3x4 matrices
30            int idx = int(blendIndices[bone]) * 3;
31
32        // Unroll the loop manually
33                mat4 worldMatrix;
34                worldMatrix[0] = worldMatrix3x4Array[idx];
35                worldMatrix[1] = worldMatrix3x4Array[idx + 1];
36                worldMatrix[2] = worldMatrix3x4Array[idx + 2];
37                worldMatrix[3] = vec4(0.0);
38                // Now weight this into final
39                blendPos += (vertex * worldMatrix).xyz * blendWeights[bone];
40        }
41
42        // Apply view / projection to position
43        gl_Position = viewProjectionMatrix * vec4(blendPos, 1.0);
44
45        colour = ambient;
46}
Note: See TracBrowser for help on using the repository browser.