1 |
root |
1.2 |
struct vertexOut { |
2 |
root |
1.8 |
float4 HPosition : POSITION; |
3 |
|
|
float4 TexCoord : TEXCOORD0; |
4 |
|
|
float3 LightVec : TEXCOORD1; |
5 |
|
|
float3 EyeVec : TEXCOORD2; |
6 |
|
|
float3 WorldNormal : TEXCOORD3; |
7 |
root |
1.12 |
float3 WorldView : TEXCOORD4; |
8 |
root |
1.16 |
float3 test1 : TEXCOORD5; |
9 |
|
|
float3 test2 : TEXCOORD6; |
10 |
root |
1.2 |
}; |
11 |
root |
1.1 |
|
12 |
|
|
struct pixelOut { |
13 |
|
|
float4 col : COLOR; |
14 |
|
|
}; |
15 |
root |
1.3 |
|
16 |
root |
1.15 |
pixelOut main(vertexOut IN, uniform sampler2D Texture) |
17 |
root |
1.1 |
{ |
18 |
root |
1.12 |
pixelOut OUT; |
19 |
root |
1.8 |
|
20 |
root |
1.12 |
half SpecExpon = 200; |
21 |
root |
1.17 |
float4 AmbiColor = { 0.1, 0.1, 0.1, 1.0 }; |
22 |
root |
1.5 |
float4 LightColor = { 1, 1, 1, 1 }; |
23 |
root |
1.15 |
float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
24 |
root |
1.3 |
|
25 |
root |
1.12 |
half3 Ln = normalize (IN.LightVec); |
26 |
|
|
half3 Nn = normalize (IN.WorldNormal); |
27 |
|
|
half3 Vn = normalize (IN.WorldView); |
28 |
|
|
|
29 |
|
|
half3 Hn = normalize (Ln + Vn); |
30 |
|
|
half ldn = dot (Ln, Nn); |
31 |
|
|
half hdn = dot (Hn, Nn); |
32 |
root |
1.8 |
|
33 |
root |
1.12 |
half4 litV = lit (ldn, hdn, SpecExpon); |
34 |
root |
1.17 |
half4 diffContrib = diffuse_color * (litV.y * LightColor + glstate.lightmodel.ambient); |
35 |
|
|
half4 specContrib = litV.y * litV.z * LightColor; |
36 |
|
|
half4 result = diffContrib + specContrib; |
37 |
|
|
//half4 result = diffuse_color * litV.y + LightColor * litV.z; |
38 |
root |
1.8 |
|
39 |
root |
1.5 |
OUT.col = result; |
40 |
root |
1.9 |
return OUT; |
41 |
root |
1.1 |
} |
42 |
|
|
|