ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/vsh.cg
Revision: 1.9
Committed: Wed Oct 6 00:23:27 2004 UTC (19 years, 8 months ago) by root
Branch: MAIN
Changes since 1.8: +4 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 struct vertexIn {
2 float4 Position : POSITION;
3 float4 Normal : NORMAL;
4 float4 UV : TEXCOORD0;
5 };
6
7 struct vertexOut {
8 float4 HPosition : POSITION;
9 float4 TexCoord : TEXCOORD0;
10 float3 LightVec : TEXCOORD1;
11 float3 EyeVec : TEXCOORD2;
12 float3 WorldNormal : TEXCOORD3;
13 float3 WorldView : TEXCOORD4;
14 };
15
16 vertexOut main(vertexIn IN)
17 {
18 vertexOut OUT;
19
20 float4 LightPos = { 0, 2, 1000, 1 };
21
22 float3 wpos = mul (glstate.matrix.modelview[0], IN.Position).xyz;
23
24 OUT.WorldNormal = normalize (mul (glstate.matrix.invtrans.modelview[0], IN.Normal).xyz);
25 OUT.EyeVec = normalize (wpos);
26 OUT.WorldView = normalize (glstate.matrix.invtrans.projection[3].xyz - wpos);
27 OUT.LightVec = normalize (mul (glstate.matrix.modelview[0], LightPos).xyz - wpos);
28 OUT.HPosition = mul (glstate.matrix.mvp, IN.Position);
29 OUT.TexCoord = IN.UV;
30
31 return OUT;
32 }
33