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