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

Comparing libgender/fsh.cg (file contents):
Revision 1.4 by root, Tue Oct 5 07:54:17 2004 UTC vs.
Revision 1.5 by root, Tue Oct 5 08:13:01 2004 UTC

20 //uniform float4 SurfColor, 20 //uniform float4 SurfColor,
21 //uniform float4 LightColor 21 //uniform float4 LightColor
22 ) 22 )
23{ 23{
24 float SpecExpon = 120; 24 float SpecExpon = 120;
25 float4 AmbiColor = { 0.5, 0, 0, 1 };
26 float4 SurfColor = { 0, 0.5, 0, 1 };
27 float4 LightColor = { 0.5, 0.5, 0.5, 1 }; 25 float4 LightColor = { 1, 1, 1, 1 };
28 26
29 pixelOut OUT; // output of the pixel shader 27 pixelOut OUT; // output of the pixel shader
30 float3 Ln = normalize(IN.LightVec); 28 float3 Ln = normalize(IN.LightVec);
31 float3 Nn = normalize(IN.WorldNormal); 29 float3 Nn = normalize(IN.WorldNormal);
32 float3 Vn = normalize(IN.WorldView); 30 float3 Vn = normalize(IN.WorldView);
36 // scalar product between halfway and normal vectors: 34 // scalar product between halfway and normal vectors:
37 float hdn = dot(Hn,Nn); 35 float hdn = dot(Hn,Nn);
38 // specialized "lit" function computes weights for 36 // specialized "lit" function computes weights for
39 // diffuse and specular parts: 37 // diffuse and specular parts:
40 float4 litV = lit(ldn,hdn,SpecExpon); 38 float4 litV = lit(ldn,hdn,SpecExpon);
41 OUT.col = litV.y * SurfColor + litV.z * LightColor; 39 float4 diffContrib = glstate.material.diffuse * ( litV.y * LightColor + glstate.lightmodel.ambient);
42 return OUT;
43 float4 diffContrib = SurfColor * ( litV.y * LightColor + AmbiColor);
44 float4 specContrib = litV.y*litV.z * LightColor; 40 float4 specContrib = litV.y*litV.z * LightColor;
45 // sum of diffuse and specular contributions: 41 // sum of diffuse and specular contributions:
46 float4 result = diffContrib + specContrib; 42 float4 result = diffContrib + specContrib;
47 OUT.col = result + AmbiColor; 43 OUT.col = result;
48 return OUT; // output of pixel shader 44 return OUT; // output of pixel shader
49} 45}
50 46

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines