varying vec2 		texcoord;
varying vec2		VPOS;
uniform vec3 		corner;

attribute vec3	s2_vertex;
attribute vec4	s2_texcoords; 

varying mat3	TBN;

void main()
{
	vec4 vertex=vec4(s2_vertex,1.0);
	
	/*	fadeAlpha=fade;
		gl_Position = (gl_ModelViewProjectionMatrix)*vertex;
				
		vec4 pos=gl_ModelViewMatrix*vertex;
		
	
	float dist=(length(pos.xyz)-fadeAlpha*0.6)/(fadeAlpha*0.4);
	fadeAlpha=(1.0 - (clamp(dist,0.0,1.0)))*colorMod.a;
*/
	TBN[0]=gl_NormalMatrix*vec3(1.0,0.0,0.0);//vec3(0.0,0.0,1.0);//
	TBN[1]=gl_NormalMatrix*vec3(0.0,0.0,-1.0);//vec3(1.0,0.0,0.0);
	TBN[2]=gl_NormalMatrix*vec3(0.0,1.0,0.0);//vec3(0.0,1.0,0.0);//
	
	gl_Position=vec4(s2_vertex,1.0);
	texcoord = s2_texcoords.st;
	VPOS=(s2_vertex.xy*corner.xy)/corner.z;
}