ARB versions of vertex programs.
parent
e7aa1751ef
commit
81f06e9c98
|
@ -0,0 +1,36 @@
|
|||
!!ARBvp1.0
|
||||
|
||||
# Compute the diffuse light from a single source
|
||||
|
||||
ATTRIB iPos = vertex.position;
|
||||
ATTRIB iNormal = vertex.normal;
|
||||
ATTRIB iTex0 = vertex.texcoord[0];
|
||||
PARAM mvp[4] = { state.matrix.mvp };
|
||||
PARAM lightDir = program.env[0];
|
||||
PARAM diffuse = state.lightprod[0].diffuse;
|
||||
PARAM ambient = state.lightmodel.ambient;
|
||||
PARAM zeroVec = { 0, 0, 0, 0 };
|
||||
OUTPUT oPos = result.position;
|
||||
OUTPUT oColor = result.color;
|
||||
OUTPUT oTex0 = result.texcoord[0];
|
||||
|
||||
TEMP diffuseFactor;
|
||||
|
||||
# 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 diffuse light component
|
||||
DP3 diffuseFactor, iNormal, lightDir;
|
||||
# Clamp the diffuse component to zero
|
||||
MAX diffuseFactor, diffuseFactor, zeroVec;
|
||||
|
||||
# Output the texture
|
||||
MOV oTex0, iTex0;
|
||||
# Output the primary color
|
||||
MAD oColor, diffuse, diffuseFactor, ambient;
|
||||
|
||||
END
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
!!ARBvp1.0
|
||||
|
||||
# Night texture lighting
|
||||
|
||||
ATTRIB iPos = vertex.position;
|
||||
ATTRIB iNormal = vertex.normal;
|
||||
ATTRIB iTex0 = vertex.texcoord[0];
|
||||
PARAM mvp[4] = { state.matrix.mvp };
|
||||
PARAM lightDir = program.env[0];
|
||||
PARAM diffuse = state.lightprod[0].diffuse;
|
||||
PARAM zeroVec = { 0, 0, 0, 0 };
|
||||
PARAM one = 1;
|
||||
OUTPUT oPos = result.position;
|
||||
OUTPUT oColor = result.color;
|
||||
OUTPUT oTex0 = result.texcoord[0];
|
||||
|
||||
TEMP diffuseFactor;
|
||||
|
||||
# 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 diffuse light component
|
||||
DP3 diffuseFactor, iNormal, lightDir;
|
||||
# Clamp the diffuse component to zero
|
||||
MAX diffuseFactor, diffuseFactor, zeroVec;
|
||||
|
||||
# Use the fourth power of L dot N to create a sharper division between
|
||||
# the lit and unlit sides of the planet.
|
||||
ADD diffuseFactor, one, -diffuseFactor;
|
||||
MUL diffuseFactor, diffuseFactor, diffuseFactor;
|
||||
MAD diffuseFactor, diffuseFactor, -diffuseFactor, one;
|
||||
|
||||
# Output the texture
|
||||
MOV oTex0, iTex0;
|
||||
# Output the primary color
|
||||
MUL oColor, diffuse, diffuseFactor;
|
||||
|
||||
END
|
||||
|
Loading…
Reference in New Issue