ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/fsh.cg
Revision: 1.14
Committed: Wed Oct 6 07:45:20 2004 UTC (19 years, 8 months ago) by root
Branch: MAIN
Changes since 1.13: +2 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 struct vertexOut {
2 float4 HPosition : POSITION;
3 float4 TexCoord : TEXCOORD0;
4 float3 LightVec : TEXCOORD1;
5 float3 EyeVec : TEXCOORD2;
6 float3 WorldNormal : TEXCOORD3;
7 float3 WorldView : TEXCOORD4;
8 };
9
10 struct pixelOut {
11 float4 col : COLOR;
12 };
13
14 pixelOut main(vertexOut IN)
15 {
16 pixelOut OUT;
17
18 half SpecExpon = 200;
19 float4 AmbiColor = { 0.5, 0.5, 0.5, 1.0 };
20 float4 LightColor = { 1, 1, 1, 1 };
21
22 half3 Ln = normalize (IN.LightVec);
23 half3 Nn = normalize (IN.WorldNormal);
24 half3 Vn = normalize (IN.WorldView);
25
26 half3 Hn = normalize (Ln + Vn);
27 half ldn = dot (Ln, Nn);
28 half hdn = dot (Hn, Nn);
29
30 half4 litV = lit (ldn, hdn, SpecExpon);
31 //half4 diffContrib = glstate.material.diffuse * (litV.y * LightColor + glstate.lightmodel.ambient);
32 //half4 specContrib = litV.y * litV.z * LightColor;
33 //half4 result = diffContrib + specContrib;
34 half4 result = AmbiColor + glstate.material.diffuse * litV.y + LightColor * litV.z;
35
36 OUT.col = result;
37 return OUT;
38 }
39