0001:
0002:
0003:
0004:
0005:
0006:
0007:
0008: struct appdata : application2vertex {
0009: float4 Position;
0010: float4 Weight;
0011: float4 Normal;
0012: float2 Texcoord0;
0013: };
0014:
0015:
0016:
0017:
0018: #pragma bind vfconn.Position = HPOS;
0019: #pragma bind vfconn.Diffuse = COL0;
0020: #pragma bind vfconn.Texcoord0 = TEX0;
0021:
0022: struct vfconn : vertex2fragment {
0023: float4 Position;
0024: float4 Diffuse;
0025: float2 Texcoord0;
0026: };
0027:
0028:
0029:
0030: vfconn main(appdata IN
0031: , uniform float4x4 worldviewproj_matrix
0032: , uniform float3x4 m0
0033: , uniform float3x4 m1
0034: , uniform float4 light
0035: , uniform float4 diffuse
0036: ) {
0037: vfconn OUT;
0038: float4 pos;
0039:
0040:
0041:
0042: float3 pos0 = mul(m0, IN.Position);
0043: float3 pos1 = mul(m1, IN.Position);
0044:
0045:
0046: pos.xyz = IN.Weight.x * pos0
0047: + IN.Weight.y * pos1;
0048: pos.w = 1.0f;
0049:
0050:
0051: OUT.Position = mul(worldviewproj_matrix, pos);
0052:
0053:
0054:
0055: float3 n0 = mul(m0, IN.Normal);
0056: float3 n1 = mul(m1, IN.Normal);
0057: float3 n = IN.Weight.x * n0 + IN.Weight.y * n1;
0058:
0059: float4 LN = max(dot(n, light.xyz), 0).xxxx + light.w;
0060:
0061: OUT.Diffuse = diffuse * LN;
0062:
0063:
0064:
0065: OUT.Texcoord0 = IN.Texcoord0;
0066:
0067: return OUT;
0068: }
0069: