0001:
0002:
0003:
0004:
0005:
0006:
0007:
0008: struct appdata {
0009: float4 position : POSITION;
0010: float4 weight : BLENDWEIGHT;
0011: float4 normal : NORMAL;
0012: float4 texcoord0 : TEXCOORD0;
0013: };
0014:
0015:
0016:
0017:
0018: vf20 main(appdata IN
0019: , uniform float4x4 worldviewproj_matrix
0020: , uniform float3x4 m0
0021: , uniform float3x4 m1
0022: , uniform float4 light
0023: , uniform float4 diffuse
0024: ) {
0025: vf20 OUT;
0026: float4 pos;
0027:
0028:
0029:
0030: float3 pos0 = mul(m0, IN.position);
0031: float3 pos1 = mul(m1, IN.position);
0032:
0033:
0034: pos.xyz = IN.weight.x * pos0
0035: + IN.weight.y * pos1;
0036: pos.w = 1.0f;
0037:
0038:
0039: OUT.HPOS = mul(worldviewproj_matrix, pos);
0040:
0041:
0042:
0043: float3 n0 = mul(m0, IN.normal);
0044: float3 n1 = mul(m1, IN.normal);
0045: float3 n = IN.weight.x * n0 + IN.weight.y * n1;
0046:
0047: float4 LN = max(dot(n, light.xyz), 0).xxxx + light.w;
0048:
0049: OUT.COL0 = diffuse * LN;
0050:
0051:
0052:
0053: OUT.TEX0 = IN.texcoord0;
0054:
0055: return OUT;
0056: }
0057: