… | |
… | |
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.5, 0.5, 0.5, 1.0 }; |
21 | float4 AmbiColor = { 0.1, 0.1, 0.1, 1.0 }; |
22 | float4 LightColor = { 1, 1, 1, 1 }; |
22 | float4 LightColor = { 1, 1, 1, 1 }; |
23 | IN.TexCoord.y += dot (IN.WorldNormal, float3 (1,1,0)); |
|
|
24 | IN.TexCoord.x += dot (IN.WorldNormal, float3 (0,1,1)); |
|
|
25 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
23 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
26 | |
24 | |
27 | half3 Ln = normalize (IN.LightVec); |
25 | half3 Ln = normalize (IN.LightVec); |
28 | half3 Nn = normalize (IN.WorldNormal); |
26 | half3 Nn = normalize (IN.WorldNormal); |
29 | half3 Vn = normalize (IN.WorldView); |
27 | half3 Vn = normalize (IN.WorldView); |
… | |
… | |
31 | half3 Hn = normalize (Ln + Vn); |
29 | half3 Hn = normalize (Ln + Vn); |
32 | half ldn = dot (Ln, Nn); |
30 | half ldn = dot (Ln, Nn); |
33 | half hdn = dot (Hn, Nn); |
31 | half hdn = dot (Hn, Nn); |
34 | |
32 | |
35 | half4 litV = lit (ldn, hdn, SpecExpon); |
33 | half4 litV = lit (ldn, hdn, SpecExpon); |
36 | //half4 diffContrib = glstate.material.diffuse * (litV.y * LightColor + glstate.lightmodel.ambient); |
34 | half4 diffContrib = diffuse_color * (litV.y * LightColor + glstate.lightmodel.ambient); |
37 | //half4 specContrib = litV.y * litV.z * LightColor; |
35 | half4 specContrib = litV.y * litV.z * LightColor; |
38 | //half4 result = diffContrib + specContrib; |
36 | half4 result = diffContrib + specContrib; |
39 | half4 result = diffuse_color * litV.y + LightColor * litV.z; |
37 | //half4 result = diffuse_color * litV.y + LightColor * litV.z; |
40 | // half4 result = AmbiColor + glstate.material.diffuse * litV.y + LightColor * litV.z; |
|
|
41 | |
38 | |
42 | OUT.col = result; |
39 | OUT.col = result; |
43 | return OUT; |
40 | return OUT; |
44 | } |
41 | } |
45 | |
42 | |