!!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 OriginalTex3		= vertex.texcoord[3];	# Input texture coordinate 1.
ATTRIB OriginalTex2		= vertex.texcoord[2];	# 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 Texture			= result.texcoord[0];	# Output texture coordinate 0.
OUTPUT DetailTexture		= result.texcoord[2];	# Output texture coordinate 1.
OUTPUT OutLine			= result.texcoord[3];	# Output texture coordinate 1.

# Constant variables...
PARAM ModelViewProj[4]  	= { state.matrix.mvp }; # Modelview Projection Matrix.
PARAM VIEWPosition     		= program.env[0];
PARAM Black 			= {0,0,0,0};
PARAM White	 		= {1,0,0,0};


# Temporary variables...
TEMP VIEWVectorNormal;                      # Just a temporary variable.
TEMP VIEWVector;                  # Just a temporary variable.
TEMP VT;
#**************************************************
# 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;


# Move normal stuff to output!
MOV OutColor, 		OriginalColor;
MOV Texture, 		OriginalTex0;
MOV DetailTexture, 	OriginalTex2;
#OV OutLine,OriginalTex3;


# Calculate the VIEW vector.
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;
#SGE OutLine.x, Black.x, VT.x;
#MOV OutLine,VT;



END
