!!ARBvp1.0
# Original Input...
ATTRIB OriginalPos   = vertex.position;		# Input vertex position.
ATTRIB OriginalColor	= vertex.color;			# Input vertex color.
ATTRIB OriginalNormal= vertex.normal;        # Input vertex normal.
ATTRIB OriginalTex2= vertex.texcoord[2];	# Input texture coordinate 1.
#ATTRIB OriginalTex1	= vertex.texcoord[1];	# Input texture coordinate 1.
ATTRIB OriginalTex0	= vertex.texcoord[0];	# Input texture coordinate 1.

# Vertex Output...
OUTPUT OutPos			= result.position;		# Output position.
OUTPUT OutColor		= result.color;			# Ouput color.
OUTPUT OutTex0			= result.texcoord[0];	# Output texture coordinate 0.
OUTPUT OutTex1			= result.texcoord[1];	# Output texture coordinate 1.
OUTPUT OutTex2			= result.texcoord[2];	# Output texture coordinate 1.
OUTPUT OutLine			= result.texcoord[3];
# Constant variables...
PARAM ModelViewProj[4]  = { state.matrix.mvp }; # Modelview Projection Matrix.
PARAM VIEWPosition     = program.env[0];     
PARAM LightPosition     = program.env[1];       # Translation value sent in from the application.
PARAM LightPosition2     = program.env[2];       # Translation value sent in from the application.

# Temporary variables...
TEMP lightVectorNormal;                      # Just a temporary variable.
TEMP lightVector;                      # Just a temporary variable.
TEMP Result1;                      # Just a temporary variable.
TEMP Result2;                      # Just a temporary variable.
TEMP VIEWVectorNormal;                      # Just a temporary variable.
TEMP VIEWVector;                      # Just a temporary variable.

#**************************************************
# BODY
#**************************************************


# Here each axis is transformed into clip space.
DP4 OutPos.x, ModelViewProj[0], OriginalPos;
DP4 OutPos.y, ModelViewProj[1], OriginalPos;
DP4 OutPos.z, ModelViewProj[2], OriginalPos;
DP4 OutPos.w, ModelViewProj[3], OriginalPos;


# Send the original color to set the output color.
MOV OutColor, OriginalColor;


# Calculate the light vector.
SUB lightVector, LightPosition,OriginalPos;
DP3 lightVectorNormal.w, lightVector, lightVector;
RSQ lightVectorNormal.w, lightVectorNormal.w;
MUL lightVectorNormal.xyz, lightVectorNormal.w, lightVector;
DP3 Result1.x, lightVectorNormal, OriginalNormal;
MUL Result1.x, Result1.x, lightVectorNormal.w;

SUB lightVector, LightPosition2,OriginalPos;
DP3 lightVectorNormal.w, lightVector, lightVector;
RSQ lightVectorNormal.w, lightVectorNormal.w;
MUL lightVectorNormal.xyz, lightVectorNormal.w, lightVector;
DP3 Result2.x, lightVectorNormal, OriginalNormal;
MUL Result2.x, Result2.x,lightVectorNormal.w;

MOV OutTex0, OriginalTex0;
MAX OutTex1.x, Result1.x, Result2.x;
MOV OutTex2, OriginalTex2;

SUB VIEWVector, 		VIEWPosition,		OriginalPos;
DP3 VIEWVectorNormal.w, 	VIEWVector, 		VIEWVector;
RSQ VIEWVectorNormal.w, 	VIEWVectorNormal.w;
MUL VIEWVectorNormal.xyz, 	VIEWVectorNormal.w, 	VIEWVector;
DP3 OutLine.x, 			VIEWVectorNormal, 	OriginalNormal;


END
