ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/fsh.cg
(Generate patch)

Comparing libgender/fsh.cg (file contents):
Revision 1.9 by root, Tue Oct 5 11:06:06 2004 UTC vs.
Revision 1.10 by root, Tue Oct 5 11:25:19 2004 UTC

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 Ln = IN.LightVec;
21 float3 Nn = IN.WorldNormal; 20 float3 n = IN.WorldNormal;
22 float3 Vn = IN.EyeVec; 21 float3 v = IN.EyeVec;
22 float3 l = IN.LightVec;
23
24 float r = reflect (-v, n);
25 float spec = pow (clamp (dot (l, r), 0, 1), SpecExpon);
26 float diff = clamp (dot (n, l), 0.0, 1);
27
28 OUT.col = glstate.material.diffuse * diff + LightColor * spec;
29 return OUT;
30
31 /*
32 float3 Ln = normalize (IN.LightVec);
33 float3 Nn = normalize (IN.WorldNormal);
34 float3 Vn = normalize (IN.EyeVec);
23 35
24 float3 Hn = 0.5 * (Ln + Vn); 36 float3 Hn = 0.5 * (Ln + Vn);
25 float ldn = dot (Ln, Nn); 37 float ldn = dot (Ln, Nn);
26 float hdn = dot (Hn, Nn); 38 float hdn = dot (Hn, Nn);
27 39
32 float4 specContrib = litV.y * litV.z * LightColor; 44 float4 specContrib = litV.y * litV.z * LightColor;
33 float4 result = diffContrib + specContrib; 45 float4 result = diffContrib + specContrib;
34 46
35 OUT.col = result; 47 OUT.col = result;
36 return OUT; 48 return OUT;
49 */
37} 50}
38 51

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines