#version 130
//#extension GL_EXT_gpu_shader4 : require

#pragma optimize(on)

//all these are in eye-space

varying vec4 position;
//varying vec3 test;
/*
varying vec3 normal;
varying vec3 tangentS;
varying vec3 tangentT;
varying vec2 texCoord;
*/

//in vec3 position;
in vec3 normal;
in vec3 texcoord;
in vec3 tangent;
in vec3 bitangent;

//out vec4 frag_position;
out vec3 frag_normal;
out vec3 frag_texcoord;
out vec3 frag_tangent;
out vec3 frag_bitangent;

varying float depth;

void main(void) {
	gl_Position = ftransform();//gl_ModelViewProjectionMatrix * gl_Vertex;

  //vec4 pos = vec4(position.xyz, 1.0);
  //gl_Position = pos + vec4(0.0, 0.0, -2.0, 0.0);

	position = gl_ModelViewMatrix * gl_Vertex;

	// transform tangents and normal
//	frag_normal = gl_NormalMatrix * gl_Normal;
//	frag_texcoord.st = gl_MultiTexCoord0.st;
//	frag_tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
//	frag_bitangent = gl_NormalMatrix * gl_MultiTexCoord2.xyz;

  //frag_position = gl_ModelViewMatrix * vec4(position, depth);
	frag_normal = gl_NormalMatrix * normal;
	frag_texcoord.st = texcoord.st;
	frag_tangent = gl_NormalMatrix * tangent;
	frag_bitangent = gl_NormalMatrix * bitangent;

	//test = gl_NormalMatrix * gl_Normal;
}
