varying float 	h;
varying vec3	vPOS;
varying	vec3	cnormal;
uniform float 	sunpower;
//varying vec4	curpos;

varying vec2	cloudsTexcoords,
				cloudsTexcoords3,
				cloudsTexcoords4,
				cloudsTexcoords5;
	
varying vec2	texcoords;
varying vec2	moonTexcoords;

uniform vec4	LTM0,
				LTM1,
				LTM3;
varying mat3	TBN;
varying mat3	iTBN;
attribute vec4	binormal; 
//varying vec3 	eyedir;
uniform vec2 	ofs;

//uniform float 	skyDepth;

// vertex attributes
attribute vec3 			s2_vertex;
attribute vec3			s2_normal;
attribute vec4			s2_texcoords; 
attribute vec4			s2_binormal; 

void main()
{
	vec4 vertex=vec4(s2_vertex,1.0);//*vec4(1.0,0.5,1.0,1.0);
	gl_Position = gl_ModelViewProjectionMatrix*vertex;
	//curpos = gl_Position;
	texcoords = s2_texcoords.st;// * vec2(1.0,2.0);
	cloudsTexcoords = s2_texcoords.st * vec2(1.0,2.0);
//	cnormal.xyz=(gl_ModelViewMatrix*vertex).xyz;
	/*vec3 npos=normalize( (s2_vertex.xyz)*vec3(1.0,10.0,1.0) );
	
	h=clamp(1.0-npos.y,0.0,1.0);
	vPOS=vertex.xyz;
	cnormal.xyz=-vertex.xyz;
	texcoords=npos.xz * vec2(30.0,30.0);
	
	vec4 pos=gl_ModelViewMatrix*vertex;
	vec4 XYproj;
	XYproj.x = dot(pos,LTM0);
	XYproj.y = dot(pos,LTM1);
	XYproj.w = dot(pos,LTM3);
	moonTexcoords.xy=(XYproj.xy/XYproj.w);
	
	cloudsTexcoords3=( s2_texcoords.st*vec2(4.0) )+ofs*2.0;
	cloudsTexcoords=( s2_texcoords.st*vec2(4.0) )+ofs*0.5;
	cloudsTexcoords5=s2_texcoords.st*vec2(3.0)+ofs*0.4;
	cloudsTexcoords4=s2_texcoords.st*vec2(3.0)+ofs*0.1;
	
	vec4 normal4      	= vec4( s2_normal.xyz, 0.0 );
	vec4 binormal4      = vec4( s2_binormal.xyz, 0.0 );
	vec4 tangent4      	= vec4(cross(binormal4.xyz,normal4.xyz),0.0);
	binormal4.xyz*=s2_binormal.w;
	
	TBN[0]=tangent4.xyz;
	TBN[1]=binormal4.xyz;
	TBN[2]=normal4.xyz;
	iTBN[0]=vec3(tangent4.x,binormal4.x,normal4.x);
	iTBN[1]=vec3(tangent4.y,binormal4.y,normal4.y);
	iTBN[2]=vec3(tangent4.z,binormal4.z,normal4.z);*/
}