… | |
… | |
8 | float3 test1 : TEXCOORD5; |
8 | float3 test1 : TEXCOORD5; |
9 | float3 test2 : TEXCOORD6; |
9 | float3 test2 : TEXCOORD6; |
10 | }; |
10 | }; |
11 | |
11 | |
12 | struct pixelOut { |
12 | struct pixelOut { |
13 | float4 col : COLOR; |
13 | float4 col : COLOR; |
14 | }; |
14 | }; |
15 | |
15 | |
16 | pixelOut main(vertexOut IN, uniform sampler2D Texture) |
16 | pixelOut main(vertexOut IN, uniform sampler2D Texture) |
17 | { |
17 | { |
18 | pixelOut OUT; |
18 | pixelOut OUT; |
19 | |
19 | |
20 | half SpecExpon = 200; |
20 | half SpecExpon = 200; |
21 | float4 AmbiColor = { 0.1, 0.1, 0.1, 1.0 }; |
|
|
22 | float4 LightColor = { 1, 1, 1, 1 }; |
21 | float4 LightColor = { 1, 1, 1, 1 }; |
23 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
22 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
24 | |
23 | |
25 | half3 Ln = normalize (IN.LightVec); |
24 | half3 Ln = normalize (IN.LightVec); |
26 | half3 Nn = normalize (IN.WorldNormal); |
25 | half3 Nn = normalize (IN.WorldNormal); |
… | |
… | |
28 | |
27 | |
29 | half3 Hn = normalize (Ln + Vn); |
28 | half3 Hn = normalize (Ln + Vn); |
30 | half ldn = dot (Ln, Nn); |
29 | half ldn = dot (Ln, Nn); |
31 | half hdn = dot (Hn, Nn); |
30 | half hdn = dot (Hn, Nn); |
32 | |
31 | |
33 | half4 litV = lit (ldn, hdn, SpecExpon); |
32 | half3 litV = lit (ldn, hdn, SpecExpon); |
34 | half4 diffContrib = diffuse_color * (litV.y * LightColor + glstate.lightmodel.ambient); |
33 | half3 diffContrib = diffuse_color * ((litV.y + 0.3) * LightColor + glstate.lightmodel.ambient); |
35 | half4 specContrib = litV.y * litV.z * LightColor; |
34 | half3 specContrib = litV.y * litV.z * LightColor; |
36 | half4 result = diffContrib + specContrib; |
35 | half4 result = (diffContrib + specContrib).xyzx; |
37 | //half4 result = diffuse_color * litV.y + LightColor * litV.z; |
36 | //half3 result = diffuse_color * litV.y + LightColor * litV.z; |
38 | |
37 | |
39 | OUT.col = result; |
38 | OUT.col = result; |
|
|
39 | //float depth = IN.HPosition.z / IN.HPosition.w; |
|
|
40 | //OUT.depth = 0.5 * depth + 0.5; |
40 | return OUT; |
41 | return OUT; |
41 | } |
42 | } |
42 | |
43 | |