1 |
|
---|
2 | void trollSkinning_One_Weight_vp(
|
---|
3 | float4 position : POSITION,
|
---|
4 | float3 normal : NORMAL,
|
---|
5 | float2 uv : TEXCOORD0,
|
---|
6 | float3 tangent : TANGENT,
|
---|
7 | float blendIdx : BLENDINDICES,
|
---|
8 | out float4 oPosition : POSITION,
|
---|
9 | out float2 oUv : TEXCOORD0,
|
---|
10 | out float3 oTangent: TEXCOORD1,
|
---|
11 | out float3 oBinormal: TEXCOORD2,
|
---|
12 | out float3 oNormal : TEXCOORD3,
|
---|
13 | out float3 V: TEXCOORD4,
|
---|
14 | out float3 L: TEXCOORD5,
|
---|
15 | uniform float3x4 worldMatrix3x4Array[67],
|
---|
16 | uniform float4x4 viewProjectionMatrix,
|
---|
17 | uniform float4 lightPos,
|
---|
18 | uniform float4 cameraPos)
|
---|
19 | {
|
---|
20 | // transform by indexed matrix
|
---|
21 | float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
|
---|
22 | // view / projection
|
---|
23 | oPosition = mul(viewProjectionMatrix, blendPos);
|
---|
24 | // transform normal
|
---|
25 | oNormal = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
|
---|
26 | oTangent = mul((float3x3)worldMatrix3x4Array[blendIdx], tangent);
|
---|
27 | oNormal = normalize(oNormal);
|
---|
28 | oTangent = normalize(oTangent);
|
---|
29 | oBinormal = cross(oTangent, oNormal);
|
---|
30 | // Lighting - support point and directional
|
---|
31 | L = lightPos.xyz - blendPos.xyz * lightPos.w;
|
---|
32 | V = cameraPos.xyz - blendPos.xyz;
|
---|
33 |
|
---|
34 | oUv = uv;
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | void trollSkinning_SMGen_One_Weight_vp(
|
---|
39 | float4 position : POSITION,
|
---|
40 | float blendIdx : BLENDINDICES,
|
---|
41 | out float4 oPosition : POSITION,
|
---|
42 | out float3 cPos:TEXCOORD0,
|
---|
43 | // Support up to 24 bones of float3x4
|
---|
44 | // vs_1_1 only supports 96 params so more than this is not feasible
|
---|
45 | uniform float3x4 worldMatrix3x4Array[67],
|
---|
46 | uniform float4x4 viewMatrix,
|
---|
47 | uniform float4x4 viewProjectionMatrix)
|
---|
48 | {
|
---|
49 | // transform by indexed matrix
|
---|
50 | float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
|
---|
51 | // view / projection
|
---|
52 | cPos = mul(viewMatrix, blendPos).xyz;
|
---|
53 | oPosition = mul(viewProjectionMatrix, blendPos);
|
---|
54 | } |
---|