source: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.hlsl @ 2368

Revision 2368, 1.7 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        out float4 oPosition : POSITION,
7        out float2 oUv       : TEXCOORD0,
8        out float4 colour           : COLOR,
9        uniform float3x4   worldMatrix3x4Array[67],
10        uniform float4x4 viewProjectionMatrix,
11        uniform float4   lightPos[2],
12        uniform float4   lightDiffuseColour[2],
13        uniform float4   ambient)
14{
15        // transform by indexed matrix
16        float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
17        // view / projection
18        oPosition = mul(viewProjectionMatrix, blendPos);
19        // transform normal
20        float3 norm = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
21        // Lighting - support point and directional
22        float3 lightDir0 =      normalize(
23                lightPos[0].xyz -  (blendPos.xyz * lightPos[0].w));
24        float3 lightDir1 =      normalize(
25                lightPos[1].xyz -  (blendPos.xyz * lightPos[1].w));
26
27        oUv = uv;
28        colour = ambient +
29                (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0])
30        //      +(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1])
31        ;
32       
33}       
34
35
36void trollSkinning_SMGen_One_Weight_vp(
37        float4 position : POSITION,
38        float  blendIdx : BLENDINDICES,
39        out float4 oPosition : POSITION,
40        out float3 cPos:TEXCOORD0,     
41        // Support up to 24 bones of float3x4
42        // vs_1_1 only supports 96 params so more than this is not feasible
43        uniform float3x4   worldMatrix3x4Array[67],
44        uniform float4x4 viewMatrix,
45        uniform float4x4 viewProjectionMatrix)
46{
47        // transform by indexed matrix
48        float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
49        // view / projection
50        cPos = mul(viewMatrix, blendPos).xyz;
51        oPosition = mul(viewProjectionMatrix, blendPos);       
52}       
Note: See TracBrowser for help on using the repository browser.