ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/fsh.cg
Revision: 1.21
Committed: Mon Oct 18 14:31:36 2004 UTC (19 years, 8 months ago) by root
Branch: MAIN
Changes since 1.20: +1 -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 float3 test1 : TEXCOORD5;
9 float3 test2 : TEXCOORD6;
10 };
11
12 struct pixelOut {
13 float4 col : COLOR;
14 };
15
16 pixelOut main(vertexOut IN, uniform sampler2D Texture)
17 {
18 pixelOut OUT;
19
20 half SpecExpon = 200;
21 float4 LightColor = { 1, 1, 1, 1 };
22 float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy);
23
24 half3 Ln = normalize (IN.LightVec);
25 half3 Nn = normalize (IN.WorldNormal);
26 half3 Vn = normalize (IN.WorldView);
27
28 half3 Hn = normalize (Ln + Vn);
29 half ldn = dot (Ln, Nn);
30 half hdn = dot (Hn, Nn);
31
32 half4 litV = lit (ldn, hdn, SpecExpon);
33 half4 diffContrib = diffuse_color * ((litV.y + 0.3) * LightColor + glstate.lightmodel.ambient);
34 half4 specContrib = litV.y * litV.z * LightColor;
35 half4 result = diffContrib + specContrib;
36 //half4 result = diffuse_color * litV.y + LightColor * litV.z;
37
38 OUT.col = result;
39 return OUT;
40 }
41