source: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.cg @ 2336

Revision 2336, 1.2 KB checked in by szirmay, 17 years ago (diff)
Line 
1void trollSkinning_One_Weight_vp(
2        float4 position : POSITION,
3        float3 normal   : NORMAL,
4        float2 uv       : TEXCOORD0,
5        float  blendIdx : BLENDINDICES,
6       
7
8        out float4 oPosition : POSITION,
9        out float2 oUv       : TEXCOORD0,
10        out float4 colour           : COLOR,
11        // Support up to 24 bones of float3x4
12        // vs_1_1 only supports 96 params so more than this is not feasible
13        uniform float3x4   worldMatrix3x4Array[67],
14        uniform float4x4 viewProjectionMatrix,
15        uniform float4   lightPos[2],
16        uniform float4   lightDiffuseColour[2],
17        uniform float4   ambient)
18{
19        // transform by indexed matrix
20        float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
21        // view / projection
22        oPosition = mul(viewProjectionMatrix, blendPos);
23        // transform normal
24        float3 norm = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
25        // Lighting - support point and directional
26        float3 lightDir0 =      normalize(
27                lightPos[0].xyz -  (blendPos.xyz * lightPos[0].w));
28        float3 lightDir1 =      normalize(
29                lightPos[1].xyz -  (blendPos.xyz * lightPos[1].w));
30
31        oUv = uv;
32        colour = ambient +
33                (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0])
34        //      +(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1])
35        ;
36       
37}       
Note: See TracBrowser for help on using the repository browser.