1 | float4x4 mvp : ModelViewProjection;
|
---|
2 | float4x4 mv : ModelView;
|
---|
3 | float4x4 mvit : ModelViewIT;
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 | float4 vertex(uniform float4x4 modelViewProj,
|
---|
8 | uniform float4x4 modelView,
|
---|
9 | uniform float4x4 modelViewIT,
|
---|
10 | float4 P : POSITION,
|
---|
11 | float4 N : NORMAL,
|
---|
12 | float2 uvIn : TEXCOORD0,
|
---|
13 | in float4 Cin : COLOR0,
|
---|
14 | out float4 CC : COLOR0,
|
---|
15 | out float3 Pcam : TEXCOORD1,
|
---|
16 | out float3 Ncam : TEXCOORD2,
|
---|
17 | out float2 uv : TEXCOORD0) : POSITION
|
---|
18 | {
|
---|
19 | CC.xyz = normalize(N.xyz);
|
---|
20 | Pcam = mul(modelView, P).xyz;
|
---|
21 | //Ncam = mul(modelViewIT, N).xyz;
|
---|
22 | float3x3 rotation = (float3x3)modelView;
|
---|
23 | Ncam.xyz = mul(rotation,N.xyz);
|
---|
24 |
|
---|
25 | uv = uvIn;
|
---|
26 | return mul(modelViewProj, P);
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | float4 light( uniform float4 col,
|
---|
31 | in float3 texcoord,
|
---|
32 | float3 Pcam : TEXCOORD1,
|
---|
33 | float3 Ncam : TEXCOORD2) : COLOR
|
---|
34 | {
|
---|
35 | float3 wo = normalize(-Pcam);
|
---|
36 | float3 result;// = ambient;
|
---|
37 | float3 Nn = normalize(Ncam);
|
---|
38 |
|
---|
39 | float3 scolor = float3(1.0,1.0,1.0);
|
---|
40 | float3 Ln = normalize(float3(0,0,-1)-Pcam);
|
---|
41 | float3 lcolor = float3(1,1,1);
|
---|
42 | float3 Hn = normalize(wo + Ln);
|
---|
43 | float ldn = dot(Ln,Nn);
|
---|
44 | float hdn = dot(Hn,Nn);
|
---|
45 | float4 litV = lit(ldn, hdn, 32);
|
---|
46 |
|
---|
47 | result = col*litV.y + scolor*litV.z;
|
---|
48 | return float4(result, 1.);
|
---|
49 | }
|
---|
50 |
|
---|
51 | technique red <string target = "joints";>
|
---|
52 | {
|
---|
53 | pass p0
|
---|
54 | {
|
---|
55 | VertexProgram = compile arbvp1 vertex(mvp, mv, mvit);
|
---|
56 | FragmentProgram = compile arbfp1 light(float4(1.0, 0.0 ,0.0 ,1.0));
|
---|
57 |
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | technique red <string target = "parts";>
|
---|
62 | {
|
---|
63 | pass p0
|
---|
64 | {
|
---|
65 | VertexProgram = compile arbvp1 vertex(mvp, mv, mvit);
|
---|
66 | FragmentProgram = compile arbfp1 light(float4(0.0, 1.0 ,0.0 ,1.0));
|
---|
67 |
|
---|
68 | }
|
---|
69 | } |
---|