1 |
|
---|
2 | void trollSkinning_One_Weight_vp(
|
---|
3 | float4 position : POSITION,
|
---|
4 | float3 normal : NORMAL,
|
---|
5 | float2 uv : TEXCOORD0,
|
---|
6 | float3 tangent : TANGENT,
|
---|
7 | float4 blendIdx : BLENDINDICES,
|
---|
8 | float4 blendWgt : BLENDWEIGHT,
|
---|
9 | out float4 oPosition : POSITION,
|
---|
10 | out float2 oUv : TEXCOORD0,
|
---|
11 | //out float3 oTangent: TEXCOORD1,
|
---|
12 | //out float3 oBinormal: TEXCOORD2,
|
---|
13 | out float3 oNormal : TEXCOORD3,
|
---|
14 | out float3 V: TEXCOORD4,
|
---|
15 | out float3 L: TEXCOORD5,
|
---|
16 | uniform float3x4 worldMatrix3x4Array[69],
|
---|
17 | uniform float4x4 viewProjectionMatrix,
|
---|
18 | uniform float4 lightPos,
|
---|
19 | uniform float4 cameraPos)
|
---|
20 | {
|
---|
21 | // transform by indexed matrix
|
---|
22 | float4 blendPos = float4(0,0,0,1);
|
---|
23 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[0]], position).xyz * blendWgt[0];
|
---|
24 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[1]], position).xyz * blendWgt[1];
|
---|
25 |
|
---|
26 | // view / projection
|
---|
27 | oPosition = mul(viewProjectionMatrix, blendPos);
|
---|
28 | // transform normal
|
---|
29 | oNormal = mul((float3x3)worldMatrix3x4Array[blendIdx[0]], normal) * blendWgt[0];
|
---|
30 | oNormal += mul((float3x3)worldMatrix3x4Array[blendIdx[1]], normal) * blendWgt[1];
|
---|
31 | //oTangent = mul((float3x3)worldMatrix3x4Array[blendIdx], tangent);
|
---|
32 | oNormal = normalize(oNormal);
|
---|
33 | // oTangent = normalize(oTangent);
|
---|
34 | // oBinormal = cross(oTangent, oNormal);
|
---|
35 | // Lighting - support point and directional
|
---|
36 | L = lightPos.xyz - blendPos.xyz * lightPos.w;
|
---|
37 | V = cameraPos.xyz - blendPos.xyz;
|
---|
38 |
|
---|
39 | oUv = uv;
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | void trollSkinning_SMGen_One_Weight_vp(
|
---|
44 | float4 position : POSITION,
|
---|
45 | float4 blendIdx : BLENDINDICES,
|
---|
46 | float4 blendWgt : BLENDWEIGHT,
|
---|
47 | out float4 oPosition : POSITION,
|
---|
48 | out float3 cPos:TEXCOORD0,
|
---|
49 | uniform float3x4 worldMatrix3x4Array[69],
|
---|
50 | uniform float4x4 viewMatrix,
|
---|
51 | uniform float4x4 viewProjectionMatrix)
|
---|
52 | {
|
---|
53 | // transform by indexed matrix
|
---|
54 | float4 blendPos = float4(0,0,0,1);
|
---|
55 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[0]], position).xyz * blendWgt[0];
|
---|
56 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[1]], position).xyz * blendWgt[1];
|
---|
57 |
|
---|
58 | // view / projection
|
---|
59 | cPos = mul(viewMatrix, blendPos).xyz;
|
---|
60 | oPosition = mul(viewProjectionMatrix, blendPos);
|
---|
61 | }
|
---|
62 |
|
---|
63 | struct PS_IN
|
---|
64 | {
|
---|
65 | float4 hPos:POSITION;
|
---|
66 | float2 texCoord:TEXCOORD0;
|
---|
67 | float3 tangent:TEXCOORD1;
|
---|
68 | float3 binormal:TEXCOORD2;
|
---|
69 | float3 normal:TEXCOORD3;
|
---|
70 | float3 V: TEXCOORD4;
|
---|
71 | float3 L: TEXCOORD5;
|
---|
72 | };
|
---|
73 |
|
---|
74 | PS_IN FPSArmSkinning_VP(float4 position : POSITION,
|
---|
75 | float3 normal : NORMAL,
|
---|
76 | float3 tangent : TANGENT,
|
---|
77 | float2 uv : TEXCOORD0,
|
---|
78 | float4 blendIdx : BLENDINDICES,
|
---|
79 | float4 blendWgt : BLENDWEIGHT,
|
---|
80 | uniform float3x4 worldMatrix3x4Array[49],
|
---|
81 | uniform float4x4 viewMatrix,
|
---|
82 | uniform float4x4 viewProjectionMatrix,
|
---|
83 | uniform float4 lightPos,
|
---|
84 | uniform float4 cameraPos)
|
---|
85 | {
|
---|
86 | PS_IN OUT = (PS_IN) 0;
|
---|
87 | // transform by indexed matrix
|
---|
88 | float4 blendPos = float4(0,0,0,1);
|
---|
89 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[0]], position).xyz * blendWgt[0];
|
---|
90 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[1]], position).xyz * blendWgt[1];
|
---|
91 |
|
---|
92 | // view / projection
|
---|
93 | OUT.hPos = mul(viewProjectionMatrix, blendPos);
|
---|
94 | // transform normal
|
---|
95 | OUT.normal = mul((float3x3)worldMatrix3x4Array[blendIdx[0]], normal) * blendWgt[0];
|
---|
96 | OUT.normal += mul((float3x3)worldMatrix3x4Array[blendIdx[1]], normal) * blendWgt[1];
|
---|
97 | OUT.tangent = mul((float3x3)worldMatrix3x4Array[blendIdx[0]], tangent) * blendWgt[0];
|
---|
98 | OUT.tangent += mul((float3x3)worldMatrix3x4Array[blendIdx[1]], tangent) * blendWgt[1];
|
---|
99 | OUT.normal = normalize(OUT.normal);
|
---|
100 | OUT.tangent = normalize(OUT.tangent);
|
---|
101 | OUT.binormal = cross(OUT.tangent, OUT.normal);
|
---|
102 | // Lighting - support point and directional
|
---|
103 | OUT.L = lightPos.xyz - blendPos.xyz * lightPos.w;
|
---|
104 | OUT.V = cameraPos.xyz - blendPos.xyz;
|
---|
105 |
|
---|
106 | OUT.texCoord = uv;
|
---|
107 |
|
---|
108 | return OUT;
|
---|
109 | }
|
---|
110 |
|
---|
111 | void FPSArmSkinning_SMGen_VP(
|
---|
112 | float4 position : POSITION,
|
---|
113 | float4 blendIdx : BLENDINDICES,
|
---|
114 | float4 blendWgt : BLENDWEIGHT,
|
---|
115 | out float4 oPosition : POSITION,
|
---|
116 | out float3 cPos:TEXCOORD0,
|
---|
117 | uniform float3x4 worldMatrix3x4Array[49],
|
---|
118 | uniform float4x4 viewMatrix,
|
---|
119 | uniform float4x4 viewProjectionMatrix)
|
---|
120 | {
|
---|
121 | // transform by indexed matrix
|
---|
122 | float4 blendPos = float4(0,0,0,1);
|
---|
123 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[0]], position).xyz * blendWgt[0];
|
---|
124 | blendPos.xyz += mul(worldMatrix3x4Array[blendIdx[1]], position).xyz * blendWgt[1];
|
---|
125 |
|
---|
126 | // view / projection
|
---|
127 | cPos = mul(viewMatrix, blendPos).xyz;
|
---|
128 | oPosition = mul(viewProjectionMatrix, blendPos);
|
---|
129 | }
|
---|
130 | |
---|