1!!ARBvp1.0
2
3# Compute the diffuse light from a single source and apply a texture
4# translation.
5
6ATTRIB iPos          = vertex.position;
7ATTRIB iNormal       = vertex.normal;
8ATTRIB iTex0         = vertex.texcoord[0];
9PARAM  mvp[4]        = { state.matrix.mvp };
10PARAM  lightDir      = program.env[0];
11PARAM  diffuse       = program.env[2];
12PARAM  texOffset     = program.env[7];
13PARAM  ambient       = program.env[5];
14PARAM  zeroVec       = { 0, 0, 0, 0 };
15OUTPUT oPos          = result.position;
16OUTPUT oColor        = result.color;
17OUTPUT oTex0         = result.texcoord[0];
18
19TEMP   diffuseFactor;
20
21# Transform the vertex by the modelview matrix
22DP4   oPos.x, mvp[0], iPos;
23DP4   oPos.y, mvp[1], iPos;
24DP4   oPos.z, mvp[2], iPos;
25DP4   oPos.w, mvp[3], iPos;
26
27# Compute the diffuse light component
28DP3   diffuseFactor, iNormal, lightDir;
29# Clamp the diffuse component to zero
30MAX   diffuseFactor, diffuseFactor, zeroVec;
31
32# Output the texture
33ADD   oTex0, iTex0, texOffset;
34# Output the primary color
35MAD   oColor, diffuse, diffuseFactor, ambient;
36
37END
38
39