1 |
struct vertexOut { |
2 |
float4 HPosition : POSITION; |
3 |
float4 TexCoord : TEXCOORD0; |
4 |
float3 LightVec : TEXCOORD1; |
5 |
float3 EyeVec : TEXCOORD2; |
6 |
float3 WorldNormal : TEXCOORD3; |
7 |
float3 WorldView : TEXCOORD4; |
8 |
float3 test1 : TEXCOORD5; |
9 |
float3 test2 : TEXCOORD6; |
10 |
}; |
11 |
|
12 |
struct pixelOut { |
13 |
float3 col : COLOR; |
14 |
float depth : DEPTH; |
15 |
}; |
16 |
|
17 |
pixelOut main(vertexOut IN, uniform sampler2D Texture) |
18 |
{ |
19 |
pixelOut OUT; |
20 |
|
21 |
half SpecExpon = 200; |
22 |
float4 LightColor = { 1, 1, 1, 1 }; |
23 |
float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
24 |
|
25 |
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 |
|
33 |
half3 litV = lit (ldn, hdn, SpecExpon); |
34 |
half3 diffContrib = diffuse_color * ((litV.y + 0.3) * LightColor + glstate.lightmodel.ambient); |
35 |
half3 specContrib = litV.y * litV.z * LightColor; |
36 |
half4 result = (diffContrib + specContrib).xyzx; |
37 |
//half3 result = diffuse_color * litV.y + LightColor * litV.z; |
38 |
|
39 |
OUT.col = result.xyz; |
40 |
//float depth = IN.HPosition.z / IN.HPosition.w; |
41 |
//OUT.depth = 0.5 * depth + 0.5; |
42 |
return OUT; |
43 |
} |
44 |
|