… | |
… | |
15 | pixelOut OUT; // output of the pixel shader |
15 | pixelOut OUT; // output of the pixel shader |
16 | |
16 | |
17 | float SpecExpon = 120; |
17 | float SpecExpon = 120; |
18 | float4 LightColor = { 1, 1, 1, 1 }; |
18 | float4 LightColor = { 1, 1, 1, 1 }; |
19 | |
19 | |
20 | float3 n = IN.WorldNormal; |
20 | half3 n = IN.WorldNormal; |
21 | float3 v = IN.EyeVec; |
21 | half3 v = IN.EyeVec; |
22 | float3 l = IN.LightVec; |
22 | half3 l = IN.LightVec; |
23 | |
23 | |
24 | float r = reflect (-v, n); |
24 | half r = reflect (-v, n); |
25 | float spec = pow (clamp (dot (l, r), 0, 1), SpecExpon); |
25 | half spec = pow (clamp (dot (l, r), 0, 1), SpecExpon); |
26 | float diff = clamp (dot (n, l), 0.0, 1); |
26 | half diff = clamp (dot (n, l), 0.0, 1); |
27 | |
27 | |
28 | OUT.col = glstate.material.diffuse * diff + LightColor * spec; |
28 | OUT.col = glstate.material.diffuse * diff + LightColor * spec; |
29 | return OUT; |
29 | return OUT; |
30 | |
30 | |
31 | /* |
31 | /* |