45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
!!ARBvp1.0
|
|
|
|
# Compute the diffuse light from two directional light sources
|
|
|
|
ATTRIB iPos = vertex.position;
|
|
ATTRIB iNormal = vertex.normal;
|
|
ATTRIB iTex0 = vertex.texcoord[0];
|
|
PARAM mvp[4] = { state.matrix.mvp };
|
|
PARAM lightDir0 = program.env[0];
|
|
PARAM diffuse0 = program.env[2];
|
|
PARAM lightDir1 = program.env[18];
|
|
PARAM diffuse1 = program.env[19];
|
|
PARAM ambient = program.env[5];
|
|
PARAM zeroVec = { 0, 0, 0, 0 };
|
|
OUTPUT oPos = result.position;
|
|
OUTPUT oColor = result.color;
|
|
OUTPUT oTex0 = result.texcoord[0];
|
|
|
|
TEMP diffuseFactor;
|
|
TEMP diffuseColor;
|
|
|
|
# Transform the vertex by the modelview matrix
|
|
DP4 oPos.x, mvp[0], iPos;
|
|
DP4 oPos.y, mvp[1], iPos;
|
|
DP4 oPos.z, mvp[2], iPos;
|
|
DP4 oPos.w, mvp[3], iPos;
|
|
|
|
# Compute the illumination from the first light source
|
|
DP3 diffuseFactor, iNormal, lightDir0;
|
|
MAX diffuseFactor, diffuseFactor, zeroVec;
|
|
MAD diffuseColor, diffuse0, diffuseFactor, ambient;
|
|
|
|
# Compute the illumination from the second light source
|
|
DP3 diffuseFactor, iNormal, lightDir1;
|
|
MAX diffuseFactor, diffuseFactor, zeroVec;
|
|
MAD diffuseColor, diffuse1, diffuseFactor, diffuseColor;
|
|
|
|
# Output the texture
|
|
MOV oTex0, iTex0;
|
|
# Output the primary color
|
|
MOV oColor, diffuseColor;
|
|
|
|
END
|
|
|